CLuainstance/cwindow.new: Add parameter for show or hide header/footer

- default (parameter missing) is true (show)


Origin commit data
------------------
Commit: b8ed776a76
Author: Michael Liebmann <tuxcode.bbg@gmail.com>
Date: 2014-07-16 (Wed, 16 Jul 2014)
This commit is contained in:
Michael Liebmann
2014-07-16 23:33:52 +02:00
parent 93ebbd694d
commit edeee02da1

View File

@@ -1459,10 +1459,22 @@ int CLuaInstance::CWindowNew(lua_State *L)
tableLookup(L, "btnYellow", btnYellow);
tableLookup(L, "btnBlue", btnBlue);
tmp1 = "true";
tableLookup(L, "show_header" , tmp1);
bool show_header = (tmp1 == "true" || tmp1 == "show" || tmp1 == "yes");
tmp1 = "true";
tableLookup(L, "show_footer" , tmp1);
bool show_footer = (tmp1 == "true" || tmp1 == "show" || tmp1 == "yes");
CLuaCWindow **udata = (CLuaCWindow **) lua_newuserdata(L, sizeof(CLuaCWindow *));
*udata = new CLuaCWindow();
(*udata)->w = new CComponentsWindow(x, y, dx, dy, name.c_str(), icon.c_str(), 0, has_shadow, (fb_pixel_t)color_frame, (fb_pixel_t)color_body, (fb_pixel_t)color_shadow);
if (!show_header)
(*udata)->w->showHeader(false);
if (!show_footer)
(*udata)->w->showFooter(false);
else {
CComponentsFooter* footer = (*udata)->w->getFooterObject();
if (footer) {
int btnCount = 0;
@@ -1485,6 +1497,7 @@ int CLuaInstance::CWindowNew(lua_State *L)
footer->addCCItem(new CComponentsButtonBlue(start+=btnw, CC_CENTERED, btnw, btnh, btnBlue, 0, false , true, false, col, col));
}
}
}
luaL_getmetatable(L, "cwindow");
lua_setmetatable(L, -2);