aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gui/PopUpWidget.cpp17
-rw-r--r--gui/PopUpWidget.h1
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();