mirror of
https://github.com/tuxbox-fork-migrations/recycled-ni-neutrino.git
synced 2025-08-31 09:21:09 +02:00
merge neutrino-mp menu/buttons/icons changes, (C) martii
Origin commit data
------------------
Commit: cf91f2eccb
Author: [CST] Focus <focus.cst@gmail.com>
Date: 2014-07-17 (Thu, 17 Jul 2014)
This commit is contained in:
@@ -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