diff --git a/src/gui/widget/menue.cpp b/src/gui/widget/menue.cpp index f7141995f..da6404ef9 100644 --- a/src/gui/widget/menue.cpp +++ b/src/gui/widget/menue.cpp @@ -113,28 +113,24 @@ void CMenuItem::setItemColors(const bool select_mode, const fb_pixel_t &def_col } } + void CMenuItem::paintItemBackground (const bool select_mode, const int &item_x, const int &item_y, const int &width, const int &height) { CFrameBuffer *frameBuffer = CFrameBuffer::getInstance(); if(select_mode) frameBuffer->paintBoxRel(item_x, item_y, width, height, item_bgcolor, RADIUS_LARGE); - //else if(last) - //frameBuffer->paintBoxRel(item_x, item_y, width, height, i_bgcolor, RADIUS_LARGE, CORNER_BOTTOM); //FIXME + //else if(last) ?? Why do we need this? + //frameBuffer->paintBoxRel(item_x, item_y, width, height, i_bgcolor, RADIUS_LARGE, CORNER_BOTTOM); //FIXME else frameBuffer->paintBoxRel(item_x, item_y, width, height, item_bgcolor); } -void CMenuItem::paintItem(const bool select_mode, int &start_x, int &start_y, int &width, int &height, - const fb_pixel_t &def_color, const fb_pixel_t &def_bgcolor, - const fb_pixel_t &def_sel_color, const fb_pixel_t &def_sel_bgcolor, - const fb_pixel_t &def_inactiv_color, const fb_pixel_t &def_inactiv_bgcolor) +void CMenuItem::paintItem(const bool select_mode, int &start_x, int &start_y, int &width, int &height) { - //set colors - setItemColors(select_mode, def_color, def_bgcolor, - def_sel_color, def_sel_bgcolor, - def_inactiv_color, def_inactiv_bgcolor); +// //set colors +// setItemColors(select_mode); //paint item background paintItemBackground(select_mode, start_x, start_y, width, height); @@ -801,13 +797,16 @@ void CMenuWidget::paintItems() { item->init(x, ypos, width, iconOffset); if( (item->isSelectable()) && (selected==-1) ) - { + { + item->setItemColors(true); ypos = item->paint(true); selected = count; } else { - ypos = item->paint(selected==((signed int) count) ); + bool sel = selected==((signed int) count) ; + item->setItemColors(sel); + ypos = item->paint(sel); } } else @@ -906,6 +905,9 @@ int CMenuOptionNumberChooser::paint(bool selected, bool /*last*/) int stringstartposName = x + offx + 10; int stringstartposOption = x + dx - stringwidth - 10; //+ offx + //set colors + setItemColors(selected); + //paint item paintItem(selected, x, y, dx, height); @@ -1120,6 +1122,9 @@ int CMenuOptionChooser::paint( bool selected , bool /*last*/) int stringstartposName = x + offx + 10; int stringstartposOption = x + dx - stringwidth - 10; //+ offx + //set colors + setItemColors(selected); + //paint item paintItem(selected, x, y, dx, height); @@ -1259,6 +1264,9 @@ int CMenuOptionStringChooser::paint( bool selected, bool /*last*/ ) //int stringstartposOption = x + dx - stringwidth - 10; //+ offx int stringstartposOption = x + offx + 10 + 10 + optionwidth; + //set colors + setItemColors(selected); + //paint item paintItem(selected, x, y, dx, height); @@ -1332,7 +1340,10 @@ int CMenuOptionLanguageChooser::exec(CMenuTarget*) int CMenuOptionLanguageChooser::paint( bool selected, bool /*last*/ ) { active = true; - + + //set colors + setItemColors(selected); + //paint item paintItem(selected, x, y, dx, height); @@ -1472,7 +1483,10 @@ int CMenuForwarder::paint(bool selected, bool /*last*/) } else CVFD::getInstance()->showMenuText(0, l_text, -1, true); } - + + //set colors + setItemColors(selected); + //paint item paintItem(selected, x, y, dx, height); diff --git a/src/gui/widget/menue.h b/src/gui/widget/menue.h index 9483ebfc3..652bae21e 100644 --- a/src/gui/widget/menue.h +++ b/src/gui/widget/menue.h @@ -80,8 +80,6 @@ class CMenuItem protected: int x, y, dx, offx; bool used; - unsigned char item_color ; - fb_pixel_t item_bgcolor ; public: bool active; @@ -91,6 +89,8 @@ class CMenuItem std::string iconName; std::string selected_iconName; bool show_marker; + fb_pixel_t item_color; + fb_pixel_t item_bgcolor; CMenuItem() @@ -131,18 +131,14 @@ class CMenuItem virtual void paintItemButton(const int startX, const int frame_height, const bool select_mode, const std::string& icon_Name = NEUTRINO_ICON_BUTTON_RIGHT, const bool icon_centered = false); - virtual void setItemColors(const bool select_mode, const fb_pixel_t &def_color = COL_MENUCONTENT, const fb_pixel_t &def_bgcolor = COL_MENUCONTENT_PLUS_0, + virtual void setItemColors(const bool select_mode , const fb_pixel_t &def_color = COL_MENUCONTENT, const fb_pixel_t &def_bgcolor = COL_MENUCONTENT_PLUS_0, const fb_pixel_t &def_sel_color = COL_MENUCONTENTSELECTED, const fb_pixel_t &def_sel_bgcolor = COL_MENUCONTENTSELECTED_PLUS_0, const fb_pixel_t &def_inactiv_color = COL_MENUCONTENTINACTIVE, const fb_pixel_t &def_inactiv_bgcolor = COL_MENUCONTENTINACTIVE_PLUS_0); virtual void paintItemBackground (const bool select_mode, const int &x, const int &y, const int &width, const int &height); - virtual void paintItem(const bool select_mode, int &x, int &y, int &width, int &height , - const fb_pixel_t &def_color = COL_MENUCONTENT, const fb_pixel_t &def_bgcolor = COL_MENUCONTENT_PLUS_0, - const fb_pixel_t &def_sel_color = COL_MENUCONTENTSELECTED, const fb_pixel_t &def_sel_bgcolor = COL_MENUCONTENTSELECTED_PLUS_0, - const fb_pixel_t &def_inactiv_color = COL_MENUCONTENTINACTIVE, const fb_pixel_t &def_inactiv_bgcolor = COL_MENUCONTENTINACTIVE_PLUS_0); + virtual void paintItem(const bool select_mode, int &start_x, int &start_y, int &width, int &height); - virtual void setItemButton(const std::string& icon_Name, const bool is_select_button = false); };