From 09db30e5edee7cce0b3283ede038240e61fd614e Mon Sep 17 00:00:00 2001 From: seife Date: Sun, 31 Jan 2010 17:04:52 +0000 Subject: [PATCH] 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 --- src/gui/widget/menue.cpp | 17 ++++++++++------- src/gui/widget/menue.h | 2 -- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/src/gui/widget/menue.cpp b/src/gui/widget/menue.cpp index 7d917e224..78a4fcf7d 100644 --- a/src/gui/widget/menue.cpp +++ b/src/gui/widget/menue.cpp @@ -1304,12 +1304,15 @@ int CMenuSeparator::getHeight(void) const int CMenuSeparator::getWidth(void) const { - return 0; -} - -const char * CMenuSeparator::getString(void) -{ - return g_Locale->getText(text); + 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); + w += g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getRenderWidth(l_text, true); + } + return w; } int CMenuSeparator::paint(bool selected, bool /*last*/) @@ -1331,7 +1334,7 @@ int CMenuSeparator::paint(bool selected, bool /*last*/) { 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 /* if no alignment is specified, align centered */ diff --git a/src/gui/widget/menue.h b/src/gui/widget/menue.h index 5af667f3c..8ee00a4af 100644 --- a/src/gui/widget/menue.h +++ b/src/gui/widget/menue.h @@ -137,8 +137,6 @@ class CMenuSeparator : public CMenuItem int paint(bool selected=false, bool last = false); int getHeight(void) const; int getWidth(void) const; - - virtual const char * getString(void); }; class CMenuForwarder : public CMenuItem