From a2b20e69edbfb51603ba762bd76f569300bd925b Mon Sep 17 00:00:00 2001 From: Liny Date: Mon, 22 Oct 2012 10:29:06 -0700 Subject: [PATCH] FIRE-8024 Ability to scroll tab containers with the scroll wheel on the mouse --- indra/llui/lltabcontainer.cpp | 39 +++++++++++++++++++++++++++++++++++ indra/llui/lltabcontainer.h | 1 + 2 files changed, 40 insertions(+) diff --git a/indra/llui/lltabcontainer.cpp b/indra/llui/lltabcontainer.cpp index e6f2577cae..8736eb89b9 100644 --- a/indra/llui/lltabcontainer.cpp +++ b/indra/llui/lltabcontainer.cpp @@ -844,6 +844,45 @@ BOOL LLTabContainer::handleKeyHere(KEY key, MASK mask) return handled; } +// FIRE-8024 Ability to scroll tab containers with the scroll wheel on the mouse +// virtual +BOOL LLTabContainer::handleScrollWheel(S32 x, S32 y, S32 clicks) +{ + LLTabTuple* firsttuple = getTab(0); + static LLUICachedControl tabcntrv_pad ("UITabCntrvPad", 0); + BOOL has_scroll_arrows = (getMaxScrollPos() > 0); + LLRect clip; + if (mIsVertical) + { + clip = LLRect(firsttuple->mButton->getRect().mLeft, + has_scroll_arrows ? mPrevArrowBtn->getRect().mBottom - tabcntrv_pad : mPrevArrowBtn->getRect().mTop, + firsttuple->mButton->getRect().mRight, + has_scroll_arrows ? mNextArrowBtn->getRect().mTop + tabcntrv_pad : mNextArrowBtn->getRect().mBottom ); + } + else + { + clip = LLRect(has_scroll_arrows ? mPrevArrowBtn->getRect().mRight : mJumpPrevArrowBtn->getRect().mLeft, + firsttuple->mButton->getRect().mTop, + has_scroll_arrows ? mNextArrowBtn->getRect().mLeft : mJumpNextArrowBtn->getRect().mRight, + firsttuple->mButton->getRect().mBottom ); + } + + if( clip.pointInRect( x, y ) ) + { + if(clicks < 0) + { + setScrollPos(getScrollPos() - 1); + } + else + { + setScrollPos(getScrollPos() + 1); + } + } + + return LLUICtrl::handleScrollWheel(x, y, clicks); +} +// + // virtual BOOL LLTabContainer::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, EDragAndDropType type, void* cargo_data, EAcceptance *accept, std::string &tooltip) { diff --git a/indra/llui/lltabcontainer.h b/indra/llui/lltabcontainer.h index cc96696dbe..e1a11a0f8a 100644 --- a/indra/llui/lltabcontainer.h +++ b/indra/llui/lltabcontainer.h @@ -148,6 +148,7 @@ public: /*virtual*/ BOOL handleMouseUp( S32 x, S32 y, MASK mask ); /*virtual*/ BOOL handleToolTip(S32 x, S32 y, MASK mask); /*virtual*/ BOOL handleKeyHere(KEY key, MASK mask); + /*virtual*/ BOOL handleScrollWheel(S32 x, S32 y, S32 clicks); // FIRE-8024 Ability to scroll tab containers with the scroll wheel on the mouse /*virtual*/ BOOL handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, EDragAndDropType type, void* cargo_data, EAcceptance* accept, std::string& tooltip);