[Scummvm-cvs-logs] SF.net SVN: scummvm:[35514] scummvm/trunk/gui

jvprat at users.sourceforge.net jvprat at users.sourceforge.net
Wed Dec 24 00:47:16 CET 2008


Revision: 35514
          http://scummvm.svn.sourceforge.net/scummvm/?rev=35514&view=rev
Author:   jvprat
Date:     2008-12-23 23:47:16 +0000 (Tue, 23 Dec 2008)

Log Message:
-----------
Modify the PopUpWidget selection by using the mouse wheel

Modified Paths:
--------------
    scummvm/trunk/gui/PopUpWidget.cpp
    scummvm/trunk/gui/PopUpWidget.h

Modified: scummvm/trunk/gui/PopUpWidget.cpp
===================================================================
--- scummvm/trunk/gui/PopUpWidget.cpp	2008-12-23 23:36:38 UTC (rev 35513)
+++ scummvm/trunk/gui/PopUpWidget.cpp	2008-12-23 23:47:16 UTC (rev 35514)
@@ -379,6 +379,23 @@
 	}
 }
 
+void PopUpWidget::handleMouseWheel(int x, int y, int direction) {
+	int newSelection = _selectedItem + direction;
+
+	// Skip separator entries
+	while ((newSelection >= 0) && (newSelection < (int)_entries.size()) &&
+		_entries[newSelection].name.equals("")) {
+		newSelection += direction;
+	}
+
+	// Just update the selected item when we're in range
+	if ((newSelection >= 0) && (newSelection < (int)_entries.size()) &&
+		(newSelection != _selectedItem)) {
+		_selectedItem = newSelection;
+		draw();
+	}
+}
+
 void PopUpWidget::reflowLayout() {
 	_leftPadding = g_gui.xmlEval()->getVar("Globals.PopUpWidget.Padding.Left", 0);
 	_rightPadding = g_gui.xmlEval()->getVar("Globals.PopUpWidget.Padding.Right", 0);

Modified: scummvm/trunk/gui/PopUpWidget.h
===================================================================
--- scummvm/trunk/gui/PopUpWidget.h	2008-12-23 23:36:38 UTC (rev 35513)
+++ scummvm/trunk/gui/PopUpWidget.h	2008-12-23 23:47:16 UTC (rev 35514)
@@ -68,6 +68,7 @@
 	void changeLabelWidth(uint newWidth) { _labelWidth = newWidth; }
 
 	void handleMouseDown(int x, int y, int button, int clickCount);
+	void handleMouseWheel(int x, int y, int direction);
 
 	void appendEntry(const String &entry, uint32 tag = (uint32)-1);
 	void clearEntries();


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list