2010-02-04 12:33:47 +01:00
|
|
|
#ifndef ICONBUTTON_H
|
|
|
|
#define ICONBUTTON_H
|
|
|
|
|
2013-08-14 04:21:56 +02:00
|
|
|
#include "delegate.h"
|
2011-05-09 05:17:25 +02:00
|
|
|
|
2013-08-14 04:21:56 +02:00
|
|
|
#include <SDL.h>
|
2011-05-09 05:17:25 +02:00
|
|
|
#include <string>
|
2010-02-04 12:33:47 +01:00
|
|
|
|
|
|
|
class GMenu2X;
|
2010-05-02 14:52:46 +02:00
|
|
|
class Surface;
|
2013-08-14 04:21:56 +02:00
|
|
|
class Touchscreen;
|
2010-02-04 12:33:47 +01:00
|
|
|
|
2013-08-14 04:21:56 +02:00
|
|
|
|
|
|
|
class IconButton {
|
2010-02-04 12:33:47 +01:00
|
|
|
public:
|
2011-12-23 14:03:05 +01:00
|
|
|
IconButton(GMenu2X *gmenu2x, Touchscreen &ts,
|
|
|
|
const std::string &icon, const std::string &label = "");
|
2010-02-04 12:33:47 +01:00
|
|
|
|
2013-08-14 04:21:56 +02:00
|
|
|
void setAction(function_t action);
|
2010-02-04 12:33:47 +01:00
|
|
|
|
2013-08-14 04:21:56 +02:00
|
|
|
SDL_Rect getRect() { return rect; }
|
|
|
|
void setPosition(int x, int y);
|
2010-02-04 12:33:47 +01:00
|
|
|
|
2013-08-14 04:21:56 +02:00
|
|
|
bool handleTS();
|
2011-10-23 12:37:39 +02:00
|
|
|
|
2013-08-14 04:21:56 +02:00
|
|
|
void paint();
|
2013-08-13 01:47:02 +02:00
|
|
|
|
2011-10-23 12:37:39 +02:00
|
|
|
private:
|
2013-08-14 04:21:56 +02:00
|
|
|
void recalcRects();
|
2011-10-23 12:37:39 +02:00
|
|
|
|
|
|
|
GMenu2X *gmenu2x;
|
2013-08-14 04:21:56 +02:00
|
|
|
Touchscreen &ts;
|
2011-10-23 12:37:39 +02:00
|
|
|
std::string icon, label;
|
2013-08-14 04:21:56 +02:00
|
|
|
function_t action;
|
2011-10-23 12:37:39 +02:00
|
|
|
|
2013-08-14 04:21:56 +02:00
|
|
|
SDL_Rect rect, iconRect, labelRect;
|
2011-10-23 12:37:39 +02:00
|
|
|
Surface *iconSurface;
|
2010-02-04 12:33:47 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|