widget/menu.*: add keyval_ext type

instead of adding unneeded default values to all menuchooser options
just to cater for two special cases, add an extra version that does
not need a locale setting but instead takes a char* instead.

git-svn-id: file:///home/bas/coolstream_public_svn/THIRDPARTY/applications/neutrino-experimental@129 e54a6e83-5905-42d5-8d5c-058d10e6a962


Origin commit data
------------------
Commit: 7dcf8fe14d
Author: Stefan Seyfried <seife@tuxbox-git.slipkontur.de>
Date: 2009-12-31 (Thu, 31 Dec 2009)
This commit is contained in:
Stefan Seyfried
2009-12-31 09:34:53 +00:00
parent 4f81bd2eac
commit f889ea0743
12 changed files with 373 additions and 295 deletions

View File

@@ -643,7 +643,6 @@ CMenuOptionChooser::CMenuOptionChooser(const neutrino_locale_t OptionName, int *
height = g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getHeight();
optionNameString = g_Locale->getText(OptionName);
optionName = OptionName;
options = Options;
active = Active;
optionValue = OptionValue;
number_of_options = Number_Of_Options;
@@ -652,6 +651,14 @@ CMenuOptionChooser::CMenuOptionChooser(const neutrino_locale_t OptionName, int *
iconName = IconName;
can_arrow = true;
pulldown = Pulldown;
for (unsigned int i = 0; i < number_of_options; i++)
{
struct keyval_ext opt;
opt.key = Options[i].key;
opt.value = Options[i].value;
opt.valname = NULL;
options.push_back(opt);
}
}
CMenuOptionChooser::CMenuOptionChooser(const char* OptionName, int * const OptionValue, const struct keyval * const Options, const unsigned Number_Of_Options, const bool Active, CChangeObserver * const Observ, const neutrino_msg_t DirectKey, const std::string & IconName, bool Pulldown)
@@ -659,7 +666,6 @@ CMenuOptionChooser::CMenuOptionChooser(const char* OptionName, int * const Optio
height = g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getHeight();
optionNameString = OptionName;
optionName = NONEXISTANT_LOCALE;
options = Options;
active = Active;
optionValue = OptionValue;
number_of_options = Number_Of_Options;
@@ -668,6 +674,57 @@ CMenuOptionChooser::CMenuOptionChooser(const char* OptionName, int * const Optio
iconName = IconName;
can_arrow = true;
pulldown = Pulldown;
for (unsigned int i = 0; i < number_of_options; i++)
{
struct keyval_ext opt;
opt.key = Options[i].key;
opt.value = Options[i].value;
opt.valname = NULL;
options.push_back(opt);
}
}
CMenuOptionChooser::CMenuOptionChooser(const neutrino_locale_t OptionName, int * const OptionValue, const struct keyval_ext * const Options,
const unsigned Number_Of_Options, const bool Active, CChangeObserver * const Observ,
const neutrino_msg_t DirectKey, const std::string & IconName, bool Pulldown)
{
height = g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getHeight();
optionNameString = g_Locale->getText(OptionName);
optionName = OptionName;
active = Active;
optionValue = OptionValue;
number_of_options = Number_Of_Options;
observ = Observ;
directKey = DirectKey;
iconName = IconName;
can_arrow = true;
pulldown = Pulldown;
for (unsigned int i = 0; i < number_of_options; i++)
options.push_back(Options[i]);
}
CMenuOptionChooser::CMenuOptionChooser(const char* OptionName, int * const OptionValue, const struct keyval_ext * const Options,
const unsigned Number_Of_Options, const bool Active, CChangeObserver * const Observ,
const neutrino_msg_t DirectKey, const std::string & IconName, bool Pulldown)
{
height = g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getHeight();
optionNameString = OptionName;
optionName = NONEXISTANT_LOCALE;
active = Active;
optionValue = OptionValue;
number_of_options = Number_Of_Options;
observ = Observ;
directKey = DirectKey;
iconName = IconName;
can_arrow = true;
pulldown = Pulldown;
for (unsigned int i = 0; i < number_of_options; i++)
options.push_back(Options[i]);
}
CMenuOptionChooser::~CMenuOptionChooser()
{
options.clear();
}
void CMenuOptionChooser::setOptionValue(const int newvalue)

View File

@@ -223,23 +223,44 @@ class CMenuOptionNumberChooser : public CAbstractMenuOptionChooser
class CMenuOptionChooser : public CAbstractMenuOptionChooser
{
public:
struct keyval_ext
{
int key;
neutrino_locale_t value;
const char *valname;
};
struct keyval
{
const int key;
const neutrino_locale_t value;
const char * valname;
};
private:
const struct keyval * options;
std::vector<keyval_ext> options;
unsigned number_of_options;
CChangeObserver * observ;
std::string optionNameString;
bool pulldown;
public:
CMenuOptionChooser(const neutrino_locale_t OptionName, int * const OptionValue, const struct keyval * const Options, const unsigned Number_Of_Options, const bool Active = false, CChangeObserver * const Observ = NULL, const neutrino_msg_t DirectKey = CRCInput::RC_nokey, const std::string & IconName= "", bool Pulldown = false);
CMenuOptionChooser(const char* OptionName, int * const OptionValue, const struct keyval * const Options, const unsigned Number_Of_Options, const bool Active = false, CChangeObserver * const Observ = NULL, const neutrino_msg_t DirectKey = CRCInput::RC_nokey, const std::string & IconName= "", bool Pulldown = false);
CMenuOptionChooser(const neutrino_locale_t OptionName, int * const OptionValue, const struct keyval * const Options,
const unsigned Number_Of_Options, const bool Active = false, CChangeObserver * const Observ = NULL,
const neutrino_msg_t DirectKey = CRCInput::RC_nokey, const std::string & IconName= "",
bool Pulldown = false);
CMenuOptionChooser(const neutrino_locale_t OptionName, int * const OptionValue, const struct keyval_ext * const Options,
const unsigned Number_Of_Options, const bool Active = false, CChangeObserver * const Observ = NULL,
const neutrino_msg_t DirectKey = CRCInput::RC_nokey, const std::string & IconName= "",
bool Pulldown = false);
CMenuOptionChooser(const char* OptionName, int * const OptionValue, const struct keyval * const Options,
const unsigned Number_Of_Options, const bool Active = false, CChangeObserver * const Observ = NULL,
const neutrino_msg_t DirectKey = CRCInput::RC_nokey, const std::string & IconName= "",
bool Pulldown = false);
CMenuOptionChooser(const char* OptionName, int * const OptionValue, const struct keyval_ext * const Options,
const unsigned Number_Of_Options, const bool Active = false, CChangeObserver * const Observ = NULL,
const neutrino_msg_t DirectKey = CRCInput::RC_nokey, const std::string & IconName= "",
bool Pulldown = false);
~CMenuOptionChooser();
void setOptionValue(const int newvalue);
int getOptionValue(void) const;