diff --git a/src/gui/lua/lua_cc_window.cpp b/src/gui/lua/lua_cc_window.cpp index 9977bfa2b..754a1c16d 100644 --- a/src/gui/lua/lua_cc_window.cpp +++ b/src/gui/lua/lua_cc_window.cpp @@ -56,6 +56,7 @@ void CLuaInstCCWindow::CCWindowRegister(lua_State *L) { "header_height", CLuaInstCCWindow::CCWindowGetHeaderHeight_dep }, /* function 'header_height' is deprecated */ { "footer_height", CLuaInstCCWindow::CCWindowGetFooterHeight_dep }, /* function 'footer_height' is deprecated */ { "setCenterPos", CLuaInstCCWindow::CCWindowSetCenterPos }, + { "setDimensionsAll", CLuaInstCCWindow::CCWindowSetDimensionsAll }, { "__gc", CLuaInstCCWindow::CCWindowDelete }, { NULL, NULL } }; @@ -295,6 +296,28 @@ int CLuaInstCCWindow::CCWindowGetFooterHeight(lua_State *L) return 1; } +int CLuaInstCCWindow::CCWindowSetDimensionsAll(lua_State *L) +{ + CLuaCCWindow *D = CCWindowCheck(L, 1); + if (!D) return 0; + lua_Integer x = luaL_checkint(L, 2); + lua_Integer y = luaL_checkint(L, 3); + lua_Integer w = luaL_checkint(L, 4); + lua_Integer h = luaL_checkint(L, 5); + if(x>-1 && y > -1 && w > 1 && h > 1){ + if (h > (lua_Integer)CFrameBuffer::getInstance()->getScreenHeight()) + h = (lua_Integer)CFrameBuffer::getInstance()->getScreenHeight(); + if (w > (lua_Integer)CFrameBuffer::getInstance()->getScreenWidth()) + w = (lua_Integer)CFrameBuffer::getInstance()->getScreenWidth(); + if(x > w) + x = 0; + if(y > h) + y = 0; + D->w->setDimensionsAll(x,y,w,h); + } + return 0; +} + int CLuaInstCCWindow::CCWindowSetCenterPos(lua_State *L) { lua_assert(lua_istable(L,1)); diff --git a/src/gui/lua/lua_cc_window.h b/src/gui/lua/lua_cc_window.h index 0e32bc386..98cd9ac86 100644 --- a/src/gui/lua/lua_cc_window.h +++ b/src/gui/lua/lua_cc_window.h @@ -51,6 +51,7 @@ class CLuaInstCCWindow static int CCWindowGetFooterHeight_dep(lua_State *L); // function 'footer_height' is deprecated static int CCWindowSetCenterPos(lua_State *L); static int CCWindowDelete(lua_State *L); + static int CCWindowSetDimensionsAll(lua_State *L); }; #endif //_LUACCWINDOW_H