diff --git a/src/gui/widget/menue.cpp b/src/gui/widget/menue.cpp index e0a4693a1..57781f3f0 100644 --- a/src/gui/widget/menue.cpp +++ b/src/gui/widget/menue.cpp @@ -895,7 +895,7 @@ int CMenuOptionChooser::paint( bool selected , bool last) return y+height; } -int CMenuOptionChooser::getWidth(void) const +int CMenuOptionChooser::getWidth(void) { int ow = 0; int tw = g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getRenderWidth(optionNameString, true); @@ -1171,7 +1171,7 @@ int CMenuForwarder::getHeight(void) const return g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getHeight(); } -int CMenuForwarder::getWidth(void) const +int CMenuForwarder::getWidth(void) { int tw = g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getRenderWidth(g_Locale->getText(text), true); const char * option_text = NULL; @@ -1312,14 +1312,19 @@ int CMenuSeparator::getHeight(void) const return (text == NONEXISTANT_LOCALE) ? 10 : g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getHeight(); } -int CMenuSeparator::getWidth(void) const +const char * CMenuSeparator::getString(void) +{ + return g_Locale->getText(text); +} + +int CMenuSeparator::getWidth(void) { int w = 0; if (type & LINE) w = 30; /* 15 pixel left and right */ if ((type & STRING) && text != NONEXISTANT_LOCALE) { - const char *l_text = g_Locale->getText(text); + const char *l_text = getString(); w += g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getRenderWidth(l_text, true); } return w; @@ -1344,7 +1349,7 @@ int CMenuSeparator::paint(bool selected, bool /*last*/) { int stringstartposX; - const char *l_text = g_Locale->getText(text); + 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 */ diff --git a/src/gui/widget/menue.h b/src/gui/widget/menue.h index 6c7e0dc02..2eef17214 100644 --- a/src/gui/widget/menue.h +++ b/src/gui/widget/menue.h @@ -97,7 +97,7 @@ class CMenuItem virtual int paint (bool selected = false, bool last = false) = 0; virtual int getHeight(void) const = 0; - virtual int getWidth(void) const + virtual int getWidth(void) { return 0; } @@ -136,7 +136,9 @@ class CMenuSeparator : public CMenuItem int paint(bool selected=false, bool last = false); int getHeight(void) const; - int getWidth(void) const; + int getWidth(void); + + virtual const char * getString(void); }; class CMenuForwarder : public CMenuItem @@ -158,7 +160,7 @@ class CMenuForwarder : public CMenuItem 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); int paint(bool selected=false, bool last = false); int getHeight(void) const; - int getWidth(void) const; + int getWidth(void); int exec(CMenuTarget* parent); bool isSelectable(void) const { @@ -262,7 +264,7 @@ class CMenuOptionChooser : public CAbstractMenuOptionChooser void setOptionValue(const int newvalue); int getOptionValue(void) const; - int getWidth(void) const; + int getWidth(void); int paint(bool selected, bool last = 0);