Operating System
Dependencies: UnitTest wolfssh mDNS wolfcrypt wolfSSL
This is an embedded operating system for K64F. It includes a ssh server, a web-server and mDNS server. It has POST on boot. The main purpose of the OS is a router for the thing network.
gui/widget.h@3:351ee68a721d, 2019-09-11 (annotated)
- Committer:
- sPymbed
- Date:
- Wed Sep 11 10:41:02 2019 +0000
- Revision:
- 3:351ee68a721d
- Parent:
- 0:97ba3e2cd071
working
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
sPymbed | 0:97ba3e2cd071 | 1 | |
sPymbed | 0:97ba3e2cd071 | 2 | #ifndef __MYOS__GUI__WIDGET_H |
sPymbed | 0:97ba3e2cd071 | 3 | #define __MYOS__GUI__WIDGET_H |
sPymbed | 0:97ba3e2cd071 | 4 | |
sPymbed | 0:97ba3e2cd071 | 5 | |
sPymbed | 0:97ba3e2cd071 | 6 | #include <common/graphicscontext.h> |
sPymbed | 0:97ba3e2cd071 | 7 | //#include <drivers/keyboard.h> |
sPymbed | 0:97ba3e2cd071 | 8 | |
sPymbed | 0:97ba3e2cd071 | 9 | namespace myos |
sPymbed | 0:97ba3e2cd071 | 10 | { |
sPymbed | 0:97ba3e2cd071 | 11 | namespace gui |
sPymbed | 0:97ba3e2cd071 | 12 | { |
sPymbed | 0:97ba3e2cd071 | 13 | |
sPymbed | 0:97ba3e2cd071 | 14 | class Widget |
sPymbed | 0:97ba3e2cd071 | 15 | { |
sPymbed | 0:97ba3e2cd071 | 16 | protected: |
sPymbed | 0:97ba3e2cd071 | 17 | Widget* parent; |
sPymbed | 0:97ba3e2cd071 | 18 | int32_t x; |
sPymbed | 0:97ba3e2cd071 | 19 | int32_t y; |
sPymbed | 0:97ba3e2cd071 | 20 | int32_t w; |
sPymbed | 0:97ba3e2cd071 | 21 | int32_t h; |
sPymbed | 0:97ba3e2cd071 | 22 | |
sPymbed | 0:97ba3e2cd071 | 23 | uint8_t r; |
sPymbed | 0:97ba3e2cd071 | 24 | uint8_t g; |
sPymbed | 0:97ba3e2cd071 | 25 | uint8_t b; |
sPymbed | 0:97ba3e2cd071 | 26 | bool Focussable; |
sPymbed | 0:97ba3e2cd071 | 27 | |
sPymbed | 0:97ba3e2cd071 | 28 | public: |
sPymbed | 0:97ba3e2cd071 | 29 | |
sPymbed | 0:97ba3e2cd071 | 30 | Widget(Widget* parent, |
sPymbed | 0:97ba3e2cd071 | 31 | int32_t x, int32_t y, int32_t w, int32_t h, |
sPymbed | 0:97ba3e2cd071 | 32 | uint8_t r, uint8_t g, uint8_t b); |
sPymbed | 0:97ba3e2cd071 | 33 | ~Widget(); |
sPymbed | 0:97ba3e2cd071 | 34 | |
sPymbed | 0:97ba3e2cd071 | 35 | virtual void GetFocus(Widget* widget); |
sPymbed | 0:97ba3e2cd071 | 36 | virtual void ModelToScreen(int32_t &x, int32_t& y); |
sPymbed | 0:97ba3e2cd071 | 37 | virtual bool ContainsCoordinate(int32_t x, int32_t y); |
sPymbed | 0:97ba3e2cd071 | 38 | |
sPymbed | 0:97ba3e2cd071 | 39 | virtual void Draw(common::GraphicsContext* gc); |
sPymbed | 0:97ba3e2cd071 | 40 | //virtual void OnMouseDown(int32_t x, int32_t y, uint8_t button); |
sPymbed | 0:97ba3e2cd071 | 41 | //virtual void OnMouseUp(int32_t x, int32_t y, uint8_t button); |
sPymbed | 0:97ba3e2cd071 | 42 | //virtual void OnMouseMove(int32_t oldx, int32_t oldy, int32_t newx, int32_t newy); |
sPymbed | 0:97ba3e2cd071 | 43 | }; |
sPymbed | 0:97ba3e2cd071 | 44 | |
sPymbed | 0:97ba3e2cd071 | 45 | |
sPymbed | 0:97ba3e2cd071 | 46 | class CompositeWidget : public Widget |
sPymbed | 0:97ba3e2cd071 | 47 | { |
sPymbed | 0:97ba3e2cd071 | 48 | private: |
sPymbed | 0:97ba3e2cd071 | 49 | Widget* children[100]; |
sPymbed | 0:97ba3e2cd071 | 50 | int numChildren; |
sPymbed | 0:97ba3e2cd071 | 51 | Widget* focussedChild; |
sPymbed | 0:97ba3e2cd071 | 52 | |
sPymbed | 0:97ba3e2cd071 | 53 | public: |
sPymbed | 0:97ba3e2cd071 | 54 | CompositeWidget(Widget* parent, |
sPymbed | 0:97ba3e2cd071 | 55 | int32_t x, int32_t y, int32_t w, int32_t h, |
sPymbed | 0:97ba3e2cd071 | 56 | uint8_t r, uint8_t g, uint8_t b); |
sPymbed | 0:97ba3e2cd071 | 57 | ~CompositeWidget(); |
sPymbed | 0:97ba3e2cd071 | 58 | |
sPymbed | 0:97ba3e2cd071 | 59 | virtual void GetFocus(Widget* widget); |
sPymbed | 0:97ba3e2cd071 | 60 | virtual bool AddChild(Widget* child); |
sPymbed | 0:97ba3e2cd071 | 61 | |
sPymbed | 0:97ba3e2cd071 | 62 | virtual void Draw(common::GraphicsContext* gc); |
sPymbed | 0:97ba3e2cd071 | 63 | //virtual void OnMouseDown(int32_t x, int32_t y, uint8_t button); |
sPymbed | 0:97ba3e2cd071 | 64 | //virtual void OnMouseUp(int32_t x, int32_t y, uint8_t button); |
sPymbed | 0:97ba3e2cd071 | 65 | //virtual void OnMouseMove(int32_t oldx, int32_t oldy, int32_t newx, int32_t newy); |
sPymbed | 0:97ba3e2cd071 | 66 | |
sPymbed | 0:97ba3e2cd071 | 67 | //virtual void OnKeyDown(char); |
sPymbed | 0:97ba3e2cd071 | 68 | //virtual void OnKeyUp(char); |
sPymbed | 0:97ba3e2cd071 | 69 | }; |
sPymbed | 0:97ba3e2cd071 | 70 | |
sPymbed | 0:97ba3e2cd071 | 71 | } |
sPymbed | 0:97ba3e2cd071 | 72 | } |
sPymbed | 0:97ba3e2cd071 | 73 | |
sPymbed | 0:97ba3e2cd071 | 74 | |
sPymbed | 0:97ba3e2cd071 | 75 | #endif |