[Scummvm-cvs-logs] CVS: scummvm/gui widget.cpp,1.12,1.13 PopUpWidget.cpp,1.8,1.9

Max Horn fingolfin at users.sourceforge.net
Wed Mar 26 04:31:08 CET 2003


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

Modified Files:
	widget.cpp PopUpWidget.cpp 
Log Message:
Make it possible to disable popups/checkboxes

Index: widget.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/gui/widget.cpp,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -d -r1.12 -r1.13
--- widget.cpp	6 Mar 2003 21:45:45 -0000	1.12
+++ widget.cpp	26 Mar 2003 12:30:19 -0000	1.13
@@ -167,12 +167,12 @@
 
 	// If checked, draw cross inside the box
 	if (_state)
-		gui->drawBitmap(checked_img, _x + 3, _y + 3, gui->_textcolor);
+		gui->drawBitmap(checked_img, _x + 3, _y + 3, !isEnabled() ? gui->_color : gui->_textcolor);
 	else
 		gui->fillRect(_x + 2, _y + 2, 10, 10, gui->_bgcolor);
 
 	// Finally draw the label
-	gui->drawString(_label, _x + 20, _y + 3, _w, gui->_textcolor);
+	gui->drawString(_label, _x + 20, _y + 3, _w, !isEnabled() ? gui->_color : gui->_textcolor);
 }
 
 #pragma mark -

Index: PopUpWidget.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/gui/PopUpWidget.cpp,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- PopUpWidget.cpp	6 Mar 2003 21:45:34 -0000	1.8
+++ PopUpWidget.cpp	26 Mar 2003 12:30:20 -0000	1.9
@@ -265,6 +265,9 @@
 	_gui->addDirtyRect(x, y, w, kLineHeight);
 }
 
+
+#pragma mark -
+
 //
 // PopUpWidget
 //
@@ -278,11 +281,14 @@
 }
 
 void PopUpWidget::handleMouseDown(int x, int y, int button, int clickCount) {
-	PopUpDialog popupDialog(this, x + _x + _boss->getX(), y + _y + _boss->getY());
-	int newSel = popupDialog.runModal();
-	if (newSel != -1 && _selectedItem != newSel) {
-		_selectedItem = newSel;
-		sendCommand(kPopUpItemSelectedCmd, _entries[_selectedItem].tag);
+
+	if (isEnabled()) {
+		PopUpDialog popupDialog(this, x + _x + _boss->getX(), y + _y + _boss->getY());
+		int newSel = popupDialog.runModal();
+		if (newSel != -1 && _selectedItem != newSel) {
+			_selectedItem = newSel;
+			sendCommand(kPopUpItemSelectedCmd, _entries[_selectedItem].tag);
+		}
 	}
 }
 
@@ -320,11 +326,11 @@
 	gui->vline(_x + _w - 1, _y, _y +_h - 1, gui->_shadowcolor);
 
 	// Draw an arrow pointing down at the right end to signal this is a dropdown/popup
-	gui->drawBitmap(up_down_arrows, _x+_w - 10, _y+2, hilite ? gui->_textcolorhi : gui->_textcolor);
+	gui->drawBitmap(up_down_arrows, _x+_w - 10, _y+2, !isEnabled() ? gui->_color : hilite ? gui->_textcolorhi : gui->_textcolor);
 
 	// Draw the selected entry, if any
 	if (_selectedItem >= 0) {
 		int align = (gui->getStringWidth(_entries[_selectedItem].name) > _w-6) ? kTextAlignRight : kTextAlignLeft;
-		gui->drawString(_entries[_selectedItem].name, _x+2, _y+3, _w-6, gui->_textcolor, align);
+		gui->drawString(_entries[_selectedItem].name, _x+2, _y+3, _w-6, !isEnabled() ? gui->_color : gui->_textcolor, align);
 	}
 }





More information about the Scummvm-git-logs mailing list