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.
This commit is contained in:
Inusaito Sayori
2014-07-21 18:00:43 -04:00
parent f119986fad
commit 601ff92871
2 changed files with 14 additions and 0 deletions

View File

@@ -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;

View File

@@ -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