[Scummvm-cvs-logs] CVS: scummvm/gui dialog.cpp,1.16,1.17 dialog.h,1.7,1.8 launcher.cpp,1.4,1.5 message.cpp,1.2,1.3 widget.cpp,1.6,1.7 widget.h,1.5,1.6

Max Horn fingolfin at users.sourceforge.net
Fri Oct 11 17:27:09 CEST 2002


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

Modified Files:
	dialog.cpp dialog.h launcher.cpp message.cpp widget.cpp 
	widget.h 
Log Message:
revised options dialog

Index: dialog.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/gui/dialog.cpp,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -d -r1.16 -r1.17
--- dialog.cpp	1 Oct 2002 23:11:19 -0000	1.16
+++ dialog.cpp	12 Oct 2002 00:26:24 -0000	1.17
@@ -38,6 +38,18 @@
  * ...
  */
 
+Dialog::~Dialog()
+{
+	Widget *w = _firstWidget, *next;
+	while (w) {
+		next = w->_next;
+		w->_next = 0;
+		delete w;
+		w = next;
+	}
+	_firstWidget = 0;
+}
+
 void Dialog::open()
 {
 	Widget *w = _firstWidget;
@@ -243,8 +255,8 @@
 	return w;
 }
 
-Widget *Dialog::addButton(int x, int y, int w, int h, const ScummVM::String &label, uint32 cmd, char hotkey)
+Widget *Dialog::addButton(int x, int y, const ScummVM::String &label, uint32 cmd, char hotkey)
 {
-	return new ButtonWidget(this, x, y, w, h, label, cmd, hotkey);
+	return new ButtonWidget(this, x, y, 54, 16, label, cmd, hotkey);
 }
 

Index: dialog.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/gui/dialog.h,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- dialog.h	1 Oct 2002 23:11:19 -0000	1.7
+++ dialog.h	12 Oct 2002 00:26:24 -0000	1.8
@@ -48,7 +48,7 @@
 		: _gui(gui), _x(x), _y(y), _w(w), _h(h), _firstWidget(0),
 		  _mouseWidget(0), _focusedWidget(0), _visible(false)
 		{}
-	virtual ~Dialog() {};
+	virtual ~Dialog();
 
 	virtual void open();
 	virtual void close();
@@ -70,7 +70,7 @@
 protected:
 	Widget* findWidget(int x, int y); // Find the widget at pos x,y if any
 
-	Widget* addButton(int x, int y, int w, int h, const ScummVM::String &label, uint32 cmd, char hotkey);
+	Widget* addButton(int x, int y, const ScummVM::String &label, uint32 cmd, char hotkey);
 };
 
 #endif

Index: launcher.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/gui/launcher.cpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- launcher.cpp	1 Oct 2002 23:11:19 -0000	1.4
+++ launcher.cpp	12 Oct 2002 00:26:24 -0000	1.5
@@ -48,9 +48,9 @@
 	: Dialog(gui, 0, 0, 320, 200), _detector(detector)
 {
 	// Add three buttons at the bottom
-	addButton(1*(_w - 54)/6, _h - 24, 54, 16, "Quit", kQuitCmd, 'Q');
-	addButton(3*(_w - 54)/6, _h - 24, 54, 16, "Options", kOptionsCmd, 'O');
-	_startButton = addButton(5*(_w - 54)/6, _h - 24, 54, 16, "Start", kStartCmd, 'S');
+	addButton(1*(_w - 54)/6, _h - 24, "Quit", kQuitCmd, 'Q');
+	addButton(3*(_w - 54)/6, _h - 24, "Options", kOptionsCmd, 'O');
+	_startButton = addButton(5*(_w - 54)/6, _h - 24, "Start", kStartCmd, 'S');
 	_startButton->setEnabled(false);
 
 	// Add list with game titles

Index: message.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/gui/message.cpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- message.cpp	26 Sep 2002 12:29:10 -0000	1.2
+++ message.cpp	12 Oct 2002 00:26:24 -0000	1.3
@@ -69,5 +69,5 @@
 	}
 
 	// FIXME - the vertical position has to be adjusted
-	addButton((_w - 54)/2, _h - 24, 54, 16, "OK", kCloseCmd, '\n');	// Confirm dialog
+	addButton((_w - kButtonWidth)/2, _h - 24, "OK", kCloseCmd, '\n');	// Confirm dialog
 }

Index: widget.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/gui/widget.cpp,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- widget.cpp	1 Oct 2002 23:11:19 -0000	1.6
+++ widget.cpp	12 Oct 2002 00:26:24 -0000	1.7
@@ -103,9 +103,7 @@
 void StaticTextWidget::drawWidget(bool hilite)
 {
 	NewGui *gui = _boss->getGui();
-	gui->drawString(_label.c_str(), _x, _y, _w,
-	                !isEnabled() ? gui->_color :
-	                hilite ? gui->_textcolorhi : gui->_textcolor, _align);
+	gui->drawString(_label.c_str(), _x, _y, _w, gui->_textcolor, _align);
 }
 
 
@@ -123,6 +121,14 @@
 {
 	if (isEnabled() && x >= 0 && x < _w && y >= 0 && y < _h)
 		sendCommand(_cmd, 0);
+}
+
+void ButtonWidget::drawWidget(bool hilite)
+{
+	NewGui *gui = _boss->getGui();
+	gui->drawString(_label.c_str(), _x, _y, _w,
+	                !isEnabled() ? gui->_color :
+	                hilite ? gui->_textcolorhi : gui->_textcolor, _align);
 }
 
 #pragma mark -

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	1 Oct 2002 23:11:19 -0000	1.5
+++ widget.h	12 Oct 2002 00:26:24 -0000	1.6
@@ -47,6 +47,13 @@
 	kScrollBarWidget	= 'SCRB'
 };
 
+enum {
+	kButtonWidth = 54,
+	kButtonHeight = 16,
+};
+
+
+
 class CommandReceiver;
 class CommandSender;
 
@@ -155,6 +162,9 @@
 	void handleMouseUp(int x, int y, int button, int clickCount);
 	void handleMouseEntered(int button)	{ setFlags(WIDGET_HILITED); draw(); }
 	void handleMouseLeft(int button)	{ clearFlags(WIDGET_HILITED); draw(); }
+
+protected:
+	void drawWidget(bool hilite);
 };
 
 /* CheckboxWidget */





More information about the Scummvm-git-logs mailing list