Foundation classes for a basic GUI implementing simple widgets and events
Dependents: TouchScreenGUIDemo
Diff: Widgets/TextWidget.h
- Revision:
- 12:63db16fea709
- Parent:
- 11:b485561aa112
- Child:
- 13:6714534e7974
--- a/Widgets/TextWidget.h Fri Apr 22 16:12:42 2016 +0000 +++ b/Widgets/TextWidget.h Sun May 08 14:42:08 2016 +0000 @@ -1,34 +1,38 @@ #ifndef SIMPLEGUI_TEXT_WIDGET_H #define SIMPLEGUI_TEXT_WIDGET_H -#include <string> - #include "Widget.h" #include "Font.h" #include "FontRenderer.h" -class TextWidget : public Widget { - - public: - - TextWidget(GUI* gui); - TextWidget(GUI* gui, FontRenderer* renderer); - TextWidget(GUI* gui, FontRenderer* renderer, Font* font); - - // Ccncrete methods for this class - virtual void setFont(Font* font); - virtual void setText(string text); - - - protected: - - // Implementation to account for whether the event's coordinates intersect this widget - virtual void _draw(); - virtual void _clear(); +class TextWidget : public Widget +{ + +public: + + TextWidget(GraphicsContext *context); + TextWidget(GraphicsContext *context, FontRenderer* renderer); + TextWidget(GraphicsContext *context, FontRenderer* renderer, Font* font); - string _text; - FontRenderer* _renderer; - Font* _font; + /************************** + * Custom methods of this class + **************************/ + virtual void setFont(Font* font); + virtual void setText(char* text); + +protected: + + /************************** + * Overrides of Widget + **************************/ + virtual void _draw(); + + /************************** + * Custom data of this class + **************************/ + char* _text; + FontRenderer* _renderer; + Font* _font; }; #endif \ No newline at end of file