mirror of
git://projects.qi-hardware.com/gmenu2x.git
synced 2024-11-26 00:20:38 +02:00
Added MenuSettingStringBase, an abstract base class for MenuSettingString, MenuSettingFile and MenuSettingDir.
This removes a lot of duplicate source code and also decreases the binary size slightly.
This commit is contained in:
parent
9d05af2881
commit
d1d55a7666
@ -6,6 +6,7 @@ gmenu2x_SOURCES = asfont.cpp button.cpp cpu.cpp dirdialog.cpp filedialog.cpp \
|
|||||||
menu.cpp menusettingbool.cpp menusetting.cpp menusettingdir.cpp \
|
menu.cpp menusettingbool.cpp menusetting.cpp menusettingdir.cpp \
|
||||||
menusettingfile.cpp menusettingimage.cpp menusettingint.cpp \
|
menusettingfile.cpp menusettingimage.cpp menusettingint.cpp \
|
||||||
menusettingmultistring.cpp menusettingrgba.cpp menusettingstring.cpp \
|
menusettingmultistring.cpp menusettingrgba.cpp menusettingstring.cpp \
|
||||||
|
menusettingstringbase.cpp \
|
||||||
messagebox.cpp selector.cpp \
|
messagebox.cpp selector.cpp \
|
||||||
settingsdialog.cpp sfontplus.cpp surfacecollection.cpp surface.cpp \
|
settingsdialog.cpp sfontplus.cpp surfacecollection.cpp surface.cpp \
|
||||||
textdialog.cpp textmanualdialog.cpp touchscreen.cpp translator.cpp \
|
textdialog.cpp textmanualdialog.cpp touchscreen.cpp translator.cpp \
|
||||||
@ -18,6 +19,7 @@ noinst_HEADERS = asfont.h button.h cpu.h dirdialog.h FastDelegate.h \
|
|||||||
menu.h menusettingbool.h menusettingdir.h \
|
menu.h menusettingbool.h menusettingdir.h \
|
||||||
menusettingfile.h menusetting.h menusettingimage.h menusettingint.h \
|
menusettingfile.h menusetting.h menusettingimage.h menusettingint.h \
|
||||||
menusettingmultistring.h menusettingrgba.h menusettingstring.h \
|
menusettingmultistring.h menusettingrgba.h menusettingstring.h \
|
||||||
|
menusettingstringbase.h \
|
||||||
messagebox.h selector.h settingsdialog.h \
|
messagebox.h selector.h settingsdialog.h \
|
||||||
sfontplus.h surfacecollection.h surface.h textdialog.h textmanualdialog.h \
|
sfontplus.h surfacecollection.h surface.h textdialog.h textmanualdialog.h \
|
||||||
touchscreen.h translator.h utilities.h wallpaperdialog.h \
|
touchscreen.h translator.h utilities.h wallpaperdialog.h \
|
||||||
|
@ -19,62 +19,28 @@
|
|||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
#include "menusettingdir.h"
|
#include "menusettingdir.h"
|
||||||
#include "dirdialog.h"
|
#include "dirdialog.h"
|
||||||
#include "utilities.h"
|
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
using namespace fastdelegate;
|
using namespace fastdelegate;
|
||||||
|
|
||||||
MenuSettingDir::MenuSettingDir(GMenu2X *gmenu2x, const string &name, const string &description, string *value)
|
MenuSettingDir::MenuSettingDir(
|
||||||
: MenuSetting(gmenu2x,name,description) {
|
GMenu2X *gmenu2x, const string &name,
|
||||||
|
const string &description, string *value)
|
||||||
|
: MenuSettingStringBase(gmenu2x, name, description, value)
|
||||||
|
{
|
||||||
IconButton *btn;
|
IconButton *btn;
|
||||||
|
|
||||||
_value = value;
|
|
||||||
originalValue = *value;
|
|
||||||
|
|
||||||
btn = new IconButton(gmenu2x, "skin:imgs/buttons/x.png", gmenu2x->tr["Clear"]);
|
btn = new IconButton(gmenu2x, "skin:imgs/buttons/x.png", gmenu2x->tr["Clear"]);
|
||||||
btn->setAction(MakeDelegate(this, &MenuSettingDir::clear));
|
btn->setAction(MakeDelegate(this, &MenuSettingDir::clear));
|
||||||
buttonBox.add(btn);
|
buttonBox.add(btn);
|
||||||
|
|
||||||
btn = new IconButton(gmenu2x, "skin:imgs/buttons/b.png", gmenu2x->tr["Select a directory"]);
|
btn = new IconButton(gmenu2x, "skin:imgs/buttons/b.png", gmenu2x->tr["Select a directory"]);
|
||||||
btn->setAction(MakeDelegate(this, &MenuSettingDir::select));
|
btn->setAction(MakeDelegate(this, &MenuSettingDir::edit));
|
||||||
buttonBox.add(btn);
|
buttonBox.add(btn);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MenuSettingDir::draw(int y)
|
void MenuSettingDir::edit()
|
||||||
{
|
|
||||||
MenuSetting::draw(y);
|
|
||||||
gmenu2x->s->write( gmenu2x->font, value(), 155, y+gmenu2x->font->getHalfHeight(), SFontHAlignLeft, SFontVAlignMiddle );
|
|
||||||
}
|
|
||||||
|
|
||||||
void MenuSettingDir::manageInput()
|
|
||||||
{
|
|
||||||
if (gmenu2x->input[ACTION_X]) setValue("");
|
|
||||||
if (gmenu2x->input[ACTION_B]) select();
|
|
||||||
}
|
|
||||||
|
|
||||||
void MenuSettingDir::clear()
|
|
||||||
{
|
|
||||||
setValue("");
|
|
||||||
}
|
|
||||||
|
|
||||||
void MenuSettingDir::select()
|
|
||||||
{
|
{
|
||||||
DirDialog dd(gmenu2x, description, value());
|
DirDialog dd(gmenu2x, description, value());
|
||||||
if (dd.exec()) setValue( dd.getPath() );
|
if (dd.exec()) setValue( dd.getPath() );
|
||||||
}
|
}
|
||||||
|
|
||||||
void MenuSettingDir::setValue(const string &value)
|
|
||||||
{
|
|
||||||
*_value = value;
|
|
||||||
}
|
|
||||||
|
|
||||||
const string &MenuSettingDir::value()
|
|
||||||
{
|
|
||||||
return *_value;
|
|
||||||
}
|
|
||||||
|
|
||||||
void MenuSettingDir::adjustInput() {}
|
|
||||||
|
|
||||||
bool MenuSettingDir::edited() {
|
|
||||||
return originalValue != value();
|
|
||||||
}
|
|
||||||
|
@ -20,29 +20,19 @@
|
|||||||
#ifndef MENUSETTINGDIR_H
|
#ifndef MENUSETTINGDIR_H
|
||||||
#define MENUSETTINGDIR_H
|
#define MENUSETTINGDIR_H
|
||||||
|
|
||||||
#include "gmenu2x.h"
|
#include "menusettingstringbase.h"
|
||||||
#include "menusetting.h"
|
|
||||||
|
|
||||||
using std::string;
|
using std::string;
|
||||||
|
|
||||||
class MenuSettingDir : public MenuSetting {
|
class MenuSettingDir : public MenuSettingStringBase {
|
||||||
private:
|
protected:
|
||||||
string originalValue;
|
virtual void edit();
|
||||||
string *_value;
|
|
||||||
|
|
||||||
void select();
|
|
||||||
void clear();
|
|
||||||
public:
|
public:
|
||||||
MenuSettingDir(GMenu2X *gmenu2x, const string &name, const string &description, string *value);
|
MenuSettingDir(
|
||||||
virtual ~MenuSettingDir() {};
|
GMenu2X *gmenu2x, const string &name,
|
||||||
|
const string &description, string *value);
|
||||||
virtual void draw(int y);
|
virtual ~MenuSettingDir() {}
|
||||||
virtual void manageInput();
|
|
||||||
virtual void adjustInput();
|
|
||||||
virtual bool edited();
|
|
||||||
|
|
||||||
void setValue(const string &value);
|
|
||||||
const string &value();
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -19,15 +19,14 @@
|
|||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
#include "menusettingfile.h"
|
#include "menusettingfile.h"
|
||||||
#include "filedialog.h"
|
#include "filedialog.h"
|
||||||
#include "utilities.h"
|
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
using namespace fastdelegate;
|
using namespace fastdelegate;
|
||||||
|
|
||||||
MenuSettingFile::MenuSettingFile(GMenu2X *gmenu2x, const string &name, const string &description, string *value, const string &filter_)
|
MenuSettingFile::MenuSettingFile(
|
||||||
: MenuSetting(gmenu2x, name, description)
|
GMenu2X *gmenu2x, const string &name,
|
||||||
, originalValue(*value)
|
const string &description, string *value, const string &filter_)
|
||||||
, _value(value)
|
: MenuSettingStringBase(gmenu2x, name, description, value)
|
||||||
, filter(filter_)
|
, filter(filter_)
|
||||||
{
|
{
|
||||||
IconButton *btn;
|
IconButton *btn;
|
||||||
@ -37,47 +36,14 @@ MenuSettingFile::MenuSettingFile(GMenu2X *gmenu2x, const string &name, const str
|
|||||||
buttonBox.add(btn);
|
buttonBox.add(btn);
|
||||||
|
|
||||||
btn = new IconButton(gmenu2x, "skin:imgs/buttons/b.png", gmenu2x->tr["Select a file"]);
|
btn = new IconButton(gmenu2x, "skin:imgs/buttons/b.png", gmenu2x->tr["Select a file"]);
|
||||||
btn->setAction(MakeDelegate(this, &MenuSettingFile::select));
|
btn->setAction(MakeDelegate(this, &MenuSettingFile::edit));
|
||||||
buttonBox.add(btn);
|
buttonBox.add(btn);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MenuSettingFile::draw(int y)
|
void MenuSettingFile::edit()
|
||||||
{
|
|
||||||
MenuSetting::draw(y);
|
|
||||||
gmenu2x->s->write( gmenu2x->font, value(), 155, y+gmenu2x->font->getHalfHeight(), SFontHAlignLeft, SFontVAlignMiddle );
|
|
||||||
}
|
|
||||||
|
|
||||||
void MenuSettingFile::manageInput()
|
|
||||||
{
|
|
||||||
if (gmenu2x->input[ACTION_X]) clear();
|
|
||||||
if (gmenu2x->input[ACTION_B]) select();
|
|
||||||
}
|
|
||||||
|
|
||||||
void MenuSettingFile::clear()
|
|
||||||
{
|
|
||||||
setValue("");
|
|
||||||
}
|
|
||||||
|
|
||||||
void MenuSettingFile::select()
|
|
||||||
{
|
{
|
||||||
FileDialog fd(gmenu2x, description, filter, value());
|
FileDialog fd(gmenu2x, description, filter, value());
|
||||||
if (fd.exec()) {
|
if (fd.exec()) {
|
||||||
setValue(fd.getPath() + "/" + fd.getFile());
|
setValue(fd.getPath() + "/" + fd.getFile());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MenuSettingFile::setValue(const string &value)
|
|
||||||
{
|
|
||||||
*_value = value;
|
|
||||||
}
|
|
||||||
|
|
||||||
const string &MenuSettingFile::value()
|
|
||||||
{
|
|
||||||
return *_value;
|
|
||||||
}
|
|
||||||
|
|
||||||
void MenuSettingFile::adjustInput() {}
|
|
||||||
|
|
||||||
bool MenuSettingFile::edited() {
|
|
||||||
return originalValue != value();
|
|
||||||
}
|
|
||||||
|
@ -20,33 +20,22 @@
|
|||||||
#ifndef MENUSETTINGFILE_H
|
#ifndef MENUSETTINGFILE_H
|
||||||
#define MENUSETTINGFILE_H
|
#define MENUSETTINGFILE_H
|
||||||
|
|
||||||
#include "gmenu2x.h"
|
#include "menusettingstringbase.h"
|
||||||
#include "menusetting.h"
|
|
||||||
|
|
||||||
using std::string;
|
using std::string;
|
||||||
|
|
||||||
class MenuSettingFile : public MenuSetting {
|
class MenuSettingFile : public MenuSettingStringBase {
|
||||||
protected:
|
protected:
|
||||||
string originalValue;
|
virtual void edit();
|
||||||
string *_value;
|
|
||||||
string filter;
|
string filter;
|
||||||
|
|
||||||
virtual void select();
|
|
||||||
void clear();
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
MenuSettingFile(GMenu2X *gmenu2x, const string &name,
|
MenuSettingFile(
|
||||||
const string &description, string *value,
|
GMenu2X *gmenu2x, const string &name,
|
||||||
const string &filter = "");
|
const string &description, string *value,
|
||||||
|
const string &filter = "");
|
||||||
virtual ~MenuSettingFile() {}
|
virtual ~MenuSettingFile() {}
|
||||||
|
|
||||||
virtual void draw(int y);
|
|
||||||
virtual void manageInput();
|
|
||||||
virtual void adjustInput();
|
|
||||||
virtual bool edited();
|
|
||||||
|
|
||||||
virtual void setValue(const string &value);
|
|
||||||
const string &value();
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -28,7 +28,7 @@ MenuSettingImage::MenuSettingImage(GMenu2X *gmenu2x, const string &name, const s
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void MenuSettingImage::select() {
|
void MenuSettingImage::edit() {
|
||||||
ImageDialog id(gmenu2x, description, filter, value());
|
ImageDialog id(gmenu2x, description, filter, value());
|
||||||
if (id.exec()) setValue(id.getPath() + "/" + id.getFile());
|
if (id.exec()) setValue(id.getPath() + "/" + id.getFile());
|
||||||
}
|
}
|
||||||
|
@ -26,7 +26,7 @@ using std::string;
|
|||||||
|
|
||||||
class MenuSettingImage : public MenuSettingFile {
|
class MenuSettingImage : public MenuSettingFile {
|
||||||
protected:
|
protected:
|
||||||
virtual void select();
|
virtual void edit();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
MenuSettingImage(GMenu2X *gmenu2x, const string &name,
|
MenuSettingImage(GMenu2X *gmenu2x, const string &name,
|
||||||
|
@ -19,21 +19,20 @@
|
|||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
#include "menusettingstring.h"
|
#include "menusettingstring.h"
|
||||||
#include "inputdialog.h"
|
#include "inputdialog.h"
|
||||||
#include "utilities.h"
|
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
using namespace fastdelegate;
|
using namespace fastdelegate;
|
||||||
|
|
||||||
MenuSettingString::MenuSettingString(GMenu2X *gmenu2x, const string &name, const string &description, string *value, const string &diagTitle, const string &diagIcon)
|
MenuSettingString::MenuSettingString(
|
||||||
: MenuSetting(gmenu2x, name, description)
|
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;
|
IconButton *btn;
|
||||||
|
|
||||||
_value = value;
|
|
||||||
originalValue = *value;
|
|
||||||
this->diagTitle = diagTitle;
|
|
||||||
this->diagIcon = diagIcon;
|
|
||||||
|
|
||||||
btn = new IconButton(gmenu2x, "skin:imgs/buttons/x.png", gmenu2x->tr["Clear"]);
|
btn = new IconButton(gmenu2x, "skin:imgs/buttons/x.png", gmenu2x->tr["Clear"]);
|
||||||
btn->setAction(MakeDelegate(this, &MenuSettingString::clear));
|
btn->setAction(MakeDelegate(this, &MenuSettingString::clear));
|
||||||
buttonBox.add(btn);
|
buttonBox.add(btn);
|
||||||
@ -43,44 +42,10 @@ MenuSettingString::MenuSettingString(GMenu2X *gmenu2x, const string &name, const
|
|||||||
buttonBox.add(btn);
|
buttonBox.add(btn);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MenuSettingString::draw(int y)
|
|
||||||
{
|
|
||||||
MenuSetting::draw(y);
|
|
||||||
gmenu2x->s->write(gmenu2x->font, value(), 155, y+gmenu2x->font->getHalfHeight(), SFontHAlignLeft, SFontVAlignMiddle);
|
|
||||||
}
|
|
||||||
|
|
||||||
void MenuSettingString::manageInput()
|
|
||||||
{
|
|
||||||
if (gmenu2x->input[ACTION_X])
|
|
||||||
clear();
|
|
||||||
if (gmenu2x->input[ACTION_B])
|
|
||||||
edit();
|
|
||||||
}
|
|
||||||
|
|
||||||
void MenuSettingString::setValue(const string &value)
|
|
||||||
{
|
|
||||||
*_value = value;
|
|
||||||
}
|
|
||||||
|
|
||||||
const string &MenuSettingString::value()
|
|
||||||
{
|
|
||||||
return *_value;
|
|
||||||
}
|
|
||||||
|
|
||||||
void MenuSettingString::adjustInput() {}
|
|
||||||
|
|
||||||
void MenuSettingString::clear()
|
|
||||||
{
|
|
||||||
setValue("");
|
|
||||||
}
|
|
||||||
|
|
||||||
void MenuSettingString::edit()
|
void MenuSettingString::edit()
|
||||||
{
|
{
|
||||||
InputDialog id(gmenu2x, gmenu2x->input, gmenu2x->ts,
|
InputDialog id(
|
||||||
description, value(), diagTitle, diagIcon);
|
gmenu2x, gmenu2x->input, gmenu2x->ts,
|
||||||
|
description, value(), diagTitle, diagIcon);
|
||||||
if (id.exec()) setValue(id.getInput());
|
if (id.exec()) setValue(id.getInput());
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MenuSettingString::edited() {
|
|
||||||
return originalValue != value();
|
|
||||||
}
|
|
||||||
|
@ -20,30 +20,22 @@
|
|||||||
#ifndef MENUSETTINGSTRING_H
|
#ifndef MENUSETTINGSTRING_H
|
||||||
#define MENUSETTINGSTRING_H
|
#define MENUSETTINGSTRING_H
|
||||||
|
|
||||||
#include "gmenu2x.h"
|
#include "menusettingstringbase.h"
|
||||||
#include "menusetting.h"
|
|
||||||
|
|
||||||
using std::string;
|
using std::string;
|
||||||
|
|
||||||
class MenuSettingString : public MenuSetting {
|
class MenuSettingString : public MenuSettingStringBase {
|
||||||
private:
|
protected:
|
||||||
string originalValue, diagTitle, diagIcon;
|
virtual void edit();
|
||||||
string *_value;
|
|
||||||
|
|
||||||
void edit();
|
string diagTitle, diagIcon;
|
||||||
void clear();
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
MenuSettingString(GMenu2X *gmenu2x, const string &name, const string &description, string *value, const string &diagTitle="", const string &diagIcon="");
|
MenuSettingString(GMenu2X *gmenu2x, const string &name,
|
||||||
virtual ~MenuSettingString() {};
|
const string &description, string *value,
|
||||||
|
const string &diagTitle = "",
|
||||||
virtual void draw(int y);
|
const string &diagIcon = "");
|
||||||
virtual void manageInput();
|
virtual ~MenuSettingString() {}
|
||||||
virtual void adjustInput();
|
|
||||||
virtual bool edited();
|
|
||||||
|
|
||||||
void setValue(const string &value);
|
|
||||||
const string &value();
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
65
src/menusettingstringbase.cpp
Normal file
65
src/menusettingstringbase.cpp
Normal file
@ -0,0 +1,65 @@
|
|||||||
|
/***************************************************************************
|
||||||
|
* Copyright (C) 2006 by Massimiliano Torromeo *
|
||||||
|
* massimiliano.torromeo@gmail.com *
|
||||||
|
* *
|
||||||
|
* This program is free software; you can redistribute it and/or modify *
|
||||||
|
* it under the terms of the GNU General Public License as published by *
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or *
|
||||||
|
* (at your option) any later version. *
|
||||||
|
* *
|
||||||
|
* This program is distributed in the hope that it will be useful, *
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||||
|
* GNU General Public License for more details. *
|
||||||
|
* *
|
||||||
|
* You should have received a copy of the GNU General Public License *
|
||||||
|
* along with this program; if not, write to the *
|
||||||
|
* Free Software Foundation, Inc., *
|
||||||
|
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
|
||||||
|
***************************************************************************/
|
||||||
|
#include "menusettingstringbase.h"
|
||||||
|
|
||||||
|
using namespace std;
|
||||||
|
using namespace fastdelegate;
|
||||||
|
|
||||||
|
MenuSettingStringBase::MenuSettingStringBase(
|
||||||
|
GMenu2X *gmenu2x, const string &name,
|
||||||
|
const string &description, string *value)
|
||||||
|
: MenuSetting(gmenu2x, name, description)
|
||||||
|
, originalValue(*value)
|
||||||
|
, _value(value)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
MenuSettingStringBase::~MenuSettingStringBase()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void MenuSettingStringBase::draw(int y)
|
||||||
|
{
|
||||||
|
MenuSetting::draw(y);
|
||||||
|
gmenu2x->s->write(
|
||||||
|
gmenu2x->font, value(),
|
||||||
|
155, y + gmenu2x->font->getHalfHeight(),
|
||||||
|
SFontHAlignLeft, SFontVAlignMiddle);
|
||||||
|
}
|
||||||
|
|
||||||
|
void MenuSettingStringBase::manageInput()
|
||||||
|
{
|
||||||
|
if (gmenu2x->input[ACTION_X]) clear();
|
||||||
|
if (gmenu2x->input[ACTION_B]) edit();
|
||||||
|
}
|
||||||
|
|
||||||
|
void MenuSettingStringBase::adjustInput()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void MenuSettingStringBase::clear()
|
||||||
|
{
|
||||||
|
setValue("");
|
||||||
|
}
|
||||||
|
|
||||||
|
bool MenuSettingStringBase::edited()
|
||||||
|
{
|
||||||
|
return originalValue != value();
|
||||||
|
}
|
50
src/menusettingstringbase.h
Normal file
50
src/menusettingstringbase.h
Normal file
@ -0,0 +1,50 @@
|
|||||||
|
/***************************************************************************
|
||||||
|
* Copyright (C) 2006 by Massimiliano Torromeo *
|
||||||
|
* massimiliano.torromeo@gmail.com *
|
||||||
|
* *
|
||||||
|
* This program is free software; you can redistribute it and/or modify *
|
||||||
|
* it under the terms of the GNU General Public License as published by *
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or *
|
||||||
|
* (at your option) any later version. *
|
||||||
|
* *
|
||||||
|
* This program is distributed in the hope that it will be useful, *
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||||
|
* GNU General Public License for more details. *
|
||||||
|
* *
|
||||||
|
* You should have received a copy of the GNU General Public License *
|
||||||
|
* along with this program; if not, write to the *
|
||||||
|
* Free Software Foundation, Inc., *
|
||||||
|
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
|
||||||
|
***************************************************************************/
|
||||||
|
#ifndef MENUSETTINGSTRINGBASE_H
|
||||||
|
#define MENUSETTINGSTRINGBASE_H
|
||||||
|
|
||||||
|
#include "menusetting.h"
|
||||||
|
|
||||||
|
using std::string;
|
||||||
|
|
||||||
|
class MenuSettingStringBase : public MenuSetting {
|
||||||
|
protected:
|
||||||
|
string originalValue;
|
||||||
|
string *_value;
|
||||||
|
|
||||||
|
virtual void edit() = 0;
|
||||||
|
void clear();
|
||||||
|
|
||||||
|
public:
|
||||||
|
MenuSettingStringBase(
|
||||||
|
GMenu2X *gmenu2x, const string &name,
|
||||||
|
const string &description, string *value);
|
||||||
|
virtual ~MenuSettingStringBase();
|
||||||
|
|
||||||
|
virtual void draw(int y);
|
||||||
|
virtual void manageInput();
|
||||||
|
virtual void adjustInput();
|
||||||
|
virtual bool edited();
|
||||||
|
|
||||||
|
void setValue(const string &value) { *_value = value; }
|
||||||
|
const string &value() { return *_value; }
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
Loading…
Reference in New Issue
Block a user