[Scummvm-cvs-logs] CVS: scummvm/gui widget.cpp,1.41,1.42 widget.h,1.38,1.39

Max Horn fingolfin at users.sourceforge.net
Sat Apr 16 10:54:26 CEST 2005


Update of /cvsroot/scummvm/scummvm/gui
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21431

Modified Files:
	widget.cpp widget.h 
Log Message:
setLabel should probably cause an automatic redraw...

Index: widget.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/gui/widget.cpp,v
retrieving revision 1.41
retrieving revision 1.42
diff -u -d -r1.41 -r1.42
--- widget.cpp	6 Jan 2005 22:48:42 -0000	1.41
+++ widget.cpp	16 Apr 2005 17:53:18 -0000	1.42
@@ -111,7 +111,7 @@
 	: 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 @@
 	_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);

Index: widget.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/gui/widget.h,v
retrieving revision 1.38
retrieving revision 1.39
diff -u -d -r1.38 -r1.39
--- widget.h	6 Apr 2005 15:21:32 -0000	1.38
+++ widget.h	16 Apr 2005 17:53:18 -0000	1.39
@@ -134,9 +134,9 @@
 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:





More information about the Scummvm-git-logs mailing list