Foundation classes for a basic GUI implementing simple widgets and events
Dependents: TouchScreenGUIDemo
Widgets/BitmapWidget.h@9:616a9686d5db, 2016-04-11 (annotated)
- Committer:
- duncanFrance
- Date:
- Mon Apr 11 19:15:53 2016 +0000
- Revision:
- 9:616a9686d5db
- Parent:
- 8:a460cabc85ac
- Child:
- 12:63db16fea709
TextWidget now writes the entire background on redraw
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
duncanFrance | 4:27546fb8b670 | 1 | #ifndef SIMPLEGUI_BITMAP_WIDGET_H |
duncanFrance | 4:27546fb8b670 | 2 | #define SIMPLEGUI_BITMAP_WIDGET_H |
duncanFrance | 4:27546fb8b670 | 3 | |
duncanFrance | 4:27546fb8b670 | 4 | #include "Widget.h" |
duncanFrance | 4:27546fb8b670 | 5 | |
duncanFrance | 4:27546fb8b670 | 6 | class BitmapWidget : public Widget { |
duncanFrance | 4:27546fb8b670 | 7 | |
duncanFrance | 4:27546fb8b670 | 8 | public: |
duncanFrance | 4:27546fb8b670 | 9 | |
duncanFrance | 8:a460cabc85ac | 10 | BitmapWidget(GUI* gui); |
duncanFrance | 9:616a9686d5db | 11 | BitmapWidget(GUI* gui, bool monochrome); |
duncanFrance | 4:27546fb8b670 | 12 | |
duncanFrance | 4:27546fb8b670 | 13 | // Ccncrete methods for this class |
duncanFrance | 4:27546fb8b670 | 14 | void setBitmap(unsigned char* bitmap); |
duncanFrance | 4:27546fb8b670 | 15 | |
duncanFrance | 4:27546fb8b670 | 16 | // Set to draw the bitmap in monochrome |
duncanFrance | 4:27546fb8b670 | 17 | void setMonochrome(bool enabled); |
duncanFrance | 4:27546fb8b670 | 18 | bool isMonochrome(); |
duncanFrance | 4:27546fb8b670 | 19 | |
duncanFrance | 8:a460cabc85ac | 20 | protected: |
duncanFrance | 4:27546fb8b670 | 21 | // Implementation to account for whether the event's coordinates intersect this widget |
duncanFrance | 8:a460cabc85ac | 22 | virtual void _draw(); |
duncanFrance | 8:a460cabc85ac | 23 | virtual void _clear(); |
duncanFrance | 4:27546fb8b670 | 24 | |
duncanFrance | 4:27546fb8b670 | 25 | unsigned char* _bitmap; |
duncanFrance | 4:27546fb8b670 | 26 | bool _monochrome; |
duncanFrance | 4:27546fb8b670 | 27 | }; |
duncanFrance | 4:27546fb8b670 | 28 | |
duncanFrance | 4:27546fb8b670 | 29 | #endif |