diff --git a/src/gui/luainstance.cpp b/src/gui/luainstance.cpp index 66dd47a0d..60e7a796b 100644 --- a/src/gui/luainstance.cpp +++ b/src/gui/luainstance.cpp @@ -1316,6 +1316,8 @@ void CLuaInstance::CWindowRegister(lua_State *L) { "new", CLuaInstance::CWindowNew }, { "paint", CLuaInstance::CWindowPaint }, { "hide", CLuaInstance::CWindowHide }, + { "setCaption", CLuaInstance::CWindowSetCaption }, + { "paintHeader", CLuaInstance::CWindowPaintHeader }, { "header_height", CLuaInstance::CWindowGetHeaderHeight }, { "footer_height", CLuaInstance::CWindowGetFooterHeight }, { "__gc", CLuaInstance::CWindowDelete }, @@ -1426,6 +1428,32 @@ int CLuaInstance::CWindowHide(lua_State *L) return 0; } +int CLuaInstance::CWindowSetCaption(lua_State *L) +{ + lua_assert(lua_istable(L,1)); + CLuaCWindow *m = CWindowCheck(L, 1); + if (!m) return 0; + + std::string name = ""; + tableLookup(L, "name", name) || tableLookup(L, "title", name) || tableLookup(L, "caption", name); + + m->w->setWindowCaption(name); + return 0; +} + +int CLuaInstance::CWindowPaintHeader(lua_State *L) +{ + CLuaCWindow *m = CWindowCheck(L, 1); + if (!m) return 0; + + CComponentsHeader* header = m->w->getHeaderObject(); + if (header) + m->w->showHeader(); + header->paint(); + + return 0; +} + int CLuaInstance::CWindowGetHeaderHeight(lua_State *L) { CLuaCWindow *m = CWindowCheck(L, 1); diff --git a/src/gui/luainstance.h b/src/gui/luainstance.h index c40e3d6d5..bdcfa8f8d 100644 --- a/src/gui/luainstance.h +++ b/src/gui/luainstance.h @@ -202,6 +202,8 @@ private: static CLuaCWindow *CWindowCheck(lua_State *L, int n); static int CWindowPaint(lua_State *L); static int CWindowHide(lua_State *L); + static int CWindowSetCaption(lua_State *L); + static int CWindowPaintHeader(lua_State *L); static int CWindowGetHeaderHeight(lua_State *L); static int CWindowGetFooterHeight(lua_State *L); static int CWindowDelete(lua_State *L);