mirror of
https://github.com/tuxbox-fork-migrations/recycled-ni-neutrino.git
synced 2025-08-31 01:11:06 +02:00
CLuaInstance: implement current method for generation of button labels in footer object
This controls more effective fontsize and button arrangement.
Lua API is not touched.
TODO: add more possible buttons. Color buttons for sure are not
be enough for some applications.
Origin commit data
------------------
Branch: ni/coolstream
Commit: 2f96c2653b
Author: Thilo Graf <dbt@novatux.de>
Date: 2015-02-16 (Mon, 16 Feb 2015)
------------------
This commit was generated by Migit
This commit is contained in:
@@ -1771,25 +1771,33 @@ int CLuaInstance::CWindowNew(lua_State *L)
|
||||
else {
|
||||
CComponentsFooter* footer = (*udata)->w->getFooterObject();
|
||||
if (footer) {
|
||||
int btnCount = 0;
|
||||
if (!btnRed.empty()) btnCount++;
|
||||
if (!btnGreen.empty()) btnCount++;
|
||||
if (!btnYellow.empty()) btnCount++;
|
||||
if (!btnBlue.empty()) btnCount++;
|
||||
if (btnCount) {
|
||||
fb_pixel_t col = footer->getColorBody();
|
||||
int btnw = (dx-20) / btnCount;
|
||||
int btnh = footer->getHeight();
|
||||
int start = 10;
|
||||
if (!btnRed.empty())
|
||||
footer->addCCItem(new CComponentsButtonRed(start, CC_CENTERED, btnw, btnh, btnRed, 0, false , true, false, col, col));
|
||||
if (!btnGreen.empty())
|
||||
footer->addCCItem(new CComponentsButtonGreen(start+=btnw, CC_CENTERED, btnw, btnh, btnGreen, 0, false , true, false, col, col));
|
||||
if (!btnYellow.empty())
|
||||
footer->addCCItem(new CComponentsButtonYellow(start+=btnw, CC_CENTERED, btnw, btnh, btnYellow, 0, false , true, false, col, col));
|
||||
if (!btnBlue.empty())
|
||||
footer->addCCItem(new CComponentsButtonBlue(start+=btnw, CC_CENTERED, btnw, btnh, btnBlue, 0, false , true, false, col, col));
|
||||
vector<button_label_s> buttons;
|
||||
if (!btnRed.empty()){
|
||||
button_label_s btnSred;
|
||||
btnSred.button = NEUTRINO_ICON_BUTTON_RED;
|
||||
btnSred.text = btnRed;
|
||||
buttons.push_back(btnSred);
|
||||
}
|
||||
if (!btnGreen.empty()){
|
||||
button_label_s btnSgreen;
|
||||
btnSgreen.button = NEUTRINO_ICON_BUTTON_GREEN;
|
||||
btnSgreen.text = btnGreen;
|
||||
buttons.push_back(btnSgreen);
|
||||
}
|
||||
if (!btnYellow.empty()){
|
||||
button_label_s btnSyellow;
|
||||
btnSyellow.button = NEUTRINO_ICON_BUTTON_YELLOW;
|
||||
btnSyellow.text = btnYellow;
|
||||
buttons.push_back(btnSyellow);
|
||||
}
|
||||
if (!btnBlue.empty()){
|
||||
button_label_s btnSblue;
|
||||
btnSblue.button = NEUTRINO_ICON_BUTTON_YELLOW;
|
||||
btnSblue.text = btnBlue;
|
||||
buttons.push_back(btnSblue);
|
||||
}
|
||||
if(!buttons.empty())
|
||||
footer->setButtonLabels(buttons, dx-20, (dx-20) / (buttons.size()+1));
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user