CLuaInstance: Add setCaption & paintHeader function to cwindow

This commit is contained in:
M. Liebmann
2014-03-16 11:57:06 +01:00
parent 5136563035
commit a501f4e10e
2 changed files with 30 additions and 0 deletions

View File

@@ -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);