Foundation classes for a basic GUI implementing simple widgets and events
Dependents: TouchScreenGUIDemo
Core/GUI.cpp@18:d849f3ada858, 2016-05-28 (annotated)
- Committer:
- duncanFrance
- Date:
- Sat May 28 14:50:14 2016 +0000
- Revision:
- 18:d849f3ada858
- Parent:
- 16:e9a771ecfdbe
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 | #include "GUI.h" |
duncanFrance | 12:63db16fea709 | 2 | |
duncanFrance | 12:63db16fea709 | 3 | GUI::GUI(GraphicsContext* context) : _context(context), _rootWindow(context) |
duncanFrance | 18:d849f3ada858 | 4 | { |
duncanFrance | 18:d849f3ada858 | 5 | _context->eventDispatcher()->attachListener(&_rootWindow); |
duncanFrance | 18:d849f3ada858 | 6 | } |
duncanFrance | 12:63db16fea709 | 7 | |
duncanFrance | 12:63db16fea709 | 8 | GraphicsContext* GUI::getGraphicsContext() { |
duncanFrance | 12:63db16fea709 | 9 | return _context; |
duncanFrance | 12:63db16fea709 | 10 | } |
duncanFrance | 12:63db16fea709 | 11 | |
duncanFrance | 12:63db16fea709 | 12 | Window* GUI::rootWindow() { |
duncanFrance | 12:63db16fea709 | 13 | return &_rootWindow; |
duncanFrance | 12:63db16fea709 | 14 | } |
duncanFrance | 12:63db16fea709 | 15 | |
duncanFrance | 18:d849f3ada858 | 16 | void GUI::run() { |
duncanFrance | 18:d849f3ada858 | 17 | _context->eventDispatcher()->pumpEvents(); |
duncanFrance | 18:d849f3ada858 | 18 | _rootWindow.draw(); |
duncanFrance | 18:d849f3ada858 | 19 | |
duncanFrance | 12:63db16fea709 | 20 | } |