mirror of
https://github.com/tuxbox-fork-migrations/recycled-ni-neutrino.git
synced 2025-08-29 16:31:05 +02:00
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:
@@ -1459,30 +1459,43 @@ 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);
|
||||
|
||||
CComponentsFooter* footer = (*udata)->w->getFooterObject();
|
||||
if (footer) {
|
||||
int btnCount = 0;
|
||||
if (btnRed != "") btnCount++;
|
||||
if (btnGreen != "") btnCount++;
|
||||
if (btnYellow != "") btnCount++;
|
||||
if (btnBlue != "") btnCount++;
|
||||
if (btnCount) {
|
||||
fb_pixel_t col = footer->getColorBody();
|
||||
int btnw = (dx-20) / btnCount;
|
||||
int btnh = footer->getHeight();
|
||||
int start = 10;
|
||||
if (btnRed != "")
|
||||
footer->addCCItem(new CComponentsButtonRed(start, CC_CENTERED, btnw, btnh, btnRed, 0, false , true, false, col, col));
|
||||
if (btnGreen != "")
|
||||
footer->addCCItem(new CComponentsButtonGreen(start+=btnw, CC_CENTERED, btnw, btnh, btnGreen, 0, false , true, false, col, col));
|
||||
if (btnYellow != "")
|
||||
footer->addCCItem(new CComponentsButtonYellow(start+=btnw, CC_CENTERED, btnw, btnh, btnYellow, 0, false , true, false, col, col));
|
||||
if (btnBlue != "")
|
||||
footer->addCCItem(new CComponentsButtonBlue(start+=btnw, CC_CENTERED, btnw, btnh, btnBlue, 0, false , true, false, col, col));
|
||||
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;
|
||||
if (btnRed != "") btnCount++;
|
||||
if (btnGreen != "") btnCount++;
|
||||
if (btnYellow != "") btnCount++;
|
||||
if (btnBlue != "") btnCount++;
|
||||
if (btnCount) {
|
||||
fb_pixel_t col = footer->getColorBody();
|
||||
int btnw = (dx-20) / btnCount;
|
||||
int btnh = footer->getHeight();
|
||||
int start = 10;
|
||||
if (btnRed != "")
|
||||
footer->addCCItem(new CComponentsButtonRed(start, CC_CENTERED, btnw, btnh, btnRed, 0, false , true, false, col, col));
|
||||
if (btnGreen != "")
|
||||
footer->addCCItem(new CComponentsButtonGreen(start+=btnw, CC_CENTERED, btnw, btnh, btnGreen, 0, false , true, false, col, col));
|
||||
if (btnYellow != "")
|
||||
footer->addCCItem(new CComponentsButtonYellow(start+=btnw, CC_CENTERED, btnw, btnh, btnYellow, 0, false , true, false, col, col));
|
||||
if (btnBlue != "")
|
||||
footer->addCCItem(new CComponentsButtonBlue(start+=btnw, CC_CENTERED, btnw, btnh, btnBlue, 0, false , true, false, col, col));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user