src/gui/luainstance.cpp add setCenterPos option to CC objects

Origin commit data
------------------
Branch: ni/coolstream
Commit: c325a3bbae
Author: Jacek Jendrzej <overx300@gmail.com>
Date: 2015-07-09 (Thu, 09 Jul 2015)


------------------
No further description and justification available within origin commit message!

------------------
This commit was generated by Migit
This commit is contained in:
Jacek Jendrzej
2015-07-09 16:51:52 +02:00
parent 714f5cb678
commit c3d2f362e6
2 changed files with 67 additions and 0 deletions

View File

@@ -1690,6 +1690,7 @@ void CLuaInstance::CWindowRegister(lua_State *L)
{ "footerHeight", CLuaInstance::CWindowGetFooterHeight }, { "footerHeight", CLuaInstance::CWindowGetFooterHeight },
{ "header_height", CLuaInstance::CWindowGetHeaderHeight_dep }, /* function 'header_height' is deprecated */ { "header_height", CLuaInstance::CWindowGetHeaderHeight_dep }, /* function 'header_height' is deprecated */
{ "footer_height", CLuaInstance::CWindowGetFooterHeight_dep }, /* function 'footer_height' is deprecated */ { "footer_height", CLuaInstance::CWindowGetFooterHeight_dep }, /* function 'footer_height' is deprecated */
{ "setCenterPos", CLuaInstance::CWindowSetCenterPos },
{ "__gc", CLuaInstance::CWindowDelete }, { "__gc", CLuaInstance::CWindowDelete },
{ NULL, NULL } { NULL, NULL }
}; };
@@ -1938,6 +1939,21 @@ int CLuaInstance::CWindowGetFooterHeight(lua_State *L)
return 1; return 1;
} }
int CLuaInstance::CWindowSetCenterPos(lua_State *L)
{
lua_assert(lua_istable(L,1));
CLuaCWindow *m = CWindowCheck(L, 1);
if (!m) return 0;
lua_Integer tmp_along_mode, along_mode = CC_ALONG_X | CC_ALONG_Y;
tableLookup(L, "along_mode", tmp_along_mode);
if(tmp_along_mode & CC_ALONG_X || tmp_along_mode & CC_ALONG_Y)
along_mode=tmp_along_mode;
m->w->setCenterPos(along_mode);
return 0;
}
int CLuaInstance::CWindowDelete(lua_State *L) int CLuaInstance::CWindowDelete(lua_State *L)
{ {
DBG("CLuaInstance::%s %d\n", __func__, lua_gettop(L)); DBG("CLuaInstance::%s %d\n", __func__, lua_gettop(L));
@@ -1961,6 +1977,7 @@ void CLuaInstance::SignalBoxRegister(lua_State *L)
luaL_Reg meth[] = { luaL_Reg meth[] = {
{ "new", CLuaInstance::SignalBoxNew }, { "new", CLuaInstance::SignalBoxNew },
{ "paint", CLuaInstance::SignalBoxPaint }, { "paint", CLuaInstance::SignalBoxPaint },
{ "setCenterPos", CLuaInstance::SignalBoxSetCenterPos },
{ "__gc", CLuaInstance::SignalBoxDelete }, { "__gc", CLuaInstance::SignalBoxDelete },
{ NULL, NULL } { NULL, NULL }
}; };
@@ -2014,6 +2031,20 @@ int CLuaInstance::SignalBoxPaint(lua_State *L)
m->s->paint(do_save_bg); m->s->paint(do_save_bg);
return 0; return 0;
} }
int CLuaInstance::SignalBoxSetCenterPos(lua_State *L)
{
lua_assert(lua_istable(L,1));
CLuaSignalBox *m = SignalBoxCheck(L, 1);
if (!m) return 0;
lua_Integer tmp_along_mode, along_mode = CC_ALONG_X | CC_ALONG_Y;
tableLookup(L, "along_mode", tmp_along_mode);
if(tmp_along_mode & CC_ALONG_X || tmp_along_mode & CC_ALONG_Y)
along_mode=tmp_along_mode;
m->s->setCenterPos(along_mode);
return 0;
}
int CLuaInstance::SignalBoxDelete(lua_State *L) int CLuaInstance::SignalBoxDelete(lua_State *L)
{ {
@@ -2040,6 +2071,7 @@ void CLuaInstance::ComponentsTextRegister(lua_State *L)
{ "hide", CLuaInstance::ComponentsTextHide }, { "hide", CLuaInstance::ComponentsTextHide },
{ "setText", CLuaInstance::ComponentsTextSetText }, { "setText", CLuaInstance::ComponentsTextSetText },
{ "scroll", CLuaInstance::ComponentsTextScroll }, { "scroll", CLuaInstance::ComponentsTextScroll },
{ "setCenterPos", CLuaInstance::ComponentsTextSetCenterPos },
{ "__gc", CLuaInstance::ComponentsTextDelete }, { "__gc", CLuaInstance::ComponentsTextDelete },
{ NULL, NULL } { NULL, NULL }
}; };
@@ -2211,6 +2243,21 @@ int CLuaInstance::ComponentsTextScroll(lua_State *L)
return 0; return 0;
} }
int CLuaInstance::ComponentsTextSetCenterPos(lua_State *L)
{
lua_assert(lua_istable(L,1));
CLuaComponentsText *m = ComponentsTextCheck(L, 1);
if (!m) return 0;
lua_Integer tmp_along_mode, along_mode = CC_ALONG_X | CC_ALONG_Y;
tableLookup(L, "along_mode", tmp_along_mode);
if(tmp_along_mode & CC_ALONG_X || tmp_along_mode & CC_ALONG_Y)
along_mode=tmp_along_mode;
m->ct->setCenterPos(along_mode);
return 0;
}
int CLuaInstance::ComponentsTextDelete(lua_State *L) int CLuaInstance::ComponentsTextDelete(lua_State *L)
{ {
DBG("CLuaInstance::%s %d\n", __func__, lua_gettop(L)); DBG("CLuaInstance::%s %d\n", __func__, lua_gettop(L));
@@ -2236,6 +2283,7 @@ void CLuaInstance::CPictureRegister(lua_State *L)
{ "paint", CLuaInstance::CPicturePaint }, { "paint", CLuaInstance::CPicturePaint },
{ "hide", CLuaInstance::CPictureHide }, { "hide", CLuaInstance::CPictureHide },
{ "setPicture", CLuaInstance::CPictureSetPicture }, { "setPicture", CLuaInstance::CPictureSetPicture },
{ "setCenterPos", CLuaInstance::CPictureSetCenterPos },
{ "__gc", CLuaInstance::CPictureDelete }, { "__gc", CLuaInstance::CPictureDelete },
{ NULL, NULL } { NULL, NULL }
}; };
@@ -2357,6 +2405,21 @@ int CLuaInstance::CPictureSetPicture(lua_State *L)
return 0; return 0;
} }
int CLuaInstance::CPictureSetCenterPos(lua_State *L)
{
lua_assert(lua_istable(L,1));
CLuaPicture *m = CPictureCheck(L, 1);
if (!m) return 0;
lua_Integer tmp_along_mode, along_mode = CC_ALONG_X | CC_ALONG_Y;
tableLookup(L, "along_mode", tmp_along_mode);
if(tmp_along_mode & CC_ALONG_X || tmp_along_mode & CC_ALONG_Y)
along_mode=tmp_along_mode;
m->cp->setCenterPos(along_mode);
return 0;
}
int CLuaInstance::CPictureDelete(lua_State *L) int CLuaInstance::CPictureDelete(lua_State *L)
{ {
DBG("CLuaInstance::%s %d\n", __func__, lua_gettop(L)); DBG("CLuaInstance::%s %d\n", __func__, lua_gettop(L));

View File

@@ -260,12 +260,14 @@ private:
static int CWindowGetFooterHeight(lua_State *L); static int CWindowGetFooterHeight(lua_State *L);
static int CWindowGetHeaderHeight_dep(lua_State *L); // function 'header_height' is deprecated static int CWindowGetHeaderHeight_dep(lua_State *L); // function 'header_height' is deprecated
static int CWindowGetFooterHeight_dep(lua_State *L); // function 'footer_height' is deprecated static int CWindowGetFooterHeight_dep(lua_State *L); // function 'footer_height' is deprecated
static int CWindowSetCenterPos(lua_State *L);
static int CWindowDelete(lua_State *L); static int CWindowDelete(lua_State *L);
static CLuaSignalBox *SignalBoxCheck(lua_State *L, int n); static CLuaSignalBox *SignalBoxCheck(lua_State *L, int n);
static void SignalBoxRegister(lua_State *L); static void SignalBoxRegister(lua_State *L);
static int SignalBoxNew(lua_State *L); static int SignalBoxNew(lua_State *L);
static int SignalBoxPaint(lua_State *L); static int SignalBoxPaint(lua_State *L);
static int SignalBoxSetCenterPos(lua_State *L);
static int SignalBoxDelete(lua_State *L); static int SignalBoxDelete(lua_State *L);
static CLuaComponentsText *ComponentsTextCheck(lua_State *L, int n); static CLuaComponentsText *ComponentsTextCheck(lua_State *L, int n);
@@ -275,6 +277,7 @@ private:
static int ComponentsTextHide(lua_State *L); static int ComponentsTextHide(lua_State *L);
static int ComponentsTextSetText(lua_State *L); static int ComponentsTextSetText(lua_State *L);
static int ComponentsTextScroll(lua_State *L); static int ComponentsTextScroll(lua_State *L);
static int ComponentsTextSetCenterPos(lua_State *L);
static int ComponentsTextDelete(lua_State *L); static int ComponentsTextDelete(lua_State *L);
static CLuaPicture *CPictureCheck(lua_State *L, int n); static CLuaPicture *CPictureCheck(lua_State *L, int n);
@@ -283,6 +286,7 @@ private:
static int CPicturePaint(lua_State *L); static int CPicturePaint(lua_State *L);
static int CPictureHide(lua_State *L); static int CPictureHide(lua_State *L);
static int CPictureSetPicture(lua_State *L); static int CPictureSetPicture(lua_State *L);
static int CPictureSetCenterPos(lua_State *L);
static int CPictureDelete(lua_State *L); static int CPictureDelete(lua_State *L);
static CLuaConfigFile *LuaConfigFileCheck(lua_State *L, int n); static CLuaConfigFile *LuaConfigFileCheck(lua_State *L, int n);