diff options
Diffstat (limited to 'indra/llui')
-rw-r--r-- | indra/llui/llaccordionctrltab.cpp | 6 | ||||
-rw-r--r-- | indra/llui/llfloater.cpp | 16 | ||||
-rw-r--r-- | indra/llui/llfloater.h | 4 | ||||
-rw-r--r-- | indra/llui/llmenubutton.cpp | 32 | ||||
-rw-r--r-- | indra/llui/llmenubutton.h | 11 |
5 files changed, 64 insertions, 5 deletions
diff --git a/indra/llui/llaccordionctrltab.cpp b/indra/llui/llaccordionctrltab.cpp index b7da5f4a1b..32112c6c51 100644 --- a/indra/llui/llaccordionctrltab.cpp +++ b/indra/llui/llaccordionctrltab.cpp @@ -735,6 +735,12 @@ S32 LLAccordionCtrlTab::notifyParent(const LLSD& info) return 1; } + + if (!getDisplayChildren()) + { + // Don't pass scrolling event further if our contents are invisible (STORM-298). + return 1; + } } return LLUICtrl::notifyParent(info); diff --git a/indra/llui/llfloater.cpp b/indra/llui/llfloater.cpp index eb5d7a6b6a..d23b876543 100644 --- a/indra/llui/llfloater.cpp +++ b/indra/llui/llfloater.cpp @@ -231,7 +231,8 @@ LLFloater::LLFloater(const LLSD& key, const LLFloater::Params& p) mTornOff(false), mHasBeenDraggedWhileMinimized(FALSE), mPreviousMinimizedBottom(0), - mPreviousMinimizedLeft(0) + mPreviousMinimizedLeft(0), + mMinimizeSignal(NULL) // mNotificationContext(NULL) { mHandle.bind(this); @@ -493,6 +494,8 @@ LLFloater::~LLFloater() setVisible(false); // We're not visible if we're destroyed storeVisibilityControl(); storeDockStateControl(); + + delete mMinimizeSignal; } void LLFloater::storeRectControl() @@ -997,6 +1000,11 @@ void LLFloater::setMinimized(BOOL minimize) if (minimize == mMinimized) return; + if(mMinimizeSignal) + { + (*mMinimizeSignal)(this, LLSD(minimize)); + } + if (minimize) { // minimized flag should be turned on before release focus @@ -2810,6 +2818,12 @@ void LLFloater::initFromParams(const LLFloater::Params& p) } } +boost::signals2::connection LLFloater::setMinimizeCallback( const commit_signal_t::slot_type& cb ) +{ + if (!mMinimizeSignal) mMinimizeSignal = new commit_signal_t(); + return mMinimizeSignal->connect(cb); +} + LLFastTimer::DeclareTimer POST_BUILD("Floater Post Build"); bool LLFloater::initFloaterXML(LLXMLNodePtr node, LLView *parent, const std::string& filename, LLXMLNodePtr output_node) diff --git a/indra/llui/llfloater.h b/indra/llui/llfloater.h index 5ecf515cf9..d26f41b4c7 100644 --- a/indra/llui/llfloater.h +++ b/indra/llui/llfloater.h @@ -142,6 +142,8 @@ public: // Don't export top/left for rect, only height/width static void setupParamsForExport(Params& p, LLView* parent); + boost::signals2::connection setMinimizeCallback( const commit_signal_t::slot_type& cb ); + void initFromParams(const LLFloater::Params& p); bool initFloaterXML(LLXMLNodePtr node, LLView *parent, const std::string& filename, LLXMLNodePtr output_node = NULL); @@ -347,6 +349,8 @@ public: // Public so external views or floaters can watch for this floater closing commit_signal_t mCloseSignal; + commit_signal_t* mMinimizeSignal; + protected: std::string mRectControl; std::string mVisibilityControl; diff --git a/indra/llui/llmenubutton.cpp b/indra/llui/llmenubutton.cpp index 3df05f4d3f..0930eb95dd 100644 --- a/indra/llui/llmenubutton.cpp +++ b/indra/llui/llmenubutton.cpp @@ -57,6 +57,8 @@ LLMenuButton::LLMenuButton(const LLMenuButton::Params& p) llwarns << "Error loading menu_button menu" << llendl; } } + + setMenuPosition(); } void LLMenuButton::toggleMenu() @@ -70,12 +72,34 @@ void LLMenuButton::toggleMenu() } else { - LLRect rect = getRect(); - //mMenu->needsArrange(); //so it recalculates the visible elements - LLMenuGL::showPopup(getParent(), mMenu, rect.mLeft, rect.mBottom); + //mMenu->needsArrange(); //so it recalculates the visible elements + LLMenuGL::showPopup(getParent(), mMenu, mX, mY); } } +void LLMenuButton::setMenuPosition(EMenuPosition position /*ON_BOTTOM_LEFT*/) +{ + if (!mMenu) + return; + + LLRect rect = getRect(); + + switch (position) + { + case ON_TOP_LEFT: + { + mX = rect.mLeft; + mY = rect.mTop + mMenu->getRect().getHeight(); + break; + } + case ON_BOTTOM_LEFT: + { + mX = rect.mLeft; + mY = rect.mBottom; + break; + } + } +} void LLMenuButton::hideMenu() { @@ -109,6 +133,8 @@ BOOL LLMenuButton::handleMouseDown(S32 x, S32 y, MASK mask) setFocus(TRUE); } + LLUICtrl::handleMouseDown(x, y, mask); + toggleMenu(); if (getSoundFlags() & MOUSE_DOWN) diff --git a/indra/llui/llmenubutton.h b/indra/llui/llmenubutton.h index 81ca0e047c..273af2413e 100644 --- a/indra/llui/llmenubutton.h +++ b/indra/llui/llmenubutton.h @@ -42,14 +42,22 @@ public: Optional<std::string> menu_filename; Params(); - }; + }; + + enum EMenuPosition + { + ON_TOP_LEFT, + ON_BOTTOM_LEFT + }; void toggleMenu(); + void setMenuPosition(EMenuPosition position = ON_BOTTOM_LEFT); /*virtual*/ void draw(); /*virtual*/ BOOL handleMouseDown(S32 x, S32 y, MASK mask); /*virtual*/ BOOL handleKeyHere(KEY key, MASK mask ); void hideMenu(); LLMenuGL* getMenu() { return mMenu; } + void setMenu(LLMenuGL* menu) { mMenu = menu; } protected: friend class LLUICtrlFactory; @@ -58,6 +66,7 @@ protected: private: LLMenuGL* mMenu; bool mMenuVisibleLastFrame; + S32 mX, mY; }; |