mirror of
https://github.com/tuxbox-fork-migrations/recycled-ni-neutrino.git
synced 2025-09-13 08:23:39 +02:00
merge neutrino-mp menu/buttons/icons changes, (C) martii
Origin commit data
------------------
Branch: ni/coolstream
Commit: cf91f2eccb
Author: [CST] Focus <focus.cst@gmail.com>
Date: 2014-07-17 (Thu, 17 Jul 2014)
------------------
No further description and justification available within origin commit message!
------------------
This commit was generated by Migit
This commit is contained in:
@@ -160,7 +160,7 @@ int CAudioSetup::showAudioSetup()
|
||||
as_oj_vsteps = new CMenuOptionNumberChooser(LOCALE_AUDIOMENU_VOLUME_STEP, (int *)&g_settings.current_volume_step, true, 1, 25, NULL);
|
||||
as_oj_vsteps->setHint("", LOCALE_MENU_HINT_AUDIO_VOLSTEP);
|
||||
|
||||
st = new CMenuOptionNumberChooser(LOCALE_AUDIOMENU_VOLUME_START, &g_settings.start_volume, true, -1, 100, NULL, 0, -1, LOCALE_OPTIONS_OFF);
|
||||
st = new CMenuOptionNumberChooser(LOCALE_AUDIOMENU_VOLUME_START, &g_settings.start_volume, true, -1, 100, NULL, CRCInput::RC_nokey, NULL, 0, -1, LOCALE_OPTIONS_OFF);
|
||||
st->setHint("", LOCALE_MENU_HINT_AUDIO_VOLSTART);
|
||||
//clock rec
|
||||
//CMenuOptionChooser * as_oj_clockrec new CMenuOptionChooser(LOCALE_AUDIOMENU_CLOCKREC, &g_settings.clockrec, AUDIOMENU_CLOCKREC_OPTIONS, AUDIOMENU_CLOCKREC_OPTION_COUNT, true, audioSetupNotifier);
|
||||
|
@@ -125,7 +125,7 @@ int CAudioPlayerSetup::showAudioPlayerSetup()
|
||||
mc->setHint("", LOCALE_MENU_HINT_AUDIOPLAYER_PLAYLIST);
|
||||
audioplayerSetup->addItem(mc);
|
||||
|
||||
CMenuOptionNumberChooser *cc = new CMenuOptionNumberChooser(LOCALE_AUDIOPLAYER_SCREENSAVER_TIMEOUT, &g_settings.audioplayer_screensaver, true, 0, 999, NULL, 0, 0, LOCALE_OPTIONS_OFF);
|
||||
CMenuOptionNumberChooser *cc = new CMenuOptionNumberChooser(LOCALE_AUDIOPLAYER_SCREENSAVER_TIMEOUT, &g_settings.audioplayer_screensaver, true, 0, 999, NULL, CRCInput::RC_nokey, NULL, 0, 0, LOCALE_OPTIONS_OFF);
|
||||
cc->setNumberFormat(std::string("%d ") + g_Locale->getText(LOCALE_UNIT_SHORT_MINUTE));
|
||||
cc->setHint("", LOCALE_MENU_HINT_AUDIOPLAYER_SCREENSAVER);
|
||||
audioplayerSetup->addItem(cc);
|
||||
|
@@ -261,7 +261,7 @@ int CKeybindSetup::showKeySetup()
|
||||
CMenuOptionNumberChooser *cc;
|
||||
|
||||
cc = new CMenuOptionNumberChooser(LOCALE_KEYBINDINGMENU_LONGKEYPRESS_DURATION,
|
||||
&g_settings.longkeypress_duration, true, LONGKEYPRESS_OFF, 9999, NULL, 0, LONGKEYPRESS_OFF, LOCALE_OPTIONS_OFF);
|
||||
&g_settings.longkeypress_duration, true, LONGKEYPRESS_OFF, 9999, NULL, CRCInput::convertDigitToKey(shortcut++), NULL, 0, LONGKEYPRESS_OFF, LOCALE_OPTIONS_OFF);
|
||||
cc->setNumberFormat(ms_number_format);
|
||||
cc->setNumericInput(true);
|
||||
cc->setHint("", LOCALE_MENU_HINT_LONGKEYPRESS_DURATION);
|
||||
|
@@ -1086,13 +1086,24 @@ int CLuaInstance::MenuAddItem(lua_State *L)
|
||||
} else
|
||||
m->m->addItem(GenericMenuSeparatorLine);
|
||||
} else {
|
||||
std::string right_icon; tableLookup(L, "right_icon", right_icon);
|
||||
std::string right_icon_str; tableLookup(L, "right_icon", right_icon_str);
|
||||
std::string action; tableLookup(L, "action", action);
|
||||
std::string value; tableLookup(L, "value", value);
|
||||
std::string hint; tableLookup(L, "hint", hint);
|
||||
std::string hint_icon; tableLookup(L, "hint_icon", hint_icon);
|
||||
std::string hint_icon_str; tableLookup(L, "hint_icon", hint_icon_str);
|
||||
std::string id; tableLookup(L, "id", id);
|
||||
std::string tmp;
|
||||
char *right_icon = NULL;
|
||||
if (!right_icon_str.empty()) {
|
||||
right_icon = strdup(right_icon_str.c_str());
|
||||
m->tofree.push_back(right_icon);
|
||||
}
|
||||
char *hint_icon = NULL;
|
||||
if (!hint_icon_str.empty()) {
|
||||
hint_icon = strdup(hint_icon_str.c_str());
|
||||
m->tofree.push_back(hint_icon);
|
||||
}
|
||||
|
||||
int directkey = CRCInput::RC_nokey; tableLookup(L, "directkey", directkey);
|
||||
int pulldown = false; tableLookup(L, "pulldown", pulldown);
|
||||
tmp = "true";
|
||||
@@ -1107,8 +1118,8 @@ int CLuaInstance::MenuAddItem(lua_State *L)
|
||||
if (type == "forwarder") {
|
||||
b->str_val = value;
|
||||
CLuaMenuForwarder *forwarder = new CLuaMenuForwarder(L, action, id);
|
||||
mi = new CMenuForwarder(b->name, enabled, b->str_val, forwarder, NULL/*ActionKey*/, directkey, icon.c_str(), right_icon.c_str());
|
||||
if (!hint.empty() || !hint_icon.empty())
|
||||
mi = new CMenuForwarder(b->name, enabled, b->str_val, forwarder, NULL/*ActionKey*/, directkey, icon.c_str(), right_icon);
|
||||
if (!hint.empty() || hint_icon)
|
||||
mi->setHint(hint_icon, hint);
|
||||
m->targets.push_back(forwarder);
|
||||
} else if (type == "chooser") {
|
||||
@@ -1161,7 +1172,7 @@ int CLuaInstance::MenuAddItem(lua_State *L)
|
||||
int sms = 0; tableLookup(L, "sms", sms);
|
||||
int size = 30; tableLookup(L, "size", size);
|
||||
CLuaMenuStringinput *stringinput = new CLuaMenuStringinput(L, action, id, b->name.c_str(), &b->str_val, size, valid_chars, m->observ, icon.c_str(), sms);
|
||||
mi = new CMenuForwarder(b->name, enabled, b->str_val, stringinput, NULL/*ActionKey*/, directkey, icon.c_str(), right_icon.c_str());
|
||||
mi = new CMenuForwarder(b->name, enabled, b->str_val, stringinput, NULL/*ActionKey*/, directkey, icon.c_str(), right_icon);
|
||||
m->targets.push_back(stringinput);
|
||||
} else if (type == "filebrowser") {
|
||||
b->str_val = value;
|
||||
@@ -1177,12 +1188,12 @@ int CLuaInstance::MenuAddItem(lua_State *L)
|
||||
}
|
||||
lua_pop(L, 1);
|
||||
|
||||
mi = new CMenuForwarder(b->name, enabled, b->str_val, filebrowser, NULL/*ActionKey*/, directkey, icon.c_str(), right_icon.c_str());
|
||||
mi = new CMenuForwarder(b->name, enabled, b->str_val, filebrowser, NULL/*ActionKey*/, directkey, icon.c_str(), right_icon);
|
||||
m->targets.push_back(filebrowser);
|
||||
}
|
||||
if (mi) {
|
||||
mi->setLua(L, action, id);
|
||||
if (!hint.empty() || !hint_icon.empty())
|
||||
if (!hint.empty() || hint_icon)
|
||||
mi->setHint(hint_icon, hint);
|
||||
m->m->addItem(mi);
|
||||
}
|
||||
|
@@ -337,7 +337,7 @@ void CMiscMenue::showMiscSettingsMenuGeneral(CMenuWidget *ms_general)
|
||||
//fan speed
|
||||
if (g_info.has_fan)
|
||||
{
|
||||
CMenuOptionNumberChooser * mn = new CMenuOptionNumberChooser(LOCALE_FAN_SPEED, &g_settings.fan_speed, true, 1, 14, fanNotifier, 0, 0, LOCALE_OPTIONS_OFF);
|
||||
CMenuOptionNumberChooser * mn = new CMenuOptionNumberChooser(LOCALE_FAN_SPEED, &g_settings.fan_speed, true, 1, 14, fanNotifier, CRCInput::RC_nokey, NULL, 0, 0, LOCALE_OPTIONS_OFF);
|
||||
mn->setHint("", LOCALE_MENU_HINT_FAN_SPEED);
|
||||
ms_general->addItem(mn);
|
||||
}
|
||||
|
@@ -46,18 +46,18 @@ struct network_service
|
||||
std::string cmd;
|
||||
std::string options;
|
||||
neutrino_locale_t hint;
|
||||
std::string icon;
|
||||
const char * icon;
|
||||
int enabled;
|
||||
};
|
||||
|
||||
static struct network_service services[] =
|
||||
{
|
||||
{ "FTP", "vsftpd", "", LOCALE_MENU_HINT_NET_FTPD, "", 0 },
|
||||
{ "Telnet", "telnetd", "-l/bin/login", LOCALE_MENU_HINT_NET_TELNET, "", 0 },
|
||||
{ "FTP", "vsftpd", "", LOCALE_MENU_HINT_NET_FTPD, NULL, 0 },
|
||||
{ "Telnet", "telnetd", "-l/bin/login", LOCALE_MENU_HINT_NET_TELNET, NULL, 0 },
|
||||
{ "DjMount", "djmount", "-o iocharset=UTF-8 /media/00upnp/", LOCALE_MENU_HINT_NET_DJMOUNT, "", 0 },
|
||||
{ "uShare", "ushare", "-D -n `cat /etc/hostname`", LOCALE_MENU_HINT_NET_USHARE, "", 0 },
|
||||
{ "xupnpd", "xupnpd", "", LOCALE_MENU_HINT_NET_XUPNPD, "", 0 },
|
||||
{ "Dropbear", "dropbear", "-B", LOCALE_MENU_HINT_NET_DROPBEAR, "", 0 },
|
||||
{ "uShare", "ushare", "-D -n `cat /etc/hostname`", LOCALE_MENU_HINT_NET_USHARE, NULL, 0 },
|
||||
{ "xupnpd", "xupnpd", "", LOCALE_MENU_HINT_NET_XUPNPD, NULL, 0 },
|
||||
{ "Dropbear", "dropbear", "-B", LOCALE_MENU_HINT_NET_DROPBEAR, NULL, 0 },
|
||||
};
|
||||
#define SERVICE_COUNT (sizeof(services)/sizeof(struct network_service))
|
||||
|
||||
|
@@ -295,7 +295,7 @@ int CPersonalizeGui::ShowPersonalizationMenu()
|
||||
if (g_settings.easymenu) {
|
||||
int count = 0;
|
||||
for (uint j = 0; j<v_item.size(); j++) {
|
||||
printf("v_item[i].widget [%s]\n", v_item[j].widget->getName().c_str());
|
||||
printf("v_item[i].widget [%s]\n", v_item[j].widget->getName());
|
||||
//pin protected items only
|
||||
if (v_item[j].item_mode == PERSONALIZE_SHOW_AS_ACCESS_OPTION)
|
||||
{
|
||||
@@ -853,7 +853,7 @@ void CPersonalizeGui::addPersonalizedItems()
|
||||
bool add_shortcut = false;
|
||||
|
||||
//get shortcut
|
||||
if (fw->iconName.empty() && fw->active ) //if no icon is defined and item is active, allow to generate a shortcut,
|
||||
if (d_key == CRCInput::RC_nokey && fw->active ) //if no icon is defined and item is active, allow to generate a shortcut,
|
||||
{
|
||||
add_shortcut = true;
|
||||
d_key = getShortcut(short_cut);
|
||||
@@ -875,7 +875,7 @@ void CPersonalizeGui::addPersonalizedItems()
|
||||
//convert item to locked forwarder and use generated pin mode for usage as ask parameter
|
||||
v_item[i].menuItem = new CLockedMenuForwarder(fw->getTextLocale(),
|
||||
g_settings.easymenu ? g_settings.parentallock_pincode : g_settings.personalize_pincode,
|
||||
use_pin, fw->active, NULL, fw->getTarget(), fw->getActionKey(), d_key, fw->iconName.c_str(), lock_icon);
|
||||
use_pin, fw->active, NULL, fw->getTarget(), fw->getActionKey(), d_key, NULL, lock_icon);
|
||||
v_item[i].menuItem->hintIcon = fw->hintIcon;
|
||||
v_item[i].menuItem->hint = fw->hint;
|
||||
//add item if it's set to visible or pin protected and allow to add an forwarder as next
|
||||
|
@@ -659,7 +659,7 @@ int CScanSetup::showScanMenuFrontendSetup()
|
||||
mf->setHint("", LOCALE_MENU_HINT_SCAN_LONGITUDE);
|
||||
rotorMenu->addItem(mf);
|
||||
|
||||
nc = new CMenuOptionNumberChooser(LOCALE_SATSETUP_USALS_REPEAT, (int *)&zapitCfg.repeatUsals, true, 0, 10, NULL, 0, 0, LOCALE_OPTIONS_OFF);
|
||||
nc = new CMenuOptionNumberChooser(LOCALE_SATSETUP_USALS_REPEAT, (int *)&zapitCfg.repeatUsals, true, 0, 10, NULL, CRCInput::convertDigitToKey(shortcut++), NULL, 0, 0, LOCALE_OPTIONS_OFF);
|
||||
nc->setHint("", LOCALE_MENU_HINT_SCAN_USALS_REPEAT);
|
||||
rotorMenu->addItem(nc);
|
||||
|
||||
@@ -1142,13 +1142,13 @@ void CScanSetup::addScanMenuTempSat(CMenuWidget *temp_sat, sat_config_t & satcon
|
||||
bool unicable = (dmode == DISEQC_UNICABLE);
|
||||
|
||||
if (!unicable) {
|
||||
diseqc = new CMenuOptionNumberChooser(LOCALE_SATSETUP_DISEQC_INPUT, &satconfig.diseqc, ((dmode != NO_DISEQC) && (dmode != DISEQC_ADVANCED)), -1, 15, this, 1, -1, LOCALE_OPTIONS_OFF);
|
||||
diseqc = new CMenuOptionNumberChooser(LOCALE_SATSETUP_DISEQC_INPUT, &satconfig.diseqc, ((dmode != NO_DISEQC) && (dmode != DISEQC_ADVANCED)), -1, 15, this, CRCInput::RC_nokey, NULL, 1, -1, LOCALE_OPTIONS_OFF);
|
||||
diseqc->setHint("", LOCALE_MENU_HINT_SCAN_DISEQC);
|
||||
comm = new CMenuOptionNumberChooser(LOCALE_SATSETUP_COMM_INPUT, &satconfig.commited, dmode == DISEQC_ADVANCED, -1, 15, NULL, 1, -1, LOCALE_OPTIONS_OFF);
|
||||
comm = new CMenuOptionNumberChooser(LOCALE_SATSETUP_COMM_INPUT, &satconfig.commited, dmode == DISEQC_ADVANCED, -1, 15, NULL, CRCInput::RC_nokey, NULL, 1, -1, LOCALE_OPTIONS_OFF);
|
||||
comm->setHint("", LOCALE_MENU_HINT_SCAN_COMMITED);
|
||||
uncomm = new CMenuOptionNumberChooser(LOCALE_SATSETUP_UNCOMM_INPUT, &satconfig.uncommited, dmode == DISEQC_ADVANCED, -1, 15, NULL, 1, -1, LOCALE_OPTIONS_OFF);
|
||||
uncomm = new CMenuOptionNumberChooser(LOCALE_SATSETUP_UNCOMM_INPUT, &satconfig.uncommited, dmode == DISEQC_ADVANCED, -1, 15, NULL, CRCInput::RC_nokey, NULL, 1, -1, LOCALE_OPTIONS_OFF);
|
||||
uncomm->setHint("", LOCALE_MENU_HINT_SCAN_UNCOMMITED);
|
||||
motor = new CMenuOptionNumberChooser(LOCALE_SATSETUP_MOTOR_POS, &satconfig.motor_position, true /*dmode == DISEQC_ADVANCED*/, 0, 64, this, 0, 0, LOCALE_OPTIONS_OFF);
|
||||
motor = new CMenuOptionNumberChooser(LOCALE_SATSETUP_MOTOR_POS, &satconfig.motor_position, true /*dmode == DISEQC_ADVANCED*/, 0, 64, this, CRCInput::RC_nokey, NULL, 0, 0, LOCALE_OPTIONS_OFF);
|
||||
motor->setHint("", LOCALE_MENU_HINT_SCAN_MOTORPOS);
|
||||
usals = new CMenuOptionChooser(LOCALE_EXTRA_USE_GOTOXX, &satconfig.use_usals, OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, true /*dmode == DISEQC_ADVANCED*/);
|
||||
usals->setHint("", LOCALE_MENU_HINT_SCAN_USEUSALS);
|
||||
@@ -1336,7 +1336,7 @@ int CScanSetup::showFastscanDiseqcSetup()
|
||||
continue;
|
||||
|
||||
std::string satname = CServiceManager::getInstance()->GetSatelliteName(sit->first);
|
||||
CMenuOptionNumberChooser *diseqc = new CMenuOptionNumberChooser(satname, &sit->second.diseqc, true, -1, 15, this, 1, -1, LOCALE_OPTIONS_OFF);
|
||||
CMenuOptionNumberChooser *diseqc = new CMenuOptionNumberChooser(satname, &sit->second.diseqc, true, -1, 15, this, CRCInput::RC_nokey, NULL, 1, -1, LOCALE_OPTIONS_OFF);
|
||||
sat_setup->addItem(diseqc);
|
||||
}
|
||||
sat_setup->addItem(GenericMenuSeparatorLine);
|
||||
|
@@ -448,7 +448,7 @@ void CTimerList::updateEvents(void)
|
||||
theight = g_Font[SNeutrinoSettings::FONT_TYPE_MENU_TITLE]->getHeight();
|
||||
fheight = g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getHeight();
|
||||
//get footerHeight from paintButtons
|
||||
footerHeight = ::paintButtons(0, 0, 0, TimerListButtonsCount, TimerListButtons, 0, 0, "", false, COL_INFOBAR_SHADOW_TEXT, NULL, 0, false);
|
||||
footerHeight = ::paintButtons(TimerListButtons, TimerListButtonsCount, 0, 0, 0, 0, 0, false);
|
||||
|
||||
width = w_max(g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getWidth()*56, 20);
|
||||
height = frameBuffer->getScreenHeight() - (2*theight); // max height
|
||||
|
@@ -169,20 +169,20 @@ void CVfdSetup::showBrightnessSetup(CMenuWidget *mn_widget)
|
||||
brightnessstandby = CVFD::getInstance()->getBrightnessStandby();
|
||||
brightnessdeepstandby = CVFD::getInstance()->getBrightnessDeepStandby();
|
||||
|
||||
nc = new CMenuOptionNumberChooser(LOCALE_LCDCONTROLER_BRIGHTNESS, &brightness, true, 0, 15, this, 0, 0, NONEXISTANT_LOCALE, true);
|
||||
nc = new CMenuOptionNumberChooser(LOCALE_LCDCONTROLER_BRIGHTNESS, &brightness, true, 0, 15, this, CRCInput::RC_nokey, NULL, 0, 0, NONEXISTANT_LOCALE, true);
|
||||
nc->setHint("", LOCALE_MENU_HINT_VFD_BRIGHTNESS);
|
||||
mn_widget->addItem(nc);
|
||||
|
||||
nc = new CMenuOptionNumberChooser(LOCALE_LCDCONTROLER_BRIGHTNESSSTANDBY, &brightnessstandby, true, 0, 15, this, 0, 0, NONEXISTANT_LOCALE, true);
|
||||
nc = new CMenuOptionNumberChooser(LOCALE_LCDCONTROLER_BRIGHTNESSSTANDBY, &brightnessstandby, true, 0, 15, this, CRCInput::RC_nokey, NULL, 0, 0, NONEXISTANT_LOCALE, true);
|
||||
nc->setHint("", LOCALE_MENU_HINT_VFD_BRIGHTNESSSTANDBY);
|
||||
mn_widget->addItem(nc);
|
||||
|
||||
if(cs_get_revision() > 7) {
|
||||
nc = new CMenuOptionNumberChooser(LOCALE_LCDCONTROLER_BRIGHTNESSDEEPSTANDBY, &brightnessdeepstandby, true, 0, 15, this, 0, 0, NONEXISTANT_LOCALE, true);
|
||||
nc = new CMenuOptionNumberChooser(LOCALE_LCDCONTROLER_BRIGHTNESSDEEPSTANDBY, &brightnessdeepstandby, true, 0, 15, this, CRCInput::RC_nokey, NULL, 0, 0, NONEXISTANT_LOCALE, true);
|
||||
nc->setHint("", LOCALE_MENU_HINT_VFD_BRIGHTNESSDEEPSTANDBY);
|
||||
mn_widget->addItem(nc);
|
||||
}
|
||||
nc = new CMenuOptionNumberChooser(LOCALE_LCDMENU_DIM_BRIGHTNESS, &g_settings.lcd_setting_dim_brightness, vfd_enabled, -1, 15, NULL, 0, -1, LOCALE_OPTIONS_OFF, true);
|
||||
nc = new CMenuOptionNumberChooser(LOCALE_LCDMENU_DIM_BRIGHTNESS, &g_settings.lcd_setting_dim_brightness, vfd_enabled, -1, 15, NULL, CRCInput::RC_nokey, NULL, 0, -1, LOCALE_OPTIONS_OFF, true);
|
||||
nc->setHint("", LOCALE_MENU_HINT_VFD_BRIGHTNESSDIM);
|
||||
mn_widget->addItem(nc);
|
||||
|
||||
|
@@ -30,7 +30,7 @@
|
||||
#include <gui/widget/buttons.h>
|
||||
#include <gui/customcolor.h>
|
||||
#include <system/settings.h>
|
||||
//#include <driver/stacktrace.h>
|
||||
// #include <driver/stacktrace.h>
|
||||
|
||||
|
||||
|
||||
@@ -50,33 +50,55 @@
|
||||
* maxwidth maximum horizontal space for the buttons
|
||||
* footerheight set height of buttonbar as similar to footer, value 0 (default) means:
|
||||
value calculates automaticly depends of maximal height of icon and caption
|
||||
|
||||
* stuff below here was obviously not tested recently
|
||||
* vertical_paint optional, default value is false (horizontal) sets direction of painted buttons
|
||||
* fcolor optional, default value is COL_INFOBAR_SHADOW_TEXT, use it to render font with other color
|
||||
* alt_buttontext optional, default NULL, overwrites button caption at definied buttonlabel id (see parameter alt_buttontext_id) with this text
|
||||
* alt_buttontext_id optional, default 0, means id from buttonlable struct which text you will change
|
||||
* show optional, default value is true (show button), if false, then no show and return the height of the button.
|
||||
* show optional, default value is true (show button), if false, then no show and return the height of the button.
|
||||
*/
|
||||
|
||||
int paintButtons( const int &x,
|
||||
int paintButtons( const int &x,
|
||||
const int &y,
|
||||
const int &footerwidth,
|
||||
const int &count,
|
||||
const button_label * const content,
|
||||
const int &maxwidth,
|
||||
const int &footerheight) {
|
||||
return paintButtons(content, count, x, y, footerwidth, footerheight, maxwidth, true, NULL, NULL);
|
||||
};
|
||||
|
||||
int paintButtons( const button_label * const content,
|
||||
const int &count,
|
||||
const int &x,
|
||||
const int &y,
|
||||
const int &footerwidth,
|
||||
const uint &count,
|
||||
const struct button_label * const content,
|
||||
const int &maxwidth,
|
||||
const int &footerheight,
|
||||
std::string /* just to make sure nobody uses anything below */,
|
||||
bool vertical_paint,
|
||||
const uint32_t fcolor,
|
||||
const char * alt_buttontext,
|
||||
const uint &buttontext_id,
|
||||
const int &maxwidth,
|
||||
bool show,
|
||||
const std::vector<neutrino_locale_t>& /*all_buttontext_id*/)
|
||||
int *wantedwidth,
|
||||
int *wantedheight)
|
||||
{
|
||||
button_label_ext content_ext[count];
|
||||
for (int i = 0; i < count; i++) {
|
||||
content_ext[i].button = content[i].button;
|
||||
content_ext[i].locale = content[i].locale;
|
||||
content_ext[i].text = NULL;
|
||||
content_ext[i].width = 0;
|
||||
content_ext[i].maximize = false;
|
||||
}
|
||||
return paintButtons(content_ext, count, x, y, footerwidth, footerheight, maxwidth, show, wantedwidth, wantedheight);
|
||||
}
|
||||
|
||||
int paintButtons( const button_label_ext * const content,
|
||||
const int &count,
|
||||
const int &x,
|
||||
const int &y,
|
||||
const int &footerwidth,
|
||||
const int &footerheight,
|
||||
const int &maxwidth,
|
||||
bool show,
|
||||
int *wantedwidth,
|
||||
int *wantedheight)
|
||||
{
|
||||
CFrameBuffer *frameBuffer = CFrameBuffer::getInstance();
|
||||
Font * font = g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_SMALL];
|
||||
uint cnt = count;
|
||||
int cnt = count;
|
||||
int x_footer = x;
|
||||
int y_footer = y;
|
||||
int w_footer = footerwidth;
|
||||
@@ -107,6 +129,211 @@ int paintButtons( const int &x,
|
||||
int fwidth[16];
|
||||
const char *buttontext[16];
|
||||
|
||||
/* sanity check... */
|
||||
if (count > 16 || count == 0)
|
||||
{
|
||||
fprintf(stderr, "paintButtons does only support max 16 buttons yet (%d)\n", count);
|
||||
// print_stacktrace();
|
||||
return 0;
|
||||
}
|
||||
if (maxwidth < 200 && show)
|
||||
{
|
||||
fprintf(stderr, "paintButtons: maxwidth very small\n");
|
||||
fprintf(stderr, " x: %d y: %d footw: %d count: %d maxw: %d footh: %d\n ",
|
||||
x, y, footerwidth, count, maxwidth, footerheight);
|
||||
// print_stacktrace();
|
||||
}
|
||||
|
||||
bool maximize = false;
|
||||
for (int i = 0; i < cnt; i++)
|
||||
maximize |= content[i].maximize;
|
||||
|
||||
for (int i = 0; i < cnt; i++)
|
||||
{
|
||||
//icon
|
||||
int w = 0;
|
||||
int h = 0;
|
||||
frameBuffer->getIconSize(content[i].button, &w, &h);
|
||||
iconw[i] = w;
|
||||
iconh[i] = h;
|
||||
h_max_icon = std::max(h_max_icon, h);
|
||||
w_icons += w;
|
||||
if (w)
|
||||
count_icons++;
|
||||
|
||||
if (content[i].text) {
|
||||
buttontext[i] = content[i].text;
|
||||
fwidth[i] = std::max(content[i].width, font->getRenderWidth(buttontext[i]));
|
||||
w_text += fwidth[i];
|
||||
count_labels++;
|
||||
} else if (content[i].locale) {
|
||||
buttontext[i] = g_Locale->getText(content[i].locale);
|
||||
fwidth[i] = std::max(content[i].width, font->getRenderWidth(buttontext[i]));
|
||||
w_text += fwidth[i];
|
||||
count_labels++;
|
||||
} else {
|
||||
buttontext[i] = "";
|
||||
fwidth[i] = 0;
|
||||
}
|
||||
if (maximize && i < cnt - 1)
|
||||
fwidth[i] += w, w_text += w;
|
||||
}
|
||||
|
||||
//calculate button heigth
|
||||
h_button = std::max(h_max_icon, h_max_text); //calculate optimal button height
|
||||
|
||||
//calculate footer heigth
|
||||
h_footer = footerheight == 0 ? (h_button + 2*h_space) : footerheight;
|
||||
|
||||
if (!show) {
|
||||
if (wantedheight)
|
||||
*wantedheight = h_button + 2*h_space;
|
||||
if (wantedwidth)
|
||||
*wantedwidth = w_space * 2 + w_text + w_icons + (count_icons + count_labels - 1) * h_space;
|
||||
return h_footer;
|
||||
}
|
||||
|
||||
//paint footer
|
||||
if (w_footer > 0)
|
||||
frameBuffer->paintBoxRel(x_footer, y_footer, w_footer, h_footer, COL_INFOBAR_SHADOW_PLUS_1, RADIUS_LARGE, CORNER_BOTTOM); //round
|
||||
|
||||
|
||||
//baseline
|
||||
int y_base = y_footer + h_footer/2;
|
||||
int spacing = maxwidth - w_space * 2 - w_text - w_icons - (count_icons + count_labels - 1) * h_space;
|
||||
#if 0
|
||||
/* debug */
|
||||
fprintf(stderr, "PB: sp %d mw %d w_t %d w_i %d w_s %d c_i %d\n",
|
||||
spacing, maxwidth, w_text, w_icons, w_space, count_items);
|
||||
#endif
|
||||
if (fwidth[cnt - 1] == 0) /* divisor needs to be labels+1 unless rightmost icon has a label */
|
||||
count_labels++; /* side effect: we don't try to divide by 0 :-) */
|
||||
|
||||
if (maximize) {
|
||||
while (spacing > 0) {
|
||||
for (int i = 0; i < cnt && spacing > 0; i++) {
|
||||
if (content[i].maximize) {
|
||||
fwidth[i]++;
|
||||
spacing--;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (spacing >= 0)
|
||||
{ /* add half of the inter-object space to the */
|
||||
spacing /= count_labels; /* left and right (this might break vertical */
|
||||
x_button += spacing / 2; /* alignment, but nobody is using this (yet) */
|
||||
} /* and I'm don't know how it should work. */
|
||||
else
|
||||
{
|
||||
/* shorten captions relative to their length */
|
||||
for (int i = 0; i < cnt; i++)
|
||||
fwidth[i] = (fwidth[i] * (w_text + spacing)) / w_text; /* spacing is negative...*/
|
||||
spacing = 0;
|
||||
}
|
||||
|
||||
for (int j = 0; j < cnt; j++)
|
||||
{
|
||||
const char * caption = NULL;
|
||||
//set caption...
|
||||
caption = buttontext[j];
|
||||
|
||||
const char * icon = content[j].button ? content[j].button : "";
|
||||
|
||||
// calculate baseline startposition of icon and text in y
|
||||
int y_caption = y_base + h_max_text/2+1;
|
||||
|
||||
// paint icon and text
|
||||
frameBuffer->paintIcon(icon, x_button , y_base - iconh[j]/2);
|
||||
x_caption = x_button + iconw[j] + h_space;
|
||||
font->RenderString(x_caption, y_caption, fwidth[j], caption, COL_INFOBAR_SHADOW_TEXT);
|
||||
|
||||
/* set next startposition x, if text is length=0 then offset is =renderwidth of icon,
|
||||
* for generating buttons without captions,
|
||||
*/
|
||||
|
||||
/* increase x position */
|
||||
x_button = x_caption;
|
||||
if (fwidth[j])
|
||||
x_button += fwidth[j] + spacing + h_space;
|
||||
}
|
||||
|
||||
return h_footer;
|
||||
}
|
||||
|
||||
/* paintButtons usage,
|
||||
use this function for painting icons with captions in horizontal or vertical direction.
|
||||
Icons automatically use the available maxwidth.
|
||||
If not enough space is available, captions are shortened.
|
||||
If there is extra space, space between icons is increased.
|
||||
|
||||
* x set horizontal startposition
|
||||
* y set vertical startposition
|
||||
* footerwidth set width of buttonbar as similar to footer, value 0 (default) means: do nothing,
|
||||
then paint it extra
|
||||
* count set count of buttons
|
||||
* content set struct buttonlabel with iconfile and locales, for an empty text let locale
|
||||
constant empty, so you can paint icons without captions,
|
||||
* maxwidth maximum horizontal space for the buttons
|
||||
* footerheight set height of buttonbar as similar to footer, value 0 (default) means:
|
||||
value calculates automaticly depends of maximal height of icon and caption
|
||||
|
||||
* stuff below here was obviously not tested recently
|
||||
* vertical_paint optional, default value is false (horizontal) sets direction of painted buttons
|
||||
* fcolor optional, default value is COL_INFOBAR_SHADOW_TEXT, use it to render font with other color
|
||||
* alt_buttontext optional, default NULL, overwrites button caption at definied buttonlabel id (see parameter alt_buttontext_id) with this text
|
||||
* alt_buttontext_id optional, default 0, means id from buttonlable struct which text you will change
|
||||
* show optional, default value is true (show button), if false, then no show and return the height of the button.
|
||||
*/
|
||||
|
||||
int paintButtons( const int &x,
|
||||
const int &y,
|
||||
const int &footerwidth,
|
||||
const uint &count,
|
||||
const struct button_label * const content,
|
||||
const int &maxwidth,
|
||||
const int &footerheight,
|
||||
std::string /* just to make sure nobody uses anything below */,
|
||||
bool vertical_paint,
|
||||
const uint32_t fcolor,
|
||||
const char * alt_buttontext,
|
||||
const uint &buttontext_id,
|
||||
bool show,
|
||||
const std::vector<neutrino_locale_t>& /*all_buttontext_id*/)
|
||||
{
|
||||
CFrameBuffer *frameBuffer = CFrameBuffer::getInstance();
|
||||
Font * font = g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_SMALL];
|
||||
uint cnt = count;
|
||||
int x_footer = x;
|
||||
int y_footer = y;
|
||||
int w_footer = footerwidth;
|
||||
int h_footer = 0;
|
||||
|
||||
int w_space = 10; //minimal space between buttons
|
||||
int h_space = 4; //minimal space between caption and/or icon and border
|
||||
int x_icon = x_footer + w_space;
|
||||
int x_caption = 0;
|
||||
|
||||
int x_button = x_icon;
|
||||
int h_button = 0;
|
||||
|
||||
//calculate max of h + w
|
||||
//icon
|
||||
int h_max_icon = 0;
|
||||
int w_icons = 0;
|
||||
|
||||
//text
|
||||
int w_text = 0;
|
||||
int h_max_text = font->getHeight();
|
||||
int count_icons = 0;
|
||||
int count_labels = 0;
|
||||
/* more than 16 buttons? noooooo*/
|
||||
int iconw[16];
|
||||
int iconh[16];
|
||||
int fwidth[16];
|
||||
const char *buttontext[16];
|
||||
|
||||
/* sanity check... */
|
||||
if (count > 16 || count == 0)
|
||||
{
|
||||
@@ -139,7 +366,7 @@ int paintButtons( const int &x,
|
||||
if (content[i].locale) {
|
||||
buttontext[i] = g_Locale->getText(content[i].locale);
|
||||
//text width
|
||||
if (alt_buttontext != NULL && i == buttontext_id)
|
||||
if (alt_buttontext != NULL && i == buttontext_id)
|
||||
fwidth[i] = font->getRenderWidth(alt_buttontext); //...with an alternate buttontext
|
||||
else
|
||||
fwidth[i] = font->getRenderWidth(buttontext[i]);
|
||||
@@ -153,7 +380,7 @@ int paintButtons( const int &x,
|
||||
|
||||
//calculate button heigth
|
||||
h_button = std::max(h_max_icon, h_max_text); //calculate optimal button height
|
||||
|
||||
|
||||
//calculate footer heigth
|
||||
h_footer = footerheight == 0 ? (h_button + 2*h_space) : footerheight;
|
||||
|
||||
@@ -164,22 +391,22 @@ int paintButtons( const int &x,
|
||||
if (w_footer > 0)
|
||||
frameBuffer->paintBoxRel(x_footer, y_footer, w_footer, h_footer, COL_INFOBAR_SHADOW_PLUS_1, RADIUS_LARGE, CORNER_BOTTOM); //round
|
||||
|
||||
|
||||
|
||||
//baseline
|
||||
int y_base = y_footer + h_footer/2;
|
||||
int spacing = maxwidth - w_space * 2 - w_text - w_icons - (count_icons + count_labels - 1) * h_space;
|
||||
#if 0
|
||||
/* debug */
|
||||
fprintf(stderr, "PB: sp %d mw %d w_t %d w_i %d w_s %d c_i %d\n",
|
||||
spacing, maxwidth, w_text, w_icons, w_space, count_items);
|
||||
spacing, maxwidth, w_text, w_icons, w_space, count_items);
|
||||
#endif
|
||||
if (fwidth[cnt - 1] == 0) /* divisor needs to be labels+1 unless rightmost icon has a label */
|
||||
count_labels++; /* side effect: we don't try to divide by 0 :-) */
|
||||
if (spacing >= 0)
|
||||
{ /* add half of the inter-object space to the */
|
||||
{ /* add half of the inter-object space to the */
|
||||
spacing /= count_labels; /* left and right (this might break vertical */
|
||||
x_button += spacing / 2; /* alignment, but nobody is using this (yet) */
|
||||
} /* and I'm don't know how it should work. */
|
||||
} /* and I'm don't know how it should work. */
|
||||
else
|
||||
{
|
||||
/* shorten captions relative to their length */
|
||||
@@ -192,7 +419,7 @@ int paintButtons( const int &x,
|
||||
{
|
||||
const char * caption = NULL;
|
||||
//set caption...
|
||||
if (alt_buttontext != NULL && j == buttontext_id)
|
||||
if (alt_buttontext != NULL && j == buttontext_id)
|
||||
caption = alt_buttontext; //...with an alternate buttontext
|
||||
else
|
||||
caption = buttontext[j];
|
||||
@@ -200,30 +427,30 @@ int paintButtons( const int &x,
|
||||
const char * icon = content[j].button ? content[j].button : "";
|
||||
|
||||
// calculate baseline startposition of icon and text in y
|
||||
int y_caption = y_base + h_max_text/2+1;
|
||||
|
||||
int y_caption = y_base + h_max_text/2+1;
|
||||
|
||||
// paint icon and text
|
||||
frameBuffer->paintIcon(icon, x_button , y_base - iconh[j]/2);
|
||||
x_caption = x_button + iconw[j] + h_space;
|
||||
font->RenderString(x_caption, y_caption, fwidth[j], caption, fcolor);
|
||||
|
||||
/* set next startposition x, if text is length=0 then offset is =renderwidth of icon,
|
||||
* for generating buttons without captions,
|
||||
*/
|
||||
|
||||
int lentext = strlen(caption);
|
||||
if (vertical_paint)
|
||||
// set x_icon for painting buttons with vertical arrangement
|
||||
|
||||
/* set next startposition x, if text is length=0 then offset is =renderwidth of icon,
|
||||
* for generating buttons without captions,
|
||||
*/
|
||||
|
||||
int lentext = strlen(caption);
|
||||
if (vertical_paint)
|
||||
// set x_icon for painting buttons with vertical arrangement
|
||||
{
|
||||
if (lentext !=0)
|
||||
{
|
||||
x_button = x;
|
||||
y_base += h_footer;
|
||||
}
|
||||
else
|
||||
{
|
||||
x_button = x_caption;
|
||||
}
|
||||
if (lentext !=0)
|
||||
{
|
||||
x_button = x;
|
||||
y_base += h_footer;
|
||||
}
|
||||
else
|
||||
{
|
||||
x_button = x_caption;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -231,7 +458,7 @@ int paintButtons( const int &x,
|
||||
x_button = x_caption;
|
||||
if (fwidth[j])
|
||||
x_button += fwidth[j] + spacing + h_space;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return h_footer;
|
||||
|
@@ -29,25 +29,64 @@
|
||||
|
||||
#include <vector>
|
||||
|
||||
typedef struct button_label
|
||||
struct button_label
|
||||
{
|
||||
const char * button;
|
||||
neutrino_locale_t locale;
|
||||
} button_label_struct;
|
||||
};
|
||||
|
||||
struct button_label_ext
|
||||
{
|
||||
const char * button;
|
||||
neutrino_locale_t locale;
|
||||
const char * text;
|
||||
int width;
|
||||
bool maximize;
|
||||
};
|
||||
|
||||
int paintButtons( const button_label * const content,
|
||||
const int &count,
|
||||
const int &x,
|
||||
const int &y,
|
||||
const int &footerheight,
|
||||
const int &footerwidth,
|
||||
const int &maxwidth,
|
||||
bool show = true,
|
||||
int *wantedwidth = NULL,
|
||||
int *wantedheight = NULL);
|
||||
|
||||
int paintButtons( const button_label_ext * const content,
|
||||
const int &count,
|
||||
const int &x,
|
||||
const int &y,
|
||||
const int &footerheight,
|
||||
const int &footerwidth,
|
||||
const int &maxwidth,
|
||||
bool show = true,
|
||||
int *wantedwidth = NULL,
|
||||
int *wantedheight = NULL);
|
||||
|
||||
int paintButtons( const int &x,
|
||||
const int &y,
|
||||
const int &footerwidth,
|
||||
const uint &count,
|
||||
const struct button_label * const content,
|
||||
const int &count,
|
||||
const button_label * const content,
|
||||
const int &maxwidth,
|
||||
const int &footerheight = 0,
|
||||
std::string tmp = "", /* just to make sure compilation breaks */
|
||||
bool vertical_paint = false,
|
||||
const uint32_t fcolor = COL_INFOBAR_SHADOW_TEXT,
|
||||
const char * alt_buttontext = NULL,
|
||||
const uint &buttontext_id = 0,
|
||||
bool show = true,
|
||||
const std::vector<neutrino_locale_t>& all_buttontext_id = std::vector<neutrino_locale_t>());
|
||||
const int &footerheight = 0);
|
||||
|
||||
int paintButtons( const int &x,
|
||||
const int &y,
|
||||
const int &footerwidth,
|
||||
const uint &count,
|
||||
const struct button_label * const content,
|
||||
const int &maxwidth,
|
||||
const int &footerheight = 0,
|
||||
std::string tmp = "", /* just to make sure compilation breaks */
|
||||
bool vertical_paint = false,
|
||||
const uint32_t fcolor = COL_INFOBAR_SHADOW_TEXT,
|
||||
const char * alt_buttontext = NULL,
|
||||
const uint &buttontext_id = 0,
|
||||
bool show = true,
|
||||
const std::vector<neutrino_locale_t>& all_buttontext_id = std::vector<neutrino_locale_t>());
|
||||
|
||||
#endif /* __gui_widget_buttons_h__ */
|
||||
|
@@ -104,9 +104,13 @@
|
||||
#define NEUTRINO_ICON_MP3 "mp3"
|
||||
#define NEUTRINO_ICON_MULTIMEDIA "multimedia"
|
||||
#define NEUTRINO_ICON_MOVIEPLAYER "icon_movieplayer"
|
||||
#define NEUTRINO_ICON_NKPLAY "icon_nkplay"
|
||||
#define NEUTRINO_ICON_YTPLAY "icon_ytplay"
|
||||
#define NEUTRINO_ICON_NOT_MOUNTED "not_mounted"
|
||||
#define NEUTRINO_ICON_PAUSE "mp_pause"
|
||||
#define NEUTRINO_ICON_PLAY "mp_play"
|
||||
#define NEUTRINO_ICON_PLAY_REPEAT_ALL "mp_play_repeat_all"
|
||||
#define NEUTRINO_ICON_PLAY_REPEAT_TRACK "mp_play_repeat_track"
|
||||
#define NEUTRINO_ICON_REW "mp_b-skip"
|
||||
#define NEUTRINO_ICON_FF "mp_f-skip"
|
||||
#define NEUTRINO_ICON_PROTECTING "protecting"
|
||||
@@ -223,6 +227,7 @@
|
||||
#define NEUTRINO_ICON_HINT_HDD "hint_hdd"
|
||||
#define NEUTRINO_ICON_HINT_KEYS "hint_keys"
|
||||
#define NEUTRINO_ICON_HINT_A_PIC "hint_a_pic"
|
||||
#define NEUTRINO_ICON_HINT_RASS "hint_rass"
|
||||
|
||||
#define NEUTRINO_ICON_HINT_COLORS "hint_colors"
|
||||
#define NEUTRINO_ICON_HINT_FONTS "hint_fonts"
|
||||
@@ -249,14 +254,41 @@
|
||||
#define NEUTRINO_ICON_HINT_FACTORY "hint_factory"
|
||||
|
||||
/* opkg manager */
|
||||
#define NEUTRINO_ICON_CHECKMARK "checkmark"
|
||||
#define NEUTRINO_ICON_WARNING "warning"
|
||||
#define NEUTRINO_ICON_CHECKMARK "checkmark"
|
||||
#define NEUTRINO_ICON_WARNING "warning"
|
||||
|
||||
/* RASS */
|
||||
#define NEUTRINO_ICON_RED_0 "0-red"
|
||||
#define NEUTRINO_ICON_RED_1 "1-red"
|
||||
#define NEUTRINO_ICON_RED_2 "2-red"
|
||||
#define NEUTRINO_ICON_RED_3 "3-red"
|
||||
#define NEUTRINO_ICON_RED_4 "4-red"
|
||||
#define NEUTRINO_ICON_RED_5 "5-red"
|
||||
#define NEUTRINO_ICON_RED_6 "6-red"
|
||||
#define NEUTRINO_ICON_RED_7 "7-red"
|
||||
#define NEUTRINO_ICON_RED_8 "8-red"
|
||||
#define NEUTRINO_ICON_RED_9 "9-red"
|
||||
|
||||
#define NEUTRINO_ICON_GREEN_0 "0-green"
|
||||
#define NEUTRINO_ICON_GREEN_1 "1-green"
|
||||
#define NEUTRINO_ICON_GREEN_2 "2-green"
|
||||
#define NEUTRINO_ICON_GREEN_3 "3-green"
|
||||
#define NEUTRINO_ICON_GREEN_4 "4-green"
|
||||
#define NEUTRINO_ICON_GREEN_5 "5-green"
|
||||
#define NEUTRINO_ICON_GREEN_6 "6-green"
|
||||
#define NEUTRINO_ICON_GREEN_7 "7-green"
|
||||
#define NEUTRINO_ICON_GREEN_8 "8-green"
|
||||
#define NEUTRINO_ICON_GREEN_9 "9-green"
|
||||
|
||||
/* misc */
|
||||
#define NEUTRINO_ICON_HINT_NKPLAY "hint_nkplay"
|
||||
#define NEUTRINO_ICON_HINT_YTPLAY "hint_ytplay"
|
||||
#define NEUTRINO_ICON_HINT_SPARK "hint_spark"
|
||||
|
||||
#define NEUTRINO_ICON_EPG "epg"
|
||||
|
||||
#define NEUTRINO_ICON_BUTTON_LONGPRESS "longpress"
|
||||
|
||||
#define NEUTRINO_ICON_VARPATH "/var/share/tuxbox/neutrino/icons/" //alternatively path for user-defined icons
|
||||
|
||||
#endif /* __gui_widget_icons_h__ */
|
||||
|
File diff suppressed because it is too large
Load Diff
@@ -39,12 +39,12 @@
|
||||
#include <driver/framebuffer.h>
|
||||
#include <driver/rcinput.h>
|
||||
#include <system/localize.h>
|
||||
#include <gui/widget/buttons.h>
|
||||
#include <gui/widget/icons.h>
|
||||
#include <gui/color.h>
|
||||
#include <gui/components/cc.h>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#if ENABLE_LUA
|
||||
extern "C" {
|
||||
#include <lua.h>
|
||||
@@ -73,7 +73,7 @@ class CChangeObserver
|
||||
{
|
||||
public:
|
||||
virtual ~CChangeObserver(){}
|
||||
virtual bool changeNotify(const neutrino_locale_t /*OptionName*/, void */*Data*/)
|
||||
virtual bool changeNotify(const neutrino_locale_t /*OptionName*/, void * /*Data*/)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@@ -101,6 +101,8 @@ class CMenuTarget
|
||||
|
||||
class CMenuItem
|
||||
{
|
||||
private:
|
||||
void setIconName();
|
||||
protected:
|
||||
int x, y, dx, offx, name_start_x, icon_frame_w;
|
||||
bool used;
|
||||
@@ -108,28 +110,32 @@ class CMenuItem
|
||||
|
||||
void initItemColors(const bool select_mode);
|
||||
#if ENABLE_LUA
|
||||
lua_State *luaState;
|
||||
std::string luaAction;
|
||||
std::string luaId;
|
||||
lua_State *luaState;
|
||||
std::string luaAction;
|
||||
std::string luaId;
|
||||
#endif
|
||||
neutrino_locale_t name;
|
||||
std::string nameString;
|
||||
|
||||
neutrino_locale_t name;
|
||||
std::string nameString;
|
||||
neutrino_locale_t desc;
|
||||
std::string descString;
|
||||
public:
|
||||
bool active;
|
||||
bool marked;
|
||||
int height;
|
||||
bool active;
|
||||
bool marked;
|
||||
bool inert;
|
||||
bool isStatic;
|
||||
bool directKeyOK;
|
||||
neutrino_msg_t directKey;
|
||||
neutrino_msg_t msg;
|
||||
std::string iconName;
|
||||
std::string selected_iconName;
|
||||
std::string iconName_Info_right;
|
||||
std::string hintIcon;
|
||||
const char * iconName;
|
||||
const char * selected_iconName;
|
||||
const char * iconName_Info_right;
|
||||
const char * hintIcon;
|
||||
std::string hintText;
|
||||
neutrino_locale_t hint;
|
||||
|
||||
CMenuItem();
|
||||
CMenuItem(bool Active = true, neutrino_msg_t DirectKey = CRCInput::RC_nokey, const char * const IconName= NULL, const char * const IconName_Info_right = NULL, bool IsStatic = false);
|
||||
|
||||
virtual ~CMenuItem(){}
|
||||
|
||||
virtual void isUsed(void)
|
||||
@@ -140,17 +146,14 @@ class CMenuItem
|
||||
virtual void init(const int X, const int Y, const int DX, const int OFFX);
|
||||
|
||||
virtual int paint (bool selected = false) = 0;
|
||||
virtual int getHeight(void) const = 0;
|
||||
virtual int getHeight(void);
|
||||
virtual int getWidth(void)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
virtual int getYPosition(void) const { return y; }
|
||||
|
||||
virtual bool isSelectable(void) const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
virtual bool isSelectable(void) const { return active; }
|
||||
|
||||
virtual int exec(CMenuTarget* /*parent*/)
|
||||
{
|
||||
@@ -160,34 +163,35 @@ class CMenuItem
|
||||
virtual void setMarked(const bool Marked);
|
||||
virtual void setInert(const bool Inert);
|
||||
|
||||
virtual void paintItemButton(const bool select_mode, const int &item_height, const std::string& icon_Name = NEUTRINO_ICON_BUTTON_RIGHT);
|
||||
virtual void paintItemButton(const bool select_mode, int item_height, const char * const icon_Name = NEUTRINO_ICON_BUTTON_RIGHT);
|
||||
|
||||
virtual void prepareItem(const bool select_mode, const int &item_height);
|
||||
|
||||
virtual void setItemButton(const std::string& icon_Name, const bool is_select_button = false);
|
||||
virtual void setItemButton(const char * const icon_Name, const bool is_select_button = false);
|
||||
|
||||
virtual void paintItemCaption(const bool select_mode, const int &item_height, const char * left_text=NULL, const char * right_text=NULL, const fb_pixel_t right_bgcol=0);
|
||||
virtual void paintItemCaption(const bool select_mode, const char * right_text=NULL, const fb_pixel_t right_bgcol=0);
|
||||
|
||||
virtual void paintItemSlider( const bool select_mode, const int &item_height, const int &optionvalue, const int &factor, const char * left_text=NULL, const char * right_text=NULL);
|
||||
|
||||
virtual int isMenueOptionChooser(void) const{return 0;}
|
||||
void setHint(const std::string icon, const neutrino_locale_t text) { hintIcon = icon; hint = text; }
|
||||
void setHint(const std::string icon, const std::string text) { hintIcon = icon; hintText = text; }
|
||||
|
||||
void setHint(const char * const icon, const neutrino_locale_t text) { hintIcon = (icon && *icon) ? icon : NULL; hint = text; }
|
||||
void setHint(const char * const icon, const std::string text) { hintIcon = (icon && *icon) ? icon : NULL; hintText = text; }
|
||||
#if ENABLE_LUA
|
||||
void setLua(lua_State *_luaState, std::string &_luaAction, std::string &_luaId) { luaState = _luaState; luaAction = _luaAction; luaId = _luaId; };
|
||||
#endif
|
||||
virtual const char *getName();
|
||||
virtual void setName(const std::string& text);
|
||||
virtual void setName(const neutrino_locale_t text);
|
||||
|
||||
virtual const char *getDescription();
|
||||
virtual void setDescription(const std::string& text);
|
||||
virtual void setDescription(const neutrino_locale_t text);
|
||||
virtual int getDescriptionHeight(void);
|
||||
};
|
||||
|
||||
class CMenuSeparator : public CMenuItem
|
||||
{
|
||||
private:
|
||||
int type;
|
||||
void initVarMenuSeparator( const int Type,
|
||||
const std::string& string_Text,
|
||||
const neutrino_locale_t locale_Text,
|
||||
bool IsStatic);
|
||||
|
||||
public:
|
||||
|
||||
@@ -204,15 +208,14 @@ class CMenuSeparator : public CMenuItem
|
||||
|
||||
|
||||
CMenuSeparator(const int Type = 0, const neutrino_locale_t Text = NONEXISTANT_LOCALE, bool IsStatic = false);
|
||||
CMenuSeparator(const int Type, const std::string& Text, bool IsStatic = false);
|
||||
CMenuSeparator(const int Type, const std::string Text, bool IsStatic = false);
|
||||
virtual ~CMenuSeparator(){}
|
||||
|
||||
int paint(bool selected=false);
|
||||
int getHeight(void) const;
|
||||
int getHeight(void);
|
||||
int getWidth(void);
|
||||
|
||||
void setName(const std::string& text);
|
||||
void setName(const neutrino_locale_t text);
|
||||
bool isSelectable(void) const { return false; }
|
||||
};
|
||||
|
||||
class CMenuForwarder : public CMenuItem
|
||||
@@ -220,125 +223,57 @@ class CMenuForwarder : public CMenuItem
|
||||
std::string actionKey;
|
||||
|
||||
protected:
|
||||
const char * option;
|
||||
const std::string * option_string;
|
||||
std::string option_string;
|
||||
const std::string * option_string_ptr;
|
||||
CMenuTarget * jumpTarget;
|
||||
|
||||
virtual std::string getOption(void);
|
||||
|
||||
void initVarMenuForwarder( const std::string& string_text,
|
||||
const neutrino_locale_t& locale_text,
|
||||
const bool Active,
|
||||
const std::string * Option_string,
|
||||
const char * const Option_cstring,
|
||||
CMenuTarget* Target,
|
||||
const char * const ActionKey,
|
||||
neutrino_msg_t DirectKey,
|
||||
const char * const IconName,
|
||||
const char * const IconName_Info_right,
|
||||
bool IsStatic);
|
||||
|
||||
public:
|
||||
|
||||
CMenuForwarder( const neutrino_locale_t Text,
|
||||
const bool Active,
|
||||
const std::string &Option,
|
||||
CMenuTarget* Target=NULL,
|
||||
const char * const ActionKey = NULL,
|
||||
const neutrino_msg_t DirectKey = CRCInput::RC_nokey,
|
||||
const char * const IconName = NULL,
|
||||
const char * const IconName_Info_right = NULL,
|
||||
bool IsStatic = false);
|
||||
|
||||
CMenuForwarder( const std::string& Text,
|
||||
const bool Active,
|
||||
const std::string &Option,
|
||||
CMenuTarget* Target=NULL,
|
||||
const char * const ActionKey = NULL,
|
||||
const neutrino_msg_t DirectKey = CRCInput::RC_nokey,
|
||||
const char * const IconName = NULL,
|
||||
const char * const IconName_Info_right = NULL,
|
||||
bool IsStatic = false);
|
||||
|
||||
CMenuForwarder( const neutrino_locale_t Text,
|
||||
const bool Active = true,
|
||||
const char * const Option=NULL,
|
||||
CMenuTarget* Target=NULL,
|
||||
const char * const ActionKey = NULL,
|
||||
const neutrino_msg_t DirectKey = CRCInput::RC_nokey,
|
||||
const char * const IconName = NULL,
|
||||
const char * const IconName_Info_right = NULL,
|
||||
bool IsStatic = false);
|
||||
|
||||
CMenuForwarder( const std::string& Text,
|
||||
const bool Active = true,
|
||||
const char * const Option=NULL,
|
||||
CMenuTarget* Target=NULL,
|
||||
const char * const ActionKey = NULL,
|
||||
const neutrino_msg_t DirectKey = CRCInput::RC_nokey,
|
||||
const char * const IconName = NULL,
|
||||
const char * const IconName_Info_right = NULL,
|
||||
bool IsStatic = false);
|
||||
|
||||
CMenuForwarder(const neutrino_locale_t Text, const bool Active, const std::string &Option,
|
||||
CMenuTarget* Target=NULL, const char * const ActionKey = NULL, const neutrino_msg_t DirectKey = CRCInput::RC_nokey,
|
||||
const char * const IconName = NULL, const char * const IconName_Info_right = NULL, bool IsStatic = false);
|
||||
CMenuForwarder(const std::string & Text, const bool Active, const std::string &Option,
|
||||
CMenuTarget* Target=NULL, const char * const ActionKey = NULL, const neutrino_msg_t DirectKey = CRCInput::RC_nokey,
|
||||
const char * const IconName = NULL, const char * const IconName_Info_right = NULL, bool IsStatic = false);
|
||||
CMenuForwarder(const neutrino_locale_t Text, const bool Active = true, const char * const Option=NULL,
|
||||
CMenuTarget* Target=NULL, const char * const ActionKey = NULL, const neutrino_msg_t DirectKey = CRCInput::RC_nokey,
|
||||
const char * const IconName = NULL, const char * const IconName_Info_right = NULL, bool IsStatic = false);
|
||||
CMenuForwarder(const std::string & Text, const bool Active = true, const char * const Option=NULL,
|
||||
CMenuTarget* Target=NULL, const char * const ActionKey = NULL, const neutrino_msg_t DirectKey = CRCInput::RC_nokey,
|
||||
const char * const IconName = NULL, const char * const IconName_Info_right = NULL, bool IsStatic = false);
|
||||
|
||||
virtual ~CMenuForwarder(){}
|
||||
|
||||
int paint(bool selected=false);
|
||||
int getHeight(void) const;
|
||||
int getWidth(void);
|
||||
neutrino_locale_t getTextLocale() const {return name;}
|
||||
CMenuTarget* getTarget() const {return jumpTarget;}
|
||||
const char *getActionKey(){return actionKey.c_str();}
|
||||
|
||||
int exec(CMenuTarget* parent);
|
||||
bool isSelectable(void) const { return active; }
|
||||
void setOption(const std::string &Option);
|
||||
void setOption(const char * const Option);
|
||||
void setName(const std::string& text);
|
||||
void setName(const neutrino_locale_t text);
|
||||
};
|
||||
|
||||
class CMenuDForwarder : public CMenuForwarder
|
||||
{
|
||||
public:
|
||||
CMenuDForwarder(const neutrino_locale_t Text,
|
||||
const bool Active,
|
||||
const std::string &Option,
|
||||
CMenuTarget* Target=NULL,
|
||||
const char * const ActionKey = NULL,
|
||||
const neutrino_msg_t DirectKey = CRCInput::RC_nokey,
|
||||
const char * const IconName = NULL,
|
||||
const char * const IconName_Info_right = NULL)
|
||||
CMenuDForwarder(const neutrino_locale_t Text, const bool Active, const std::string &Option,
|
||||
CMenuTarget* Target=NULL, const char * const ActionKey = NULL, const neutrino_msg_t DirectKey = CRCInput::RC_nokey,
|
||||
const char * const IconName = NULL, const char * const IconName_Info_right = NULL)
|
||||
: CMenuForwarder(Text, Active, Option, Target, ActionKey, DirectKey, IconName, IconName_Info_right) { };
|
||||
|
||||
CMenuDForwarder(const std::string& Text,
|
||||
const bool Active,
|
||||
const std::string &Option,
|
||||
CMenuTarget* Target=NULL,
|
||||
const char * const ActionKey = NULL,
|
||||
const neutrino_msg_t DirectKey = CRCInput::RC_nokey,
|
||||
const char * const IconName = NULL,
|
||||
const char * const IconName_Info_right = NULL)
|
||||
CMenuDForwarder(const std::string & Text, const bool Active, const std::string &Option,
|
||||
CMenuTarget* Target=NULL, const char * const ActionKey = NULL, const neutrino_msg_t DirectKey = CRCInput::RC_nokey,
|
||||
const char * const IconName = NULL, const char * const IconName_Info_right = NULL)
|
||||
: CMenuForwarder(Text, Active, Option, Target, ActionKey, DirectKey, IconName, IconName_Info_right) { };
|
||||
|
||||
CMenuDForwarder(const neutrino_locale_t Text,
|
||||
const bool Active=true,
|
||||
const char * const Option=NULL,
|
||||
CMenuTarget* Target=NULL,
|
||||
const char * const ActionKey = NULL,
|
||||
const neutrino_msg_t DirectKey = CRCInput::RC_nokey,
|
||||
const char * const IconName = NULL,
|
||||
const char * const IconName_Info_right = NULL)
|
||||
CMenuDForwarder(const neutrino_locale_t Text, const bool Active=true, const char * const Option=NULL,
|
||||
CMenuTarget* Target=NULL, const char * const ActionKey = NULL, const neutrino_msg_t DirectKey = CRCInput::RC_nokey,
|
||||
const char * const IconName = NULL, const char * const IconName_Info_right = NULL)
|
||||
: CMenuForwarder(Text, Active, Option, Target, ActionKey, DirectKey, IconName, IconName_Info_right) { };
|
||||
|
||||
CMenuDForwarder(const std::string& Text,
|
||||
bool Active=true,
|
||||
const char * const Option=NULL,
|
||||
CMenuTarget* Target=NULL,
|
||||
const char * const ActionKey = NULL,
|
||||
const neutrino_msg_t DirectKey = CRCInput::RC_nokey,
|
||||
const char * const IconName = NULL,
|
||||
const char * const IconName_Info_right = NULL)
|
||||
CMenuDForwarder(const std::string & Text, const bool Active=true, const char * const Option=NULL,
|
||||
CMenuTarget* Target=NULL, const char * const ActionKey = NULL, const neutrino_msg_t DirectKey = CRCInput::RC_nokey,
|
||||
const char * const IconName = NULL, const char * const IconName_Info_right = NULL)
|
||||
: CMenuForwarder(Text, Active, Option, Target, ActionKey, DirectKey, IconName, IconName_Info_right) { };
|
||||
|
||||
~CMenuDForwarder() { delete jumpTarget; }
|
||||
@@ -347,17 +282,11 @@ class CMenuDForwarder : public CMenuForwarder
|
||||
class CAbstractMenuOptionChooser : public CMenuItem
|
||||
{
|
||||
protected:
|
||||
int height;
|
||||
int * optionValue;
|
||||
|
||||
int getHeight(void) const{return height;}
|
||||
|
||||
bool isSelectable(void) const{return active;}
|
||||
public:
|
||||
CAbstractMenuOptionChooser()
|
||||
CAbstractMenuOptionChooser(bool Active, const neutrino_msg_t DirectKey, const char * const IconName, const char *const IconName_Info_right = NULL, bool IsStatic = false) : CMenuItem(Active, DirectKey, IconName, IconName_Info_right, IsStatic)
|
||||
{
|
||||
name = NONEXISTANT_LOCALE;
|
||||
height = 0;
|
||||
optionValue = NULL;
|
||||
}
|
||||
~CAbstractMenuOptionChooser(){}
|
||||
@@ -380,40 +309,17 @@ private:
|
||||
std::string numberFormat;
|
||||
std::string (*numberFormatFunction)(int num);
|
||||
|
||||
void initMenuOptionNumberChooser( const std::string &s_name,
|
||||
const neutrino_locale_t l_name,
|
||||
int * const OptionValue,
|
||||
const bool Active,
|
||||
const int min_value,
|
||||
const int max_value,
|
||||
CChangeObserver * const Observ,
|
||||
const int print_offset,
|
||||
const int special_value,
|
||||
const neutrino_locale_t special_value_name,
|
||||
bool sliderOn);
|
||||
|
||||
public:
|
||||
CMenuOptionNumberChooser(const neutrino_locale_t name,
|
||||
int * const OptionValue,
|
||||
const bool Active,
|
||||
const int min_value,
|
||||
const int max_value,
|
||||
CChangeObserver * const Observ = NULL,
|
||||
const int print_offset = 0,
|
||||
const int special_value = 0,
|
||||
const neutrino_locale_t special_value_name = NONEXISTANT_LOCALE,
|
||||
bool sliderOn = false );
|
||||
|
||||
CMenuOptionNumberChooser(const std::string &name,
|
||||
int * const OptionValue,
|
||||
const bool Active,
|
||||
const int min_value,
|
||||
const int max_value,
|
||||
CChangeObserver * const Observ = NULL,
|
||||
const int print_offset = 0,
|
||||
const int special_value = 0,
|
||||
const neutrino_locale_t special_value_name = NONEXISTANT_LOCALE,
|
||||
bool sliderOn = false );
|
||||
CMenuOptionNumberChooser(const neutrino_locale_t name, int * const OptionValue, const bool Active,
|
||||
const int min_value, const int max_value, CChangeObserver * const Observ = NULL,
|
||||
const neutrino_msg_t DirectKey = CRCInput::RC_nokey, const char * const IconName = NULL,
|
||||
const int print_offset = 0,
|
||||
const int special_value = 0, const neutrino_locale_t special_value_name = NONEXISTANT_LOCALE, bool sliderOn = false );
|
||||
CMenuOptionNumberChooser(const std::string &name, int * const OptionValue, const bool Active,
|
||||
const int min_value, const int max_value, CChangeObserver * const Observ = NULL,
|
||||
const neutrino_msg_t DirectKey = CRCInput::RC_nokey, const char * const IconName = NULL,
|
||||
const int print_offset = 0,
|
||||
const int special_value = 0, const neutrino_locale_t special_value_name = NONEXISTANT_LOCALE, bool sliderOn = false );
|
||||
|
||||
int paint(bool selected);
|
||||
|
||||
@@ -426,7 +332,7 @@ private:
|
||||
};
|
||||
|
||||
class CMenuOptionChooserOptions
|
||||
{
|
||||
{
|
||||
public:
|
||||
int key;
|
||||
std::string valname;
|
||||
@@ -447,168 +353,119 @@ struct CMenuOptionChooserCompareItem: public std::binary_function <const CMenuOp
|
||||
|
||||
class CMenuOptionChooser : public CAbstractMenuOptionChooser
|
||||
{
|
||||
public:
|
||||
struct keyval
|
||||
{
|
||||
const int key;
|
||||
const neutrino_locale_t value;
|
||||
};
|
||||
|
||||
struct keyval_ext
|
||||
{
|
||||
int key;
|
||||
neutrino_locale_t value;
|
||||
const char *valname;
|
||||
keyval_ext & operator=(const keyval &p)
|
||||
public:
|
||||
struct keyval
|
||||
{
|
||||
key = p.key;
|
||||
value = p.value;
|
||||
valname = NULL;
|
||||
return *this;
|
||||
}
|
||||
};
|
||||
const int key;
|
||||
const neutrino_locale_t value;
|
||||
};
|
||||
struct keyval_ext
|
||||
{
|
||||
int key;
|
||||
neutrino_locale_t value;
|
||||
const char *valname;
|
||||
keyval_ext & operator=(const keyval &p)
|
||||
{
|
||||
key = p.key;
|
||||
value = p.value;
|
||||
valname = NULL;
|
||||
return *this;
|
||||
}
|
||||
};
|
||||
|
||||
private:
|
||||
std::vector<keyval_ext> options;
|
||||
std::vector<CMenuOptionChooserOptions*> option_chooser_options_v;
|
||||
unsigned number_of_options;
|
||||
CChangeObserver * observ;
|
||||
bool pulldown;
|
||||
bool optionsSort;
|
||||
private:
|
||||
std::vector<keyval_ext> options;
|
||||
std::vector<CMenuOptionChooserOptions*> option_chooser_options_v;
|
||||
unsigned number_of_options;
|
||||
CChangeObserver * observ;
|
||||
bool pulldown;
|
||||
bool optionsSort;
|
||||
|
||||
void clearChooserOptions();
|
||||
void initVarOptionChooser( const std::string &OptionName,
|
||||
const neutrino_locale_t Name,
|
||||
int * const OptionValue,
|
||||
const bool Active,
|
||||
CChangeObserver * const Observ,
|
||||
neutrino_msg_t DirectKey,
|
||||
const std::string & IconName,
|
||||
bool Pulldown,
|
||||
bool OptionsSort
|
||||
void clearChooserOptions();
|
||||
void initVarOptionChooser( const std::string &OptionName,
|
||||
const neutrino_locale_t Name,
|
||||
int * const OptionValue,
|
||||
const bool Active,
|
||||
CChangeObserver * const Observ,
|
||||
neutrino_msg_t DirectKey,
|
||||
const char * IconName,
|
||||
bool Pulldown,
|
||||
bool OptionsSort
|
||||
);
|
||||
|
||||
public:
|
||||
CMenuOptionChooser( const neutrino_locale_t Name,
|
||||
int * const OptionValue,
|
||||
const struct keyval * const Options,
|
||||
const unsigned Number_Of_Options,
|
||||
const bool Active = false,
|
||||
CChangeObserver * const Observ = NULL,
|
||||
const neutrino_msg_t DirectKey = CRCInput::RC_nokey,
|
||||
const std::string & IconName= "",
|
||||
|
||||
public:
|
||||
CMenuOptionChooser(const neutrino_locale_t Name, int * const OptionValue, const struct keyval * const Options,
|
||||
const unsigned Number_Of_Options, const bool Active = false, CChangeObserver * const Observ = NULL,
|
||||
const neutrino_msg_t DirectKey = CRCInput::RC_nokey, const char * const IconName = NULL,
|
||||
bool Pulldown = false, bool OptionsSort = false);
|
||||
CMenuOptionChooser(const neutrino_locale_t Name, int * const OptionValue, const struct keyval_ext * const Options,
|
||||
const unsigned Number_Of_Options, const bool Active = false, CChangeObserver * const Observ = NULL,
|
||||
const neutrino_msg_t DirectKey = CRCInput::RC_nokey, const char * const IconName = NULL,
|
||||
bool Pulldown = false, bool OptionsSort = false);
|
||||
CMenuOptionChooser(const std::string &Name, int * const OptionValue, const struct keyval * const Options,
|
||||
const unsigned Number_Of_Options, const bool Active = false, CChangeObserver * const Observ = NULL,
|
||||
const neutrino_msg_t DirectKey = CRCInput::RC_nokey, const char * const IconName = NULL,
|
||||
bool Pulldown = false, bool OptionsSort = false);
|
||||
CMenuOptionChooser(const std::string &Name, int * const OptionValue, const struct keyval_ext * const Options,
|
||||
const unsigned Number_Of_Options, const bool Active = false, CChangeObserver * const Observ = NULL,
|
||||
const neutrino_msg_t DirectKey = CRCInput::RC_nokey, const char * const IconName = NULL,
|
||||
bool Pulldown = false, bool OptionsSort = false);
|
||||
CMenuOptionChooser(const neutrino_locale_t Name, int * const OptionValue, std::vector<keyval_ext> &Options,
|
||||
const bool Active = false, CChangeObserver * const Observ = NULL,
|
||||
const neutrino_msg_t DirectKey = CRCInput::RC_nokey, const char * const IconName = NULL,
|
||||
bool Pulldown = false, bool OptionsSort = false);
|
||||
CMenuOptionChooser(const std::string &Name, int * const OptionValue, std::vector<keyval_ext> &Options,
|
||||
const bool Active = false, CChangeObserver * const Observ = NULL,
|
||||
const neutrino_msg_t DirectKey = CRCInput::RC_nokey, const char * const IconName = NULL,
|
||||
bool Pulldown = false, bool OptionsSort = false);
|
||||
~CMenuOptionChooser();
|
||||
|
||||
CMenuOptionChooser( const neutrino_locale_t Name,
|
||||
int * const OptionValue,
|
||||
const struct keyval_ext * const Options,
|
||||
const unsigned Number_Of_Options,
|
||||
const bool Active = false,
|
||||
CChangeObserver * const Observ = NULL,
|
||||
const neutrino_msg_t DirectKey = CRCInput::RC_nokey,
|
||||
const std::string & IconName= "",
|
||||
bool Pulldown = false,
|
||||
bool OptionsSort = false);
|
||||
void setOption(const int newvalue);
|
||||
int getOption(void) const;
|
||||
int getWidth(void);
|
||||
void setOptions(const struct keyval * const Options, const unsigned Number_Of_Options);
|
||||
void setOptions(const struct keyval_ext * const Options, const unsigned Number_Of_Options);
|
||||
|
||||
CMenuOptionChooser( const std::string &Name,
|
||||
int * const OptionValue, const struct keyval * const Options,
|
||||
const unsigned Number_Of_Options,
|
||||
const bool Active = false,
|
||||
CChangeObserver * const Observ = NULL,
|
||||
const neutrino_msg_t DirectKey = CRCInput::RC_nokey,
|
||||
const std::string & IconName= "",
|
||||
bool Pulldown = false,
|
||||
bool OptionsSort = false);
|
||||
int paint(bool selected);
|
||||
|
||||
CMenuOptionChooser( const std::string &Name,
|
||||
int * const OptionValue,
|
||||
const struct keyval_ext * const Options,
|
||||
const unsigned Number_Of_Options,
|
||||
const bool Active = false,
|
||||
CChangeObserver * const Observ = NULL,
|
||||
const neutrino_msg_t DirectKey = CRCInput::RC_nokey,
|
||||
const std::string & IconName= "",
|
||||
bool Pulldown = false,
|
||||
bool OptionsSort = false);
|
||||
|
||||
CMenuOptionChooser( const neutrino_locale_t Name,
|
||||
int * const OptionValue,
|
||||
std::vector<keyval_ext> &Options,
|
||||
const bool Active = false,
|
||||
CChangeObserver * const Observ = NULL,
|
||||
const neutrino_msg_t DirectKey = CRCInput::RC_nokey,
|
||||
const std::string & IconName= "",
|
||||
bool Pulldown = false,
|
||||
bool OptionsSort = false);
|
||||
|
||||
CMenuOptionChooser( const std::string &Name,
|
||||
int * const OptionValue,
|
||||
std::vector<keyval_ext> &Options,
|
||||
const bool Active = false,
|
||||
CChangeObserver * const Observ = NULL,
|
||||
const neutrino_msg_t DirectKey = CRCInput::RC_nokey,
|
||||
const std::string & IconName= "",
|
||||
bool Pulldown = false,
|
||||
bool OptionsSort = false);
|
||||
|
||||
~CMenuOptionChooser();
|
||||
|
||||
void setOption(const int newvalue);
|
||||
int getOption(void) const;
|
||||
int getWidth(void);
|
||||
void setOptions(const struct keyval * const Options, const unsigned Number_Of_Options);
|
||||
void setOptions(const struct keyval_ext * const Options, const unsigned Number_Of_Options);
|
||||
|
||||
int paint(bool selected);
|
||||
|
||||
int exec(CMenuTarget* parent);
|
||||
int isMenueOptionChooser(void) const{return 1;}
|
||||
int exec(CMenuTarget* parent);
|
||||
int isMenueOptionChooser(void) const{return 1;}
|
||||
};
|
||||
|
||||
class CMenuOptionStringChooser : public CMenuItem
|
||||
{
|
||||
private:
|
||||
int height;
|
||||
std::string * optionValueString;
|
||||
std::string * optionValuePtr;
|
||||
std::string title;
|
||||
std::string optionValue;
|
||||
std::vector<std::string> options;
|
||||
CChangeObserver * observ;
|
||||
bool pulldown;
|
||||
|
||||
void initVarMenuOptionStringChooser( const std::string &string_Name,
|
||||
const neutrino_locale_t locale_Name,
|
||||
std::string* OptionValue,
|
||||
bool Active,
|
||||
CChangeObserver* Observ,
|
||||
const neutrino_msg_t DirectKey,
|
||||
const std::string & IconName,
|
||||
bool Pulldown);
|
||||
public:
|
||||
CMenuOptionStringChooser( const neutrino_locale_t Name,
|
||||
std::string* OptionValue,
|
||||
bool Active = false,
|
||||
CChangeObserver* Observ = NULL,
|
||||
const neutrino_msg_t DirectKey = CRCInput::RC_nokey,
|
||||
const std::string & IconName= "",
|
||||
bool Pulldown = false);
|
||||
|
||||
CMenuOptionStringChooser( const std::string &Name,
|
||||
std::string* OptionValue,
|
||||
bool Active = false,
|
||||
CChangeObserver* Observ = NULL,
|
||||
const neutrino_msg_t DirectKey = CRCInput::RC_nokey,
|
||||
const std::string & IconName= "",
|
||||
bool Pulldown = false);
|
||||
CMenuOptionStringChooser(const neutrino_locale_t Name, std::string* OptionValue, bool Active = false,
|
||||
CChangeObserver* Observ = NULL, const neutrino_msg_t DirectKey = CRCInput::RC_nokey,
|
||||
const char * const IconName = NULL, bool Pulldown = false);
|
||||
CMenuOptionStringChooser(const std::string &Name, std::string* OptionValue, bool Active = false,
|
||||
CChangeObserver* Observ = NULL, const neutrino_msg_t DirectKey = CRCInput::RC_nokey,
|
||||
const char * const IconName = NULL, bool Pulldown = false);
|
||||
|
||||
~CMenuOptionStringChooser();
|
||||
|
||||
void addOption(const std::string &value);
|
||||
void removeOptions(){options.clear();};
|
||||
void removeOptions(){options.clear();}
|
||||
void setOptions(std::vector<std::string> &vec) { options = vec; }
|
||||
void setTitle(std::string &Title);
|
||||
void setTitle(const neutrino_locale_t Title);
|
||||
int paint(bool selected);
|
||||
int getHeight(void) const { return height; }
|
||||
bool isSelectable(void) const { return active; }
|
||||
void sortOptions();
|
||||
int exec(CMenuTarget* parent);
|
||||
int isMenueOptionChooser(void) const{return 1;}
|
||||
void setOptionValue(std::string &val) {
|
||||
if (!optionValuePtr) optionValuePtr = &optionValue;
|
||||
*optionValuePtr = val;
|
||||
}
|
||||
std::string getOptionValue() { return *optionValuePtr; }
|
||||
};
|
||||
|
||||
class CMenuGlobal
|
||||
@@ -633,7 +490,7 @@ class CMenuWidget : public CMenuTarget
|
||||
bool show_details_line;
|
||||
protected:
|
||||
std::string nameString;
|
||||
neutrino_locale_t name;
|
||||
neutrino_locale_t name;
|
||||
CFrameBuffer *frameBuffer;
|
||||
std::vector<CMenuItem*> items;
|
||||
std::vector<int> page_start;
|
||||
@@ -652,24 +509,24 @@ class CMenuWidget : public CMenuTarget
|
||||
int selected;
|
||||
int iconOffset;
|
||||
int sb_width;
|
||||
int sb_height;
|
||||
fb_pixel_t *background;
|
||||
int full_width, full_height;
|
||||
bool savescreen;
|
||||
bool has_hints; // is any items has hints
|
||||
bool hint_painted; // is hint painted
|
||||
|
||||
int fbutton_width;
|
||||
int fbutton_height;
|
||||
int fbutton_count;
|
||||
const struct button_label *fbutton_labels;
|
||||
|
||||
unsigned int item_start_y;
|
||||
unsigned int current_page;
|
||||
unsigned int total_pages;
|
||||
bool exit_pressed;
|
||||
bool from_wizard;
|
||||
bool fade;
|
||||
bool washidden;
|
||||
unsigned int item_start_y;
|
||||
unsigned int current_page;
|
||||
unsigned int total_pages;
|
||||
bool exit_pressed;
|
||||
bool from_wizard;
|
||||
bool fade;
|
||||
bool washidden;
|
||||
|
||||
void Init(const std::string & Icon, const int mwidth, const mn_widget_id_t &w_index);
|
||||
virtual void paintItems();
|
||||
@@ -682,7 +539,7 @@ class CMenuWidget : public CMenuTarget
|
||||
public:
|
||||
CMenuWidget();
|
||||
/* mwidth (minimum width) in percent of screen width */
|
||||
CMenuWidget(const char* Name, const std::string & Icon = "", const int mwidth = 30, const mn_widget_id_t &w_index = NO_WIDGET_ID);
|
||||
CMenuWidget(const std::string &Name, const std::string & Icon = "", const int mwidth = 30, const mn_widget_id_t &w_index = NO_WIDGET_ID);
|
||||
CMenuWidget(const neutrino_locale_t Name, const std::string & Icon = "", const int mwidth = 30, const mn_widget_id_t &w_index = NO_WIDGET_ID);
|
||||
~CMenuWidget();
|
||||
|
||||
@@ -690,10 +547,10 @@ class CMenuWidget : public CMenuTarget
|
||||
|
||||
enum
|
||||
{
|
||||
BTN_TYPE_BACK = 0,
|
||||
BTN_TYPE_CANCEL = 1,
|
||||
BTN_TYPE_NEXT = 3,
|
||||
BTN_TYPE_NO = -1
|
||||
BTN_TYPE_BACK = 0,
|
||||
BTN_TYPE_CANCEL = 1,
|
||||
BTN_TYPE_NEXT = 3,
|
||||
BTN_TYPE_NO = -1
|
||||
};
|
||||
virtual void addIntroItems(neutrino_locale_t subhead_text = NONEXISTANT_LOCALE, neutrino_locale_t section_text = NONEXISTANT_LOCALE, int buttontype = BTN_TYPE_BACK );
|
||||
bool hasItem();
|
||||
@@ -706,7 +563,7 @@ class CMenuWidget : public CMenuTarget
|
||||
virtual void paint();
|
||||
virtual void hide();
|
||||
virtual int exec(CMenuTarget* parent, const std::string & actionKey);
|
||||
virtual std::string getName();
|
||||
virtual const char *getName();
|
||||
void setSelected(const int &Preselected){ preselected = Preselected; };
|
||||
int getSelected()const { return selected; };
|
||||
void move(int xoff, int yoff);
|
||||
@@ -782,8 +639,6 @@ class CLockedMenuForwarder : public CMenuForwarder, public CPINProtection
|
||||
//but use always an info icon if defined in parameter 'IconName_Info_right'
|
||||
if (IconName_Info_right || ask)
|
||||
iconName_Info_right = IconName_Info_right ? IconName_Info_right : NEUTRINO_ICON_LOCK;
|
||||
else
|
||||
iconName_Info_right = "";
|
||||
};
|
||||
|
||||
virtual int exec(CMenuTarget* parent);
|
||||
@@ -791,12 +646,30 @@ class CLockedMenuForwarder : public CMenuForwarder, public CPINProtection
|
||||
|
||||
class CMenuSelectorTarget : public CMenuTarget
|
||||
{
|
||||
public:
|
||||
CMenuSelectorTarget(int *select) {m_select = select;};
|
||||
int exec(CMenuTarget* parent, const std::string & actionKey);
|
||||
public:
|
||||
CMenuSelectorTarget(int *select) {m_select = select;};
|
||||
int exec(CMenuTarget* parent, const std::string & actionKey);
|
||||
|
||||
private:
|
||||
int *m_select;
|
||||
private:
|
||||
int *m_select;
|
||||
};
|
||||
|
||||
class CMenuProgressbar : public CMenuItem
|
||||
{
|
||||
private:
|
||||
CProgressBar scale;
|
||||
void init (const neutrino_locale_t Loc, const std::string & Text);
|
||||
public:
|
||||
|
||||
CMenuProgressbar(const neutrino_locale_t Text);
|
||||
CMenuProgressbar(const std::string & Text);
|
||||
virtual ~CMenuProgressbar(){}
|
||||
|
||||
int paint(bool selected=false);
|
||||
int getWidth(void);
|
||||
int getHeight(void);
|
||||
int exec(CMenuTarget *parent);
|
||||
CProgressBar *getScale() { return &scale; }
|
||||
};
|
||||
|
||||
extern CMenuSeparator * const GenericMenuSeparator;
|
||||
|
Reference in New Issue
Block a user