aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMax Horn2005-04-16 17:53:18 +0000
committerMax Horn2005-04-16 17:53:18 +0000
commitcaf142657dad21aa80a09387e34786591b2088ed (patch)
tree73e33d33e9e23588c8ee06863ec71b4f318c7668
parentb31ee93c75be5b715d282a36f01502e0fe293610 (diff)
downloadscummvm-rg350-caf142657dad21aa80a09387e34786591b2088ed.tar.gz
scummvm-rg350-caf142657dad21aa80a09387e34786591b2088ed.tar.bz2
scummvm-rg350-caf142657dad21aa80a09387e34786591b2088ed.zip
setLabel should probably cause an automatic redraw...
svn-id: r17638
-rw-r--r--gui/widget.cpp18
-rw-r--r--gui/widget.h4
2 files changed, 19 insertions, 3 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);
diff --git a/gui/widget.h b/gui/widget.h
index 1ce9ba9285..3a97cab747 100644
--- a/gui/widget.h
+++ b/gui/widget.h
@@ -134,9 +134,9 @@ protected:
public:
StaticTextWidget(GuiObject *boss, int x, int y, int w, int h, const String &text, TextAlignment align);
void setValue(int value);
- void setLabel(const String &label) { _label = label; }
+ void setLabel(const String &label);
const String &getLabel() const { return _label; }
- void setAlign(TextAlignment align) { _align = align; }
+ void setAlign(TextAlignment align);
TextAlignment getAlign() const { return _align; }
protected: