diff options
author | Leyla Farazha <leyla@lindenlab.com> | 2011-09-27 15:42:37 -0700 |
---|---|---|
committer | Leyla Farazha <leyla@lindenlab.com> | 2011-09-27 15:42:37 -0700 |
commit | 18b3afe11a59b3fae85bc803c6afc95c8689a84b (patch) | |
tree | 07f0e6175b856f346ac4a5d0b1717746ca13ae49 /indra/llui/lltoolbar.cpp | |
parent | c7f5aebbb71228b705059be248e82e83ee0f9475 (diff) | |
parent | 442350a6a5ef1537f2998796c61b0f1053b455c8 (diff) |
merge
Diffstat (limited to 'indra/llui/lltoolbar.cpp')
-rw-r--r-- | indra/llui/lltoolbar.cpp | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/indra/llui/lltoolbar.cpp b/indra/llui/lltoolbar.cpp index 2fb9f249d4..8249df3e9d 100644 --- a/indra/llui/lltoolbar.cpp +++ b/indra/llui/lltoolbar.cpp @@ -123,12 +123,16 @@ void LLToolBar::createContextMenu() { if (!mPopupMenuHandle.get()) { + // Setup bindings specific to this instance for the context menu options + LLUICtrl::CommitCallbackRegistry::Registrar& commit_reg = LLUICtrl::CommitCallbackRegistry::defaultRegistrar(); commit_reg.add("Toolbars.EnableSetting", boost::bind(&LLToolBar::onSettingEnable, this, _2)); LLUICtrl::EnableCallbackRegistry::Registrar& enable_reg = LLUICtrl::EnableCallbackRegistry::defaultRegistrar(); enable_reg.add("Toolbars.CheckSetting", boost::bind(&LLToolBar::isSettingChecked, this, _2)); + // Create the context menu + LLContextMenu* menu = LLUICtrlFactory::instance().createFromFile<LLContextMenu>("menu_toolbars.xml", LLMenuGL::sMenuContainer, LLMenuHolderGL::child_registry_t::instance()); if (menu) @@ -141,6 +145,10 @@ void LLToolBar::createContextMenu() { llwarns << "Unable to load toolbars context menu." << llendl; } + + // Remove this instance's bindings + commit_reg.remove("Toolbars.EnableSetting"); + enable_reg.remove("Toolbars.CheckSetting"); } } @@ -187,12 +195,6 @@ void LLToolBar::initFromParams(const LLToolBar::Params& p) mCenteringStack->addChild(LLUICtrlFactory::create<LLLayoutPanel>(border_panel_p)); - BOOST_FOREACH (const LLCommandId::Params& command_id, p.commands) - { - mButtonCommands.push_back(command_id); - } - createButtons(); - mNeedsLayout = true; } @@ -202,8 +204,11 @@ bool LLToolBar::addCommand(const LLCommandId& commandId) bool add_command = (command != NULL); - mButtonCommands.push_back(commandId); - createButtons(); + if (add_command) + { + mButtonCommands.push_back(commandId); + createButtons(); + } return add_command; } @@ -251,11 +256,13 @@ BOOL LLToolBar::handleRightMouseDown(S32 x, S32 y, MASK mask) if (handle_it_here) { createContextMenu(); + LLContextMenu * menu = (LLContextMenu *) mPopupMenuHandle.get(); if (menu) { menu->show(x, y); + LLMenuGL::showPopup(this, menu, x, y); } } |