Foundation classes for a basic GUI implementing simple widgets and events
Dependents: TouchScreenGUIDemo
Widgets/TextWidget.cpp
- Committer:
- duncanFrance
- Date:
- 2016-04-10
- Revision:
- 7:303850a4b30c
- Parent:
- 4:27546fb8b670
- Child:
- 8:a460cabc85ac
File content as of revision 7:303850a4b30c:
#include "TextWidget.h" /** * A basic widget implementation which just draws some text. * If the text does not fit in the bounding-box it will be clipped **/ TextWidget::TextWidget(GraphicsDisplay& display, FontRenderer* renderer) : Widget(display), _renderer(renderer) { } void TextWidget::setText(char* text) { _text = text; } void TextWidget::setFont(Font* font) { _font = font; } void TextWidget::draw() { _renderer->window(_x, _y, _width, _height, false); _renderer->setForeground(_fg); _renderer->setBackground(_bg); _renderer->setFont(_font); char c; char *p = _text; while(*p != NULL) { c = *p; p++; _renderer->putc(c, _display); } _display.copy_to_lcd(); }