Foundation classes for a basic GUI implementing simple widgets and events. (Fork for custom changes.)

Fork of SimpleGUI by Duncan McIntyre

Revision:
14:e6515b19f5a0
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Dialogs/OKCancelDialog.cpp	Sat May 21 16:36:02 2016 +0000
@@ -0,0 +1,45 @@
+#include "OKCancelDialog.h"
+#include "BitmapWidget.h"
+#include "GreenTick_64x64_bmp.h"
+#include "RedCross_64x64_bmp.h"
+
+OKCancelDialog::OKCancelDialog(GraphicsContext *context) : ContainerWidget(context)
+{
+
+    setLayout(FIXED);
+    setSize(
+        context->display()->width(),
+        context->display()->height()
+    );
+
+
+    BitmapWidget *apply = new BitmapWidget(context);
+    apply->setBitmap(GreenTick_64x64_bmp, 64, 64);
+    apply->setLocation(
+        0,
+        context->display()->height() - apply->height()
+    );
+    attach(apply);
+
+    BitmapWidget *cancel = new BitmapWidget(context);
+    cancel->setBitmap(RedCross_64x64_bmp, 64, 64);
+    cancel->setLocation(
+        context->display()->width() - cancel->width(),
+        context->display()->height() - cancel->height()
+    );
+    attach(cancel);
+    
+    EventHandler *ok = new EventHandler(TOUCH_TAP, this, &OKCancelDialog::_handleOK);
+    EventHandler *cancelled = new EventHandler(TOUCH_TAP, this, &OKCancelDialog::_handleCancel);
+    apply->setEventHandler(ok);
+    cancel->setEventHandler(cancelled);
+}
+
+
+void OKCancelDialog::_handleOK(Event e) {
+    _onOK.call(e);
+}
+
+void OKCancelDialog::_handleCancel(Event e) {
+    _onCancel.call(e);
+}
\ No newline at end of file