Example #1
0
MenuSettingRGBA::MenuSettingRGBA(GMenu2X *gmenu2x, const string &name, const string &description, RGBAColor *value)
	: MenuSetting(gmenu2x,name,description) {
	IconButton *btn;

	selPart = 0;
	_value = value;
	originalValue = *value;
	this->setR(this->value().r);
	this->setG(this->value().g);
	this->setB(this->value().b);
	this->setA(this->value().a);

	btn = new IconButton(gmenu2x, "skin:imgs/buttons/x.png", gmenu2x->tr["Decrease"]);
	btn->setAction(MakeDelegate(this, &MenuSettingRGBA::dec));
	buttonBox.add(btn);

	btn = new IconButton(gmenu2x, "skin:imgs/buttons/y.png", gmenu2x->tr["Increase"]);
	btn->setAction(MakeDelegate(this, &MenuSettingRGBA::inc));
	buttonBox.add(btn);

	btn = new IconButton(gmenu2x, "skin:imgs/buttons/left.png");
	btn->setAction(MakeDelegate(this, &MenuSettingRGBA::leftComponent));
	buttonBox.add(btn);

	btn = new IconButton(gmenu2x, "skin:imgs/buttons/right.png", gmenu2x->tr["Change color component"]);
	btn->setAction(MakeDelegate(this, &MenuSettingRGBA::rightComponent));
	buttonBox.add(btn);
}
MenuSettingInt::MenuSettingInt(
		GMenu2X *gmenu2x, Touchscreen &ts,
		const string &name, const string &description,
		int *value, int min, int max, int increment)
	: MenuSetting(gmenu2x,name,description)
{
	IconButton *btn;

	_value = value;
	originalValue = *value;
	this->min = min;
	this->max = max;
	this->increment = increment;
	setValue(this->value());

	//Delegates
	ButtonAction actionInc = MakeDelegate(this, &MenuSettingInt::inc);
	ButtonAction actionDec = MakeDelegate(this, &MenuSettingInt::dec);

	btn = new IconButton(gmenu2x, ts, "skin:imgs/buttons/l.png");
	btn->setAction(actionDec);
	buttonBox.add(btn);

	btn = new IconButton(gmenu2x, ts, "skin:imgs/buttons/left.png", gmenu2x->tr["Decrease"]);
	btn->setAction(actionDec);
	buttonBox.add(btn);

	btn = new IconButton(gmenu2x, ts, "skin:imgs/buttons/r.png");
	btn->setAction(actionInc);
	buttonBox.add(btn);

	btn = new IconButton(gmenu2x, ts, "skin:imgs/buttons/right.png", gmenu2x->tr["Increase"]);
	btn->setAction(actionInc);
	buttonBox.add(btn);
}
MenuSettingFile::MenuSettingFile(GMenu2X *gmenu2x, const string &name, const string &description, string *value, const string &filter_, const string &startPath_)
	: MenuSettingStringBase(gmenu2x, name, description, value)
	, filter(filter_), startPath(startPath_)
{
	IconButton *btn;

	btn = new IconButton(gmenu2x, "uda://gmenu2x/skins/Default/imgs/buttons/x.png", gmenu2x->tr["Clear"]);
	btn->setAction(MakeDelegate(this, &MenuSettingFile::clear));
	buttonBox.add(btn);

	btn = new IconButton(gmenu2x, "uda://gmenu2x/skins/Default/imgs/buttons/b.png", gmenu2x->tr["Select a file"]);
	btn->setAction(MakeDelegate(this, &MenuSettingFile::edit));
	buttonBox.add(btn);
}
Example #4
0
MenuSettingDir::MenuSettingDir(GMenu2X *gmenu2x, const string &name, const string &description, string *value, const std::string &startPath_)
	: MenuSettingStringBase(gmenu2x, name, description, value)
	, startPath(startPath_)
{
	IconButton *btn;

	btn = new IconButton(gmenu2x, "skin:imgs/buttons/x.png", gmenu2x->tr["Clear"]);
	btn->setAction(MakeDelegate(this, &MenuSettingDir::clear));
	buttonBox.add(btn);

	btn = new IconButton(gmenu2x, "skin:imgs/buttons/b.png", gmenu2x->tr["Select a directory"]);
	btn->setAction(MakeDelegate(this, &MenuSettingDir::edit));
	buttonBox.add(btn);
}
Example #5
0
void MenuSettingBool::initButton()
{
	IconButton *btn = new IconButton(gmenu2x, "skin:imgs/buttons/b.png",
									 gmenu2x->tr["Switch"]);
	btn->setAction(MakeDelegate(this, &MenuSettingBool::toggle));
	buttonBox.add(btn);
}
MenuSettingDir::MenuSettingDir(
		GMenu2X *gmenu2x, Touchscreen &ts_,
		const string &name, const string &description, string *value)
	: MenuSettingStringBase(gmenu2x, name, description, value)
	, ts(ts_)
{
	IconButton *btn;

	btn = new IconButton(gmenu2x, ts, "skin:imgs/buttons/cancel.png",
			gmenu2x->tr["Clear"]);
	btn->setAction(BIND(&MenuSettingDir::clear));
	buttonBox.add(btn);

	btn = new IconButton(gmenu2x, ts, "skin:imgs/buttons/accept.png",
			gmenu2x->tr["Select a directory"]);
	btn->setAction(BIND(&MenuSettingDir::edit));
	buttonBox.add(btn);
}
MenuSettingString::MenuSettingString(
		GMenu2X *gmenu2x, const string &name,
		const string &description, string *value,
		const string &diagTitle_, const string &diagIcon_)
	: MenuSettingStringBase(gmenu2x, name, description, value)
	, diagTitle(diagTitle_)
	, diagIcon(diagIcon_)
{
	IconButton *btn;

	btn = new IconButton(gmenu2x, "skin:imgs/buttons/cancel.png", gmenu2x->tr["Clear"]);
	btn->setAction(MakeDelegate(this, &MenuSettingString::clear));
	buttonBox.add(btn);

	btn = new IconButton(gmenu2x, "skin:imgs/buttons/accept.png", gmenu2x->tr["Edit"]);
	btn->setAction(MakeDelegate(this, &MenuSettingString::edit));
	buttonBox.add(btn);
}
MenuSettingMultiString::MenuSettingMultiString(
    GMenu2X *gmenu2x, Touchscreen &ts,
    const string &name, const string &description,
    string *value, const vector<string> *choices_)
    : MenuSettingStringBase(gmenu2x, name, description, value)
    , choices(choices_)
{
    setSel(find(choices->begin(), choices->end(), *value) - choices->begin());

    IconButton *btn;

    btn = new IconButton(gmenu2x, ts, "skin:imgs/buttons/left.png");
    btn->setAction(MakeDelegate(this, &MenuSettingMultiString::decSel));
    buttonBox.add(btn);

    btn = new IconButton(gmenu2x, ts, "skin:imgs/buttons/right.png", gmenu2x->tr["Change value"]);
    btn->setAction(MakeDelegate(this, &MenuSettingMultiString::incSel));
    buttonBox.add(btn);
}