1
0
mirror of git://projects.qi-hardware.com/gmenu2x.git synced 2024-11-22 17:51:34 +02:00

Add ButtonBox widget to simplify managing buttons in the bottombar. Also fixes some memleaks where buttons were left unfreed.

This commit is contained in:
Lars-Peter Clausen 2010-05-03 22:21:36 +02:00
parent 2a6a1f0041
commit 3b2538cfaf
25 changed files with 362 additions and 249 deletions

View File

@ -1,8 +1,29 @@
bin_PROGRAMS = gmenu2x bin_PROGRAMS = gmenu2x
# #
gmenu2x_SOURCES = asfont.cpp button.cpp cpu.cpp dirdialog.cpp filedialog.cpp filelister.cpp gmenu2x.cpp iconbutton.cpp imagedialog.cpp inputdialog.cpp inputmanager.cpp linkaction.cpp linkapp.cpp link.cpp listviewitem.cpp menu.cpp menusettingbool.cpp menusetting.cpp menusettingdir.cpp menusettingfile.cpp menusettingimage.cpp menusettingint.cpp menusettingmultistring.cpp menusettingrgba.cpp menusettingstring.cpp messagebox.cpp pxml.cpp selector.cpp selectordetector.cpp settingsdialog.cpp sfontplus.cpp surfacecollection.cpp surface.cpp textdialog.cpp textmanualdialog.cpp touchscreen.cpp translator.cpp utilities.cpp wallpaperdialog.cpp listview.cpp tinyxml/tinystr.cpp tinyxml/tinyxml.cpp tinyxml/tinyxmlerror.cpp tinyxml/tinyxmlparser.cpp browsedialog.cpp gmenu2x_SOURCES = asfont.cpp button.cpp cpu.cpp dirdialog.cpp filedialog.cpp \
filelister.cpp gmenu2x.cpp iconbutton.cpp imagedialog.cpp inputdialog.cpp \
inputmanager.cpp linkaction.cpp linkapp.cpp link.cpp listviewitem.cpp \
menu.cpp menusettingbool.cpp menusetting.cpp menusettingdir.cpp \
menusettingfile.cpp menusettingimage.cpp menusettingint.cpp \
menusettingmultistring.cpp menusettingrgba.cpp menusettingstring.cpp \
messagebox.cpp pxml.cpp selector.cpp selectordetector.cpp \
settingsdialog.cpp sfontplus.cpp surfacecollection.cpp surface.cpp \
textdialog.cpp textmanualdialog.cpp touchscreen.cpp translator.cpp \
utilities.cpp wallpaperdialog.cpp listview.cpp tinyxml/tinystr.cpp \
tinyxml/tinyxml.cpp tinyxml/tinyxmlerror.cpp tinyxml/tinyxmlparser.cpp \
browsedialog.cpp buttonbox.cpp
noinst_HEADERS = asfont.h button.h cpu.h dirdialog.h FastDelegate.h \
filedialog.h filelister.h gmenu2x.h gp2x.h iconbutton.h imagedialog.h \
inputdialog.h inputmanager.h jz4740.h linkaction.h linkapp.h link.h \
listview.h listviewitem.h menu.h menusettingbool.h menusettingdir.h \
menusettingfile.h menusetting.h menusettingimage.h menusettingint.h \
menusettingmultistring.h menusettingrgba.h menusettingstring.h \
messagebox.h pxml.h selectordetector.h selector.h settingsdialog.h \
sfontplus.h surfacecollection.h surface.h textdialog.h textmanualdialog.h \
touchscreen.h translator.h utilities.h wallpaperdialog.h \
tinyxml/tinystr.h tinyxml/tinyxml.h browsedialog.h buttonbox.h
noinst_HEADERS = asfont.h button.h cpu.h dirdialog.h FastDelegate.h filedialog.h filelister.h gmenu2x.h gp2x.h iconbutton.h imagedialog.h inputdialog.h inputmanager.h jz4740.h linkaction.h linkapp.h link.h listview.h listviewitem.h menu.h menusettingbool.h menusettingdir.h menusettingfile.h menusetting.h menusettingimage.h menusettingint.h menusettingmultistring.h menusettingrgba.h menusettingstring.h messagebox.h pxml.h selectordetector.h selector.h settingsdialog.h sfontplus.h surfacecollection.h surface.h textdialog.h textmanualdialog.h touchscreen.h translator.h utilities.h wallpaperdialog.h tinyxml/tinystr.h tinyxml/tinyxml.h browsedialog.h
AM_CFLAGS= @CFLAGS@ @SDL_CFLAGS@ AM_CFLAGS= @CFLAGS@ @SDL_CFLAGS@
AM_CXXFLAGS = @CXXFLAGS@ @SDL_CFLAGS@ AM_CXXFLAGS = @CXXFLAGS@ @SDL_CFLAGS@

View File

@ -9,20 +9,21 @@ using namespace fastdelegate;
BrowseDialog::BrowseDialog(GMenu2X *gmenu2x, const string &title, BrowseDialog::BrowseDialog(GMenu2X *gmenu2x, const string &title,
const string &subtitle) : const string &subtitle) :
gmenu2x(gmenu2x), title(title), subtitle(subtitle) gmenu2x(gmenu2x), title(title), subtitle(subtitle), buttonBox(gmenu2x)
{ {
ButtonAction actionUp = MakeDelegate(this, &BrowseDialog::directoryUp); IconButton *btn;
ButtonAction actionEnter = MakeDelegate(this, &BrowseDialog::directoryEnter);
ButtonAction actionConfirm = MakeDelegate(this, &BrowseDialog::confirm);
btnUp = new IconButton(gmenu2x, "skin:imgs/buttons/x.png", gmenu2x->tr["Up one folder"]); btn = new IconButton(gmenu2x, "skin:imgs/buttons/x.png", gmenu2x->tr["Up one folder"]);
btnUp->setAction(actionUp); btn->setAction(MakeDelegate(this, &BrowseDialog::directoryUp));
buttonBox.add(btn);
btnEnter = new IconButton(gmenu2x, "skin:imgs/buttons/b.png", gmenu2x->tr["Enter folder"]); btn = new IconButton(gmenu2x, "skin:imgs/buttons/b.png", gmenu2x->tr["Enter folder"]);
btnEnter->setAction(actionEnter); btn->setAction(MakeDelegate(this, &BrowseDialog::directoryEnter));
buttonBox.add(btn);
btnConfirm = new IconButton(gmenu2x, "skin:imgs/buttons/start.png", gmenu2x->tr["Confirm"]); btn = new IconButton(gmenu2x, "skin:imgs/buttons/start.png", gmenu2x->tr["Confirm"]);
btnConfirm->setAction(actionConfirm); btn->setAction(MakeDelegate(this, &BrowseDialog::confirm));
buttonBox.add(btn);
iconGoUp = gmenu2x->sc.skinRes("imgs/go-up.png"); iconGoUp = gmenu2x->sc.skinRes("imgs/go-up.png");
iconFolder = gmenu2x->sc.skinRes("imgs/folder.png"); iconFolder = gmenu2x->sc.skinRes("imgs/folder.png");
@ -143,9 +144,7 @@ bool BrowseDialog::handleInput()
break; break;
} }
btnUp->handleTS(); buttonBox.handleTS();
btnEnter->handleTS();
btnConfirm->handleTS();
} }
#include <iostream> #include <iostream>
@ -195,9 +194,7 @@ void BrowseDialog::paint()
gmenu2x->writeTitle(title); gmenu2x->writeTitle(title);
gmenu2x->writeSubTitle(subtitle); gmenu2x->writeSubTitle(subtitle);
gmenu2x->drawButton(btnConfirm, buttonBox.paint(5);
gmenu2x->drawButton(btnUp,
gmenu2x->drawButton(btnEnter, 5)));
if (selected>firstElement+numRows-1) if (selected>firstElement+numRows-1)
firstElement = selected-numRows+1; firstElement = selected-numRows+1;

View File

@ -24,6 +24,7 @@
#include <string> #include <string>
#include "filelister.h" #include "filelister.h"
#include "gmenu2x.h" #include "gmenu2x.h"
#include "buttonbox.h"
class FileLister; class FileLister;
@ -73,13 +74,14 @@ private:
unsigned int numRows; unsigned int numRows;
unsigned int rowHeight; unsigned int rowHeight;
bool ts_pressed; bool ts_pressed;
Surface *iconGoUp; Surface *iconGoUp;
Surface *iconFolder; Surface *iconFolder;
Surface *iconFile; Surface *iconFile;
ButtonBox buttonBox;
Action getAction(); Action getAction();
bool handleInput(); bool handleInput();

View File

@ -46,7 +46,7 @@ public:
SDL_Rect getRect(); SDL_Rect getRect();
void setSize(int w, int h); void setSize(int w, int h);
void setPosition(int x, int y); virtual void setPosition(int x, int y);
virtual void paint(); virtual void paint();
virtual bool paintHover(); virtual bool paintHover();
@ -54,6 +54,7 @@ public:
bool isPressed(); bool isPressed();
bool isReleased(); bool isReleased();
bool handleTS(); bool handleTS();
void exec(); void exec();
void voidAction() {}; void voidAction() {};
void setAction(ButtonAction action); void setAction(ButtonAction action);

32
src/buttonbox.cpp Normal file
View File

@ -0,0 +1,32 @@
#include "button.h"
#include "gmenu2x.h"
#include "buttonbox.h"
ButtonBox::ButtonBox(GMenu2X *gmenu2x) : gmenu2x(gmenu2x)
{
}
ButtonBox::~ButtonBox()
{
for (ButtonList::const_iterator it = buttons.begin(); it != buttons.end(); ++it)
delete *it;
}
void ButtonBox::add(Button *button)
{
buttons.push_back(button);
}
void ButtonBox::paint(unsigned int posX)
{
for (ButtonList::const_iterator it = buttons.begin(); it != buttons.end(); ++it)
posX = gmenu2x->drawButton(*it, posX);
}
void ButtonBox::handleTS()
{
for (ButtonList::iterator it = buttons.begin(); it != buttons.end(); ++it)
(*it)->handleTS();
}

26
src/buttonbox.h Normal file
View File

@ -0,0 +1,26 @@
#ifndef __BUTTONBOX_H__
#define __BUTTONBOX_H__
#include <vector>
class GMenu2X;
class Button;
class ButtonBox
{
public:
ButtonBox(GMenu2X *gmenu2x);
~ButtonBox();
void add(Button *button);
void paint(unsigned int posX);
void handleTS();
private:
typedef std::vector<Button*> ButtonList;
ButtonList buttons;
GMenu2X *gmenu2x;
};
#endif

View File

@ -1914,7 +1914,7 @@ string GMenu2X::getDiskFree() {
return df; return df;
} }
int GMenu2X::drawButton(IconButton *btn, int x, int y) { int GMenu2X::drawButton(Button *btn, int x, int y) {
if (y<0) y = resY+y; if (y<0) y = resY+y;
btn->setPosition(x, y-7); btn->setPosition(x, y-7);
btn->paint(); btn->paint();

View File

@ -238,7 +238,7 @@ public:
void deleteSection(); void deleteSection();
void initBG(); void initBG();
int drawButton(IconButton *btn, int x=5, int y=-10); int drawButton(Button *btn, int x=5, int y=-10);
int drawButton(Surface *s, const string &btn, const string &text, int x=5, int y=-10); int drawButton(Surface *s, const string &btn, const string &text, int x=5, int y=-10);
int drawButtonRight(Surface *s, const string &btn, const string &text, int x=5, int y=-10); int drawButtonRight(Surface *s, const string &btn, const string &text, int x=5, int y=-10);
void drawScrollBar(uint pagesize, uint totalsize, uint pagepos, uint top, uint height); void drawScrollBar(uint pagesize, uint totalsize, uint pagepos, uint top, uint height);

View File

@ -33,7 +33,7 @@ public:
virtual void paint(); virtual void paint();
virtual bool paintHover(); virtual bool paintHover();
void setPosition(int x, int y); virtual void setPosition(int x, int y);
const string &getLabel(); const string &getLabel();
void setLabel(const string &label); void setLabel(const string &label);

View File

@ -19,18 +19,23 @@
***************************************************************************/ ***************************************************************************/
#include "menusetting.h" #include "menusetting.h"
MenuSetting::MenuSetting(GMenu2X *gmenu2x, const string &name, const string &description) { MenuSetting::MenuSetting(GMenu2X *gmenu2x, const string &name,
this->gmenu2x = gmenu2x; const string &description) : gmenu2x(gmenu2x), name(name),
this->name = name; description(description), buttonBox(gmenu2x)
this->description = description; {
} }
void MenuSetting::draw(int y) { void MenuSetting::draw(int y)
{
gmenu2x->s->write( gmenu2x->font, name, 5, y+gmenu2x->font->getHalfHeight(), SFontHAlignLeft, SFontVAlignMiddle ); gmenu2x->s->write( gmenu2x->font, name, 5, y+gmenu2x->font->getHalfHeight(), SFontHAlignLeft, SFontVAlignMiddle );
} }
void MenuSetting::handleTS() {} void MenuSetting::handleTS()
void MenuSetting::manageInput() {} {
void MenuSetting::adjustInput() {} buttonBox.handleTS();
void MenuSetting::drawSelected(int) {} }
bool MenuSetting::edited() { return true; }
void MenuSetting::drawSelected(int)
{
buttonBox.paint(5);
}

View File

@ -25,6 +25,7 @@
#endif #endif
#include "gmenu2x.h" #include "gmenu2x.h"
#include "buttonbox.h"
using std::string; using std::string;
@ -37,16 +38,19 @@ class MenuSetting {
protected: protected:
GMenu2X *gmenu2x; GMenu2X *gmenu2x;
ButtonBox buttonBox;
public: public:
MenuSetting(GMenu2X *gmenu2x, const string &name, const string &description); MenuSetting(GMenu2X *gmenu2x, const string &name, const string &description);
virtual ~MenuSetting() {}; virtual ~MenuSetting() {};
virtual void draw(int y); virtual void draw(int y);
virtual void handleTS(); virtual void handleTS();
virtual void manageInput();
virtual void adjustInput(); virtual void manageInput() {};
virtual void drawSelected(int y); virtual void adjustInput() {};
virtual bool edited(); virtual void drawSelected(int);
virtual bool edited() { return true; };
string name, description; string name, description;
}; };

View File

@ -25,49 +25,59 @@ using namespace std;
using namespace fastdelegate; using namespace fastdelegate;
MenuSettingBool::MenuSettingBool(GMenu2X *gmenu2x, const string &name, const string &description, int *value) MenuSettingBool::MenuSettingBool(GMenu2X *gmenu2x, const string &name, const string &description, int *value)
: MenuSetting(gmenu2x,name,description) { : MenuSetting(gmenu2x,name,description)
{
IconButton *btn;
_ivalue = value; _ivalue = value;
_value = NULL; _value = NULL;
originalValue = *value != 0; originalValue = *value != 0;
setValue(this->value()); setValue(this->value());
btnToggle = new IconButton(gmenu2x, "skin:imgs/buttons/b.png", gmenu2x->tr["Switch"]); btn = new IconButton(gmenu2x, "skin:imgs/buttons/b.png", gmenu2x->tr["Switch"]);
btnToggle->setAction(MakeDelegate(this, &MenuSettingBool::toggle)); btn->setAction(MakeDelegate(this, &MenuSettingBool::toggle));
buttonBox.add(btn);
} }
MenuSettingBool::MenuSettingBool(GMenu2X *gmenu2x, const string &name, const string &description, bool *value) MenuSettingBool::MenuSettingBool(GMenu2X *gmenu2x, const string &name, const string &description, bool *value)
: MenuSetting(gmenu2x,name,description) { : MenuSetting(gmenu2x,name,description)
{
IconButton *btn;
_value = value; _value = value;
_ivalue = NULL; _ivalue = NULL;
originalValue = *value; originalValue = *value;
setValue(this->value()); setValue(this->value());
btnToggle = new IconButton(gmenu2x, "skin:imgs/buttons/b.png", gmenu2x->tr["Switch"]); btn = new IconButton(gmenu2x, "skin:imgs/buttons/b.png", gmenu2x->tr["Switch"]);
btnToggle->setAction(MakeDelegate(this, &MenuSettingBool::toggle)); btn->setAction(MakeDelegate(this, &MenuSettingBool::toggle));
buttonBox.add(btn);
} }
void MenuSettingBool::draw(int y) { void MenuSettingBool::draw(int y)
{
MenuSetting::draw(y); MenuSetting::draw(y);
gmenu2x->s->write( gmenu2x->font, strvalue, 155, y+gmenu2x->font->getHalfHeight(), SFontHAlignLeft, SFontVAlignMiddle ); gmenu2x->s->write( gmenu2x->font, strvalue, 155, y+gmenu2x->font->getHalfHeight(), SFontHAlignLeft, SFontVAlignMiddle );
} }
void MenuSettingBool::handleTS() { void MenuSettingBool::manageInput()
btnToggle->handleTS(); {
if (gmenu2x->input[ACTION_B])
toggle();
} }
void MenuSettingBool::manageInput() { void MenuSettingBool::toggle()
if ( gmenu2x->input[ACTION_B] ) toggle(); {
}
void MenuSettingBool::toggle() {
setValue(!value()); setValue(!value());
} }
void MenuSettingBool::setValue(int value) { void MenuSettingBool::setValue(int value)
{
setValue(value != 0); setValue(value != 0);
} }
void MenuSettingBool::setValue(bool value) { void MenuSettingBool::setValue(bool value)
{
if (_value == NULL) if (_value == NULL)
*_ivalue = value; *_ivalue = value;
else else
@ -75,7 +85,8 @@ void MenuSettingBool::setValue(bool value) {
strvalue = value ? "ON" : "OFF"; strvalue = value ? "ON" : "OFF";
} }
bool MenuSettingBool::value() { bool MenuSettingBool::value()
{
if (_value == NULL) if (_value == NULL)
return *_ivalue != 0; return *_ivalue != 0;
else else
@ -84,10 +95,7 @@ bool MenuSettingBool::value() {
void MenuSettingBool::adjustInput() {} void MenuSettingBool::adjustInput() {}
void MenuSettingBool::drawSelected(int) { bool MenuSettingBool::edited()
gmenu2x->drawButton(btnToggle); {
}
bool MenuSettingBool::edited() {
return originalValue != value(); return originalValue != value();
} }

View File

@ -32,7 +32,6 @@ private:
bool *_value; bool *_value;
int *_ivalue; int *_ivalue;
string strvalue; string strvalue;
IconButton *btnToggle;
void toggle(); void toggle();
@ -42,10 +41,8 @@ public:
virtual ~MenuSettingBool() {}; virtual ~MenuSettingBool() {};
virtual void draw(int y); virtual void draw(int y);
virtual void handleTS();
virtual void manageInput(); virtual void manageInput();
virtual void adjustInput(); virtual void adjustInput();
virtual void drawSelected(int y);
virtual bool edited(); virtual bool edited();
void setValue(int value); void setValue(int value);

View File

@ -26,55 +26,55 @@ using namespace fastdelegate;
MenuSettingDir::MenuSettingDir(GMenu2X *gmenu2x, const string &name, const string &description, string *value) MenuSettingDir::MenuSettingDir(GMenu2X *gmenu2x, const string &name, const string &description, string *value)
: MenuSetting(gmenu2x,name,description) { : MenuSetting(gmenu2x,name,description) {
IconButton *btn;
_value = value; _value = value;
originalValue = *value; originalValue = *value;
btnClear = new IconButton(gmenu2x, "skin:imgs/buttons/x.png", gmenu2x->tr["Clear"]); btn = new IconButton(gmenu2x, "skin:imgs/buttons/x.png", gmenu2x->tr["Clear"]);
btnClear->setAction(MakeDelegate(this, &MenuSettingDir::clear)); btn->setAction(MakeDelegate(this, &MenuSettingDir::clear));
buttonBox.add(btn);
btnSelect = 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"]);
btnSelect->setAction(MakeDelegate(this, &MenuSettingDir::select)); btn->setAction(MakeDelegate(this, &MenuSettingDir::select));
buttonBox.add(btn);
} }
void MenuSettingDir::draw(int y) { void MenuSettingDir::draw(int y)
{
MenuSetting::draw(y); MenuSetting::draw(y);
gmenu2x->s->write( gmenu2x->font, value(), 155, y+gmenu2x->font->getHalfHeight(), SFontHAlignLeft, SFontVAlignMiddle ); gmenu2x->s->write( gmenu2x->font, value(), 155, y+gmenu2x->font->getHalfHeight(), SFontHAlignLeft, SFontVAlignMiddle );
} }
void MenuSettingDir::handleTS() { void MenuSettingDir::manageInput()
btnSelect->handleTS(); {
btnClear->handleTS();
}
void MenuSettingDir::manageInput() {
if (gmenu2x->input[ACTION_X]) setValue(""); if (gmenu2x->input[ACTION_X]) setValue("");
if (gmenu2x->input[ACTION_B]) select(); if (gmenu2x->input[ACTION_B]) select();
} }
void MenuSettingDir::clear() { void MenuSettingDir::clear()
{
setValue(""); setValue("");
} }
void MenuSettingDir::select() { 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) { void MenuSettingDir::setValue(const string &value)
{
*_value = value; *_value = value;
} }
const string &MenuSettingDir::value() { const string &MenuSettingDir::value()
{
return *_value; return *_value;
} }
void MenuSettingDir::adjustInput() {} void MenuSettingDir::adjustInput() {}
void MenuSettingDir::drawSelected(int) {
gmenu2x->drawButton(btnClear,
gmenu2x->drawButton(btnSelect));
}
bool MenuSettingDir::edited() { bool MenuSettingDir::edited() {
return originalValue != value(); return originalValue != value();
} }

View File

@ -29,20 +29,16 @@ class MenuSettingDir : public MenuSetting {
private: private:
string originalValue; string originalValue;
string *_value; string *_value;
IconButton *btnClear, *btnSelect;
void select(); void select();
void clear(); void clear();
public: public:
MenuSettingDir(GMenu2X *gmenu2x, const string &name, const string &description, string *value); MenuSettingDir(GMenu2X *gmenu2x, const string &name, const string &description, string *value);
virtual ~MenuSettingDir() {}; virtual ~MenuSettingDir() {};
virtual void draw(int y); virtual void draw(int y);
virtual void handleTS();
virtual void manageInput(); virtual void manageInput();
virtual void adjustInput(); virtual void adjustInput();
virtual void drawSelected(int y);
virtual bool edited(); virtual bool edited();
void setValue(const string &value); void setValue(const string &value);

View File

@ -25,57 +25,61 @@ 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(GMenu2X *gmenu2x, const string &name, const string &description, string *value, const string &filter)
: MenuSetting(gmenu2x,name,description) { : MenuSetting(gmenu2x,name,description)
{
IconButton *btn;
this->filter = filter; this->filter = filter;
_value = value; _value = value;
originalValue = *value; originalValue = *value;
btnClear = new IconButton(gmenu2x, "skin:imgs/buttons/x.png", gmenu2x->tr["Clear"]); btn = new IconButton(gmenu2x, "skin:imgs/buttons/x.png", gmenu2x->tr["Clear"]);
btnClear->setAction(MakeDelegate(this, &MenuSettingFile::clear)); btn->setAction(MakeDelegate(this, &MenuSettingFile::clear));
buttonBox.add(btn);
btnSelect = 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"]);
btnSelect->setAction(MakeDelegate(this, &MenuSettingFile::select)); btn->setAction(MakeDelegate(this, &MenuSettingFile::select));
buttonBox.add(btn);
} }
void MenuSettingFile::draw(int y) { void MenuSettingFile::draw(int y)
{
MenuSetting::draw(y); MenuSetting::draw(y);
gmenu2x->s->write( gmenu2x->font, value(), 155, y+gmenu2x->font->getHalfHeight(), SFontHAlignLeft, SFontVAlignMiddle ); gmenu2x->s->write( gmenu2x->font, value(), 155, y+gmenu2x->font->getHalfHeight(), SFontHAlignLeft, SFontVAlignMiddle );
} }
void MenuSettingFile::handleTS() { void MenuSettingFile::manageInput()
btnSelect->handleTS(); {
btnClear->handleTS(); if (gmenu2x->input[ACTION_X])
setValue("");
if (gmenu2x->input[ACTION_B])
select();
} }
void MenuSettingFile::manageInput() { void MenuSettingFile::clear()
if ( gmenu2x->input[ACTION_X] ) setValue(""); {
if ( gmenu2x->input[ACTION_B] ) select();
}
void MenuSettingFile::clear() {
setValue(""); setValue("");
} }
void MenuSettingFile::select() { void MenuSettingFile::select()
{
FileDialog fd(gmenu2x, description, filter, value()); FileDialog fd(gmenu2x, description, filter, value());
if (fd.exec()) setValue( fd.getPath()+"/"+fd.getFile() ); if (fd.exec())
setValue(fd.getPath()+"/"+fd.getFile());
} }
void MenuSettingFile::setValue(const string &value) { void MenuSettingFile::setValue(const string &value)
{
*_value = value; *_value = value;
} }
const string &MenuSettingFile::value() { const string &MenuSettingFile::value()
{
return *_value; return *_value;
} }
void MenuSettingFile::adjustInput() {} void MenuSettingFile::adjustInput() {}
void MenuSettingFile::drawSelected(int) {
gmenu2x->drawButton(btnClear,
gmenu2x->drawButton(btnSelect));
}
bool MenuSettingFile::edited() { bool MenuSettingFile::edited() {
return originalValue != value(); return originalValue != value();
} }

View File

@ -30,7 +30,6 @@ protected:
string originalValue; string originalValue;
string *_value; string *_value;
string filter; string filter;
IconButton *btnClear, *btnSelect;
void select(); void select();
void clear(); void clear();
@ -40,10 +39,8 @@ public:
virtual ~MenuSettingFile() {}; virtual ~MenuSettingFile() {};
virtual void draw(int y); virtual void draw(int y);
virtual void handleTS();
virtual void manageInput(); virtual void manageInput();
virtual void adjustInput(); virtual void adjustInput();
virtual void drawSelected(int y);
virtual bool edited(); virtual bool edited();
virtual void setValue(const string &value); virtual void setValue(const string &value);

View File

@ -25,7 +25,10 @@ using namespace std;
using namespace fastdelegate; using namespace fastdelegate;
MenuSettingInt::MenuSettingInt(GMenu2X *gmenu2x, const string &name, const string &description, int *value, int min, int max) MenuSettingInt::MenuSettingInt(GMenu2X *gmenu2x, const string &name, const string &description, int *value, int min, int max)
: MenuSetting(gmenu2x,name,description) { : MenuSetting(gmenu2x,name,description)
{
IconButton *btn;
_value = value; _value = value;
originalValue = *value; originalValue = *value;
this->min = min; this->min = min;
@ -36,45 +39,49 @@ MenuSettingInt::MenuSettingInt(GMenu2X *gmenu2x, const string &name, const strin
ButtonAction actionInc = MakeDelegate(this, &MenuSettingInt::inc); ButtonAction actionInc = MakeDelegate(this, &MenuSettingInt::inc);
ButtonAction actionDec = MakeDelegate(this, &MenuSettingInt::dec); ButtonAction actionDec = MakeDelegate(this, &MenuSettingInt::dec);
btnInc = new IconButton(gmenu2x, "skin:imgs/buttons/y.png", gmenu2x->tr["Increase value"]); btn = new IconButton(gmenu2x, "skin:imgs/buttons/left.png");
btnInc->setAction(actionInc); btn->setAction(actionDec);
buttonBox.add(btn);
btnDec = new IconButton(gmenu2x, "skin:imgs/buttons/x.png", gmenu2x->tr["Decrease value"]); btn = new IconButton(gmenu2x, "skin:imgs/buttons/y.png", gmenu2x->tr["Increase value"]);
btnDec->setAction(actionDec); btn->setAction(actionInc);
buttonBox.add(btn);
btnInc2 = new IconButton(gmenu2x, "skin:imgs/buttons/right.png"); btn = new IconButton(gmenu2x, "skin:imgs/buttons/right.png");
btnInc2->setAction(actionInc); btn->setAction(actionInc);
buttonBox.add(btn);
btnDec2 = new IconButton(gmenu2x, "skin:imgs/buttons/left.png"); btn = new IconButton(gmenu2x, "skin:imgs/buttons/x.png", gmenu2x->tr["Decrease value"]);
btnDec2->setAction(actionDec); btn->setAction(actionDec);
buttonBox.add(btn);
} }
void MenuSettingInt::draw(int y) { void MenuSettingInt::draw(int y)
{
MenuSetting::draw(y); MenuSetting::draw(y);
gmenu2x->s->write( gmenu2x->font, strvalue, 155, y+gmenu2x->font->getHalfHeight(), SFontHAlignLeft, SFontVAlignMiddle ); gmenu2x->s->write( gmenu2x->font, strvalue, 155, y+gmenu2x->font->getHalfHeight(), SFontHAlignLeft, SFontVAlignMiddle );
} }
void MenuSettingInt::handleTS() { void MenuSettingInt::manageInput()
btnInc->handleTS(); {
btnDec->handleTS(); if (gmenu2x->input[ACTION_LEFT ] || gmenu2x->input[ACTION_X])
btnInc2->handleTS(); dec();
btnDec2->handleTS(); if (gmenu2x->input[ACTION_RIGHT] || gmenu2x->input[ACTION_Y])
inc();
} }
void MenuSettingInt::manageInput() { void MenuSettingInt::inc()
if ( gmenu2x->input[ACTION_LEFT ] || gmenu2x->input[ACTION_X] ) dec(); {
if ( gmenu2x->input[ACTION_RIGHT] || gmenu2x->input[ACTION_Y] ) inc();
}
void MenuSettingInt::inc() {
setValue(value() + 1); setValue(value() + 1);
} }
void MenuSettingInt::dec() { void MenuSettingInt::dec()
{
setValue(value() - 1); setValue(value() - 1);
} }
void MenuSettingInt::setValue(int value) { void MenuSettingInt::setValue(int value)
{
*_value = constrain(value,min,max); *_value = constrain(value,min,max);
stringstream ss; stringstream ss;
ss << *_value; ss << *_value;
@ -82,24 +89,20 @@ void MenuSettingInt::setValue(int value) {
ss >> strvalue; ss >> strvalue;
} }
int MenuSettingInt::value() { int MenuSettingInt::value()
{
return *_value; return *_value;
} }
void MenuSettingInt::adjustInput() { void MenuSettingInt::adjustInput()
{
#ifdef TARGET_GP2X #ifdef TARGET_GP2X
gmenu2x->input.setInterval(30, ACTION_LEFT ); gmenu2x->input.setInterval(30, ACTION_LEFT );
gmenu2x->input.setInterval(30, ACTION_RIGHT); gmenu2x->input.setInterval(30, ACTION_RIGHT);
#endif #endif
} }
void MenuSettingInt::drawSelected(int) { bool MenuSettingInt::edited()
gmenu2x->drawButton(btnInc, {
gmenu2x->drawButton(btnInc2,
gmenu2x->drawButton(btnDec,
gmenu2x->drawButton(btnDec2)-10))-10);
}
bool MenuSettingInt::edited() {
return originalValue != value(); return originalValue != value();
} }

View File

@ -32,7 +32,6 @@ private:
int originalValue; int originalValue;
int *_value; int *_value;
string strvalue; string strvalue;
IconButton *btnInc, *btnDec, *btnInc2, *btnDec2;
void inc(); void inc();
void dec(); void dec();
@ -41,11 +40,9 @@ public:
MenuSettingInt(GMenu2X *gmenu2x, const string &name, const string &description, int *value, int min, int max); MenuSettingInt(GMenu2X *gmenu2x, const string &name, const string &description, int *value, int min, int max);
virtual ~MenuSettingInt() {}; virtual ~MenuSettingInt() {};
virtual void draw(int y);
virtual void handleTS();
virtual void manageInput(); virtual void manageInput();
virtual void adjustInput(); virtual void adjustInput();
virtual void drawSelected(int y); virtual void draw(int);
virtual bool edited(); virtual bool edited();
int min, max; int min, max;

View File

@ -24,56 +24,61 @@ using namespace std;
using namespace fastdelegate; using namespace fastdelegate;
MenuSettingMultiString::MenuSettingMultiString(GMenu2X *gmenu2x, const string &name, const string &description, string *value, vector<string> *choices) MenuSettingMultiString::MenuSettingMultiString(GMenu2X *gmenu2x, const string &name, const string &description, string *value, vector<string> *choices)
: MenuSetting(gmenu2x,name,description) { : MenuSetting(gmenu2x,name,description)
{
IconButton *btn;
this->choices = choices; this->choices = choices;
this->value = value; this->value = value;
originalValue = *value; originalValue = *value;
setSel( find(choices->begin(),choices->end(),*value)-choices->begin() ); setSel( find(choices->begin(),choices->end(),*value)-choices->begin() );
btnDec = new IconButton(gmenu2x, "skin:imgs/buttons/left.png"); btn = new IconButton(gmenu2x, "skin:imgs/buttons/left.png");
btnDec->setAction(MakeDelegate(this, &MenuSettingMultiString::decSel)); btn->setAction(MakeDelegate(this, &MenuSettingMultiString::decSel));
buttonBox.add(btn);
btnInc = new IconButton(gmenu2x, "skin:imgs/buttons/right.png", gmenu2x->tr["Change value"]); btn = new IconButton(gmenu2x, "skin:imgs/buttons/right.png", gmenu2x->tr["Change value"]);
btnInc->setAction(MakeDelegate(this, &MenuSettingMultiString::incSel)); btn->setAction(MakeDelegate(this, &MenuSettingMultiString::incSel));
buttonBox.add(btn);
} }
void MenuSettingMultiString::draw(int y) { void MenuSettingMultiString::draw(int y)
{
MenuSetting::draw(y); MenuSetting::draw(y);
gmenu2x->s->write( gmenu2x->font, *value, 155, y+gmenu2x->font->getHalfHeight(), SFontHAlignLeft, SFontVAlignMiddle ); gmenu2x->s->write( gmenu2x->font, *value, 155, y+gmenu2x->font->getHalfHeight(), SFontHAlignLeft, SFontVAlignMiddle );
} }
void MenuSettingMultiString::handleTS() { void MenuSettingMultiString::manageInput()
btnDec->handleTS(); {
btnInc->handleTS(); if (gmenu2x->input[ACTION_LEFT ])
decSel();
if (gmenu2x->input[ACTION_RIGHT])
incSel();
} }
void MenuSettingMultiString::manageInput() { void MenuSettingMultiString::incSel()
if ( gmenu2x->input[ACTION_LEFT ] ) decSel(); {
if ( gmenu2x->input[ACTION_RIGHT] ) incSel();
}
void MenuSettingMultiString::incSel() {
setSel(selected+1); setSel(selected+1);
} }
void MenuSettingMultiString::decSel() { void MenuSettingMultiString::decSel()
{
setSel(selected-1); setSel(selected-1);
} }
void MenuSettingMultiString::setSel(int sel) { void MenuSettingMultiString::setSel(int sel)
if (sel<0) sel = choices->size()-1; {
else if (sel>=(int)choices->size()) sel = 0; if (sel < 0)
sel = choices->size()-1;
else if (sel >= (int)choices->size())
sel = 0;
selected = sel; selected = sel;
*value = (*choices)[sel]; *value = (*choices)[sel];
} }
void MenuSettingMultiString::adjustInput() {} void MenuSettingMultiString::adjustInput() {}
void MenuSettingMultiString::drawSelected(int) { bool MenuSettingMultiString::edited()
gmenu2x->drawButton(btnInc, {
gmenu2x->drawButton(btnDec)-6);
}
bool MenuSettingMultiString::edited() {
return originalValue != *value; return originalValue != *value;
} }

View File

@ -42,10 +42,8 @@ public:
virtual ~MenuSettingMultiString() {}; virtual ~MenuSettingMultiString() {};
virtual void draw(int y); virtual void draw(int y);
virtual void handleTS();
virtual void manageInput(); virtual void manageInput();
virtual void adjustInput(); virtual void adjustInput();
virtual void drawSelected(int y);
virtual bool edited(); virtual bool edited();
}; };

View File

@ -25,6 +25,8 @@ using namespace fastdelegate;
MenuSettingRGBA::MenuSettingRGBA(GMenu2X *gmenu2x, const string &name, const string &description, RGBAColor *value) MenuSettingRGBA::MenuSettingRGBA(GMenu2X *gmenu2x, const string &name, const string &description, RGBAColor *value)
: MenuSetting(gmenu2x,name,description) { : MenuSetting(gmenu2x,name,description) {
IconButton *btn;
selPart = 0; selPart = 0;
_value = value; _value = value;
originalValue = *value; originalValue = *value;
@ -33,17 +35,21 @@ MenuSettingRGBA::MenuSettingRGBA(GMenu2X *gmenu2x, const string &name, const str
this->setB(this->value().b); this->setB(this->value().b);
this->setA(this->value().a); this->setA(this->value().a);
btnDec = new IconButton(gmenu2x, "skin:imgs/buttons/x.png", gmenu2x->tr["Decrease"]); btn = new IconButton(gmenu2x, "skin:imgs/buttons/x.png", gmenu2x->tr["Decrease"]);
btnDec->setAction(MakeDelegate(this, &MenuSettingRGBA::dec)); btn->setAction(MakeDelegate(this, &MenuSettingRGBA::dec));
buttonBox.add(btn);
btnInc = new IconButton(gmenu2x, "skin:imgs/buttons/y.png", gmenu2x->tr["Increase"]); btn = new IconButton(gmenu2x, "skin:imgs/buttons/y.png", gmenu2x->tr["Increase"]);
btnInc->setAction(MakeDelegate(this, &MenuSettingRGBA::inc)); btn->setAction(MakeDelegate(this, &MenuSettingRGBA::inc));
buttonBox.add(btn);
btnLeftComponent = new IconButton(gmenu2x, "skin:imgs/buttons/left.png"); btn = new IconButton(gmenu2x, "skin:imgs/buttons/left.png");
btnLeftComponent->setAction(MakeDelegate(this, &MenuSettingRGBA::leftComponent)); btn->setAction(MakeDelegate(this, &MenuSettingRGBA::leftComponent));
buttonBox.add(btn);
btnRightComponent = new IconButton(gmenu2x, "skin:imgs/buttons/right.png", gmenu2x->tr["Change color component"]); btn = new IconButton(gmenu2x, "skin:imgs/buttons/right.png", gmenu2x->tr["Change color component"]);
btnRightComponent->setAction(MakeDelegate(this, &MenuSettingRGBA::rightComponent)); btn->setAction(MakeDelegate(this, &MenuSettingRGBA::rightComponent));
buttonBox.add(btn);
} }
void MenuSettingRGBA::draw(int y) { void MenuSettingRGBA::draw(int y) {
@ -58,71 +64,83 @@ void MenuSettingRGBA::draw(int y) {
} }
void MenuSettingRGBA::handleTS() { void MenuSettingRGBA::handleTS() {
if (gmenu2x->ts.pressed()) if (gmenu2x->ts.pressed()) {
for (int i=0; i<4; i++) for (int i=0; i<4; i++) {
if (i!=selPart && gmenu2x->ts.inRect(166+i*36,y,36,14)) { if (i!=selPart && gmenu2x->ts.inRect(166+i*36,y,36,14)) {
selPart = i; selPart = i;
i = 4; i = 4;
} }
}
}
btnDec->handleTS(); MenuSetting::handleTS();
btnInc->handleTS();
btnLeftComponent->handleTS();
btnRightComponent->handleTS();
} }
void MenuSettingRGBA::manageInput() { void MenuSettingRGBA::manageInput() {
if ( gmenu2x->input[ACTION_Y ]) inc(); if (gmenu2x->input[ACTION_Y])
if ( gmenu2x->input[ACTION_X ]) dec(); inc();
if ( gmenu2x->input[ACTION_LEFT ]) leftComponent(); if (gmenu2x->input[ACTION_X])
if ( gmenu2x->input[ACTION_RIGHT]) rightComponent(); dec();
if (gmenu2x->input[ACTION_LEFT])
leftComponent();
if (gmenu2x->input[ACTION_RIGHT])
rightComponent();
} }
void MenuSettingRGBA::dec() { void MenuSettingRGBA::dec()
{
setSelPart(constrain(getSelPart()-1,0,255)); setSelPart(constrain(getSelPart()-1,0,255));
} }
void MenuSettingRGBA::inc() { void MenuSettingRGBA::inc()
{
setSelPart(constrain(getSelPart()+1,0,255)); setSelPart(constrain(getSelPart()+1,0,255));
} }
void MenuSettingRGBA::leftComponent() { void MenuSettingRGBA::leftComponent()
{
selPart = constrain(selPart-1,0,3); selPart = constrain(selPart-1,0,3);
} }
void MenuSettingRGBA::rightComponent() { void MenuSettingRGBA::rightComponent()
{
selPart = constrain(selPart+1,0,3); selPart = constrain(selPart+1,0,3);
} }
void MenuSettingRGBA::setR(unsigned short r) { void MenuSettingRGBA::setR(unsigned short r)
{
_value->r = r; _value->r = r;
stringstream ss; stringstream ss;
ss << r; ss << r;
ss >> strR; ss >> strR;
} }
void MenuSettingRGBA::setG(unsigned short g) { void MenuSettingRGBA::setG(unsigned short g)
{
_value->g = g; _value->g = g;
stringstream ss; stringstream ss;
ss << g; ss << g;
ss >> strG; ss >> strG;
} }
void MenuSettingRGBA::setB(unsigned short b) { void MenuSettingRGBA::setB(unsigned short b)
{
_value->b = b; _value->b = b;
stringstream ss; stringstream ss;
ss << b; ss << b;
ss >> strB; ss >> strB;
} }
void MenuSettingRGBA::setA(unsigned short a) { void MenuSettingRGBA::setA(unsigned short a)
{
_value->a = a; _value->a = a;
stringstream ss; stringstream ss;
ss << a; ss << a;
ss >> strA; ss >> strA;
} }
void MenuSettingRGBA::setSelPart(unsigned short value) { void MenuSettingRGBA::setSelPart(unsigned short value)
{
switch (selPart) { switch (selPart) {
default: case 0: setR(value); break; default: case 0: setR(value); break;
case 1: setG(value); break; case 1: setG(value); break;
@ -131,11 +149,13 @@ void MenuSettingRGBA::setSelPart(unsigned short value) {
} }
} }
RGBAColor MenuSettingRGBA::value() { RGBAColor MenuSettingRGBA::value()
{
return *_value; return *_value;
} }
unsigned short MenuSettingRGBA::getSelPart() { unsigned short MenuSettingRGBA::getSelPart()
{
switch (selPart) { switch (selPart) {
default: case 0: return value().r; default: case 0: return value().r;
case 1: return value().g; case 1: return value().g;
@ -144,7 +164,8 @@ unsigned short MenuSettingRGBA::getSelPart() {
} }
} }
void MenuSettingRGBA::adjustInput() { void MenuSettingRGBA::adjustInput()
{
#ifdef TARGET_GP2X #ifdef TARGET_GP2X
gmenu2x->input.setInterval(30, ACTION_Y ); gmenu2x->input.setInterval(30, ACTION_Y );
gmenu2x->input.setInterval(30, ACTION_X ); gmenu2x->input.setInterval(30, ACTION_X );
@ -152,16 +173,15 @@ void MenuSettingRGBA::adjustInput() {
#endif #endif
} }
void MenuSettingRGBA::drawSelected(int y) { void MenuSettingRGBA::drawSelected(int y)
{
int x = 166+selPart*36; int x = 166+selPart*36;
gmenu2x->s->box( x, y, 36, 14, gmenu2x->skinConfColors[COLOR_SELECTION_BG] ); gmenu2x->s->box( x, y, 36, 14, gmenu2x->skinConfColors[COLOR_SELECTION_BG] );
gmenu2x->drawButton(btnDec, MenuSetting::drawSelected(y);
gmenu2x->drawButton(btnInc,
gmenu2x->drawButton(btnRightComponent,
gmenu2x->drawButton(btnLeftComponent)-6)));
} }
bool MenuSettingRGBA::edited() { bool MenuSettingRGBA::edited()
{
return originalValue.r != value().r || originalValue.g != value().g || originalValue.b != value().b || originalValue.a != value().a; return originalValue.r != value().r || originalValue.g != value().g || originalValue.b != value().b || originalValue.a != value().a;
} }

View File

@ -33,7 +33,6 @@ private:
string strR, strG, strB, strA; string strR, strG, strB, strA;
RGBAColor originalValue; RGBAColor originalValue;
RGBAColor *_value; RGBAColor *_value;
IconButton *btnDec, *btnInc, *btnLeftComponent, *btnRightComponent;
void dec(); void dec();
void inc(); void inc();

View File

@ -25,57 +25,61 @@ 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(GMenu2X *gmenu2x, const string &name, const string &description, string *value, const string &diagTitle, const string &diagIcon)
: MenuSetting(gmenu2x,name,description) { : MenuSetting(gmenu2x, name, description)
{
IconButton *btn;
_value = value; _value = value;
originalValue = *value; originalValue = *value;
this->diagTitle = diagTitle; this->diagTitle = diagTitle;
this->diagIcon = diagIcon; this->diagIcon = diagIcon;
btnClear = new IconButton(gmenu2x, "skin:imgs/buttons/x.png", gmenu2x->tr["Clear"]); btn = new IconButton(gmenu2x, "skin:imgs/buttons/x.png", gmenu2x->tr["Clear"]);
btnClear->setAction(MakeDelegate(this, &MenuSettingString::clear)); btn->setAction(MakeDelegate(this, &MenuSettingString::clear));
buttonBox.add(btn);
btnEdit = new IconButton(gmenu2x, "skin:imgs/buttons/b.png", gmenu2x->tr["Edit"]); btn = new IconButton(gmenu2x, "skin:imgs/buttons/b.png", gmenu2x->tr["Edit"]);
btnEdit->setAction(MakeDelegate(this, &MenuSettingString::edit)); btn->setAction(MakeDelegate(this, &MenuSettingString::edit));
buttonBox.add(btn);
} }
void MenuSettingString::draw(int y) { void MenuSettingString::draw(int y)
{
MenuSetting::draw(y); MenuSetting::draw(y);
gmenu2x->s->write(gmenu2x->font, value(), 155, y+gmenu2x->font->getHalfHeight(), SFontHAlignLeft, SFontVAlignMiddle); gmenu2x->s->write(gmenu2x->font, value(), 155, y+gmenu2x->font->getHalfHeight(), SFontHAlignLeft, SFontVAlignMiddle);
} }
void MenuSettingString::handleTS() { void MenuSettingString::manageInput()
btnEdit->handleTS(); {
if (gmenu2x->input[ACTION_X])
clear();
if (gmenu2x->input[ACTION_B])
edit();
} }
void MenuSettingString::manageInput() { void MenuSettingString::setValue(const string &value)
if ( gmenu2x->input[ACTION_X] ) clear(); {
if ( gmenu2x->input[ACTION_B] ) edit();
}
void MenuSettingString::setValue(const string &value) {
*_value = value; *_value = value;
} }
const string &MenuSettingString::value() { const string &MenuSettingString::value()
{
return *_value; return *_value;
} }
void MenuSettingString::adjustInput() {} void MenuSettingString::adjustInput() {}
void MenuSettingString::clear() { void MenuSettingString::clear()
{
setValue(""); setValue("");
} }
void MenuSettingString::edit() { void MenuSettingString::edit()
{
InputDialog id(gmenu2x,description,value(), diagTitle,diagIcon); InputDialog id(gmenu2x,description,value(), diagTitle,diagIcon);
if (id.exec()) setValue(id.input); if (id.exec()) setValue(id.input);
} }
void MenuSettingString::drawSelected(int) {
gmenu2x->drawButton(btnClear,
gmenu2x->drawButton(btnEdit));
}
bool MenuSettingString::edited() { bool MenuSettingString::edited() {
return originalValue != value(); return originalValue != value();
} }

View File

@ -29,7 +29,6 @@ class MenuSettingString : public MenuSetting {
private: private:
string originalValue, diagTitle, diagIcon; string originalValue, diagTitle, diagIcon;
string *_value; string *_value;
IconButton *btnClear, *btnEdit;
void edit(); void edit();
void clear(); void clear();
@ -39,10 +38,8 @@ public:
virtual ~MenuSettingString() {}; virtual ~MenuSettingString() {};
virtual void draw(int y); virtual void draw(int y);
virtual void handleTS();
virtual void manageInput(); virtual void manageInput();
virtual void adjustInput(); virtual void adjustInput();
virtual void drawSelected(int y);
virtual bool edited(); virtual bool edited();
void setValue(const string &value); void setValue(const string &value);