Lab4
Dependencies: SeeedStudioTFTv2 TFT_fonts mbed
Fork of Seeed_TFT_Touch_Shield by
ActionListener.cpp@4:ebcf8d366b91, 2014-09-26 (annotated)
- 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?
User | Revision | Line number | New contents of line |
---|---|---|---|
uswickra | 4:ebcf8d366b91 | 1 | #include "ActionListener.h" |
uswickra | 4:ebcf8d366b91 | 2 | |
uswickra | 4:ebcf8d366b91 | 3 | ActionListener::ActionListener() |
uswickra | 4:ebcf8d366b91 | 4 | { |
uswickra | 4:ebcf8d366b91 | 5 | is_reg = false ; |
uswickra | 4:ebcf8d366b91 | 6 | }; |
uswickra | 4:ebcf8d366b91 | 7 | |
uswickra | 4:ebcf8d366b91 | 8 | void ActionListener::registerForEvents(ActionListener* widg) |
uswickra | 4:ebcf8d366b91 | 9 | { |
uswickra | 4:ebcf8d366b91 | 10 | target = widg ; |
uswickra | 4:ebcf8d366b91 | 11 | is_reg = true ; |
uswickra | 4:ebcf8d366b91 | 12 | children.push_back(widg); |
uswickra | 4:ebcf8d366b91 | 13 | }; |
uswickra | 4:ebcf8d366b91 | 14 | |
uswickra | 4:ebcf8d366b91 | 15 | void ActionListener::action(ActionType type, ActionEvent evnt) |
uswickra | 4:ebcf8d366b91 | 16 | { |
uswickra | 4:ebcf8d366b91 | 17 | if(is_reg) { |
uswickra | 4:ebcf8d366b91 | 18 | // target->trigger_action(type, evnt); |
uswickra | 4:ebcf8d366b91 | 19 | for(vector<ActionListener*>::iterator it = children.begin(); it != children.end(); it++) { |
uswickra | 4:ebcf8d366b91 | 20 | ActionListener* w = *it; |
uswickra | 4:ebcf8d366b91 | 21 | w->trigger_action(type, evnt); |
uswickra | 4:ebcf8d366b91 | 22 | } |
uswickra | 4:ebcf8d366b91 | 23 | } |
uswickra | 4:ebcf8d366b91 | 24 | |
uswickra | 4:ebcf8d366b91 | 25 | }; |