From 8086923d663cbca32a9b147973f912adcbd4a08a Mon Sep 17 00:00:00 2001 From: Leyla Farazha Date: Tue, 6 Oct 2009 22:55:01 +0000 Subject: EXT-1283 [Inspectors] Avatar gear menu does not dismiss when selecting another AV reviewed by James --- indra/llui/llmenubutton.cpp | 6 ++++++ indra/llui/llmenubutton.h | 1 + indra/llui/lltooltip.cpp | 12 +++++++++++- indra/newview/llinspectavatar.cpp | 11 +++++++++++ indra/newview/llinspectobject.cpp | 3 +++ 5 files changed, 32 insertions(+), 1 deletion(-) (limited to 'indra') diff --git a/indra/llui/llmenubutton.cpp b/indra/llui/llmenubutton.cpp index 2bb6749c83..8dbcd6e229 100644 --- a/indra/llui/llmenubutton.cpp +++ b/indra/llui/llmenubutton.cpp @@ -83,6 +83,12 @@ void LLMenuButton::toggleMenu() } +void LLMenuButton::hideMenu() +{ + mMenu->setVisible(FALSE); +} + + BOOL LLMenuButton::handleKeyHere(KEY key, MASK mask ) { if( KEY_RETURN == key && mask == MASK_NONE && !gKeyboard->getKeyRepeated(key)) diff --git a/indra/llui/llmenubutton.h b/indra/llui/llmenubutton.h index 94b0e4355d..02eb9d3806 100644 --- a/indra/llui/llmenubutton.h +++ b/indra/llui/llmenubutton.h @@ -54,6 +54,7 @@ public: /*virtual*/ void draw(); /*virtual*/ BOOL handleMouseDown(S32 x, S32 y, MASK mask); /*virtual*/ BOOL handleKeyHere(KEY key, MASK mask ); + void hideMenu(); protected: friend class LLUICtrlFactory; diff --git a/indra/llui/lltooltip.cpp b/indra/llui/lltooltip.cpp index d742281f30..c55273cacf 100644 --- a/indra/llui/lltooltip.cpp +++ b/indra/llui/lltooltip.cpp @@ -38,6 +38,7 @@ // Library includes #include "lltextbox.h" #include "lliconctrl.h" +#include "llmenugl.h" // hideMenus() #include "llui.h" // positionViewNearMouse() #include "llwindow.h" @@ -94,7 +95,16 @@ BOOL LLToolTipView::handleHover(S32 x, S32 y, MASK mask) BOOL LLToolTipView::handleMouseDown(S32 x, S32 y, MASK mask) { LLToolTipMgr::instance().blockToolTips(); - return LLView::handleMouseDown(x, y, mask); + + if (LLView::handleMouseDown(x, y, mask)) + { + // If we are handling the mouse event menu holder + // won't get a chance to close menus so do this here + LLMenuGL::sMenuContainer->hideMenus(); + return TRUE; + } + + return FALSE; } BOOL LLToolTipView::handleMiddleMouseDown(S32 x, S32 y, MASK mask) diff --git a/indra/newview/llinspectavatar.cpp b/indra/newview/llinspectavatar.cpp index 9b75c15597..fd301505cd 100644 --- a/indra/newview/llinspectavatar.cpp +++ b/indra/newview/llinspectavatar.cpp @@ -51,6 +51,7 @@ #include "llcontrol.h" // LLCachedControl #include "llfloater.h" #include "llfloaterreg.h" +#include "llmenubutton.h" #include "lltooltip.h" // positionViewNearMouse() #include "lluictrl.h" @@ -80,6 +81,9 @@ public: // Because floater is single instance, need to re-parse data on each spawn // (for example, inspector about same avatar but in different position) /*virtual*/ void onOpen(const LLSD& avatar_id); + + // When closing they should close their gear menu + /*virtual*/ void onClose(); // Inspectors close themselves when they lose focus /*virtual*/ void onFocusLost(); @@ -224,6 +228,8 @@ BOOL LLInspectAvatar::postBuild(void) getChild("volume_slider")->setCommitCallback( boost::bind(&LLInspectAvatar::onVolumeChange, this, _2)); + mCloseSignal.connect(boost::bind(&LLInspectAvatar::onClose, this)); + return TRUE; } @@ -288,6 +294,11 @@ void LLInspectAvatar::onOpen(const LLSD& data) updateVolumeSlider(); } +void LLInspectAvatar::onClose() +{ + getChild("gear_btn")->hideMenu(); +} + //virtual void LLInspectAvatar::onFocusLost() { diff --git a/indra/newview/llinspectobject.cpp b/indra/newview/llinspectobject.cpp index b0e6273c41..1a88bcb8f0 100644 --- a/indra/newview/llinspectobject.cpp +++ b/indra/newview/llinspectobject.cpp @@ -46,6 +46,7 @@ #include "llcontrol.h" // LLCachedControl #include "llfloater.h" #include "llfloaterreg.h" +#include "llmenubutton.h" #include "llresmgr.h" // getMonetaryString #include "llsafehandle.h" #include "lltextbox.h" // for description truncation @@ -254,6 +255,8 @@ void LLInspectObject::onClose() { // Release selection to deselect mObjectSelection = NULL; + + getChild("gear_btn")->hideMenu(); } //virtual -- cgit v1.2.3