*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 is contained in:
thilo
2012-01-05 23:39:00 +00:00
parent 0db7df99bd
commit c12fe22766

View File

@@ -306,13 +306,14 @@ CMenuWidget::CMenuWidget()
sb_width = 0; sb_width = 0;
savescreen = false; savescreen = false;
background = NULL; 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) CMenuWidget::CMenuWidget(const neutrino_locale_t Name, const std::string & Icon, const int mwidth, const mn_widget_id_t &w_index)
{ {
name = Name; name = Name;
nameString = g_Locale->getText(Name); nameString = g_Locale->getText(Name);
preselected = -1;
Init(Icon, mwidth, w_index); Init(Icon, mwidth, w_index);
} }
@@ -320,7 +321,7 @@ CMenuWidget::CMenuWidget(const char* Name, const std::string & Icon, const int m
{ {
name = NONEXISTANT_LOCALE; name = NONEXISTANT_LOCALE;
nameString = Name; nameString = Name;
preselected = -1;
Init(Icon, mwidth, w_index); Init(Icon, mwidth, w_index);
} }
@@ -340,9 +341,14 @@ void CMenuWidget::Init(const std::string & Icon, const int mwidth, const mn_widg
//ok //ok
widget_index = w_index; 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]); selected = (widget_index == NO_WIDGET_ID ? preselected : mglobal->v_selected[widget_index]);
min_width = 0; min_width = 0;
width = 0; /* is set in paint() */ width = 0; /* is set in paint() */