lua: add function to set background image to window body

update to v1.87
This commit is contained in:
2020-10-05 10:54:05 +02:00
parent 0760620cfe
commit 4c63c6ffa8
3 changed files with 17 additions and 1 deletions

View File

@@ -4,4 +4,4 @@
* to luainstance.h changes
*/
#define LUA_API_VERSION_MAJOR 1
#define LUA_API_VERSION_MINOR 86
#define LUA_API_VERSION_MINOR 87

View File

@@ -57,6 +57,7 @@ void CLuaInstCCWindow::CCWindowRegister(lua_State *L)
{ "footer_height", CLuaInstCCWindow::CCWindowGetFooterHeight_dep }, /* function 'footer_height' is deprecated */
{ "setCenterPos", CLuaInstCCWindow::CCWindowSetCenterPos },
{ "setDimensionsAll", CLuaInstCCWindow::CCWindowSetDimensionsAll },
{ "setBodyImage", CCWindowSetBodyImage },
{ "__gc", CLuaInstCCWindow::CCWindowDelete },
{ NULL, NULL }
};
@@ -341,6 +342,20 @@ int CLuaInstCCWindow::CCWindowSetCenterPos(lua_State *L)
return 0;
}
int CLuaInstCCWindow::CCWindowSetBodyImage(lua_State *L)
{
lua_assert(lua_istable(L,1));
CLuaCCWindow *D = CCWindowCheck(L, 1);
if (!D) return 0;
std::string image = "";
if (lua_istable(L, -1))
tableLookup(L, "image_path", image);
D->w->setBodyBGImage(image);
return 0;
}
int CLuaInstCCWindow::CCWindowDelete(lua_State *L)
{
LUA_DEBUG("CLuaInstCCWindow::%s %d\n", __func__, lua_gettop(L));

View File

@@ -52,6 +52,7 @@ class CLuaInstCCWindow : CCHeaderTypes
static int CCWindowSetCenterPos(lua_State *L);
static int CCWindowDelete(lua_State *L);
static int CCWindowSetDimensionsAll(lua_State *L);
static int CCWindowSetBodyImage(lua_State *L);
};
#endif //_LUACCWINDOW_H