[Scummvm-cvs-logs] CVS: scummvm/gui dialog.cpp,1.9,1.10 widget.cpp,1.8,1.9 widget.h,1.5,1.6

Max Horn fingolfin at users.sourceforge.net
Mon Jul 8 04:56:03 CEST 2002


Update of /cvsroot/scummvm/scummvm/gui
In directory usw-pr-cvs1:/tmp/cvs-serv23554/gui

Modified Files:
	dialog.cpp widget.cpp widget.h 
Log Message:
got rid of RTTI again (i.e. dynamic_cast)

Index: dialog.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/gui/dialog.cpp,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- dialog.cpp	8 Jul 2002 00:29:47 -0000	1.9
+++ dialog.cpp	8 Jul 2002 11:55:55 -0000	1.10
@@ -56,9 +56,8 @@
 	Widget *w = _firstWidget;
 	key = toupper(key);
 	while (w) {
-		ButtonWidget *b = dynamic_cast<ButtonWidget *>(w);
-		if (b && key == toupper(b->_hotkey)) {
-			b->handleClick(1);
+		if (w->_type == kButtonWidget && key == toupper(((ButtonWidget *)w)->_hotkey)) {
+			w->handleClick(1);
 			break;
 		}
 		w = w->_next;

Index: widget.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/gui/widget.cpp,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- widget.cpp	8 Jul 2002 00:29:47 -0000	1.8
+++ widget.cpp	8 Jul 2002 11:55:55 -0000	1.9
@@ -25,7 +25,7 @@
 
 
 Widget::Widget (Dialog *boss, int x, int y, int w, int h)
-	: _boss(boss), _x(x), _y(y), _w(w), _h(h), _id(0), _flags(0)
+	: _type(0), _boss(boss), _x(x), _y(y), _w(w), _h(h), _id(0), _flags(0)
 {
 	// Insert into the widget list of the boss
 	_next = _boss->_firstWidget;
@@ -78,6 +78,7 @@
 {
 	// FIXME - maybe we should make a real copy of the string?
 	_text = text;
+	_type = kStaticTextWidget;
 }
 
 void StaticTextWidget::drawWidget(bool hilite)
@@ -94,6 +95,7 @@
 	: StaticTextWidget(boss, x, y, w, h, label), _cmd(cmd), _hotkey(hotkey)
 {
 	_flags = WIDGET_ENABLED | WIDGET_BORDER /* | WIDGET_CLEARBG */ ;
+	_type = kButtonWidget;
 }
 
 void ButtonWidget::handleClick(int button)
@@ -122,6 +124,7 @@
 	: ButtonWidget(boss, x, y, w, h, label, cmd, hotkey), _state(false)
 {
 	_flags = WIDGET_ENABLED;
+	_type = kCheckboxWidget;
 }
 
 void CheckboxWidget::handleClick(int button)

Index: widget.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/gui/widget.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- widget.h	8 Jul 2002 00:29:47 -0000	1.5
+++ widget.h	8 Jul 2002 11:55:55 -0000	1.6
@@ -35,10 +35,17 @@
 	WIDGET_WANT_TICKLE	= 1 << 5,
 };
 
+enum {
+	kStaticTextWidget	= 'TEXT',
+	kButtonWidget		= 'BTTN',
+	kCheckboxWidget		= 'CHKB',
+};
+
 /* Widget */
 class Widget {
 friend class Dialog;
 protected:
+	int			_type;
 	Dialog		*_boss;
 	Widget		*_next;
 	int16		_x, _y;





More information about the Scummvm-git-logs mailing list