Foundation classes for a basic GUI implementing simple widgets and events
Dependents: TouchScreenGUIDemo
Diff: Widgets/ContainerWidget.h
- Revision:
- 8:a460cabc85ac
- Parent:
- 7:303850a4b30c
- Child:
- 9:616a9686d5db
--- a/Widgets/ContainerWidget.h Sun Apr 10 16:48:44 2016 +0000 +++ b/Widgets/ContainerWidget.h Mon Apr 11 16:54:02 2016 +0000 @@ -24,7 +24,7 @@ public: - ContainerWidget(GraphicsDisplay& display) : Widget(display), _padding(0), _widgets(NULL) { + ContainerWidget(GUI* gui) : Widget(gui), _padding(0), _widgets(NULL) { } /** @@ -102,16 +102,16 @@ } } - virtual void draw() { + virtual void _draw() { // Draw the border // Top - _display.fillrect(_x, _y, _x+_width, _y+_borderWidth, _borderColour); + _gui->display()->fillrect(_x, _y, _x+_width, _y+_borderWidth, _borderColour); // Bottom - _display.fillrect(_x, _y + _height - _borderWidth, _x + _width, _y+_height, _borderColour); + _gui->display()->fillrect(_x, _y + _height - _borderWidth, _x + _width, _y+_height, _borderColour); // Left - _display.fillrect(_x, _y, _x+_borderWidth, _y+_height, _borderColour); + _gui->display()->fillrect(_x, _y, _x+_borderWidth, _y+_height, _borderColour); // Right - _display.fillrect(_x+_width-_borderWidth, _y, _x+_width, _y+_height, _borderColour); + _gui->display()->fillrect(_x+_width-_borderWidth, _y, _x+_width, _y+_height, _borderColour); WidgetList* p = _widgets; while(p != NULL) { @@ -119,6 +119,15 @@ p = p->next; } } + + virtual void _clear() { + WidgetList* p = _widgets; + while(p != NULL) { + p->widget->clear(); + p = p->next; + } + } + protected: