Lab4

Dependencies:   SeeedStudioTFTv2 TFT_fonts mbed

Fork of Seeed_TFT_Touch_Shield by Shields

Revision:
4:ebcf8d366b91
Child:
6:ebffa73d4f95
diff -r a717ac467c2e -r ebcf8d366b91 ActionListener.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ActionListener.h	Fri Sep 26 12:40:19 2014 +0000
@@ -0,0 +1,33 @@
+#pragma once
+#include <vector>
+#include "mbed.h"
+
+typedef enum { CORD, STR, CORD_STR } ActionType;
+
+class ActionEvent{
+public:
+    //pixel x that event took place
+    int x;  
+    //pixel y that event took place
+    int y;   
+    
+    char* string;
+};
+
+class ActionListener{
+public:
+    ActionListener();
+    
+    void registerForEvents(ActionListener* widg);
+    
+    void action(ActionType type, ActionEvent evnt);
+
+protected:
+    virtual void trigger_action( ActionType type, ActionEvent evnt)=0;
+    
+private:
+    bool is_reg;
+    ActionListener* target;
+    vector<ActionListener*> children;    
+       
+};
\ No newline at end of file