diff options
| author | Jordi Vilalta Prat | 2008-12-23 23:47:16 +0000 | 
|---|---|---|
| committer | Jordi Vilalta Prat | 2008-12-23 23:47:16 +0000 | 
| commit | 604b8f08b6c52b027972457e52932f7c95eb353b (patch) | |
| tree | 52096deae924db865d1f3be9bfdeddd2b440cce5 /gui | |
| parent | f75893a2940901493b7901bda15b796aeab3fd74 (diff) | |
| download | scummvm-rg350-604b8f08b6c52b027972457e52932f7c95eb353b.tar.gz scummvm-rg350-604b8f08b6c52b027972457e52932f7c95eb353b.tar.bz2 scummvm-rg350-604b8f08b6c52b027972457e52932f7c95eb353b.zip  | |
Modify the PopUpWidget selection by using the mouse wheel
svn-id: r35514
Diffstat (limited to 'gui')
| -rw-r--r-- | gui/PopUpWidget.cpp | 17 | ||||
| -rw-r--r-- | gui/PopUpWidget.h | 1 | 
2 files changed, 18 insertions, 0 deletions
diff --git a/gui/PopUpWidget.cpp b/gui/PopUpWidget.cpp index 74c441e916..4c9dd8d81a 100644 --- a/gui/PopUpWidget.cpp +++ b/gui/PopUpWidget.cpp @@ -379,6 +379,23 @@ void PopUpWidget::handleMouseDown(int x, int y, int button, int clickCount) {  	}  } +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); diff --git a/gui/PopUpWidget.h b/gui/PopUpWidget.h index 8a7a8e867d..3f65106ac1 100644 --- a/gui/PopUpWidget.h +++ b/gui/PopUpWidget.h @@ -68,6 +68,7 @@ public:  	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();  | 
