tuxbox-port:added menu subhead, also sed in new member addintroItems(), added in menu class

git-svn-id: file:///home/bas/coolstream_public_svn/THIRDPARTY/applications/neutrino-experimental@895 e54a6e83-5905-42d5-8d5c-058d10e6a962
This commit is contained in:
thilo
2010-11-27 23:16:44 +00:00
parent a508e4ab5f
commit 965fce099c
2 changed files with 44 additions and 15 deletions

View File

@@ -574,7 +574,7 @@ void CMenuWidget::paint()
if(!(iconfile.empty())){
int w, h;
frameBuffer->getIconSize(iconfile.c_str(), &w, &h);
HeadiconOffset = w;
HeadiconOffset = w+6;
}
g_Font[SNeutrinoSettings::FONT_TYPE_MENU_TITLE]->RenderString(x+(fw/3)+HeadiconOffset,y+hheight+1, width-((fw/3)+HeadiconOffset), l_name, COL_MENUHEAD, 0, true); // UTF-8
frameBuffer->paintIcon(iconfile, x + fw/4, y, hheight);
@@ -628,6 +628,19 @@ void CMenuWidget::paintItems()
}
}
/*adds the typical menu intro with optional subhead, separator, back button and separatorline to menu*/
void CMenuWidget::addIntroItems(neutrino_locale_t subhead_text, neutrino_locale_t section_text)
{
if (subhead_text != NONEXISTANT_LOCALE)
addItem(new CMenuSeparator(CMenuSeparator::ALIGN_LEFT | CMenuSeparator::SUB_HEAD | CMenuSeparator::STRING, subhead_text));
addItem(GenericMenuSeparator);
addItem(GenericMenuBack);
if (section_text != NONEXISTANT_LOCALE)
addItem(new CMenuSeparator(CMenuSeparator::LINE | CMenuSeparator::STRING, section_text));
else
addItem(GenericMenuSeparatorLine);
}
//-------------------------------------------------------------------------------------------------------------------------------
CMenuOptionNumberChooser::CMenuOptionNumberChooser(const neutrino_locale_t 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, const char * non_localized_name)
{
@@ -1400,8 +1413,21 @@ int CMenuSeparator::paint(bool selected, bool /*last*/)
int height;
CFrameBuffer * frameBuffer = CFrameBuffer::getInstance();
height = getHeight();
uint8_t color;
fb_pixel_t bgcolor0;
frameBuffer->paintBoxRel(x,y, dx, height, COL_MENUCONTENT_PLUS_0);
if ((type & SUB_HEAD))
{
color = COL_MENUHEAD;
bgcolor0 = COL_MENUHEAD_PLUS_0;
}
else
{
color = COL_MENUCONTENTINACTIVE;
bgcolor0 = COL_MENUCONTENT_PLUS_0;
}
frameBuffer->paintBoxRel(x,y, dx, height, bgcolor0);
if ((type & LINE))
{
frameBuffer->paintHLineRel(x+10,dx-20,y+(height>>1), COL_MENUCONTENT_PLUS_3);
@@ -1409,25 +1435,26 @@ int CMenuSeparator::paint(bool selected, bool /*last*/)
}
if ((type & STRING))
{
const char * l_text;
l_text = getString();
if (text != NONEXISTANT_LOCALE)
if (text != NONEXISTANT_LOCALE || strlen(l_text) != 0)
{
int stringstartposX;
const char *l_text = getString();
int stringwidth = g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getRenderWidth(l_text, true); // UTF-8
/* if no alignment is specified, align centered */
if (type & ALIGN_LEFT)
stringstartposX = x + 20;
stringstartposX = x + (!SUB_HEAD ? 20 : 20 +18);
else if (type & ALIGN_RIGHT)
stringstartposX = x + dx - stringwidth - 20;
else /* ALIGN_CENTER */
stringstartposX = x + (dx >> 1) - (stringwidth >> 1);
frameBuffer->paintBoxRel(stringstartposX-5, y, stringwidth+10, height, COL_MENUCONTENT_PLUS_0);
frameBuffer->paintBoxRel(stringstartposX-5, y, stringwidth+10, height, bgcolor0);
g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->RenderString(stringstartposX, y+height,dx- (stringstartposX- x) , l_text, COL_MENUCONTENTINACTIVE, 0, true); // UTF-8
g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->RenderString(stringstartposX, y+height,dx- (stringstartposX- x) , l_text, color, 0, true); // UTF-8
if (selected)
{

View File

@@ -127,7 +127,8 @@ class CMenuSeparator : public CMenuItem
STRING = 2,
ALIGN_CENTER = 4,
ALIGN_LEFT = 8,
ALIGN_RIGHT = 16
ALIGN_RIGHT = 16,
SUB_HEAD = 32
};
@@ -359,6 +360,7 @@ class CMenuWidget : public CMenuTarget
~CMenuWidget();
virtual void addItem(CMenuItem* menuItem, const bool defaultselected = false);
virtual void addIntroItems(neutrino_locale_t subhead_text = NONEXISTANT_LOCALE, neutrino_locale_t section_text = NONEXISTANT_LOCALE);
bool hasItem();
virtual void paint();
virtual void hide();