simple GUI elements for drawing on a canvas, works with adafruit graphics lib

Dependents:   ezSBC_MPU9250

Revision:
0:ccdf1edcbba6
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/SmallGUIBase.cpp	Mon Apr 24 16:21:53 2017 +0000
@@ -0,0 +1,23 @@
+#include "SmallGUIBase.h"
+
+Canvas::Canvas(Adafruit_GFX &_gfxDevice) :
+    gfxDevice(_gfxDevice)
+{
+    ctrlCount = 0;
+}
+
+void Canvas::draw()
+{
+    // call draw() on all controls
+    int i;
+    for (i=0; i < ctrlCount; i++)
+        ctrlList[i]->draw(gfxDevice);
+}
+
+void Canvas::addControl(baseControl &bc)
+{
+    if (ctrlCount < MAX_CONTROLS_PER_CANVAS) {
+        ctrlList[ctrlCount] = &bc;
+        ctrlCount++;
+    }
+}
\ No newline at end of file