summaryrefslogtreecommitdiff
path: root/indra/llui
diff options
context:
space:
mode:
authorMerov Linden <merov@lindenlab.com>2012-01-11 17:43:17 -0800
committerMerov Linden <merov@lindenlab.com>2012-01-11 17:43:17 -0800
commit33a17d8a83b3810e344e663395219d3130cb34c3 (patch)
tree5d0e7dd343b3aef2a42f8c38e513b45369e56f63 /indra/llui
parentdaa96009a20b09b7ab9f84b4562462e410d1fa78 (diff)
EXP-1549 : Disable the Remove button menu item in the toolbar contextual menu if no button clicked
Diffstat (limited to 'indra/llui')
-rw-r--r--indra/llui/lltoolbar.cpp9
-rw-r--r--indra/llui/lltoolbar.h1
2 files changed, 9 insertions, 1 deletions
diff --git a/indra/llui/lltoolbar.cpp b/indra/llui/lltoolbar.cpp
index 7f96c1373c..9b31a6449d 100644
--- a/indra/llui/lltoolbar.cpp
+++ b/indra/llui/lltoolbar.cpp
@@ -151,14 +151,20 @@ void LLToolBar::createContextMenu()
if (menu)
{
menu->setBackgroundColor(LLUIColorTable::instance().getColor("MenuPopupBgColor"));
-
mPopupMenuHandle = menu->getHandle();
+ mRemoveButtonHandle = menu->getChild<LLView>("Remove button")->getHandle();
}
else
{
llwarns << "Unable to load toolbars context menu." << llendl;
}
}
+
+ if (mRemoveButtonHandle.get())
+ {
+ // Disable/Enable the "Remove button" menu item depending on whether or not a button was clicked
+ mRemoveButtonHandle.get()->setEnabled(mRightMouseTargetButton != NULL);
+ }
}
void LLToolBar::initFromParams(const LLToolBar::Params& p)
@@ -401,6 +407,7 @@ BOOL LLToolBar::handleRightMouseDown(S32 x, S32 y, MASK mask)
{
// Determine which button the mouse was over during the click in case the context menu action
// is intended to affect the button.
+ mRightMouseTargetButton = NULL;
BOOST_FOREACH(LLToolBarButton* button, mButtons)
{
LLRect button_rect;
diff --git a/indra/llui/lltoolbar.h b/indra/llui/lltoolbar.h
index 51fe23ddd1..a50c60282c 100644
--- a/indra/llui/lltoolbar.h
+++ b/indra/llui/lltoolbar.h
@@ -271,6 +271,7 @@ private:
LLLayoutStack* mCenteringStack;
LLPanel* mButtonPanel;
LLHandle<class LLContextMenu> mPopupMenuHandle;
+ LLHandle<class LLView> mRemoveButtonHandle;
LLToolBarButton* mRightMouseTargetButton;