mirror of
https://github.com/tuxbox-neutrino/neutrino.git
synced 2025-08-27 15:32:59 +02:00
lua_cc_window: add setDimensionsAll option
This commit is contained in:
@@ -56,6 +56,7 @@ void CLuaInstCCWindow::CCWindowRegister(lua_State *L)
|
|||||||
{ "header_height", CLuaInstCCWindow::CCWindowGetHeaderHeight_dep }, /* function 'header_height' is deprecated */
|
{ "header_height", CLuaInstCCWindow::CCWindowGetHeaderHeight_dep }, /* function 'header_height' is deprecated */
|
||||||
{ "footer_height", CLuaInstCCWindow::CCWindowGetFooterHeight_dep }, /* function 'footer_height' is deprecated */
|
{ "footer_height", CLuaInstCCWindow::CCWindowGetFooterHeight_dep }, /* function 'footer_height' is deprecated */
|
||||||
{ "setCenterPos", CLuaInstCCWindow::CCWindowSetCenterPos },
|
{ "setCenterPos", CLuaInstCCWindow::CCWindowSetCenterPos },
|
||||||
|
{ "setDimensionsAll", CLuaInstCCWindow::CCWindowSetDimensionsAll },
|
||||||
{ "__gc", CLuaInstCCWindow::CCWindowDelete },
|
{ "__gc", CLuaInstCCWindow::CCWindowDelete },
|
||||||
{ NULL, NULL }
|
{ NULL, NULL }
|
||||||
};
|
};
|
||||||
@@ -295,6 +296,28 @@ int CLuaInstCCWindow::CCWindowGetFooterHeight(lua_State *L)
|
|||||||
return 1;
|
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)
|
int CLuaInstCCWindow::CCWindowSetCenterPos(lua_State *L)
|
||||||
{
|
{
|
||||||
lua_assert(lua_istable(L,1));
|
lua_assert(lua_istable(L,1));
|
||||||
|
@@ -51,6 +51,7 @@ class CLuaInstCCWindow
|
|||||||
static int CCWindowGetFooterHeight_dep(lua_State *L); // function 'footer_height' is deprecated
|
static int CCWindowGetFooterHeight_dep(lua_State *L); // function 'footer_height' is deprecated
|
||||||
static int CCWindowSetCenterPos(lua_State *L);
|
static int CCWindowSetCenterPos(lua_State *L);
|
||||||
static int CCWindowDelete(lua_State *L);
|
static int CCWindowDelete(lua_State *L);
|
||||||
|
static int CCWindowSetDimensionsAll(lua_State *L);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif //_LUACCWINDOW_H
|
#endif //_LUACCWINDOW_H
|
||||||
|
Reference in New Issue
Block a user