From 8a7da64e814b9ec0b3df1276f9b6ac35d4b83b86 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Thu, 5 Jan 2012 23:39:00 +0000 Subject: [PATCH] neutrino menu: make setSelected()also usable if widget index is in use setSelected() had no effect with widget index git-svn-id: file:///home/bas/coolstream_public_svn/THIRDPARTY/applications/neutrino-beta@2037 e54a6e83-5905-42d5-8d5c-058d10e6a962 Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/c12fe22766b7f46419ea7b2fcef6b8e7a68803e7 Author: Thilo Graf Date: 2012-01-06 (Fri, 06 Jan 2012) Origin message was: ------------------ *neutrino menu: make setSelected()also usable if widget index is in use setSelected() had no effect with widget index git-svn-id: file:///home/bas/coolstream_public_svn/THIRDPARTY/applications/neutrino-beta@2037 e54a6e83-5905-42d5-8d5c-058d10e6a962 ------------------ This commit was generated by Migit --- src/gui/widget/menue.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/gui/widget/menue.cpp b/src/gui/widget/menue.cpp index 62fe481a6..8a45f39f3 100644 --- a/src/gui/widget/menue.cpp +++ b/src/gui/widget/menue.cpp @@ -306,13 +306,14 @@ CMenuWidget::CMenuWidget() sb_width = 0; savescreen = false; background = NULL; + preselected = -1; } CMenuWidget::CMenuWidget(const neutrino_locale_t Name, const std::string & Icon, const int mwidth, const mn_widget_id_t &w_index) { name = Name; nameString = g_Locale->getText(Name); - + preselected = -1; Init(Icon, mwidth, w_index); } @@ -320,7 +321,7 @@ CMenuWidget::CMenuWidget(const char* Name, const std::string & Icon, const int m { name = NONEXISTANT_LOCALE; nameString = Name; - + preselected = -1; Init(Icon, mwidth, w_index); } @@ -340,8 +341,13 @@ void CMenuWidget::Init(const std::string & Icon, const int mwidth, const mn_widg //ok widget_index = w_index; } - preselected = NO_WIDGET_ID; + + //set default preselected if value = -1 (no selected). If value has changed, e.g. with setSelected(), then use current value + preselected = preselected != -1 ? preselected : -1; + + //overwrite preselected value with global select value selected = (widget_index == NO_WIDGET_ID ? preselected : mglobal->v_selected[widget_index]); + min_width = 0; width = 0; /* is set in paint() */