Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: LCD_DISCO_F429ZI mbed TS_DISCO_F429ZI BSP_DISCO_F429ZI
button.h@0:6d5a5f60d228, 2019-04-04 (annotated)
- Committer:
- fzajdel
- Date:
- Thu Apr 04 15:26:11 2019 +0000
- Revision:
- 0:6d5a5f60d228
- Child:
- 2:bd49dd9c7bd6
Working Buttons changing Color on Tap
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| fzajdel | 0:6d5a5f60d228 | 1 | #ifndef button_h |
| fzajdel | 0:6d5a5f60d228 | 2 | #define button_h |
| fzajdel | 0:6d5a5f60d228 | 3 | |
| fzajdel | 0:6d5a5f60d228 | 4 | #include "mbed.h" |
| fzajdel | 0:6d5a5f60d228 | 5 | #include "rectangle.h" |
| fzajdel | 0:6d5a5f60d228 | 6 | #include "LCD_DISCO_F429ZI.h" |
| fzajdel | 0:6d5a5f60d228 | 7 | #include "config.h" |
| fzajdel | 0:6d5a5f60d228 | 8 | #include "widget.h" |
| fzajdel | 0:6d5a5f60d228 | 9 | #include "widgetcallback.h" |
| fzajdel | 0:6d5a5f60d228 | 10 | #include <string> |
| fzajdel | 0:6d5a5f60d228 | 11 | |
| fzajdel | 0:6d5a5f60d228 | 12 | class Button : public Widget{ |
| fzajdel | 0:6d5a5f60d228 | 13 | public: |
| fzajdel | 0:6d5a5f60d228 | 14 | Button(){} |
| fzajdel | 0:6d5a5f60d228 | 15 | Button(uint8_t x, uint8_t y, uint8_t width, uint8_t height, string Text = RECTANGLE_DEFAULT_TEXT); |
| fzajdel | 0:6d5a5f60d228 | 16 | Button(uint8_t x, uint8_t y, uint8_t width, uint8_t height, WidgetCallback* CbOnPress, WidgetCallback* CbOnRelease, string Text = RECTANGLE_DEFAULT_TEXT); |
| fzajdel | 0:6d5a5f60d228 | 17 | virtual ~Button(){}; |
| fzajdel | 0:6d5a5f60d228 | 18 | virtual void Check(uint16_t X, uint16_t Y); |
| fzajdel | 0:6d5a5f60d228 | 19 | virtual Figure *GetFigure(); // Temporary Solution |
| fzajdel | 0:6d5a5f60d228 | 20 | |
| fzajdel | 0:6d5a5f60d228 | 21 | private: |
| fzajdel | 0:6d5a5f60d228 | 22 | enum {PRESSED, RELEASED}; |
| fzajdel | 0:6d5a5f60d228 | 23 | uint8_t State; |
| fzajdel | 0:6d5a5f60d228 | 24 | Rectangle* MyRectangle; |
| fzajdel | 0:6d5a5f60d228 | 25 | WidgetCallback* CbOnPress; |
| fzajdel | 0:6d5a5f60d228 | 26 | WidgetCallback* CbOnRelease; |
| fzajdel | 0:6d5a5f60d228 | 27 | |
| fzajdel | 0:6d5a5f60d228 | 28 | void OnPress(); |
| fzajdel | 0:6d5a5f60d228 | 29 | void OnRelease(); |
| fzajdel | 0:6d5a5f60d228 | 30 | bool CheckRectRange(uint16_t x, uint16_t y); |
| fzajdel | 0:6d5a5f60d228 | 31 | }; |
| fzajdel | 0:6d5a5f60d228 | 32 | |
| fzajdel | 0:6d5a5f60d228 | 33 | |
| fzajdel | 0:6d5a5f60d228 | 34 | |
| fzajdel | 0:6d5a5f60d228 | 35 | |
| fzajdel | 0:6d5a5f60d228 | 36 | #endif |