gui/widget/menue.cpp: disable 'back' hint, if no other hints present

This commit is contained in:
[CST] Focus
2012-07-24 15:13:18 +04:00
parent d8d42b26a0
commit 04f1e9c3f2
2 changed files with 23 additions and 2 deletions

View File

@@ -491,7 +491,11 @@ int CMenuWidget::exec(CMenuTarget* parent, const std::string &)
}
}
}
GenericMenuBack->setHint(NEUTRINO_ICON_HINT_BACK, LOCALE_MENU_HINT_BACK);
GenericMenuBack->setHint("", NONEXISTANT_LOCALE);
checkHints();
if (has_hints)
GenericMenuBack->setHint(NEUTRINO_ICON_HINT_BACK, LOCALE_MENU_HINT_BACK);
if(savescreen) {
calcSize();
saveScreen();
@@ -666,6 +670,7 @@ int CMenuWidget::exec(CMenuTarget* parent, const std::string &)
case menu_return::RETURN_EXIT_REPAINT:
if (fade && washidden)
fader.StartFadeIn();
checkHints();
paint();
break;
}
@@ -693,6 +698,7 @@ int CMenuWidget::exec(CMenuTarget* parent, const std::string &)
break;
case (CRCInput::RC_help):
// FIXME should we switch hints in menu without hints ?
checkHints();
if (has_hints)
hide();
g_settings.show_menu_hints = !g_settings.show_menu_hints;
@@ -761,6 +767,19 @@ void CMenuWidget::hide()
washidden = true;
}
void CMenuWidget::checkHints()
{
GenericMenuBack->setHint("", NONEXISTANT_LOCALE);
for (unsigned int i= 0; i< items.size(); i++) {
if(!items[i]->hintIcon.empty() || items[i]->hint != NONEXISTANT_LOCALE) {
has_hints = true;
break;
}
}
if (has_hints)
GenericMenuBack->setHint(NEUTRINO_ICON_HINT_BACK, LOCALE_MENU_HINT_BACK);
}
void CMenuWidget::calcSize()
{
if (name != NONEXISTANT_LOCALE)
@@ -781,10 +800,11 @@ void CMenuWidget::calcSize()
int tmpw = items[i]->getWidth() + 10 + 10 + wi; /* 10 pixels to the left and right of the text */
if (tmpw > width)
width = tmpw;
#if 0
if(!items[i]->hintIcon.empty() || items[i]->hint != NONEXISTANT_LOCALE) {
has_hints = true;
}
#endif
}
hint_height = 0;
if(g_settings.show_menu_hints && has_hints) {

View File

@@ -462,6 +462,7 @@ class CMenuWidget : public CMenuTarget
void Init(const std::string & Icon, const int mwidth, const mn_widget_id_t &w_index);
virtual void paintItems();
void checkHints();
void calcSize();
void saveScreen();
void restoreScreen();