neutrino: implement CMenuSeparator::getString() in menue

this fixes the menu autosize issues with strings in menu separators

git-svn-id: file:///home/bas/coolstream_public_svn/THIRDPARTY/applications/neutrino-experimental@241 e54a6e83-5905-42d5-8d5c-058d10e6a962
This commit is contained in:
seife
2010-01-31 17:04:52 +00:00
parent 3c805e7a7a
commit 09db30e5ed
2 changed files with 10 additions and 9 deletions

View File

@@ -1304,12 +1304,15 @@ int CMenuSeparator::getHeight(void) const
int CMenuSeparator::getWidth(void) const int CMenuSeparator::getWidth(void) const
{ {
return 0; int w = 0;
} if (type & LINE)
w = 30; /* 15 pixel left and right */
const char * CMenuSeparator::getString(void) if ((type & STRING) && text != NONEXISTANT_LOCALE)
{ {
return g_Locale->getText(text); const char *l_text = g_Locale->getText(text);
w += g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getRenderWidth(l_text, true);
}
return w;
} }
int CMenuSeparator::paint(bool selected, bool /*last*/) int CMenuSeparator::paint(bool selected, bool /*last*/)
@@ -1331,7 +1334,7 @@ int CMenuSeparator::paint(bool selected, bool /*last*/)
{ {
int stringstartposX; int stringstartposX;
const char * l_text = getString(); const char *l_text = g_Locale->getText(text);
int stringwidth = g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getRenderWidth(l_text, true); // UTF-8 int stringwidth = g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getRenderWidth(l_text, true); // UTF-8
/* if no alignment is specified, align centered */ /* if no alignment is specified, align centered */

View File

@@ -137,8 +137,6 @@ class CMenuSeparator : public CMenuItem
int paint(bool selected=false, bool last = false); int paint(bool selected=false, bool last = false);
int getHeight(void) const; int getHeight(void) const;
int getWidth(void) const; int getWidth(void) const;
virtual const char * getString(void);
}; };
class CMenuForwarder : public CMenuItem class CMenuForwarder : public CMenuItem