Foundation classes for a basic GUI implementing simple widgets and events
Dependents: TouchScreenGUIDemo
Diff: Widgets/TextWidget.cpp
- Revision:
- 9:616a9686d5db
- Parent:
- 8:a460cabc85ac
- Child:
- 10:e9d13e3a9d4f
--- a/Widgets/TextWidget.cpp Mon Apr 11 16:54:02 2016 +0000 +++ b/Widgets/TextWidget.cpp Mon Apr 11 19:15:53 2016 +0000 @@ -1,4 +1,5 @@ #include "TextWidget.h" +#include "string.h" /** * A basic widget implementation which just draws some text. @@ -27,7 +28,7 @@ void TextWidget::setText(char* text) { - _text = text; + _text = text; //strncpy(_text, text, strlen(text)); } void TextWidget::setFont(Font* font) @@ -41,7 +42,10 @@ _renderer->window(_x, _y, _width, _height, false); _renderer->setForeground(_fg); _renderer->setBackground(_bg); + _gui->display()->fillrect(_x, _y, _x+_width, _y+_height, _bg); + _renderer->puts(_text, _gui->display(), _font); + /** char c; char *p = _text; @@ -50,7 +54,7 @@ p++; _renderer->putc(c, _gui->display(), _font); } - +**/ _gui->display()->copy_to_lcd(); }