Foundation classes for a basic GUI implementing simple widgets and events

Dependents:   TouchScreenGUIDemo

Revision:
9:616a9686d5db
Parent:
8:a460cabc85ac
Child:
12:63db16fea709
--- a/Widgets/ContainerWidget.h	Mon Apr 11 16:54:02 2016 +0000
+++ b/Widgets/ContainerWidget.h	Mon Apr 11 19:15:53 2016 +0000
@@ -24,7 +24,7 @@
 
 public:
 
-    ContainerWidget(GUI* gui) : Widget(gui), _padding(0), _widgets(NULL) {
+    ContainerWidget(GUI* gui) : Widget(gui), _padding(0), _borderWidth(1), _borderColour(White), _widgets(NULL) {
     }
 
     /**
@@ -48,11 +48,16 @@
     void append(Widget* widget) {
 
         WidgetList* w = new WidgetList(widget);
-
+        WidgetList* p = _widgets;
+        
         if(_widgets == NULL) {
             _widgets = w;
         } else {
-            _widgets->next = w;
+            while(p->next != NULL) {
+                p = p->next;
+            }
+            
+            p->next = w;
         }
 
         adjust();
@@ -133,10 +138,11 @@
 protected:
 
     int _padding;
-    WidgetList* _widgets;
-    int _minWidth, _minHeight;
     int _borderWidth;
     uint16_t _borderColour;
+
+    int _minWidth, _minHeight;
+    WidgetList* _widgets;
 };
 
 #endif
\ No newline at end of file