Foundation classes for a basic GUI implementing simple widgets and events
Dependents: TouchScreenGUIDemo
Widgets/BitmapWidget.h@16:e9a771ecfdbe, 2016-05-22 (annotated)
- Committer:
- duncanFrance
- Date:
- Sun May 22 14:40:29 2016 +0000
- Revision:
- 16:e9a771ecfdbe
- Parent:
- 14:e6515b19f5a0
Added vertical alignment control to TextWidget; pumpEvents no longer blocks
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 | 12:63db16fea709 | 10 | BitmapWidget(GraphicsContext *context); |
duncanFrance | 12:63db16fea709 | 11 | BitmapWidget(GraphicsContext *context, bool monochrome); |
duncanFrance | 4:27546fb8b670 | 12 | |
duncanFrance | 4:27546fb8b670 | 13 | // Ccncrete methods for this class |
duncanFrance | 14:e6515b19f5a0 | 14 | void setBitmap(unsigned char const * bitmap, int width, int height); |
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 | 16:e9a771ecfdbe | 19 | |
duncanFrance | 16:e9a771ecfdbe | 20 | // Override to accommodate auto-resizing (yes, yes. sorry) |
duncanFrance | 16:e9a771ecfdbe | 21 | virtual void setBorder(int width, uint16_t color); |
duncanFrance | 4:27546fb8b670 | 22 | |
duncanFrance | 8:a460cabc85ac | 23 | protected: |
duncanFrance | 12:63db16fea709 | 24 | |
duncanFrance | 8:a460cabc85ac | 25 | virtual void _draw(); |
duncanFrance | 12:63db16fea709 | 26 | |
duncanFrance | 4:27546fb8b670 | 27 | unsigned char* _bitmap; |
duncanFrance | 4:27546fb8b670 | 28 | bool _monochrome; |
duncanFrance | 16:e9a771ecfdbe | 29 | int _bitmapWidth, _bitmapHeight; |
duncanFrance | 4:27546fb8b670 | 30 | }; |
duncanFrance | 4:27546fb8b670 | 31 | |
duncanFrance | 4:27546fb8b670 | 32 | #endif |