Lab4
Dependencies: SeeedStudioTFTv2 TFT_fonts mbed
Fork of Seeed_TFT_Touch_Shield by
ActionListener.h@6:ebffa73d4f95, 2014-09-26 (annotated)
- Committer:
- uswickra
- Date:
- Fri Sep 26 15:33:34 2014 +0000
- Revision:
- 6:ebffa73d4f95
- Parent:
- 4:ebcf8d366b91
fix report
Who changed what in which revision?
User | Revision | Line number | New 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 | 6:ebffa73d4f95 | 14 | char* str; |
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 | 6:ebffa73d4f95 | 26 | virtual void trigger_action( ActionType type, ActionEvent evnt, void* target)=0; |
uswickra | 6:ebffa73d4f95 | 27 | bool is_reg; |
uswickra | 4:ebcf8d366b91 | 28 | |
uswickra | 4:ebcf8d366b91 | 29 | private: |
uswickra | 6:ebffa73d4f95 | 30 | ActionListener* target; |
uswickra | 4:ebcf8d366b91 | 31 | |
uswickra | 4:ebcf8d366b91 | 32 | }; |