Lab4
Dependencies: SeeedStudioTFTv2 TFT_fonts mbed
Fork of Seeed_TFT_Touch_Shield by
Widget.cpp
- Committer:
- uswickra
- Date:
- 2014-09-26
- Revision:
- 4:ebcf8d366b91
- Child:
- 6:ebffa73d4f95
File content as of revision 4:ebcf8d366b91:
#include "Widget.h" void AbstractWidget::redraw() { //if state has changed in this widget if(state_changed) { paint(); pc.printf("starting to paint# \r\n"); state_changed = false; } //redraw action for all children for(vector<AbstractWidget*>::iterator it = children.begin(); it != children.end(); it++) { AbstractWidget* w = *it; w->redraw(); } } void AbstractWidget::refresh() { state_changed = true; //try to re-adjust cordinates for any children of 'p' if(children.size() > 0 ) { curr_row = 0 ; curr_col = 0 ; for(vector<AbstractWidget*>::iterator it = children.begin(); it != children.end(); it++) { AbstractWidget* pnl = (*it); push_children = false ; addWidget(pnl); push_children = true ; } } //refresh action for all children for(vector<AbstractWidget*>::iterator it = children.begin(); it != children.end(); it++) { AbstractWidget* w = *it; w->refresh(); } } AbstractWidget* AbstractWidget::remove_child() { AbstractWidget* w = children.back(); children.pop_back(); //refresh state of returned widget // w->refresh(); //revert to previous row/col position curr_row = prev_row; curr_col = prev_col; return w; } void AbstractWidget::trigger_action(ActionType type, ActionEvent evnt){ //do nothing }