diff --git a/src/gui/widget/menue.cpp b/src/gui/widget/menue.cpp index 6dadde798..008017dee 100644 --- a/src/gui/widget/menue.cpp +++ b/src/gui/widget/menue.cpp @@ -2127,48 +2127,52 @@ int CMenuOptionStringChooser::paint( bool selected ) } //------------------------------------------------------------------------------------------------------------------------------- -CMenuForwarder::CMenuForwarder(const neutrino_locale_t Text, const bool Active, const std::string &Option, CMenuTarget* Target, const char * const ActionKey, - neutrino_msg_t DirectKey, const char * const IconName, const char * const IconName_Info_right, bool IsStatic) - : CMenuItem(Active, DirectKey, IconName, IconName_Info_right, IsStatic) +CMenuForwarder::CMenuForwarder( const neutrino_locale_t Text, const bool Active, const std::string &Option, CMenuTarget* Target, const char * const ActionKey, + neutrino_msg_t DirectKey, const char * const IconName, const char * const IconName_Info_right, bool IsStatic) + : CMenuItem(Active, DirectKey, IconName, IconName_Info_right, IsStatic) { - option_string_ptr = &Option; - name = Text; - nameString = ""; - jumpTarget = Target; - actionKey = ActionKey ? ActionKey : ""; + init("", Text, Option, NULL, Target, ActionKey); } -CMenuForwarder::CMenuForwarder(const std::string& Text, const bool Active, const std::string &Option, CMenuTarget* Target, const char * const ActionKey, - neutrino_msg_t DirectKey, const char * const IconName, const char * const IconName_Info_right, bool IsStatic) - : CMenuItem(Active, DirectKey, IconName, IconName_Info_right, IsStatic) +CMenuForwarder::CMenuForwarder( const std::string& Text, const bool Active, const std::string &Option, CMenuTarget* Target, const char * const ActionKey, + neutrino_msg_t DirectKey, const char * const IconName, const char * const IconName_Info_right, bool IsStatic) + : CMenuItem(Active, DirectKey, IconName, IconName_Info_right, IsStatic) +{ + init(Text, NONEXISTANT_LOCALE, Option, NULL, Target, ActionKey); +} + +CMenuForwarder::CMenuForwarder( const neutrino_locale_t Text, const bool Active, const char * const Option, CMenuTarget* Target, const char * const ActionKey, + neutrino_msg_t DirectKey, const char * const IconName, const char * const IconName_Info_right, bool IsStatic) + : CMenuItem(Active, DirectKey, IconName, IconName_Info_right, IsStatic) +{ + init("", Text, "", Option, Target, ActionKey); +} + +CMenuForwarder::CMenuForwarder( const std::string& Text, const bool Active, const char * const Option, CMenuTarget* Target, const char * const ActionKey, + neutrino_msg_t DirectKey, const char * const IconName, const char * const IconName_Info_right, bool IsStatic) + : CMenuItem(Active, DirectKey, IconName, IconName_Info_right, IsStatic) +{ + init(Text, NONEXISTANT_LOCALE, "", Option, Target, ActionKey); +} + +void CMenuForwarder::init( const std::string &Text, + const neutrino_locale_t Name, + const std::string &sOption, + const char * const cOption, + CMenuTarget* Target, + const char * const ActionKey) { - option_string_ptr = &Option; - name = NONEXISTANT_LOCALE; nameString = Text; - jumpTarget = Target; - actionKey = ActionKey ? ActionKey : ""; -} + name = Name; -CMenuForwarder::CMenuForwarder(const neutrino_locale_t Text, const bool Active, const char * const Option, CMenuTarget* Target, const char * const ActionKey, - neutrino_msg_t DirectKey, const char * const IconName, const char * const IconName_Info_right, bool IsStatic) - : CMenuItem(Active, DirectKey, IconName, IconName_Info_right, IsStatic) -{ - option_string = Option ? Option : ""; - option_string_ptr = &option_string; - name = Text; - nameString = ""; - jumpTarget = Target; - actionKey = ActionKey ? ActionKey : ""; -} + if (sOption.empty()) + { + option_string = cOption ? cOption : ""; + option_string_ptr = &option_string; + } + else + option_string_ptr = &sOption; -CMenuForwarder::CMenuForwarder(const std::string& Text, const bool Active, const char * const Option, CMenuTarget* Target, const char * const ActionKey, - neutrino_msg_t DirectKey, const char * const IconName, const char * const IconName_Info_right, bool IsStatic) - : CMenuItem(Active, DirectKey, IconName, IconName_Info_right, IsStatic) -{ - option_string = Option ? Option : ""; - option_string_ptr = &option_string; - name = NONEXISTANT_LOCALE; - nameString = Text; jumpTarget = Target; actionKey = ActionKey ? ActionKey : ""; } diff --git a/src/gui/widget/menue.h b/src/gui/widget/menue.h index b059ed525..d9726588e 100644 --- a/src/gui/widget/menue.h +++ b/src/gui/widget/menue.h @@ -231,6 +231,12 @@ class CMenuSeparator : public CMenuItem class CMenuForwarder : public CMenuItem { std::string actionKey; + void init( const std::string &OptionName, + const neutrino_locale_t Name, + const std::string &sOption, + const char * const cOption, + CMenuTarget* Target, + const char * const ActionKey); protected: std::string option_string;