summaryrefslogtreecommitdiff
path: root/indra/llui
diff options
context:
space:
mode:
authorRye Mutt <rye@alchemyviewer.org>2024-07-22 02:25:09 -0400
committerAndrey Kleshchev <117672381+akleshchev@users.noreply.github.com>2024-07-22 15:08:04 +0300
commit8a3c9a0b9d3bdf193b49f7f82378558c275948a6 (patch)
tree822ff2d946219dfcdf4b242f2e34a8474216d3c4 /indra/llui
parent3887404678756d46e082de016887b5837bf14217 (diff)
Introduce scroll wheel support to LLComboBox
Diffstat (limited to 'indra/llui')
-rw-r--r--indra/llui/llcombobox.cpp14
-rw-r--r--indra/llui/llcombobox.h1
2 files changed, 15 insertions, 0 deletions
diff --git a/indra/llui/llcombobox.cpp b/indra/llui/llcombobox.cpp
index 79dce1c714..ee1700e009 100644
--- a/indra/llui/llcombobox.cpp
+++ b/indra/llui/llcombobox.cpp
@@ -875,6 +875,20 @@ bool LLComboBox::handleUnicodeCharHere(llwchar uni_char)
return result;
}
+// virtual
+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::setTextEntry(const LLStringExplicit& text)
{
if (mTextEntry)
diff --git a/indra/llui/llcombobox.h b/indra/llui/llcombobox.h
index cc1c2885fc..9dc6fa9257 100644
--- a/indra/llui/llcombobox.h
+++ b/indra/llui/llcombobox.h
@@ -114,6 +114,7 @@ public:
virtual bool handleToolTip(S32 x, S32 y, MASK mask);
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