1
0
mirror of git://projects.qi-hardware.com/gmenu2x.git synced 2024-11-23 04:29:41 +02:00

Drop incredibly dirty and huge file FastDelegate.h

It's way too over-engineered for what we need to do, and we can
do much simpler using C++11.
This commit is contained in:
Paul Cercueil 2013-07-29 12:58:25 -04:00
parent 9951ab2ab5
commit 88f54e1ccc
24 changed files with 72 additions and 2179 deletions

File diff suppressed because it is too large Load Diff

View File

@ -14,7 +14,7 @@ gmenu2x_SOURCES = asfont.cpp button.cpp cpu.cpp dirdialog.cpp filedialog.cpp \
browsedialog.cpp buttonbox.cpp dialog.cpp \ browsedialog.cpp buttonbox.cpp dialog.cpp \
imageio.cpp powersaver.cpp monitor.cpp mediamonitor.cpp clock.cpp imageio.cpp powersaver.cpp monitor.cpp mediamonitor.cpp clock.cpp
noinst_HEADERS = asfont.h button.h cpu.h dirdialog.h FastDelegate.h \ noinst_HEADERS = asfont.h button.h cpu.h dirdialog.h \
filedialog.h filelister.h gmenu2x.h gp2x.h iconbutton.h imagedialog.h \ filedialog.h filelister.h gmenu2x.h gp2x.h iconbutton.h imagedialog.h \
inputdialog.h inputmanager.h linkapp.h link.h \ inputdialog.h inputmanager.h linkapp.h link.h \
menu.h menusettingbool.h menusettingdir.h \ menu.h menusettingbool.h menusettingdir.h \

View File

@ -1,12 +1,10 @@
#include "browsedialog.h" #include "browsedialog.h"
#include "FastDelegate.h"
#include "filelister.h" #include "filelister.h"
#include "gmenu2x.h" #include "gmenu2x.h"
#include "iconbutton.h" #include "iconbutton.h"
#include "utilities.h" #include "utilities.h"
using namespace fastdelegate;
using std::string; using std::string;
BrowseDialog::BrowseDialog( BrowseDialog::BrowseDialog(
@ -23,19 +21,19 @@ BrowseDialog::BrowseDialog(
buttonBox.add(new IconButton(gmenu2x, ts, "skin:imgs/buttons/left.png")); buttonBox.add(new IconButton(gmenu2x, ts, "skin:imgs/buttons/left.png"));
btn = new IconButton(gmenu2x, ts, "skin:imgs/buttons/cancel.png", gmenu2x->tr["Up one folder"]); btn = new IconButton(gmenu2x, ts, "skin:imgs/buttons/cancel.png", gmenu2x->tr["Up one folder"]);
btn->setAction(MakeDelegate(this, &BrowseDialog::directoryUp)); btn->setAction(BIND(&BrowseDialog::directoryUp));
buttonBox.add(btn); buttonBox.add(btn);
btn = new IconButton(gmenu2x, ts, "skin:imgs/buttons/accept.png", gmenu2x->tr["Enter folder"]); btn = new IconButton(gmenu2x, ts, "skin:imgs/buttons/accept.png", gmenu2x->tr["Enter folder"]);
btn->setAction(MakeDelegate(this, &BrowseDialog::directoryEnter)); btn->setAction(BIND(&BrowseDialog::directoryEnter));
buttonBox.add(btn); buttonBox.add(btn);
btn = new IconButton(gmenu2x, ts, "skin:imgs/buttons/start.png", gmenu2x->tr["Confirm"]); btn = new IconButton(gmenu2x, ts, "skin:imgs/buttons/start.png", gmenu2x->tr["Confirm"]);
btn->setAction(MakeDelegate(this, &BrowseDialog::confirm)); btn->setAction(BIND(&BrowseDialog::confirm));
buttonBox.add(btn); buttonBox.add(btn);
btn = new IconButton(gmenu2x, ts, "skin:imgs/buttons/select.png", gmenu2x->tr["Exit"]); btn = new IconButton(gmenu2x, ts, "skin:imgs/buttons/select.png", gmenu2x->tr["Exit"]);
btn->setAction(MakeDelegate(this, &BrowseDialog::quit)); btn->setAction(BIND(&BrowseDialog::quit));
buttonBox.add(btn); buttonBox.add(btn);
iconGoUp = gmenu2x->sc.skinRes("imgs/go-up.png"); iconGoUp = gmenu2x->sc.skinRes("imgs/go-up.png");

View File

@ -1,12 +1,12 @@
#include "button.h" #include "button.h"
#include "delegate.h"
#include "gmenu2x.h" #include "gmenu2x.h"
using namespace std; using namespace std;
using namespace fastdelegate;
Button::Button(Touchscreen &ts_, bool doubleClick_) Button::Button(Touchscreen &ts_, bool doubleClick_)
: ts(ts_) : ts(ts_)
, action(MakeDelegate(this, &Button::voidAction)) , action(BIND(&Button::voidAction))
, rect((SDL_Rect) { 0, 0, 0, 0 }) , rect((SDL_Rect) { 0, 0, 0, 0 })
, doubleClick(doubleClick_) , doubleClick(doubleClick_)
, lastTick(0) , lastTick(0)
@ -64,6 +64,6 @@ void Button::setPosition(int x, int y) {
rect.y = y; rect.y = y;
} }
void Button::setAction(ButtonAction action) { void Button::setAction(function_t action) {
this->action = action; this->action = action;
} }

View File

@ -21,17 +21,16 @@
#ifndef BUTTON_H #ifndef BUTTON_H
#define BUTTON_H #define BUTTON_H
#include "FastDelegate.h" #include "delegate.h"
#include <SDL.h> #include <SDL.h>
typedef fastdelegate::FastDelegate0<> ButtonAction;
class Touchscreen; class Touchscreen;
class Button { class Button {
protected: protected:
Touchscreen &ts; Touchscreen &ts;
ButtonAction action; function_t action;
SDL_Rect rect; SDL_Rect rect;
bool doubleClick; bool doubleClick;
int lastTick; int lastTick;
@ -53,7 +52,7 @@ public:
void exec(); void exec();
void voidAction() {}; void voidAction() {};
void setAction(ButtonAction action); void setAction(function_t action);
}; };
#endif // BUTTON_H #endif // BUTTON_H

View File

@ -11,7 +11,7 @@
#define DEBUG_L 4 #define DEBUG_L 4
#ifndef LOG_LEVEL #ifndef LOG_LEVEL
#define LOG_LEVEL INFO_L #define LOG_LEVEL DEBUG_L
#endif #endif
// ------------- // -------------

10
src/delegate.h Normal file
View File

@ -0,0 +1,10 @@
#ifndef __DELEGATE_H__
#define __DELEGATE_H__
#include <functional>
typedef std::function<void(void)> function_t;
#define BIND(function) std::bind(function, this)
#endif /* __DELEGATE_H__ */

View File

@ -80,14 +80,12 @@
#include <sys/mman.h> #include <sys/mman.h>
typedef fastdelegate::FastDelegate0<> MenuAction;
struct MenuOption { struct MenuOption {
std::string text; std::string text;
MenuAction action; function_t action;
}; };
using namespace std; using namespace std;
using namespace fastdelegate;
#ifndef DEFAULT_WALLPAPER_PATH #ifndef DEFAULT_WALLPAPER_PATH
#define DEFAULT_WALLPAPER_PATH \ #define DEFAULT_WALLPAPER_PATH \
@ -378,17 +376,17 @@ void GMenu2X::initMenu() {
for (uint i=0; i<menu->getSections().size(); i++) { for (uint i=0; i<menu->getSections().size(); i++) {
//Add virtual links in the applications section //Add virtual links in the applications section
if (menu->getSections()[i]=="applications") { if (menu->getSections()[i]=="applications") {
menu->addActionLink(i,"Explorer",MakeDelegate(this,&GMenu2X::explorer),tr["Launch an application"],"skin:icons/explorer.png"); menu->addActionLink(i,"Explorer", BIND(&GMenu2X::explorer),tr["Launch an application"],"skin:icons/explorer.png");
} }
//Add virtual links in the setting section //Add virtual links in the setting section
else if (menu->getSections()[i]=="settings") { else if (menu->getSections()[i]=="settings") {
menu->addActionLink(i,"GMenu2X",MakeDelegate(this,&GMenu2X::options),tr["Configure GMenu2X's options"],"skin:icons/configure.png"); menu->addActionLink(i,"GMenu2X",BIND(&GMenu2X::options),tr["Configure GMenu2X's options"],"skin:icons/configure.png");
menu->addActionLink(i,tr["Skin"],MakeDelegate(this,&GMenu2X::skinMenu),tr["Configure skin"],"skin:icons/skin.png"); menu->addActionLink(i,tr["Skin"],BIND(&GMenu2X::skinMenu),tr["Configure skin"],"skin:icons/skin.png");
menu->addActionLink(i,tr["Wallpaper"],MakeDelegate(this,&GMenu2X::changeWallpaper),tr["Change GMenu2X wallpaper"],"skin:icons/wallpaper.png"); menu->addActionLink(i,tr["Wallpaper"],BIND(&GMenu2X::changeWallpaper),tr["Change GMenu2X wallpaper"],"skin:icons/wallpaper.png");
if (fileExists(getHome()+"/log.txt")) if (fileExists(getHome()+"/log.txt"))
menu->addActionLink(i,tr["Log Viewer"],MakeDelegate(this,&GMenu2X::viewLog),tr["Displays last launched program's output"],"skin:icons/ebook.png"); menu->addActionLink(i,tr["Log Viewer"],BIND(&GMenu2X::viewLog),tr["Displays last launched program's output"],"skin:icons/ebook.png");
menu->addActionLink(i,tr["About"],MakeDelegate(this,&GMenu2X::about),tr["Info about GMenu2X"],"skin:icons/about.png"); menu->addActionLink(i,tr["About"],BIND(&GMenu2X::about),tr["Info about GMenu2X"],"skin:icons/about.png");
} }
} }
@ -625,7 +623,7 @@ void GMenu2X::main() {
IconButton btnContextMenu(this, ts, "skin:imgs/menu.png"); IconButton btnContextMenu(this, ts, "skin:imgs/menu.png");
btnContextMenu.setPosition(resX-38, bottomBarIconY); btnContextMenu.setPosition(resX-38, bottomBarIconY);
btnContextMenu.setAction(MakeDelegate(this, &GMenu2X::contextMenu)); btnContextMenu.setAction(BIND(&GMenu2X::contextMenu));
if (!fileExists(CARD_ROOT)) if (!fileExists(CARD_ROOT))
CARD_ROOT = ""; CARD_ROOT = "";
@ -1002,7 +1000,7 @@ void GMenu2X::showManual() {
void GMenu2X::contextMenu() { void GMenu2X::contextMenu() {
vector<MenuOption> voices; vector<MenuOption> voices;
{ {
MenuOption opt = {tr.translate("Add link in $1",menu->selSection().c_str(),NULL), MakeDelegate(this, &GMenu2X::addLink)}; MenuOption opt = {tr.translate("Add link in $1",menu->selSection().c_str(),NULL), BIND(&GMenu2X::addLink)};
voices.push_back(opt); voices.push_back(opt);
} }
@ -1010,7 +1008,7 @@ void GMenu2X::contextMenu() {
LinkApp* app = menu->selLinkApp(); LinkApp* app = menu->selLinkApp();
if (app && !app->getManual().empty()) { if (app && !app->getManual().empty()) {
MenuOption opt = {tr.translate("Show manual of $1",menu->selLink()->getTitle().c_str(),NULL), MenuOption opt = {tr.translate("Show manual of $1",menu->selLink()->getTitle().c_str(),NULL),
MakeDelegate(this, &GMenu2X::showManual), BIND(&GMenu2X::showManual),
}; };
voices.push_back(opt); voices.push_back(opt);
} }
@ -1028,29 +1026,29 @@ void GMenu2X::contextMenu() {
!menu->selLinkApp()->getSelectorDir().empty()) !menu->selLinkApp()->getSelectorDir().empty())
#endif #endif
{ {
MenuOption opt = {tr.translate("Edit $1",menu->selLink()->getTitle().c_str(),NULL), MakeDelegate(this, &GMenu2X::editLink)}; MenuOption opt = {tr.translate("Edit $1",menu->selLink()->getTitle().c_str(),NULL), BIND(&GMenu2X::editLink)};
voices.push_back(opt); voices.push_back(opt);
} }
#ifdef HAVE_LIBOPK #ifdef HAVE_LIBOPK
if (!menu->selLinkApp()->isOpk()) if (!menu->selLinkApp()->isOpk())
#endif #endif
{ {
MenuOption opt = {tr.translate("Delete $1 link",menu->selLink()->getTitle().c_str(),NULL), MakeDelegate(this, &GMenu2X::deleteLink)}; MenuOption opt = {tr.translate("Delete $1 link",menu->selLink()->getTitle().c_str(),NULL), BIND(&GMenu2X::deleteLink)};
voices.push_back(opt); voices.push_back(opt);
} }
} }
{ {
MenuOption opt = {tr["Add section"], MakeDelegate(this, &GMenu2X::addSection)}; MenuOption opt = {tr["Add section"], BIND(&GMenu2X::addSection)};
voices.push_back(opt); voices.push_back(opt);
}{ }{
MenuOption opt = {tr["Rename section"], MakeDelegate(this, &GMenu2X::renameSection)}; MenuOption opt = {tr["Rename section"], BIND(&GMenu2X::renameSection)};
voices.push_back(opt); voices.push_back(opt);
}{ }{
MenuOption opt = {tr["Delete section"], MakeDelegate(this, &GMenu2X::deleteSection)}; MenuOption opt = {tr["Delete section"], BIND(&GMenu2X::deleteSection)};
voices.push_back(opt); voices.push_back(opt);
}{ }{
MenuOption opt = {tr["Scan for applications and games"], MakeDelegate(this, &GMenu2X::scanner)}; MenuOption opt = {tr["Scan for applications and games"], BIND(&GMenu2X::scanner)};
voices.push_back(opt); voices.push_back(opt);
} }

View File

@ -23,7 +23,6 @@
#include "surfacecollection.h" #include "surfacecollection.h"
#include "translator.h" #include "translator.h"
#include "FastDelegate.h"
#include "touchscreen.h" #include "touchscreen.h"
#include "inputmanager.h" #include "inputmanager.h"
#include "surface.h" #include "surface.h"

View File

@ -5,7 +5,6 @@
#include "surface.h" #include "surface.h"
using namespace std; using namespace std;
using namespace fastdelegate;
IconButton::IconButton( IconButton::IconButton(
GMenu2X *gmenu2x_, Touchscreen &ts_, GMenu2X *gmenu2x_, Touchscreen &ts_,
@ -68,6 +67,6 @@ void IconButton::recalcSize() {
setSize(w, h); setSize(w, h);
} }
void IconButton::setAction(ButtonAction action) { void IconButton::setAction(function_t action) {
this->action = action; this->action = action;
} }

View File

@ -19,7 +19,7 @@ public:
virtual void setPosition(int x, int y); virtual void setPosition(int x, int y);
void setAction(ButtonAction action); void setAction(function_t action);
private: private:
void updateSurfaces(); void updateSurfaces();

View File

@ -21,6 +21,7 @@
#include "inputdialog.h" #include "inputdialog.h"
#include "buttonbox.h" #include "buttonbox.h"
#include "delegate.h"
#include "gmenu2x.h" #include "gmenu2x.h"
#include "iconbutton.h" #include "iconbutton.h"
#include "utilities.h" #include "utilities.h"
@ -28,7 +29,6 @@
#include <SDL_gfxPrimitives.h> #include <SDL_gfxPrimitives.h>
using namespace std; using namespace std;
using namespace fastdelegate;
#define KEY_WIDTH 20 #define KEY_WIDTH 20
#define KEY_HEIGHT 20 #define KEY_HEIGHT 20
@ -96,22 +96,22 @@ InputDialog::InputDialog(GMenu2X *gmenu2x, InputManager &inputMgr_,
buttonbox = new ButtonBox(gmenu2x); buttonbox = new ButtonBox(gmenu2x);
IconButton *btnBackspace = new IconButton(gmenu2x, ts, IconButton *btnBackspace = new IconButton(gmenu2x, ts,
"skin:imgs/buttons/l.png", gmenu2x->tr["Backspace"]); "skin:imgs/buttons/l.png", gmenu2x->tr["Backspace"]);
btnBackspace->setAction(MakeDelegate(this, &InputDialog::backspace)); btnBackspace->setAction(BIND(&InputDialog::backspace));
buttonbox->add(btnBackspace); buttonbox->add(btnBackspace);
IconButton *btnSpace = new IconButton(gmenu2x, ts, IconButton *btnSpace = new IconButton(gmenu2x, ts,
"skin:imgs/buttons/r.png", gmenu2x->tr["Space"]); "skin:imgs/buttons/r.png", gmenu2x->tr["Space"]);
btnSpace->setAction(MakeDelegate(this, &InputDialog::space)); btnSpace->setAction(BIND(&InputDialog::space));
buttonbox->add(btnSpace); buttonbox->add(btnSpace);
IconButton *btnConfirm = new IconButton(gmenu2x, ts, IconButton *btnConfirm = new IconButton(gmenu2x, ts,
"skin:imgs/buttons/accept.png", gmenu2x->tr["Confirm"]); "skin:imgs/buttons/accept.png", gmenu2x->tr["Confirm"]);
btnConfirm->setAction(MakeDelegate(this, &InputDialog::confirm)); btnConfirm->setAction(BIND(&InputDialog::confirm));
buttonbox->add(btnConfirm); buttonbox->add(btnConfirm);
IconButton *btnChangeKeys = new IconButton(gmenu2x, ts, IconButton *btnChangeKeys = new IconButton(gmenu2x, ts,
"skin:imgs/buttons/cancel.png", gmenu2x->tr["Change keys"]); "skin:imgs/buttons/cancel.png", gmenu2x->tr["Change keys"]);
btnChangeKeys->setAction(MakeDelegate(this, &InputDialog::changeKeys)); btnChangeKeys->setAction(BIND(&InputDialog::changeKeys));
buttonbox->add(btnChangeKeys); buttonbox->add(btnChangeKeys);
} }

View File

@ -30,7 +30,7 @@
using namespace std; using namespace std;
Link::Link(GMenu2X *gmenu2x_, Touchscreen &ts, LinkRunAction action_) Link::Link(GMenu2X *gmenu2x_, Touchscreen &ts, function_t action_)
: Button(ts, true) : Button(ts, true)
, action(action_) , action(action_)
, gmenu2x(gmenu2x_) , gmenu2x(gmenu2x_)

View File

@ -22,15 +22,13 @@
#define LINK_H #define LINK_H
#include "button.h" #include "button.h"
#include "FastDelegate.h" #include "delegate.h"
#include <string> #include <string>
class GMenu2X; class GMenu2X;
class Surface; class Surface;
typedef fastdelegate::FastDelegate0<> LinkRunAction;
/** /**
Base class that represents a link on screen. Base class that represents a link on screen.
@ -39,7 +37,7 @@ Base class that represents a link on screen.
*/ */
class Link : public Button { class Link : public Button {
private: private:
LinkRunAction action; function_t action;
uint iconX, padding; uint iconX, padding;
protected: protected:
@ -54,7 +52,7 @@ protected:
void updateSurfaces(); void updateSurfaces();
public: public:
Link(GMenu2X *gmenu2x, Touchscreen &ts, LinkRunAction action); Link(GMenu2X *gmenu2x, Touchscreen &ts, function_t action);
virtual ~Link() {}; virtual ~Link() {};
virtual void paint(); virtual void paint();

View File

@ -21,6 +21,7 @@
#include "linkapp.h" #include "linkapp.h"
#include "debug.h" #include "debug.h"
#include "delegate.h"
#include "gmenu2x.h" #include "gmenu2x.h"
#include "menu.h" #include "menu.h"
#include "selector.h" #include "selector.h"
@ -50,7 +51,6 @@
#include <xdgmime.h> #include <xdgmime.h>
#endif #endif
using fastdelegate::MakeDelegate;
using namespace std; using namespace std;
static const char *tokens[] = { "%f", "%F", "%u", "%U", }; static const char *tokens[] = { "%f", "%F", "%u", "%U", };
@ -62,7 +62,7 @@ LinkApp::LinkApp(GMenu2X *gmenu2x_, Touchscreen &ts, InputManager &inputMgr_,
LinkApp::LinkApp(GMenu2X *gmenu2x_, Touchscreen &ts, InputManager &inputMgr_, LinkApp::LinkApp(GMenu2X *gmenu2x_, Touchscreen &ts, InputManager &inputMgr_,
const char* linkfile) const char* linkfile)
#endif #endif
: Link(gmenu2x_, ts, MakeDelegate(this, &LinkApp::start)) : Link(gmenu2x_, ts, BIND(&LinkApp::start))
, inputMgr(inputMgr_) , inputMgr(inputMgr_)
{ {
manual = ""; manual = "";

View File

@ -198,7 +198,7 @@ void Menu::setSectionIndex(int i) {
/*==================================== /*====================================
LINKS MANAGEMENT LINKS MANAGEMENT
====================================*/ ====================================*/
bool Menu::addActionLink(uint section, const string &title, LinkRunAction action, const string &description, const string &icon) { bool Menu::addActionLink(uint section, const string &title, function_t action, const string &description, const string &icon) {
if (section>=sections.size()) return false; if (section>=sections.size()) return false;
Link *link = new Link(gmenu2x, ts, action); Link *link = new Link(gmenu2x, ts, action);

View File

@ -22,6 +22,7 @@
#define MENU_H #define MENU_H
#include "link.h" #include "link.h"
#include "delegate.h"
#include <string> #include <string>
#include <vector> #include <vector>
@ -85,7 +86,7 @@ public:
uint firstDispRow(); uint firstDispRow();
bool addActionLink(uint section, const std::string &title, bool addActionLink(uint section, const std::string &title,
LinkRunAction action, const std::string &description="", function_t action, const std::string &description="",
const std::string &icon=""); const std::string &icon="");
bool addLink(std::string path, std::string file, std::string section=""); bool addLink(std::string path, std::string file, std::string section="");
bool addSection(const std::string &sectionName); bool addSection(const std::string &sectionName);

View File

@ -20,6 +20,7 @@
#include "menusettingbool.h" #include "menusettingbool.h"
#include "delegate.h"
#include "gmenu2x.h" #include "gmenu2x.h"
#include "iconbutton.h" #include "iconbutton.h"
#include "utilities.h" #include "utilities.h"
@ -27,7 +28,6 @@
#include <sstream> #include <sstream>
using std::string; using std::string;
using fastdelegate::MakeDelegate;
MenuSettingBool::MenuSettingBool( MenuSettingBool::MenuSettingBool(
GMenu2X *gmenu2x, Touchscreen &ts, GMenu2X *gmenu2x, Touchscreen &ts,
@ -60,7 +60,7 @@ void MenuSettingBool::initButton()
IconButton *btn = new IconButton(gmenu2x, ts, IconButton *btn = new IconButton(gmenu2x, ts,
"skin:imgs/buttons/accept.png", "skin:imgs/buttons/accept.png",
gmenu2x->tr["Switch"]); gmenu2x->tr["Switch"]);
btn->setAction(MakeDelegate(this, &MenuSettingBool::toggle)); btn->setAction(BIND(&MenuSettingBool::toggle));
buttonBox.add(btn); buttonBox.add(btn);
} }

View File

@ -20,12 +20,12 @@
#include "menusettingdir.h" #include "menusettingdir.h"
#include "delegate.h"
#include "dirdialog.h" #include "dirdialog.h"
#include "gmenu2x.h" #include "gmenu2x.h"
#include "iconbutton.h" #include "iconbutton.h"
using std::string; using std::string;
using fastdelegate::MakeDelegate;
MenuSettingDir::MenuSettingDir( MenuSettingDir::MenuSettingDir(
GMenu2X *gmenu2x, Touchscreen &ts_, GMenu2X *gmenu2x, Touchscreen &ts_,
@ -37,12 +37,12 @@ MenuSettingDir::MenuSettingDir(
btn = new IconButton(gmenu2x, ts, "skin:imgs/buttons/cancel.png", btn = new IconButton(gmenu2x, ts, "skin:imgs/buttons/cancel.png",
gmenu2x->tr["Clear"]); gmenu2x->tr["Clear"]);
btn->setAction(MakeDelegate(this, &MenuSettingDir::clear)); btn->setAction(BIND(&MenuSettingDir::clear));
buttonBox.add(btn); buttonBox.add(btn);
btn = new IconButton(gmenu2x, ts, "skin:imgs/buttons/accept.png", btn = new IconButton(gmenu2x, ts, "skin:imgs/buttons/accept.png",
gmenu2x->tr["Select a directory"]); gmenu2x->tr["Select a directory"]);
btn->setAction(MakeDelegate(this, &MenuSettingDir::edit)); btn->setAction(BIND(&MenuSettingDir::edit));
buttonBox.add(btn); buttonBox.add(btn);
} }

View File

@ -20,12 +20,12 @@
#include "menusettingfile.h" #include "menusettingfile.h"
#include "delegate.h"
#include "filedialog.h" #include "filedialog.h"
#include "gmenu2x.h" #include "gmenu2x.h"
#include "iconbutton.h" #include "iconbutton.h"
using std::string; using std::string;
using fastdelegate::MakeDelegate;
MenuSettingFile::MenuSettingFile( MenuSettingFile::MenuSettingFile(
GMenu2X *gmenu2x, Touchscreen &ts_, GMenu2X *gmenu2x, Touchscreen &ts_,
@ -38,11 +38,11 @@ MenuSettingFile::MenuSettingFile(
IconButton *btn; IconButton *btn;
btn = new IconButton(gmenu2x, ts, "skin:imgs/buttons/cancel.png", gmenu2x->tr["Clear"]); btn = new IconButton(gmenu2x, ts, "skin:imgs/buttons/cancel.png", gmenu2x->tr["Clear"]);
btn->setAction(MakeDelegate(this, &MenuSettingFile::clear)); btn->setAction(BIND(&MenuSettingFile::clear));
buttonBox.add(btn); buttonBox.add(btn);
btn = new IconButton(gmenu2x, ts, "skin:imgs/buttons/accept.png", gmenu2x->tr["Select a file"]); btn = new IconButton(gmenu2x, ts, "skin:imgs/buttons/accept.png", gmenu2x->tr["Select a file"]);
btn->setAction(MakeDelegate(this, &MenuSettingFile::edit)); btn->setAction(BIND(&MenuSettingFile::edit));
buttonBox.add(btn); buttonBox.add(btn);
} }

View File

@ -20,6 +20,7 @@
#include "menusettingint.h" #include "menusettingint.h"
#include "delegate.h"
#include "gmenu2x.h" #include "gmenu2x.h"
#include "iconbutton.h" #include "iconbutton.h"
#include "utilities.h" #include "utilities.h"
@ -28,7 +29,6 @@
using std::string; using std::string;
using std::stringstream; using std::stringstream;
using fastdelegate::MakeDelegate;
MenuSettingInt::MenuSettingInt( MenuSettingInt::MenuSettingInt(
GMenu2X *gmenu2x, Touchscreen &ts, GMenu2X *gmenu2x, Touchscreen &ts,
@ -46,8 +46,8 @@ MenuSettingInt::MenuSettingInt(
setValue(this->value()); setValue(this->value());
//Delegates //Delegates
ButtonAction actionInc = MakeDelegate(this, &MenuSettingInt::inc); function_t actionInc = BIND(&MenuSettingInt::inc);
ButtonAction actionDec = MakeDelegate(this, &MenuSettingInt::dec); function_t actionDec = BIND(&MenuSettingInt::dec);
btn = new IconButton(gmenu2x, ts, "skin:imgs/buttons/l.png"); btn = new IconButton(gmenu2x, ts, "skin:imgs/buttons/l.png");
btn->setAction(actionDec); btn->setAction(actionDec);

View File

@ -17,17 +17,17 @@
* Free Software Foundation, Inc., * * Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/ ***************************************************************************/
#include "delegate.h"
#include "menusettingmultistring.h" #include "menusettingmultistring.h"
#include "gmenu2x.h" #include "gmenu2x.h"
#include "iconbutton.h" #include "iconbutton.h"
#include "FastDelegate.h"
#include <algorithm> #include <algorithm>
using std::find; using std::find;
using std::string; using std::string;
using std::vector; using std::vector;
using fastdelegate::MakeDelegate;
MenuSettingMultiString::MenuSettingMultiString( MenuSettingMultiString::MenuSettingMultiString(
GMenu2X *gmenu2x, Touchscreen &ts, GMenu2X *gmenu2x, Touchscreen &ts,
@ -41,11 +41,11 @@ MenuSettingMultiString::MenuSettingMultiString(
IconButton *btn; IconButton *btn;
btn = new IconButton(gmenu2x, ts, "skin:imgs/buttons/left.png"); btn = new IconButton(gmenu2x, ts, "skin:imgs/buttons/left.png");
btn->setAction(MakeDelegate(this, &MenuSettingMultiString::decSel)); btn->setAction(BIND(&MenuSettingMultiString::decSel));
buttonBox.add(btn); buttonBox.add(btn);
btn = new IconButton(gmenu2x, ts, "skin:imgs/buttons/right.png", gmenu2x->tr["Change value"]); btn = new IconButton(gmenu2x, ts, "skin:imgs/buttons/right.png", gmenu2x->tr["Change value"]);
btn->setAction(MakeDelegate(this, &MenuSettingMultiString::incSel)); btn->setAction(BIND(&MenuSettingMultiString::incSel));
buttonBox.add(btn); buttonBox.add(btn);
} }

View File

@ -28,7 +28,6 @@
using std::string; using std::string;
using std::stringstream; using std::stringstream;
using fastdelegate::MakeDelegate;
MenuSettingRGBA::MenuSettingRGBA( MenuSettingRGBA::MenuSettingRGBA(
GMenu2X *gmenu2x, Touchscreen &ts_, GMenu2X *gmenu2x, Touchscreen &ts_,

View File

@ -20,12 +20,12 @@
#include "menusettingstring.h" #include "menusettingstring.h"
#include "delegate.h"
#include "gmenu2x.h" #include "gmenu2x.h"
#include "iconbutton.h" #include "iconbutton.h"
#include "inputdialog.h" #include "inputdialog.h"
using std::string; using std::string;
using fastdelegate::MakeDelegate;
MenuSettingString::MenuSettingString( MenuSettingString::MenuSettingString(
GMenu2X *gmenu2x, Touchscreen &ts_, GMenu2X *gmenu2x, Touchscreen &ts_,
@ -39,11 +39,11 @@ MenuSettingString::MenuSettingString(
IconButton *btn; IconButton *btn;
btn = new IconButton(gmenu2x, ts, "skin:imgs/buttons/cancel.png", gmenu2x->tr["Clear"]); btn = new IconButton(gmenu2x, ts, "skin:imgs/buttons/cancel.png", gmenu2x->tr["Clear"]);
btn->setAction(MakeDelegate(this, &MenuSettingString::clear)); btn->setAction(BIND(&MenuSettingString::clear));
buttonBox.add(btn); buttonBox.add(btn);
btn = new IconButton(gmenu2x, ts, "skin:imgs/buttons/accept.png", gmenu2x->tr["Edit"]); btn = new IconButton(gmenu2x, ts, "skin:imgs/buttons/accept.png", gmenu2x->tr["Edit"]);
btn->setAction(MakeDelegate(this, &MenuSettingString::edit)); btn->setAction(BIND(&MenuSettingString::edit));
buttonBox.add(btn); buttonBox.add(btn);
} }