Foundation classes for a basic GUI implementing simple widgets and events
Dependents: TouchScreenGUIDemo
Widgets/TextWidget.cpp
- Committer:
- duncanFrance
- Date:
- 2016-03-27
- Revision:
- 4:27546fb8b670
- Parent:
- 3:cb004f59b715
- Child:
- 7:303850a4b30c
File content as of revision 4:27546fb8b670:
#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) : Widget(display), _renderer(display) {} void TextWidget::setText(char* text) { _text = text; } void TextWidget::setFont(Font* font) { _font = font; } void TextWidget::draw() { _renderer.clip(_x, _y, _width, _height); char c; char *p = _text; while(*p != NULL) { c = *p; p++; _renderer.putc(c, _font, _fg, _bg); } _display->copy_to_lcd(); }