Lab4

Dependencies:   SeeedStudioTFTv2 TFT_fonts mbed

Fork of Seeed_TFT_Touch_Shield by Shields

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?

UserRevisionLine numberNew contents of line
uswickra 4:ebcf8d366b91 1 #pragma once
uswickra 4:ebcf8d366b91 2 #include "mbed.h"
uswickra 4:ebcf8d366b91 3 #include "SeeedStudioTFTv2.h"
uswickra 4:ebcf8d366b91 4 #include "ActionListener.h"
uswickra 4:ebcf8d366b91 5 #include <vector>
uswickra 4:ebcf8d366b91 6 //extern ActionType;
uswickra 4:ebcf8d366b91 7
uswickra 4:ebcf8d366b91 8 extern SeeedStudioTFTv2 TFT;
uswickra 4:ebcf8d366b91 9 extern Serial pc;
uswickra 4:ebcf8d366b91 10 //class ActionEvent;
uswickra 4:ebcf8d366b91 11 //class ActionListener;
uswickra 4:ebcf8d366b91 12 //typedef enum { CORD, STR, CORD_STR } ActionType;
uswickra 4:ebcf8d366b91 13
uswickra 4:ebcf8d366b91 14 class AbstractWidget:public ActionListener
uswickra 4:ebcf8d366b91 15 {
uswickra 4:ebcf8d366b91 16 friend class Panel;
uswickra 4:ebcf8d366b91 17 public:
uswickra 4:ebcf8d366b91 18 void redraw();
uswickra 4:ebcf8d366b91 19
uswickra 4:ebcf8d366b91 20 //refresh state of this widget and all its children
uswickra 4:ebcf8d366b91 21 void refresh() ;
uswickra 4:ebcf8d366b91 22
uswickra 4:ebcf8d366b91 23 AbstractWidget* remove_child();
uswickra 4:ebcf8d366b91 24
uswickra 6:ebffa73d4f95 25 virtual void trigger_action(ActionType type, ActionEvent evnt, void* target);
uswickra 6:ebffa73d4f95 26
uswickra 6:ebffa73d4f95 27 void inject_action(int x, int y);
uswickra 4:ebcf8d366b91 28
uswickra 4:ebcf8d366b91 29
uswickra 4:ebcf8d366b91 30 protected:
uswickra 4:ebcf8d366b91 31 virtual bool addWidget(AbstractWidget *p){return true;};
uswickra 4:ebcf8d366b91 32 vector<AbstractWidget*> children;
uswickra 4:ebcf8d366b91 33 bool state_changed ;
uswickra 4:ebcf8d366b91 34 virtual void paint()=0;
uswickra 4:ebcf8d366b91 35 int back_color, border_color;
uswickra 4:ebcf8d366b91 36 //relative measure unit on space occupied on parent
uswickra 4:ebcf8d366b91 37 //width/hieght in "cell" units
uswickra 4:ebcf8d366b91 38 int width, height ;
uswickra 4:ebcf8d366b91 39 //left top corner of widget
uswickra 4:ebcf8d366b91 40 int x0,y0 ;
uswickra 4:ebcf8d366b91 41 //right bottom corner of widget
uswickra 4:ebcf8d366b91 42 int x1,y1 ;
uswickra 4:ebcf8d366b91 43 //number of cells panel is divided into
uswickra 4:ebcf8d366b91 44 //book keeping for child widgets
uswickra 4:ebcf8d366b91 45 int rows, cols ;
uswickra 4:ebcf8d366b91 46 double pp_row;
uswickra 4:ebcf8d366b91 47 double pp_col;
uswickra 4:ebcf8d366b91 48 bool push_children;
uswickra 4:ebcf8d366b91 49
uswickra 4:ebcf8d366b91 50 int curr_row;
uswickra 4:ebcf8d366b91 51 int curr_col;
uswickra 4:ebcf8d366b91 52 int prev_row;
uswickra 4:ebcf8d366b91 53 int prev_col;
uswickra 4:ebcf8d366b91 54
uswickra 4:ebcf8d366b91 55 };