Lab4

Dependencies:   SeeedStudioTFTv2 TFT_fonts mbed

Fork of Seeed_TFT_Touch_Shield by Shields

Committer:
uswickra
Date:
Fri Sep 26 12:40:19 2014 +0000
Revision:
4:ebcf8d366b91
Child:
6:ebffa73d4f95
Lab 4;

Who changed what in which revision?

UserRevisionLine numberNew contents of line
uswickra 4:ebcf8d366b91 1 #pragma once
uswickra 4:ebcf8d366b91 2 #include <vector>
uswickra 4:ebcf8d366b91 3 #include "mbed.h"
uswickra 4:ebcf8d366b91 4
uswickra 4:ebcf8d366b91 5 typedef enum { CORD, STR, CORD_STR } ActionType;
uswickra 4:ebcf8d366b91 6
uswickra 4:ebcf8d366b91 7 class ActionEvent{
uswickra 4:ebcf8d366b91 8 public:
uswickra 4:ebcf8d366b91 9 //pixel x that event took place
uswickra 4:ebcf8d366b91 10 int x;
uswickra 4:ebcf8d366b91 11 //pixel y that event took place
uswickra 4:ebcf8d366b91 12 int y;
uswickra 4:ebcf8d366b91 13
uswickra 4:ebcf8d366b91 14 char* string;
uswickra 4:ebcf8d366b91 15 };
uswickra 4:ebcf8d366b91 16
uswickra 4:ebcf8d366b91 17 class ActionListener{
uswickra 4:ebcf8d366b91 18 public:
uswickra 4:ebcf8d366b91 19 ActionListener();
uswickra 4:ebcf8d366b91 20
uswickra 4:ebcf8d366b91 21 void registerForEvents(ActionListener* widg);
uswickra 4:ebcf8d366b91 22
uswickra 4:ebcf8d366b91 23 void action(ActionType type, ActionEvent evnt);
uswickra 4:ebcf8d366b91 24
uswickra 4:ebcf8d366b91 25 protected:
uswickra 4:ebcf8d366b91 26 virtual void trigger_action( ActionType type, ActionEvent evnt)=0;
uswickra 4:ebcf8d366b91 27
uswickra 4:ebcf8d366b91 28 private:
uswickra 4:ebcf8d366b91 29 bool is_reg;
uswickra 4:ebcf8d366b91 30 ActionListener* target;
uswickra 4:ebcf8d366b91 31 vector<ActionListener*> children;
uswickra 4:ebcf8d366b91 32
uswickra 4:ebcf8d366b91 33 };