Root/
1 | #ifndef ICONBUTTON_H |
2 | #define ICONBUTTON_H |
3 | |
4 | #include "delegate.h" |
5 | |
6 | #include <SDL.h> |
7 | #include <string> |
8 | |
9 | class GMenu2X; |
10 | class Surface; |
11 | class Touchscreen; |
12 | |
13 | |
14 | class IconButton { |
15 | public: |
16 | IconButton(GMenu2X *gmenu2x, Touchscreen &ts, |
17 | const std::string &icon, const std::string &label = ""); |
18 | |
19 | void setAction(function_t action); |
20 | |
21 | SDL_Rect getRect() { return rect; } |
22 | void setPosition(int x, int y); |
23 | |
24 | bool handleTS(); |
25 | |
26 | void paint(); |
27 | |
28 | private: |
29 | void recalcRects(); |
30 | |
31 | GMenu2X *gmenu2x; |
32 | Touchscreen &ts; |
33 | std::string icon, label; |
34 | function_t action; |
35 | |
36 | SDL_Rect rect, iconRect, labelRect; |
37 | Surface *iconSurface; |
38 | }; |
39 | |
40 | #endif |
41 |
Branches:
install_locations
master
opkrun
packages