![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
Basic calculator example to show the LPC4088 Experiment Base Board with a touch LCD from DisplayModule
Dependencies: DmTftLibrary mbed
Fork of dm_calc by
Button.h@6:2063744e0512, 2014-10-01 (annotated)
- Committer:
- embeddedartists
- Date:
- Wed Oct 01 11:22:41 2014 +0000
- Revision:
- 6:2063744e0512
- Parent:
- 0:3713b01e72fe
Updated used libraries
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
displaymodule | 0:3713b01e72fe | 1 | #ifndef BUTTON_h |
displaymodule | 0:3713b01e72fe | 2 | #define BUTTON_h |
displaymodule | 0:3713b01e72fe | 3 | |
displaymodule | 0:3713b01e72fe | 4 | #include "DmTftBase.h" |
displaymodule | 0:3713b01e72fe | 5 | |
displaymodule | 0:3713b01e72fe | 6 | typedef void (*cbFunc)(uint32_t); |
displaymodule | 0:3713b01e72fe | 7 | |
displaymodule | 0:3713b01e72fe | 8 | class Button { |
displaymodule | 0:3713b01e72fe | 9 | public: |
displaymodule | 0:3713b01e72fe | 10 | Button(const char* caption, uint16_t x, uint16_t y, uint16_t width, uint16_t height); |
displaymodule | 0:3713b01e72fe | 11 | void setAction(cbFunc func, uint32_t arg) { _func = func; _funcArg = arg; } |
displaymodule | 0:3713b01e72fe | 12 | void setCaption(const char* caption) { _caption = caption; } |
displaymodule | 0:3713b01e72fe | 13 | void setColors(uint16_t bg, uint16_t fg, uint16_t bgPressed, uint16_t fgPressed); |
displaymodule | 0:3713b01e72fe | 14 | bool handle(uint16_t x, uint16_t y, bool pressed); |
displaymodule | 0:3713b01e72fe | 15 | void draw(DmTftBase* tft); |
displaymodule | 0:3713b01e72fe | 16 | |
displaymodule | 0:3713b01e72fe | 17 | private: |
displaymodule | 0:3713b01e72fe | 18 | const char* _caption; |
displaymodule | 0:3713b01e72fe | 19 | uint16_t _x0, _y0, _x1, _y1; |
displaymodule | 0:3713b01e72fe | 20 | uint16_t _bgCol, _fgCol, _bgColPressed, _fgColPressed; |
displaymodule | 0:3713b01e72fe | 21 | bool _enabled, _pressed; |
displaymodule | 0:3713b01e72fe | 22 | cbFunc _func; |
displaymodule | 0:3713b01e72fe | 23 | uint32_t _funcArg; |
displaymodule | 0:3713b01e72fe | 24 | }; |
displaymodule | 0:3713b01e72fe | 25 | |
displaymodule | 0:3713b01e72fe | 26 | #endif /* BUTTON_h */ |
displaymodule | 0:3713b01e72fe | 27 |