Pass action to IconButton constructor

This removes the need for a separate setAction method.

The default action is the empty action, which does nothing. However,
a touch event on a button with the empty action is no longer considered
handled.

Menu::btnContextMenu was changed from a unique_ptr to a plain data
member.
This commit is contained in:
Maarten ter Huurne committed 2014-08-16 06:44:13 +02:00
1 parent 428a316bc1
commit 7e308879c1
13 files changed
+93 -113

No files matched your search

+2 -3
View File
@@ -15,9 +15,8 @@ class Touchscreen;
class IconButton {
public:
IconButton(GMenu2X *gmenu2x, Touchscreen &ts,
const std::string &icon, const std::string &label = "");
void setAction(function_t action);
const std::string &icon, const std::string &label = "",
function_t action = nullptr);
SDL_Rect getRect() { return rect; }
void setPosition(int x, int y);