From 601ff92871c35668209027e5d13751bb3d66f074 Mon Sep 17 00:00:00 2001 From: Inusaito Sayori Date: Mon, 21 Jul 2014 18:00:43 -0400 Subject: [PATCH] Address Issue 1570: Make comboboxes scrollable Note: It appears that mLabel is never set by combo boxes, this should eventually be fixed. Checking !getFirstSelected() is sufficient to test if we're in the list, however. --- indra/llui/llcombobox.cpp | 13 +++++++++++++ indra/llui/llcombobox.h | 1 + 2 files changed, 14 insertions(+) diff --git a/indra/llui/llcombobox.cpp b/indra/llui/llcombobox.cpp index 7c8e1afeb..b3d1ee64d 100644 --- a/indra/llui/llcombobox.cpp +++ b/indra/llui/llcombobox.cpp @@ -909,6 +909,19 @@ BOOL LLComboBox::handleUnicodeCharHere(llwchar uni_char) return result; } +BOOL LLComboBox::handleScrollWheel(S32 x, S32 y, S32 clicks) +{ + if (mList->getVisible()) return mList->handleScrollWheel(x, y, clicks); + if (mAllowTextEntry) // We might be editable + if (!mList->getFirstSelected()) // We aren't in the list, don't kill their text + return false; + + setCurrentByIndex(llclamp(getCurrentIndex() + clicks, 0, getItemCount() - 1)); + prearrangeList(); + onCommit(); + return true; +} + void LLComboBox::setAllowTextEntry(BOOL allow, S32 max_chars, BOOL set_tentative) { mAllowTextEntry = allow; diff --git a/indra/llui/llcombobox.h b/indra/llui/llcombobox.h index 2131ba06c..4e180924e 100644 --- a/indra/llui/llcombobox.h +++ b/indra/llui/llcombobox.h @@ -76,6 +76,7 @@ public: virtual BOOL handleToolTip(S32 x, S32 y, std::string& msg, LLRect* sticky_rect); virtual BOOL handleKeyHere(KEY key, MASK mask); virtual BOOL handleUnicodeCharHere(llwchar uni_char); + virtual BOOL handleScrollWheel(S32 x, S32 y, S32 clicks); // LLUICtrl interface virtual void clear(); // select nothing