mirror of
https://github.com/tuxbox-fork-migrations/recycled-ni-neutrino.git
synced 2025-08-30 08:51:04 +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, "btnYellow", btnYellow);
|
||||||
tableLookup(L, "btnBlue", btnBlue);
|
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 *));
|
CLuaCWindow **udata = (CLuaCWindow **) lua_newuserdata(L, sizeof(CLuaCWindow *));
|
||||||
*udata = new 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);
|
(*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 (!show_header)
|
||||||
if (footer) {
|
(*udata)->w->showHeader(false);
|
||||||
int btnCount = 0;
|
if (!show_footer)
|
||||||
if (btnRed != "") btnCount++;
|
(*udata)->w->showFooter(false);
|
||||||
if (btnGreen != "") btnCount++;
|
else {
|
||||||
if (btnYellow != "") btnCount++;
|
CComponentsFooter* footer = (*udata)->w->getFooterObject();
|
||||||
if (btnBlue != "") btnCount++;
|
if (footer) {
|
||||||
if (btnCount) {
|
int btnCount = 0;
|
||||||
fb_pixel_t col = footer->getColorBody();
|
if (btnRed != "") btnCount++;
|
||||||
int btnw = (dx-20) / btnCount;
|
if (btnGreen != "") btnCount++;
|
||||||
int btnh = footer->getHeight();
|
if (btnYellow != "") btnCount++;
|
||||||
int start = 10;
|
if (btnBlue != "") btnCount++;
|
||||||
if (btnRed != "")
|
if (btnCount) {
|
||||||
footer->addCCItem(new CComponentsButtonRed(start, CC_CENTERED, btnw, btnh, btnRed, 0, false , true, false, col, col));
|
fb_pixel_t col = footer->getColorBody();
|
||||||
if (btnGreen != "")
|
int btnw = (dx-20) / btnCount;
|
||||||
footer->addCCItem(new CComponentsButtonGreen(start+=btnw, CC_CENTERED, btnw, btnh, btnGreen, 0, false , true, false, col, col));
|
int btnh = footer->getHeight();
|
||||||
if (btnYellow != "")
|
int start = 10;
|
||||||
footer->addCCItem(new CComponentsButtonYellow(start+=btnw, CC_CENTERED, btnw, btnh, btnYellow, 0, false , true, false, col, col));
|
if (btnRed != "")
|
||||||
if (btnBlue != "")
|
footer->addCCItem(new CComponentsButtonRed(start, CC_CENTERED, btnw, btnh, btnRed, 0, false , true, false, col, col));
|
||||||
footer->addCCItem(new CComponentsButtonBlue(start+=btnw, CC_CENTERED, btnw, btnh, btnBlue, 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