[Scummvm-cvs-logs] CVS: scummvm/gui dialog.cpp,1.36,1.37 dialog.h,1.23,1.24 widget.cpp,1.24,1.25 widget.h,1.29,1.30

Max Horn fingolfin at users.sourceforge.net
Mon Nov 3 15:35:04 CET 2003


Update of /cvsroot/scummvm/scummvm/gui
In directory sc8-pr-cvs1:/tmp/cvs-serv2492

Modified Files:
	dialog.cpp dialog.h widget.cpp widget.h 
Log Message:
removed PushButtonWidget

Index: dialog.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/gui/dialog.cpp,v
retrieving revision 1.36
retrieving revision 1.37
diff -u -d -r1.36 -r1.37
--- dialog.cpp	2 Nov 2003 22:31:19 -0000	1.36
+++ dialog.cpp	3 Nov 2003 23:33:40 -0000	1.37
@@ -275,8 +275,3 @@
 ButtonWidget *Dialog::addButton(int x, int y, const Common::String &label, uint32 cmd, char hotkey) {
 	return new ButtonWidget(this, x, y, kButtonWidth, 16, label, cmd, hotkey);
 }
-
-PushButtonWidget *Dialog::addPushButton(int x, int y, const Common::String &label, uint32 cmd, char hotkey) {
-	return new PushButtonWidget(this, x, y, kButtonWidth, 16, label, cmd, hotkey);
-}
-

Index: dialog.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/gui/dialog.h,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -d -r1.23 -r1.24
--- dialog.h	2 Nov 2003 14:50:44 -0000	1.23
+++ dialog.h	3 Nov 2003 23:33:40 -0000	1.24
@@ -28,7 +28,6 @@
 
 class NewGui;
 class ButtonWidget;
-class PushButtonWidget;
 
 // Some "common" commands sent to handleCommand()
 enum {
@@ -77,7 +76,6 @@
 	Widget *findWidget(int x, int y); // Find the widget at pos x,y if any
 
 	ButtonWidget *addButton(int x, int y, const Common::String &label, uint32 cmd, char hotkey);
-	PushButtonWidget *addPushButton(int x, int y, const Common::String &label, uint32 cmd, char hotkey);
 
 	void setResult(int result) { _result = result; }
 };

Index: widget.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/gui/widget.cpp,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -d -r1.24 -r1.25
--- widget.cpp	3 Nov 2003 01:00:26 -0000	1.24
+++ widget.cpp	3 Nov 2003 23:33:40 -0000	1.25
@@ -135,24 +135,8 @@
 void ButtonWidget::drawWidget(bool hilite) {
 	NewGui *gui = &g_gui;
 	gui->drawString(_label, _x, _y, _w,
-									!isEnabled() ? gui->_color :
-									hilite ? gui->_textcolorhi : gui->_textcolor, _align);
-}
-
-#pragma mark -
-
-PushButtonWidget::PushButtonWidget(GuiObject *boss, int x, int y, int w, int h, const String &label, uint32 cmd, uint8 hotkey)
-	: ButtonWidget(boss, x, y, w, h, label, cmd, hotkey), _state(false) {
-	_flags = WIDGET_ENABLED | WIDGET_BORDER | WIDGET_CLEARBG;
-	_type = kButtonWidget;
-}
-
-void PushButtonWidget::setState(bool state) {
-	if (_state != state) {
-		_state = state;
-		_flags ^= WIDGET_INV_BORDER;
-		draw();
-	}
+	                !isEnabled() ? gui->_color :
+	                hilite ? gui->_textcolorhi : gui->_textcolor, _align);
 }
 
 #pragma mark -
@@ -170,7 +154,7 @@
 };
 
 CheckboxWidget::CheckboxWidget(GuiObject *boss, int x, int y, int w, int h, const String &label, uint32 cmd, uint8 hotkey)
-	: PushButtonWidget(boss, x, y, w, h, label, cmd, hotkey) {
+	: ButtonWidget(boss, x, y, w, h, label, cmd, hotkey), _state(false) {
 	_flags = WIDGET_ENABLED;
 	_type = kCheckboxWidget;
 }
@@ -179,6 +163,14 @@
 	if (isEnabled() && x >= 0 && x < _w && y >= 0 && y < _h) {
 		toggleState();
 		sendCommand(_cmd, 0);
+	}
+}
+
+void CheckboxWidget::setState(bool state) {
+	if (_state != state) {
+		_state = state;
+		_flags ^= WIDGET_INV_BORDER;
+		draw();
 	}
 }
 

Index: widget.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/gui/widget.h,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -d -r1.29 -r1.30
--- widget.h	3 Nov 2003 01:00:26 -0000	1.29
+++ widget.h	3 Nov 2003 23:33:40 -0000	1.30
@@ -159,27 +159,20 @@
 	void drawWidget(bool hilite);
 };
 
-/* PushButtonWidget */
-class PushButtonWidget : public ButtonWidget {
-protected:
-	bool	_state;
-public:
-	PushButtonWidget(GuiObject *boss, int x, int y, int w, int h, const String &label, uint32 cmd = 0, uint8 hotkey = 0);
-
-	void setState(bool state);
-	void toggleState()			{ setState(!_state); }
-	bool getState() const		{ return _state; }
-};
-
 /* CheckboxWidget */
-class CheckboxWidget : public PushButtonWidget {
+class CheckboxWidget : public ButtonWidget {
 protected:
+	bool	_state;
 public:
 	CheckboxWidget(GuiObject *boss, int x, int y, int w, int h, const String &label, uint32 cmd = 0, uint8 hotkey = 0);
 
 	void handleMouseUp(int x, int y, int button, int clickCount);
 	virtual void handleMouseEntered(int button)	{}
 	virtual void handleMouseLeft(int button)	{}
+
+	void setState(bool state);
+	void toggleState()			{ setState(!_state); }
+	bool getState() const		{ return _state; }
 
 protected:
 	void drawWidget(bool hilite);





More information about the Scummvm-git-logs mailing list