Basic swim GUI for LPC4088
Fork of DMBasicGUI by
Application/Button.h@0:4977187e90c7, 2014-12-11 (annotated)
- Committer:
- embeddedartists
- Date:
- Thu Dec 11 11:03:57 2014 +0000
- Revision:
- 0:4977187e90c7
- Child:
- 1:46c8df4608c8
First version
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
embeddedartists | 0:4977187e90c7 | 1 | #ifndef BUTTON_h |
embeddedartists | 0:4977187e90c7 | 2 | #define BUTTON_h |
embeddedartists | 0:4977187e90c7 | 3 | |
embeddedartists | 0:4977187e90c7 | 4 | #include "lpc_swim.h" |
embeddedartists | 0:4977187e90c7 | 5 | |
embeddedartists | 0:4977187e90c7 | 6 | class Button { |
embeddedartists | 0:4977187e90c7 | 7 | public: |
embeddedartists | 0:4977187e90c7 | 8 | Button(const char* caption, COLOR_T* fb, uint16_t x, uint16_t y, uint16_t width, uint16_t height); |
embeddedartists | 0:4977187e90c7 | 9 | void setAction(void (*func)(uint32_t arg), uint32_t arg) { _func = func; _funcArg = arg; } |
embeddedartists | 0:4977187e90c7 | 10 | void setCaption(const char* caption); |
embeddedartists | 0:4977187e90c7 | 11 | void setColors(COLOR_T bg, COLOR_T fg, COLOR_T bgPressed, COLOR_T fgPressed); |
embeddedartists | 0:4977187e90c7 | 12 | bool handle(uint16_t x, uint16_t y, bool pressed); |
embeddedartists | 0:4977187e90c7 | 13 | void draw(); |
embeddedartists | 0:4977187e90c7 | 14 | |
embeddedartists | 0:4977187e90c7 | 15 | private: |
embeddedartists | 0:4977187e90c7 | 16 | const char* _caption; |
embeddedartists | 0:4977187e90c7 | 17 | int _capx, _capy; |
embeddedartists | 0:4977187e90c7 | 18 | //uint16_t _x0, _y0, _x1, _y1; |
embeddedartists | 0:4977187e90c7 | 19 | COLOR_T _bgCol, _fgCol, _bgColPressed, _fgColPressed; |
embeddedartists | 0:4977187e90c7 | 20 | bool _enabled, _pressed; |
embeddedartists | 0:4977187e90c7 | 21 | void (*_func)(uint32_t arg); |
embeddedartists | 0:4977187e90c7 | 22 | uint32_t _funcArg; |
embeddedartists | 0:4977187e90c7 | 23 | SWIM_WINDOW_T _win; |
embeddedartists | 0:4977187e90c7 | 24 | }; |
embeddedartists | 0:4977187e90c7 | 25 | |
embeddedartists | 0:4977187e90c7 | 26 | #endif /* BUTTON_h */ |
embeddedartists | 0:4977187e90c7 | 27 | |
embeddedartists | 0:4977187e90c7 | 28 |