mirror of
git://projects.qi-hardware.com/gmenu2x.git
synced 2024-11-22 12:30:18 +02:00
Removed "delegate.h"
The abstraction it provided was so thin that I think it is simpler to just have the code use std::bind directly.
This commit is contained in:
parent
7e308879c1
commit
fe0db484ec
@ -6,6 +6,7 @@
|
|||||||
#include "surface.h"
|
#include "surface.h"
|
||||||
#include "utilities.h"
|
#include "utilities.h"
|
||||||
|
|
||||||
|
using std::bind;
|
||||||
using std::string;
|
using std::string;
|
||||||
using std::unique_ptr;
|
using std::unique_ptr;
|
||||||
|
|
||||||
@ -23,22 +24,22 @@ BrowseDialog::BrowseDialog(
|
|||||||
buttonBox.add(unique_ptr<IconButton>(new IconButton(
|
buttonBox.add(unique_ptr<IconButton>(new IconButton(
|
||||||
gmenu2x, ts, "skin:imgs/buttons/cancel.png",
|
gmenu2x, ts, "skin:imgs/buttons/cancel.png",
|
||||||
gmenu2x->tr["Up one folder"],
|
gmenu2x->tr["Up one folder"],
|
||||||
BIND(&BrowseDialog::directoryUp))));
|
bind(&BrowseDialog::directoryUp, this))));
|
||||||
|
|
||||||
buttonBox.add(unique_ptr<IconButton>(new IconButton(
|
buttonBox.add(unique_ptr<IconButton>(new IconButton(
|
||||||
gmenu2x, ts, "skin:imgs/buttons/accept.png",
|
gmenu2x, ts, "skin:imgs/buttons/accept.png",
|
||||||
gmenu2x->tr["Select"],
|
gmenu2x->tr["Select"],
|
||||||
BIND(&BrowseDialog::directoryEnter))));
|
bind(&BrowseDialog::directoryEnter, this))));
|
||||||
|
|
||||||
buttonBox.add(unique_ptr<IconButton>(new IconButton(
|
buttonBox.add(unique_ptr<IconButton>(new IconButton(
|
||||||
gmenu2x, ts, "skin:imgs/buttons/start.png",
|
gmenu2x, ts, "skin:imgs/buttons/start.png",
|
||||||
gmenu2x->tr["Confirm"],
|
gmenu2x->tr["Confirm"],
|
||||||
BIND(&BrowseDialog::confirm))));
|
bind(&BrowseDialog::confirm, this))));
|
||||||
|
|
||||||
buttonBox.add(unique_ptr<IconButton>(new IconButton(
|
buttonBox.add(unique_ptr<IconButton>(new IconButton(
|
||||||
gmenu2x, ts, "skin:imgs/buttons/select.png",
|
gmenu2x, ts, "skin:imgs/buttons/select.png",
|
||||||
gmenu2x->tr["Exit"],
|
gmenu2x->tr["Exit"],
|
||||||
BIND(&BrowseDialog::quit))));
|
bind(&BrowseDialog::quit, this))));
|
||||||
|
|
||||||
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");
|
||||||
|
@ -3,20 +3,21 @@
|
|||||||
|
|
||||||
#include "contextmenu.h"
|
#include "contextmenu.h"
|
||||||
|
|
||||||
#include "delegate.h"
|
|
||||||
#include "gmenu2x.h"
|
#include "gmenu2x.h"
|
||||||
#include "linkapp.h"
|
#include "linkapp.h"
|
||||||
#include "menu.h"
|
#include "menu.h"
|
||||||
#include "utilities.h"
|
#include "utilities.h"
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
#include <functional>
|
||||||
|
|
||||||
|
|
||||||
struct ContextMenu::MenuOption {
|
struct ContextMenu::MenuOption {
|
||||||
MenuOption(std::string text, function_t action)
|
typedef std::function<void(void)> Action;
|
||||||
|
MenuOption(std::string text, Action action)
|
||||||
: text(text), action(action) {}
|
: text(text), action(action) {}
|
||||||
std::string text;
|
std::string text;
|
||||||
function_t action;
|
Action action;
|
||||||
};
|
};
|
||||||
|
|
||||||
ContextMenu::ContextMenu(GMenu2X &gmenu2x, Menu &menu)
|
ContextMenu::ContextMenu(GMenu2X &gmenu2x, Menu &menu)
|
||||||
|
@ -1,10 +0,0 @@
|
|||||||
#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__ */
|
|
@ -381,17 +381,36 @@ 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", BIND(&GMenu2X::explorer),tr["Launch an application"],"skin:icons/explorer.png");
|
menu->addActionLink(i, "Explorer",
|
||||||
|
bind(&GMenu2X::explorer, this),
|
||||||
|
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",BIND(&GMenu2X::showSettings),tr["Configure GMenu2X's options"],"skin:icons/configure.png");
|
menu->addActionLink(i, "GMenu2X",
|
||||||
menu->addActionLink(i,tr["Skin"],BIND(&GMenu2X::skinMenu),tr["Configure skin"],"skin:icons/skin.png");
|
bind(&GMenu2X::showSettings, this),
|
||||||
menu->addActionLink(i,tr["Wallpaper"],BIND(&GMenu2X::changeWallpaper),tr["Change GMenu2X wallpaper"],"skin:icons/wallpaper.png");
|
tr["Configure GMenu2X's options"],
|
||||||
if (fileExists(LOG_FILE))
|
"skin:icons/configure.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["Skin"],
|
||||||
menu->addActionLink(i,tr["About"],BIND(&GMenu2X::about),tr["Info about GMenu2X"],"skin:icons/about.png");
|
bind(&GMenu2X::skinMenu, this),
|
||||||
|
tr["Configure skin"],
|
||||||
|
"skin:icons/skin.png");
|
||||||
|
menu->addActionLink(i, tr["Wallpaper"],
|
||||||
|
bind(&GMenu2X::changeWallpaper, this),
|
||||||
|
tr["Change GMenu2X wallpaper"],
|
||||||
|
"skin:icons/wallpaper.png");
|
||||||
|
if (fileExists(LOG_FILE)) {
|
||||||
|
menu->addActionLink(i, tr["Log Viewer"],
|
||||||
|
bind(&GMenu2X::viewLog, this),
|
||||||
|
tr["Displays last launched program's output"],
|
||||||
|
"skin:icons/ebook.png");
|
||||||
|
}
|
||||||
|
menu->addActionLink(i, tr["About"],
|
||||||
|
bind(&GMenu2X::about, this),
|
||||||
|
tr["Info about GMenu2X"],
|
||||||
|
"skin:icons/about.png");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -9,7 +9,7 @@ using namespace std;
|
|||||||
|
|
||||||
IconButton::IconButton(
|
IconButton::IconButton(
|
||||||
GMenu2X *gmenu2x, Touchscreen &ts,
|
GMenu2X *gmenu2x, Touchscreen &ts,
|
||||||
const string &icon, const string &label, function_t action)
|
const string &icon, const string &label, Action action)
|
||||||
: gmenu2x(gmenu2x)
|
: gmenu2x(gmenu2x)
|
||||||
, ts(ts)
|
, ts(ts)
|
||||||
, icon(icon)
|
, icon(icon)
|
||||||
|
@ -1,10 +1,11 @@
|
|||||||
#ifndef ICONBUTTON_H
|
#ifndef ICONBUTTON_H
|
||||||
#define ICONBUTTON_H
|
#define ICONBUTTON_H
|
||||||
|
|
||||||
#include "delegate.h"
|
|
||||||
#include "gmenu2x.h"
|
#include "gmenu2x.h"
|
||||||
|
|
||||||
#include <SDL.h>
|
#include <SDL.h>
|
||||||
|
|
||||||
|
#include <functional>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
class OffscreenSurface;
|
class OffscreenSurface;
|
||||||
@ -14,9 +15,11 @@ class Touchscreen;
|
|||||||
|
|
||||||
class IconButton {
|
class IconButton {
|
||||||
public:
|
public:
|
||||||
|
typedef std::function<void(void)> Action;
|
||||||
|
|
||||||
IconButton(GMenu2X *gmenu2x, Touchscreen &ts,
|
IconButton(GMenu2X *gmenu2x, Touchscreen &ts,
|
||||||
const std::string &icon, const std::string &label = "",
|
const std::string &icon, const std::string &label = "",
|
||||||
function_t action = nullptr);
|
Action action = nullptr);
|
||||||
|
|
||||||
SDL_Rect getRect() { return rect; }
|
SDL_Rect getRect() { return rect; }
|
||||||
void setPosition(int x, int y);
|
void setPosition(int x, int y);
|
||||||
@ -31,7 +34,7 @@ private:
|
|||||||
GMenu2X *gmenu2x;
|
GMenu2X *gmenu2x;
|
||||||
Touchscreen &ts;
|
Touchscreen &ts;
|
||||||
std::string icon, label;
|
std::string icon, label;
|
||||||
function_t action;
|
Action action;
|
||||||
|
|
||||||
SDL_Rect rect, iconRect, labelRect;
|
SDL_Rect rect, iconRect, labelRect;
|
||||||
OffscreenSurface *iconSurface;
|
OffscreenSurface *iconSurface;
|
||||||
|
@ -21,7 +21,6 @@
|
|||||||
#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 "surface.h"
|
#include "surface.h"
|
||||||
@ -100,22 +99,22 @@ InputDialog::InputDialog(GMenu2X *gmenu2x, InputManager &inputMgr_,
|
|||||||
buttonbox.add(unique_ptr<IconButton>(new IconButton(
|
buttonbox.add(unique_ptr<IconButton>(new IconButton(
|
||||||
gmenu2x, ts, "skin:imgs/buttons/l.png",
|
gmenu2x, ts, "skin:imgs/buttons/l.png",
|
||||||
gmenu2x->tr["Backspace"],
|
gmenu2x->tr["Backspace"],
|
||||||
BIND(&InputDialog::backspace))));
|
bind(&InputDialog::backspace, this))));
|
||||||
|
|
||||||
buttonbox.add(unique_ptr<IconButton>(new IconButton(
|
buttonbox.add(unique_ptr<IconButton>(new IconButton(
|
||||||
gmenu2x, ts, "skin:imgs/buttons/r.png",
|
gmenu2x, ts, "skin:imgs/buttons/r.png",
|
||||||
gmenu2x->tr["Space"],
|
gmenu2x->tr["Space"],
|
||||||
BIND(&InputDialog::space))));
|
bind(&InputDialog::space, this))));
|
||||||
|
|
||||||
buttonbox.add(unique_ptr<IconButton>(new IconButton(
|
buttonbox.add(unique_ptr<IconButton>(new IconButton(
|
||||||
gmenu2x, ts, "skin:imgs/buttons/accept.png",
|
gmenu2x, ts, "skin:imgs/buttons/accept.png",
|
||||||
gmenu2x->tr["Confirm"],
|
gmenu2x->tr["Confirm"],
|
||||||
BIND(&InputDialog::confirm))));
|
bind(&InputDialog::confirm, this))));
|
||||||
|
|
||||||
buttonbox.add(unique_ptr<IconButton>(new IconButton(
|
buttonbox.add(unique_ptr<IconButton>(new IconButton(
|
||||||
gmenu2x, ts, "skin:imgs/buttons/cancel.png",
|
gmenu2x, ts, "skin:imgs/buttons/cancel.png",
|
||||||
gmenu2x->tr["Change keys"],
|
gmenu2x->tr["Change keys"],
|
||||||
BIND(&InputDialog::changeKeys))));
|
bind(&InputDialog::changeKeys, this))));
|
||||||
}
|
}
|
||||||
|
|
||||||
void InputDialog::setKeyboard(int kb) {
|
void InputDialog::setKeyboard(int kb) {
|
||||||
|
@ -32,7 +32,7 @@
|
|||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
|
|
||||||
Link::Link(GMenu2X *gmenu2x, function_t action)
|
Link::Link(GMenu2X *gmenu2x, Action action)
|
||||||
: gmenu2x(gmenu2x)
|
: gmenu2x(gmenu2x)
|
||||||
, ts(gmenu2x->getTouchscreen())
|
, ts(gmenu2x->getTouchscreen())
|
||||||
, action(action)
|
, action(action)
|
||||||
|
10
src/link.h
10
src/link.h
@ -21,9 +21,9 @@
|
|||||||
#ifndef LINK_H
|
#ifndef LINK_H
|
||||||
#define LINK_H
|
#define LINK_H
|
||||||
|
|
||||||
#include "delegate.h"
|
|
||||||
|
|
||||||
#include <SDL.h>
|
#include <SDL.h>
|
||||||
|
|
||||||
|
#include <functional>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
class GMenu2X;
|
class GMenu2X;
|
||||||
@ -38,7 +38,9 @@ Base class that represents a link on screen.
|
|||||||
*/
|
*/
|
||||||
class Link {
|
class Link {
|
||||||
public:
|
public:
|
||||||
Link(GMenu2X *gmenu2x, function_t action);
|
typedef std::function<void(void)> Action;
|
||||||
|
|
||||||
|
Link(GMenu2X *gmenu2x, Action action);
|
||||||
virtual ~Link() {};
|
virtual ~Link() {};
|
||||||
|
|
||||||
bool isPressed();
|
bool isPressed();
|
||||||
@ -78,7 +80,7 @@ private:
|
|||||||
void recalcCoordinates();
|
void recalcCoordinates();
|
||||||
|
|
||||||
Touchscreen &ts;
|
Touchscreen &ts;
|
||||||
function_t action;
|
Action action;
|
||||||
|
|
||||||
SDL_Rect rect;
|
SDL_Rect rect;
|
||||||
uint iconX, padding;
|
uint iconX, padding;
|
||||||
|
@ -21,7 +21,6 @@
|
|||||||
#include "linkapp.h"
|
#include "linkapp.h"
|
||||||
|
|
||||||
#include "debug.h"
|
#include "debug.h"
|
||||||
#include "delegate.h"
|
|
||||||
#include "gmenu2x.h"
|
#include "gmenu2x.h"
|
||||||
#include "launcher.h"
|
#include "launcher.h"
|
||||||
#include "layer.h"
|
#include "layer.h"
|
||||||
@ -87,7 +86,7 @@ LinkApp::LinkApp(GMenu2X *gmenu2x_, const char* linkfile,
|
|||||||
#else
|
#else
|
||||||
LinkApp::LinkApp(GMenu2X *gmenu2x_, const char* linkfile)
|
LinkApp::LinkApp(GMenu2X *gmenu2x_, const char* linkfile)
|
||||||
#endif
|
#endif
|
||||||
: Link(gmenu2x_, BIND(&LinkApp::start))
|
: Link(gmenu2x_, bind(&LinkApp::start, this))
|
||||||
{
|
{
|
||||||
manual = "";
|
manual = "";
|
||||||
file = linkfile;
|
file = linkfile;
|
||||||
|
@ -387,7 +387,7 @@ void Menu::setSectionIndex(int i) {
|
|||||||
/*====================================
|
/*====================================
|
||||||
LINKS MANAGEMENT
|
LINKS MANAGEMENT
|
||||||
====================================*/
|
====================================*/
|
||||||
void Menu::addActionLink(uint section, const string &title, function_t action, const string &description, const string &icon) {
|
void Menu::addActionLink(uint section, const string &title, Action action, const string &description, const string &icon) {
|
||||||
assert(section < sections.size());
|
assert(section < sections.size());
|
||||||
|
|
||||||
Link *link = new Link(gmenu2x, action);
|
Link *link = new Link(gmenu2x, action);
|
||||||
|
@ -21,11 +21,11 @@
|
|||||||
#ifndef MENU_H
|
#ifndef MENU_H
|
||||||
#define MENU_H
|
#define MENU_H
|
||||||
|
|
||||||
#include "delegate.h"
|
|
||||||
#include "iconbutton.h"
|
#include "iconbutton.h"
|
||||||
#include "layer.h"
|
#include "layer.h"
|
||||||
#include "link.h"
|
#include "link.h"
|
||||||
|
|
||||||
|
#include <functional>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
@ -99,6 +99,8 @@ private:
|
|||||||
void linkDown();
|
void linkDown();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
typedef std::function<void(void)> Action;
|
||||||
|
|
||||||
Menu(GMenu2X *gmenu2x, Touchscreen &ts);
|
Menu(GMenu2X *gmenu2x, Touchscreen &ts);
|
||||||
virtual ~Menu();
|
virtual ~Menu();
|
||||||
|
|
||||||
@ -115,7 +117,7 @@ public:
|
|||||||
void setSectionIndex(int i);
|
void setSectionIndex(int i);
|
||||||
|
|
||||||
void addActionLink(uint section, const std::string &title,
|
void addActionLink(uint section, const std::string &title,
|
||||||
function_t action, const std::string &description="",
|
Action 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 §ionName);
|
bool addSection(const std::string §ionName);
|
||||||
|
@ -20,7 +20,6 @@
|
|||||||
|
|
||||||
#include "menusettingbool.h"
|
#include "menusettingbool.h"
|
||||||
|
|
||||||
#include "delegate.h"
|
|
||||||
#include "gmenu2x.h"
|
#include "gmenu2x.h"
|
||||||
#include "iconbutton.h"
|
#include "iconbutton.h"
|
||||||
#include "surface.h"
|
#include "surface.h"
|
||||||
@ -28,6 +27,7 @@
|
|||||||
|
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
|
|
||||||
|
using std::bind;
|
||||||
using std::string;
|
using std::string;
|
||||||
using std::unique_ptr;
|
using std::unique_ptr;
|
||||||
|
|
||||||
@ -62,7 +62,7 @@ void MenuSettingBool::initButton()
|
|||||||
buttonBox.add(unique_ptr<IconButton>(new IconButton(
|
buttonBox.add(unique_ptr<IconButton>(new IconButton(
|
||||||
gmenu2x, ts, "skin:imgs/buttons/accept.png",
|
gmenu2x, ts, "skin:imgs/buttons/accept.png",
|
||||||
gmenu2x->tr["Switch"],
|
gmenu2x->tr["Switch"],
|
||||||
BIND(&MenuSettingBool::toggle))));
|
bind(&MenuSettingBool::toggle, this))));
|
||||||
}
|
}
|
||||||
|
|
||||||
void MenuSettingBool::draw(int valueX, int y, int h)
|
void MenuSettingBool::draw(int valueX, int y, int h)
|
||||||
|
@ -20,11 +20,11 @@
|
|||||||
|
|
||||||
#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::bind;
|
||||||
using std::string;
|
using std::string;
|
||||||
using std::unique_ptr;
|
using std::unique_ptr;
|
||||||
|
|
||||||
@ -37,12 +37,12 @@ MenuSettingDir::MenuSettingDir(
|
|||||||
buttonBox.add(unique_ptr<IconButton>(new IconButton(
|
buttonBox.add(unique_ptr<IconButton>(new IconButton(
|
||||||
gmenu2x, ts, "skin:imgs/buttons/cancel.png",
|
gmenu2x, ts, "skin:imgs/buttons/cancel.png",
|
||||||
gmenu2x->tr["Clear"],
|
gmenu2x->tr["Clear"],
|
||||||
BIND(&MenuSettingDir::clear))));
|
bind(&MenuSettingDir::clear, this))));
|
||||||
|
|
||||||
buttonBox.add(unique_ptr<IconButton>(new IconButton(
|
buttonBox.add(unique_ptr<IconButton>(new IconButton(
|
||||||
gmenu2x, ts, "skin:imgs/buttons/accept.png",
|
gmenu2x, ts, "skin:imgs/buttons/accept.png",
|
||||||
gmenu2x->tr["Select"],
|
gmenu2x->tr["Select"],
|
||||||
BIND(&MenuSettingDir::edit))));
|
bind(&MenuSettingDir::edit, this))));
|
||||||
}
|
}
|
||||||
|
|
||||||
void MenuSettingDir::edit()
|
void MenuSettingDir::edit()
|
||||||
|
@ -20,11 +20,11 @@
|
|||||||
|
|
||||||
#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::bind;
|
||||||
using std::string;
|
using std::string;
|
||||||
using std::unique_ptr;
|
using std::unique_ptr;
|
||||||
|
|
||||||
@ -39,12 +39,12 @@ MenuSettingFile::MenuSettingFile(
|
|||||||
buttonBox.add(unique_ptr<IconButton>(new IconButton(
|
buttonBox.add(unique_ptr<IconButton>(new IconButton(
|
||||||
gmenu2x, ts, "skin:imgs/buttons/cancel.png",
|
gmenu2x, ts, "skin:imgs/buttons/cancel.png",
|
||||||
gmenu2x->tr["Clear"],
|
gmenu2x->tr["Clear"],
|
||||||
BIND(&MenuSettingFile::clear))));
|
bind(&MenuSettingFile::clear, this))));
|
||||||
|
|
||||||
buttonBox.add(unique_ptr<IconButton>(new IconButton(
|
buttonBox.add(unique_ptr<IconButton>(new IconButton(
|
||||||
gmenu2x, ts, "skin:imgs/buttons/accept.png",
|
gmenu2x, ts, "skin:imgs/buttons/accept.png",
|
||||||
gmenu2x->tr["Select"],
|
gmenu2x->tr["Select"],
|
||||||
BIND(&MenuSettingFile::edit))));
|
bind(&MenuSettingFile::edit, this))));
|
||||||
}
|
}
|
||||||
|
|
||||||
void MenuSettingFile::edit()
|
void MenuSettingFile::edit()
|
||||||
|
@ -20,7 +20,6 @@
|
|||||||
|
|
||||||
#include "menusettingint.h"
|
#include "menusettingint.h"
|
||||||
|
|
||||||
#include "delegate.h"
|
|
||||||
#include "gmenu2x.h"
|
#include "gmenu2x.h"
|
||||||
#include "iconbutton.h"
|
#include "iconbutton.h"
|
||||||
#include "surface.h"
|
#include "surface.h"
|
||||||
@ -28,6 +27,7 @@
|
|||||||
|
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
|
|
||||||
|
using std::bind;
|
||||||
using std::string;
|
using std::string;
|
||||||
using std::stringstream;
|
using std::stringstream;
|
||||||
using std::unique_ptr;
|
using std::unique_ptr;
|
||||||
@ -46,8 +46,8 @@ MenuSettingInt::MenuSettingInt(
|
|||||||
setValue(this->value());
|
setValue(this->value());
|
||||||
|
|
||||||
//Delegates
|
//Delegates
|
||||||
function_t actionInc = BIND(&MenuSettingInt::inc);
|
IconButton::Action actionInc = bind(&MenuSettingInt::inc, this);
|
||||||
function_t actionDec = BIND(&MenuSettingInt::dec);
|
IconButton::Action actionDec = bind(&MenuSettingInt::dec, this);
|
||||||
|
|
||||||
buttonBox.add(unique_ptr<IconButton>(new IconButton(
|
buttonBox.add(unique_ptr<IconButton>(new IconButton(
|
||||||
gmenu2x, ts, "skin:imgs/buttons/l.png",
|
gmenu2x, ts, "skin:imgs/buttons/l.png",
|
||||||
|
@ -18,13 +18,13 @@
|
|||||||
* 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 <algorithm>
|
#include <algorithm>
|
||||||
|
|
||||||
|
using std::bind;
|
||||||
using std::find;
|
using std::find;
|
||||||
using std::string;
|
using std::string;
|
||||||
using std::vector;
|
using std::vector;
|
||||||
@ -41,11 +41,11 @@ MenuSettingMultiString::MenuSettingMultiString(
|
|||||||
|
|
||||||
buttonBox.add(unique_ptr<IconButton>(new IconButton(
|
buttonBox.add(unique_ptr<IconButton>(new IconButton(
|
||||||
gmenu2x, ts, "skin:imgs/buttons/left.png", "",
|
gmenu2x, ts, "skin:imgs/buttons/left.png", "",
|
||||||
BIND(&MenuSettingMultiString::decSel))));
|
bind(&MenuSettingMultiString::decSel, this))));
|
||||||
buttonBox.add(unique_ptr<IconButton>(new IconButton(
|
buttonBox.add(unique_ptr<IconButton>(new IconButton(
|
||||||
gmenu2x, ts, "skin:imgs/buttons/right.png",
|
gmenu2x, ts, "skin:imgs/buttons/right.png",
|
||||||
gmenu2x->tr["Change value"],
|
gmenu2x->tr["Change value"],
|
||||||
BIND(&MenuSettingMultiString::incSel))));
|
bind(&MenuSettingMultiString::incSel, this))));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MenuSettingMultiString::handleButtonPress(InputManager::Button button)
|
bool MenuSettingMultiString::handleButtonPress(InputManager::Button button)
|
||||||
|
@ -20,11 +20,11 @@
|
|||||||
|
|
||||||
#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::bind;
|
||||||
using std::string;
|
using std::string;
|
||||||
using std::unique_ptr;
|
using std::unique_ptr;
|
||||||
|
|
||||||
@ -40,12 +40,12 @@ MenuSettingString::MenuSettingString(
|
|||||||
buttonBox.add(unique_ptr<IconButton>(new IconButton(
|
buttonBox.add(unique_ptr<IconButton>(new IconButton(
|
||||||
gmenu2x, ts, "skin:imgs/buttons/cancel.png",
|
gmenu2x, ts, "skin:imgs/buttons/cancel.png",
|
||||||
gmenu2x->tr["Clear"],
|
gmenu2x->tr["Clear"],
|
||||||
BIND(&MenuSettingString::clear))));
|
bind(&MenuSettingString::clear, this))));
|
||||||
|
|
||||||
buttonBox.add(unique_ptr<IconButton>(new IconButton(
|
buttonBox.add(unique_ptr<IconButton>(new IconButton(
|
||||||
gmenu2x, ts, "skin:imgs/buttons/accept.png",
|
gmenu2x, ts, "skin:imgs/buttons/accept.png",
|
||||||
gmenu2x->tr["Edit"],
|
gmenu2x->tr["Edit"],
|
||||||
BIND(&MenuSettingString::edit))));
|
bind(&MenuSettingString::edit, this))));
|
||||||
}
|
}
|
||||||
|
|
||||||
void MenuSettingString::edit()
|
void MenuSettingString::edit()
|
||||||
|
Loading…
Reference in New Issue
Block a user