aboutsummaryrefslogtreecommitdiff
path: root/gui/widget.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'gui/widget.cpp')
-rw-r--r--gui/widget.cpp18
1 files changed, 17 insertions, 1 deletions
diff --git a/gui/widget.cpp b/gui/widget.cpp
index 865b011a77..e8a7d80183 100644
--- a/gui/widget.cpp
+++ b/gui/widget.cpp
@@ -111,7 +111,7 @@ StaticTextWidget::StaticTextWidget(GuiObject *boss, int x, int y, int w, int h,
: Widget(boss, x, y, w, h), _align(align) {
_flags = WIDGET_ENABLED;
_type = kStaticTextWidget;
- setLabel(text);
+ _label = text;
}
void StaticTextWidget::setValue(int value) {
@@ -120,6 +120,22 @@ void StaticTextWidget::setValue(int value) {
_label = buf;
}
+void StaticTextWidget::setLabel(const String &label) {
+ _label = label;
+ // TODO: We should automatically redraw when the label is changed.
+ // The following doesn't quite work when we are using tabs, plus it
+ // is rather clumsy to force a full redraw for a single static text.
+ // However, as long as we do blending, it might be the only way.
+ //_boss->draw();
+}
+
+void StaticTextWidget::setAlign(TextAlignment align) {
+ _align = align;
+ // TODO: We should automatically redraw when the alignment is changed.
+ // See setLabel() for more insights.
+}
+
+
void StaticTextWidget::drawWidget(bool hilite) {
NewGui *gui = &g_gui;
gui->drawString(_label, _x, _y, _w, isEnabled() ? gui->_textcolor : gui->_color, _align);