mirror of
https://github.com/tuxbox-neutrino/neutrino.git
synced 2025-08-27 15:32:59 +02:00
*neutrino menu: colorhandling optimized, was not working nice
git-svn-id: file:///home/bas/coolstream_public_svn/THIRDPARTY/applications/neutrino-experimental@1023 e54a6e83-5905-42d5-8d5c-058d10e6a962
This commit is contained in:
@@ -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)
|
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();
|
CFrameBuffer *frameBuffer = CFrameBuffer::getInstance();
|
||||||
|
|
||||||
if(select_mode)
|
if(select_mode)
|
||||||
frameBuffer->paintBoxRel(item_x, item_y, width, height, item_bgcolor, RADIUS_LARGE);
|
frameBuffer->paintBoxRel(item_x, item_y, width, height, item_bgcolor, RADIUS_LARGE);
|
||||||
//else if(last)
|
//else if(last) ?? Why do we need this?
|
||||||
//frameBuffer->paintBoxRel(item_x, item_y, width, height, i_bgcolor, RADIUS_LARGE, CORNER_BOTTOM); //FIXME
|
//frameBuffer->paintBoxRel(item_x, item_y, width, height, i_bgcolor, RADIUS_LARGE, CORNER_BOTTOM); //FIXME
|
||||||
else
|
else
|
||||||
frameBuffer->paintBoxRel(item_x, item_y, width, height, item_bgcolor);
|
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,
|
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)
|
|
||||||
{
|
{
|
||||||
//set colors
|
// //set colors
|
||||||
setItemColors(select_mode, def_color, def_bgcolor,
|
// setItemColors(select_mode);
|
||||||
def_sel_color, def_sel_bgcolor,
|
|
||||||
def_inactiv_color, def_inactiv_bgcolor);
|
|
||||||
|
|
||||||
//paint item background
|
//paint item background
|
||||||
paintItemBackground(select_mode, start_x, start_y, width, height);
|
paintItemBackground(select_mode, start_x, start_y, width, height);
|
||||||
@@ -801,13 +797,16 @@ void CMenuWidget::paintItems()
|
|||||||
{
|
{
|
||||||
item->init(x, ypos, width, iconOffset);
|
item->init(x, ypos, width, iconOffset);
|
||||||
if( (item->isSelectable()) && (selected==-1) )
|
if( (item->isSelectable()) && (selected==-1) )
|
||||||
{
|
{
|
||||||
|
item->setItemColors(true);
|
||||||
ypos = item->paint(true);
|
ypos = item->paint(true);
|
||||||
selected = count;
|
selected = count;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ypos = item->paint(selected==((signed int) count) );
|
bool sel = selected==((signed int) count) ;
|
||||||
|
item->setItemColors(sel);
|
||||||
|
ypos = item->paint(sel);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -906,6 +905,9 @@ int CMenuOptionNumberChooser::paint(bool selected, bool /*last*/)
|
|||||||
int stringstartposName = x + offx + 10;
|
int stringstartposName = x + offx + 10;
|
||||||
int stringstartposOption = x + dx - stringwidth - 10; //+ offx
|
int stringstartposOption = x + dx - stringwidth - 10; //+ offx
|
||||||
|
|
||||||
|
//set colors
|
||||||
|
setItemColors(selected);
|
||||||
|
|
||||||
//paint item
|
//paint item
|
||||||
paintItem(selected, x, y, dx, height);
|
paintItem(selected, x, y, dx, height);
|
||||||
|
|
||||||
@@ -1120,6 +1122,9 @@ int CMenuOptionChooser::paint( bool selected , bool /*last*/)
|
|||||||
int stringstartposName = x + offx + 10;
|
int stringstartposName = x + offx + 10;
|
||||||
int stringstartposOption = x + dx - stringwidth - 10; //+ offx
|
int stringstartposOption = x + dx - stringwidth - 10; //+ offx
|
||||||
|
|
||||||
|
//set colors
|
||||||
|
setItemColors(selected);
|
||||||
|
|
||||||
//paint item
|
//paint item
|
||||||
paintItem(selected, x, y, dx, height);
|
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 + dx - stringwidth - 10; //+ offx
|
||||||
int stringstartposOption = x + offx + 10 + 10 + optionwidth;
|
int stringstartposOption = x + offx + 10 + 10 + optionwidth;
|
||||||
|
|
||||||
|
//set colors
|
||||||
|
setItemColors(selected);
|
||||||
|
|
||||||
//paint item
|
//paint item
|
||||||
paintItem(selected, x, y, dx, height);
|
paintItem(selected, x, y, dx, height);
|
||||||
|
|
||||||
@@ -1332,7 +1340,10 @@ int CMenuOptionLanguageChooser::exec(CMenuTarget*)
|
|||||||
int CMenuOptionLanguageChooser::paint( bool selected, bool /*last*/ )
|
int CMenuOptionLanguageChooser::paint( bool selected, bool /*last*/ )
|
||||||
{
|
{
|
||||||
active = true;
|
active = true;
|
||||||
|
|
||||||
|
//set colors
|
||||||
|
setItemColors(selected);
|
||||||
|
|
||||||
//paint item
|
//paint item
|
||||||
paintItem(selected, x, y, dx, height);
|
paintItem(selected, x, y, dx, height);
|
||||||
|
|
||||||
@@ -1472,7 +1483,10 @@ int CMenuForwarder::paint(bool selected, bool /*last*/)
|
|||||||
} else
|
} else
|
||||||
CVFD::getInstance()->showMenuText(0, l_text, -1, true);
|
CVFD::getInstance()->showMenuText(0, l_text, -1, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//set colors
|
||||||
|
setItemColors(selected);
|
||||||
|
|
||||||
//paint item
|
//paint item
|
||||||
paintItem(selected, x, y, dx, height);
|
paintItem(selected, x, y, dx, height);
|
||||||
|
|
||||||
|
@@ -80,8 +80,6 @@ class CMenuItem
|
|||||||
protected:
|
protected:
|
||||||
int x, y, dx, offx;
|
int x, y, dx, offx;
|
||||||
bool used;
|
bool used;
|
||||||
unsigned char item_color ;
|
|
||||||
fb_pixel_t item_bgcolor ;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
bool active;
|
bool active;
|
||||||
@@ -91,6 +89,8 @@ class CMenuItem
|
|||||||
std::string iconName;
|
std::string iconName;
|
||||||
std::string selected_iconName;
|
std::string selected_iconName;
|
||||||
bool show_marker;
|
bool show_marker;
|
||||||
|
fb_pixel_t item_color;
|
||||||
|
fb_pixel_t item_bgcolor;
|
||||||
|
|
||||||
|
|
||||||
CMenuItem()
|
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 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_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);
|
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 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 ,
|
virtual void paintItem(const bool select_mode, int &start_x, int &start_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 setItemButton(const std::string& icon_Name, const bool is_select_button = false);
|
virtual void setItemButton(const std::string& icon_Name, const bool is_select_button = false);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user