Commits

Merov Linden committed f43aeea

EXP-1549 : Disable the Remove button menu item in the toolbar contextual menu if no button clicked

Comments (0)

Files changed (2)

indra/llui/lltoolbar.cpp

 		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)
 	{
 		// 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;

indra/llui/lltoolbar.h

 	LLLayoutStack*					mCenteringStack;
 	LLPanel*						mButtonPanel;
 	LLHandle<class LLContextMenu>	mPopupMenuHandle;
+	LLHandle<class LLView>			mRemoveButtonHandle;
 
 	LLToolBarButton*				mRightMouseTargetButton;