Library for 3.2'' uLcd Picaso Display4D system Picaso Serial Environment Command Set web: http://www.4dsystems.com.au/product/20/67/Processors_Graphics/PICASO/
Screen.h@1:a74e42cf52b2, 2015-04-05 (annotated)
- Committer:
- adelino
- Date:
- Sun Apr 05 13:54:48 2015 +0000
- Revision:
- 1:a74e42cf52b2
PicasoLib version 2
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
adelino | 1:a74e42cf52b2 | 1 | #ifndef SCREEN_H |
adelino | 1:a74e42cf52b2 | 2 | #define SCREEN_H |
adelino | 1:a74e42cf52b2 | 3 | |
adelino | 1:a74e42cf52b2 | 4 | #include "mbed.h" |
adelino | 1:a74e42cf52b2 | 5 | #include "PicasoSerial.h" |
adelino | 1:a74e42cf52b2 | 6 | #include <string> |
adelino | 1:a74e42cf52b2 | 7 | #include <vector> |
adelino | 1:a74e42cf52b2 | 8 | |
adelino | 1:a74e42cf52b2 | 9 | /// |
adelino | 1:a74e42cf52b2 | 10 | class Widget; |
adelino | 1:a74e42cf52b2 | 11 | ///////// |
adelino | 1:a74e42cf52b2 | 12 | |
adelino | 1:a74e42cf52b2 | 13 | class Screen |
adelino | 1:a74e42cf52b2 | 14 | { |
adelino | 1:a74e42cf52b2 | 15 | public: |
adelino | 1:a74e42cf52b2 | 16 | /** Construct a Screen |
adelino | 1:a74e42cf52b2 | 17 | * |
adelino | 1:a74e42cf52b2 | 18 | * @param serial the PicasoSerial Obj |
adelino | 1:a74e42cf52b2 | 19 | * @param _x the up left |
adelino | 1:a74e42cf52b2 | 20 | * @params _y the up left |
adelino | 1:a74e42cf52b2 | 21 | * @params _w the width |
adelino | 1:a74e42cf52b2 | 22 | * @params _h the height |
adelino | 1:a74e42cf52b2 | 23 | * @param _colorBkg the background color |
adelino | 1:a74e42cf52b2 | 24 | */ |
adelino | 1:a74e42cf52b2 | 25 | // constructeur |
adelino | 1:a74e42cf52b2 | 26 | Screen(PicasoSerial* serial,UINT16 _x,UINT16 _y,UINT16 _w,UINT16 _h,Color _colorBkg); |
adelino | 1:a74e42cf52b2 | 27 | // |
adelino | 1:a74e42cf52b2 | 28 | virtual ~Screen(void); |
adelino | 1:a74e42cf52b2 | 29 | // |
adelino | 1:a74e42cf52b2 | 30 | //! draw all objects |
adelino | 1:a74e42cf52b2 | 31 | void drawAllWidget(void); |
adelino | 1:a74e42cf52b2 | 32 | //------------------------------ |
adelino | 1:a74e42cf52b2 | 33 | //! add a new Objet |
adelino | 1:a74e42cf52b2 | 34 | void addWidget(Widget* pObj); |
adelino | 1:a74e42cf52b2 | 35 | // |
adelino | 1:a74e42cf52b2 | 36 | //! draw a particular object |
adelino | 1:a74e42cf52b2 | 37 | void drawWidget(Widget* pObj); |
adelino | 1:a74e42cf52b2 | 38 | // |
adelino | 1:a74e42cf52b2 | 39 | //! @returns PicasoSerial the pointer to draw on the screen |
adelino | 1:a74e42cf52b2 | 40 | PicasoSerial* getPicasoSerial(void) const; |
adelino | 1:a74e42cf52b2 | 41 | // |
adelino | 1:a74e42cf52b2 | 42 | void setClear(); |
adelino | 1:a74e42cf52b2 | 43 | |
adelino | 1:a74e42cf52b2 | 44 | //getter |
adelino | 1:a74e42cf52b2 | 45 | UINT16 getXpos(void) const; |
adelino | 1:a74e42cf52b2 | 46 | UINT16 getYpos(void) const; |
adelino | 1:a74e42cf52b2 | 47 | UINT16 getWidth(void) const; |
adelino | 1:a74e42cf52b2 | 48 | UINT16 getHeight(void) const; |
adelino | 1:a74e42cf52b2 | 49 | Color getColorBkg(void) const; |
adelino | 1:a74e42cf52b2 | 50 | |
adelino | 1:a74e42cf52b2 | 51 | bool isContent(Widget* pObj, UINT16 _x,UINT16 _y); |
adelino | 1:a74e42cf52b2 | 52 | |
adelino | 1:a74e42cf52b2 | 53 | //----------------------------------------------------- |
adelino | 1:a74e42cf52b2 | 54 | //! returns the Objet in [_x,_y] position |
adelino | 1:a74e42cf52b2 | 55 | Widget* getWidgetPosition(UINT16 _x,UINT16 _y); |
adelino | 1:a74e42cf52b2 | 56 | |
adelino | 1:a74e42cf52b2 | 57 | //! returns the Objet by Id |
adelino | 1:a74e42cf52b2 | 58 | Widget* getWidgetById(UINT16 _id); |
adelino | 1:a74e42cf52b2 | 59 | |
adelino | 1:a74e42cf52b2 | 60 | //----------------------------------------------------- |
adelino | 1:a74e42cf52b2 | 61 | //! returns the touch and update the GraphicMessage |
adelino | 1:a74e42cf52b2 | 62 | TouchEvent getTouchEvent(GraphicMessage* msg); |
adelino | 1:a74e42cf52b2 | 63 | |
adelino | 1:a74e42cf52b2 | 64 | //------------------------------------------- |
adelino | 1:a74e42cf52b2 | 65 | //! update the identifier Id of the object being touched |
adelino | 1:a74e42cf52b2 | 66 | void getProcessMessage(GraphicMessage* msg); |
adelino | 1:a74e42cf52b2 | 67 | |
adelino | 1:a74e42cf52b2 | 68 | protected: |
adelino | 1:a74e42cf52b2 | 69 | PicasoSerial* mySerial; |
adelino | 1:a74e42cf52b2 | 70 | |
adelino | 1:a74e42cf52b2 | 71 | UINT16 myXpos,myYpos,myWidth,myHeight; |
adelino | 1:a74e42cf52b2 | 72 | |
adelino | 1:a74e42cf52b2 | 73 | Color myColorBkg; |
adelino | 1:a74e42cf52b2 | 74 | |
adelino | 1:a74e42cf52b2 | 75 | vector<Widget*> myVectorObjet; |
adelino | 1:a74e42cf52b2 | 76 | }; |
adelino | 1:a74e42cf52b2 | 77 | |
adelino | 1:a74e42cf52b2 | 78 | /////////////////////////////// |
adelino | 1:a74e42cf52b2 | 79 | class Widget |
adelino | 1:a74e42cf52b2 | 80 | { |
adelino | 1:a74e42cf52b2 | 81 | public: |
adelino | 1:a74e42cf52b2 | 82 | /** Construct a Widget the father |
adelino | 1:a74e42cf52b2 | 83 | * |
adelino | 1:a74e42cf52b2 | 84 | * @param mScreen the pointer screen |
adelino | 1:a74e42cf52b2 | 85 | * @param _id the identifier Id |
adelino | 1:a74e42cf52b2 | 86 | * @params _x the up left |
adelino | 1:a74e42cf52b2 | 87 | * @params _y the up left |
adelino | 1:a74e42cf52b2 | 88 | * @params _w the width |
adelino | 1:a74e42cf52b2 | 89 | * @params _h the height |
adelino | 1:a74e42cf52b2 | 90 | * @param _color the background color |
adelino | 1:a74e42cf52b2 | 91 | * @params _isVisible |
adelino | 1:a74e42cf52b2 | 92 | */ |
adelino | 1:a74e42cf52b2 | 93 | // constructor |
adelino | 1:a74e42cf52b2 | 94 | // |
adelino | 1:a74e42cf52b2 | 95 | Widget(Screen* mScreen,UINT16 _id,UINT16 _x,UINT16 _y,UINT16 _w,UINT16 _h,Color _color); |
adelino | 1:a74e42cf52b2 | 96 | // |
adelino | 1:a74e42cf52b2 | 97 | //! draw the obj |
adelino | 1:a74e42cf52b2 | 98 | virtual void draw(void); |
adelino | 1:a74e42cf52b2 | 99 | // |
adelino | 1:a74e42cf52b2 | 100 | virtual ~Widget(void); |
adelino | 1:a74e42cf52b2 | 101 | // |
adelino | 1:a74e42cf52b2 | 102 | |
adelino | 1:a74e42cf52b2 | 103 | UINT16 getXposition(void) const; |
adelino | 1:a74e42cf52b2 | 104 | UINT16 getYposition(void) const; |
adelino | 1:a74e42cf52b2 | 105 | UINT16 getWidth(void) const; |
adelino | 1:a74e42cf52b2 | 106 | UINT16 getHeight(void) const; |
adelino | 1:a74e42cf52b2 | 107 | UINT16 getId(void) const; |
adelino | 1:a74e42cf52b2 | 108 | bool getIsVisible(void) const; |
adelino | 1:a74e42cf52b2 | 109 | State getState(void) const; |
adelino | 1:a74e42cf52b2 | 110 | Color getColor(void) const; |
adelino | 1:a74e42cf52b2 | 111 | |
adelino | 1:a74e42cf52b2 | 112 | |
adelino | 1:a74e42cf52b2 | 113 | void setColor(Color _color); |
adelino | 1:a74e42cf52b2 | 114 | void setState(State _state); |
adelino | 1:a74e42cf52b2 | 115 | void setId(UINT16 _id); |
adelino | 1:a74e42cf52b2 | 116 | void setVisibility(bool _val); |
adelino | 1:a74e42cf52b2 | 117 | void setXposition(UINT16 _xpos); |
adelino | 1:a74e42cf52b2 | 118 | void setYposition(UINT16 _ypos); |
adelino | 1:a74e42cf52b2 | 119 | |
adelino | 1:a74e42cf52b2 | 120 | |
adelino | 1:a74e42cf52b2 | 121 | WIDGET_TYPE getType(void) const; |
adelino | 1:a74e42cf52b2 | 122 | |
adelino | 1:a74e42cf52b2 | 123 | |
adelino | 1:a74e42cf52b2 | 124 | |
adelino | 1:a74e42cf52b2 | 125 | protected: |
adelino | 1:a74e42cf52b2 | 126 | Screen* myScreen; |
adelino | 1:a74e42cf52b2 | 127 | |
adelino | 1:a74e42cf52b2 | 128 | UINT16 myX,myY,myWidth,myHeight; |
adelino | 1:a74e42cf52b2 | 129 | UINT16 myId; |
adelino | 1:a74e42cf52b2 | 130 | WIDGET_TYPE myType; |
adelino | 1:a74e42cf52b2 | 131 | |
adelino | 1:a74e42cf52b2 | 132 | bool myIsVisible; |
adelino | 1:a74e42cf52b2 | 133 | |
adelino | 1:a74e42cf52b2 | 134 | State myState; |
adelino | 1:a74e42cf52b2 | 135 | Color myColor; |
adelino | 1:a74e42cf52b2 | 136 | }; |
adelino | 1:a74e42cf52b2 | 137 | #endif |