diff --git a/src/gui/luainstance.cpp b/src/gui/luainstance.cpp index b09badcb4..f140f43c0 100644 --- a/src/gui/luainstance.cpp +++ b/src/gui/luainstance.cpp @@ -1690,6 +1690,7 @@ void CLuaInstance::CWindowRegister(lua_State *L) { "footerHeight", CLuaInstance::CWindowGetFooterHeight }, { "header_height", CLuaInstance::CWindowGetHeaderHeight_dep }, /* function 'header_height' is deprecated */ { "footer_height", CLuaInstance::CWindowGetFooterHeight_dep }, /* function 'footer_height' is deprecated */ + { "setCenterPos", CLuaInstance::CWindowSetCenterPos }, { "__gc", CLuaInstance::CWindowDelete }, { NULL, NULL } }; @@ -1938,6 +1939,21 @@ int CLuaInstance::CWindowGetFooterHeight(lua_State *L) 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) { DBG("CLuaInstance::%s %d\n", __func__, lua_gettop(L)); @@ -1961,6 +1977,7 @@ void CLuaInstance::SignalBoxRegister(lua_State *L) luaL_Reg meth[] = { { "new", CLuaInstance::SignalBoxNew }, { "paint", CLuaInstance::SignalBoxPaint }, + { "setCenterPos", CLuaInstance::SignalBoxSetCenterPos }, { "__gc", CLuaInstance::SignalBoxDelete }, { NULL, NULL } }; @@ -2014,6 +2031,20 @@ int CLuaInstance::SignalBoxPaint(lua_State *L) m->s->paint(do_save_bg); 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) { @@ -2040,6 +2071,7 @@ void CLuaInstance::ComponentsTextRegister(lua_State *L) { "hide", CLuaInstance::ComponentsTextHide }, { "setText", CLuaInstance::ComponentsTextSetText }, { "scroll", CLuaInstance::ComponentsTextScroll }, + { "setCenterPos", CLuaInstance::ComponentsTextSetCenterPos }, { "__gc", CLuaInstance::ComponentsTextDelete }, { NULL, NULL } }; @@ -2211,6 +2243,21 @@ int CLuaInstance::ComponentsTextScroll(lua_State *L) 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) { DBG("CLuaInstance::%s %d\n", __func__, lua_gettop(L)); @@ -2236,6 +2283,7 @@ void CLuaInstance::CPictureRegister(lua_State *L) { "paint", CLuaInstance::CPicturePaint }, { "hide", CLuaInstance::CPictureHide }, { "setPicture", CLuaInstance::CPictureSetPicture }, + { "setCenterPos", CLuaInstance::CPictureSetCenterPos }, { "__gc", CLuaInstance::CPictureDelete }, { NULL, NULL } }; @@ -2357,6 +2405,21 @@ int CLuaInstance::CPictureSetPicture(lua_State *L) 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) { DBG("CLuaInstance::%s %d\n", __func__, lua_gettop(L)); diff --git a/src/gui/luainstance.h b/src/gui/luainstance.h index 83712c872..6b9cd9771 100644 --- a/src/gui/luainstance.h +++ b/src/gui/luainstance.h @@ -260,12 +260,14 @@ private: static int CWindowGetFooterHeight(lua_State *L); 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 CWindowSetCenterPos(lua_State *L); static int CWindowDelete(lua_State *L); static CLuaSignalBox *SignalBoxCheck(lua_State *L, int n); static void SignalBoxRegister(lua_State *L); static int SignalBoxNew(lua_State *L); static int SignalBoxPaint(lua_State *L); + static int SignalBoxSetCenterPos(lua_State *L); static int SignalBoxDelete(lua_State *L); static CLuaComponentsText *ComponentsTextCheck(lua_State *L, int n); @@ -275,6 +277,7 @@ private: static int ComponentsTextHide(lua_State *L); static int ComponentsTextSetText(lua_State *L); static int ComponentsTextScroll(lua_State *L); + static int ComponentsTextSetCenterPos(lua_State *L); static int ComponentsTextDelete(lua_State *L); static CLuaPicture *CPictureCheck(lua_State *L, int n); @@ -283,6 +286,7 @@ private: static int CPicturePaint(lua_State *L); static int CPictureHide(lua_State *L); static int CPictureSetPicture(lua_State *L); + static int CPictureSetCenterPos(lua_State *L); static int CPictureDelete(lua_State *L); static CLuaConfigFile *LuaConfigFileCheck(lua_State *L, int n);