Foundation classes for a basic GUI implementing simple widgets and events. (Fork for custom changes.)
Fork of SimpleGUI by
Widgets/Window.h@18:d849f3ada858, 2016-05-28 (annotated)
- Committer:
- duncanFrance
- Date:
- Sat May 28 14:50:14 2016 +0000
- Revision:
- 18:d849f3ada858
- Parent:
- 12:63db16fea709
Moved the event queue into the EventDispatcher; Improved event handling across Window/Widget
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
duncanFrance | 12:63db16fea709 | 1 | #ifndef SIMPLEGUI_WINDOW_H |
duncanFrance | 12:63db16fea709 | 2 | #define SIMPLEGUI_WINDOW_H |
duncanFrance | 12:63db16fea709 | 3 | |
duncanFrance | 12:63db16fea709 | 4 | /** |
duncanFrance | 12:63db16fea709 | 5 | * Defines an interface for classes which can contain widgets |
duncanFrance | 12:63db16fea709 | 6 | **/ |
duncanFrance | 12:63db16fea709 | 7 | |
duncanFrance | 12:63db16fea709 | 8 | class Window; |
duncanFrance | 12:63db16fea709 | 9 | |
duncanFrance | 12:63db16fea709 | 10 | #include "Widget.h" |
duncanFrance | 12:63db16fea709 | 11 | #include "GraphicsContext.h" |
duncanFrance | 12:63db16fea709 | 12 | #include "LinkedList.h" |
duncanFrance | 12:63db16fea709 | 13 | |
duncanFrance | 12:63db16fea709 | 14 | class Window : public Widget { |
duncanFrance | 12:63db16fea709 | 15 | |
duncanFrance | 12:63db16fea709 | 16 | public: |
duncanFrance | 12:63db16fea709 | 17 | |
duncanFrance | 12:63db16fea709 | 18 | Window(GraphicsContext *context); |
duncanFrance | 12:63db16fea709 | 19 | |
duncanFrance | 12:63db16fea709 | 20 | /** |
duncanFrance | 12:63db16fea709 | 21 | * We are going to override these Widget methods |
duncanFrance | 12:63db16fea709 | 22 | **/ |
duncanFrance | 12:63db16fea709 | 23 | virtual void attach(Widget *widget); |
duncanFrance | 12:63db16fea709 | 24 | virtual void detach(Widget *widget); |
duncanFrance | 12:63db16fea709 | 25 | virtual void dirtyAll(); |
duncanFrance | 12:63db16fea709 | 26 | |
duncanFrance | 18:d849f3ada858 | 27 | virtual void handleEvent(Event e); |
duncanFrance | 18:d849f3ada858 | 28 | virtual void _reenumerateHandledEvents(); |
duncanFrance | 18:d849f3ada858 | 29 | virtual uint16_t _getHandledEvents(); |
duncanFrance | 18:d849f3ada858 | 30 | |
duncanFrance | 12:63db16fea709 | 31 | protected: |
duncanFrance | 12:63db16fea709 | 32 | |
duncanFrance | 12:63db16fea709 | 33 | /** |
duncanFrance | 12:63db16fea709 | 34 | * Override to draw all the children |
duncanFrance | 12:63db16fea709 | 35 | **/ |
duncanFrance | 12:63db16fea709 | 36 | virtual void _draw(); |
duncanFrance | 12:63db16fea709 | 37 | |
duncanFrance | 12:63db16fea709 | 38 | LinkedList<Widget> _widgets; |
duncanFrance | 18:d849f3ada858 | 39 | uint16_t _childHandledEvents; |
duncanFrance | 12:63db16fea709 | 40 | |
duncanFrance | 12:63db16fea709 | 41 | void _dirtyIntersected(Widget *w); |
duncanFrance | 12:63db16fea709 | 42 | }; |
duncanFrance | 12:63db16fea709 | 43 | |
duncanFrance | 12:63db16fea709 | 44 | #endif |