CMenuOptionStringChooser: remember last item

useful for some cases if needed, default off


Origin commit data
------------------
Commit: d41b2ce0bc
Author: Thilo Graf <dbt@novatux.de>
Date: 2019-03-18 (Mon, 18 Mar 2019)
This commit is contained in:
2019-03-18 15:53:03 +01:00
committed by vanhofen
parent e25eca10dd
commit 2cf149f073
3 changed files with 7 additions and 2 deletions

View File

@@ -2156,6 +2156,7 @@ void CMenuOptionStringChooser::init( const std::string &OptionName,
optionValuePtr = pOptionValue ? pOptionValue : &optionValue; optionValuePtr = pOptionValue ? pOptionValue : &optionValue;
observ = Observ; observ = Observ;
pulldown = Pulldown; pulldown = Pulldown;
hold_last_item = false;
} }
@@ -2197,7 +2198,7 @@ int CMenuOptionStringChooser::exec(CMenuTarget* parent)
std::string title_str = title.empty() ? getName() : title; std::string title_str = title.empty() ? getName() : title;
CMenuWidget* menu = new CMenuWidget(title_str, NEUTRINO_ICON_SETTINGS); CMenuWidget* menu = new CMenuWidget(title_str, NEUTRINO_ICON_SETTINGS, 20, hold_last_item ? MN_WIDGET_ID_MENU_SELECT_STRING : -1);
menu->addIntroItems(NONEXISTANT_LOCALE, NONEXISTANT_LOCALE, CMenuWidget::BTN_TYPE_CANCEL); menu->addIntroItems(NONEXISTANT_LOCALE, NONEXISTANT_LOCALE, CMenuWidget::BTN_TYPE_CANCEL);
//if(parent) menu->move(20, 0); //if(parent) menu->move(20, 0);
CMenuSelectorTarget * selector = new CMenuSelectorTarget(&select); CMenuSelectorTarget * selector = new CMenuSelectorTarget(&select);

View File

@@ -503,7 +503,7 @@ class CMenuOptionStringChooser : public CMenuItem
std::string* pOptionValue, std::string* pOptionValue,
CChangeObserver * const Observ, CChangeObserver * const Observ,
bool Pulldown ); bool Pulldown );
bool hold_last_item;
public: public:
CMenuOptionStringChooser(const neutrino_locale_t Name, std::string* OptionValue, bool Active = false, CMenuOptionStringChooser(const neutrino_locale_t Name, std::string* OptionValue, bool Active = false,
CChangeObserver* Observ = NULL, const neutrino_msg_t DirectKey = RC_NOKEY, CChangeObserver* Observ = NULL, const neutrino_msg_t DirectKey = RC_NOKEY,
@@ -529,6 +529,7 @@ class CMenuOptionStringChooser : public CMenuItem
} }
std::string getOptionValue() { return *optionValuePtr; } std::string getOptionValue() { return *optionValuePtr; }
sigc::signal<void> OnAfterChangeOption; sigc::signal<void> OnAfterChangeOption;
void rememberLastItem(bool remember = true) {hold_last_item = remember;}
}; };
class CMenuGlobal class CMenuGlobal

View File

@@ -208,6 +208,9 @@ enum MN_WIDGET_ID
//network services //network services
MN_WIDGET_ID_NETWORKSETUP_SERVICES, MN_WIDGET_ID_NETWORKSETUP_SERVICES,
//options select menue
MN_WIDGET_ID_MENU_SELECT_STRING,
MN_WIDGET_ID_MAX MN_WIDGET_ID_MAX
}; };