Foundation classes for a basic GUI implementing simple widgets and events
Dependents: TouchScreenGUIDemo
Diff: Widgets/TextWidget.cpp
- Revision:
- 11:b485561aa112
- Parent:
- 10:e9d13e3a9d4f
- Child:
- 12:63db16fea709
--- a/Widgets/TextWidget.cpp Mon Apr 11 19:19:54 2016 +0000 +++ b/Widgets/TextWidget.cpp Fri Apr 22 16:12:42 2016 +0000 @@ -1,5 +1,4 @@ #include "TextWidget.h" -#include "string.h" /** * A basic widget implementation which just draws some text. @@ -26,9 +25,9 @@ { } -void TextWidget::setText(char* text) +void TextWidget::setText(string text) { - _text = text; //strncpy(_text, text, strlen(text)); + _text = text; } void TextWidget::setFont(Font* font) @@ -44,7 +43,7 @@ _renderer->setBackground(_bg); _gui->display()->fillrect(_x, _y, _x+_width, _y+_height, _bg); - _renderer->puts(_text, _gui->display(), _font); + _renderer->puts(_text.c_str(), _gui->display(), _font); _gui->display()->copy_to_lcd(); }