diff options
| author | Eugene Mutavchi <emutavchi@productengine.com> | 2009-12-18 18:41:14 +0200 |
|---|---|---|
| committer | Eugene Mutavchi <emutavchi@productengine.com> | 2009-12-18 18:41:14 +0200 |
| commit | 216726dd23ef925f5bd6cccbdeb09cfca5400a7a (patch) | |
| tree | 030b774f82193719f5358b254d7496795974f35e /indra/newview/llchiclet.cpp | |
| parent | 8083feada1b4dc047e4da995c1a6c695d99d3fc0 (diff) | |
Implemented major sub-task EXT-3524 (Context menu for IM well)
--HG--
branch : product-engine
Diffstat (limited to 'indra/newview/llchiclet.cpp')
| -rw-r--r-- | indra/newview/llchiclet.cpp | 38 |
1 files changed, 37 insertions, 1 deletions
diff --git a/indra/newview/llchiclet.cpp b/indra/newview/llchiclet.cpp index 84722db384..21a0381495 100644 --- a/indra/newview/llchiclet.cpp +++ b/indra/newview/llchiclet.cpp @@ -267,9 +267,45 @@ LLIMWellChiclet::~LLIMWellChiclet() LLIMMgr::getInstance()->removeSessionObserver(this); } +void LLIMWellChiclet::onMenuItemClicked(const LLSD& user_data) +{ + std::string action = user_data.asString(); + if("close all" == action) + { + LLIMWellWindow::getInstance()->closeAll(); + } +} + +bool LLIMWellChiclet::enableMenuItem(const LLSD& user_data) +{ + std::string item = user_data.asString(); + if (item == "can close all") + { + return !LLIMWellWindow::getInstance()->isWindowEmpty(); + } + return true; +} + void LLIMWellChiclet::createMenu() { - // TODO: implement context menu for IM well + if(mContextMenu) + { + llwarns << "Menu already exists" << llendl; + return; + } + + LLUICtrl::CommitCallbackRegistry::ScopedRegistrar registrar; + registrar.add("IMWellChicletMenu.Action", + boost::bind(&LLIMWellChiclet::onMenuItemClicked, this, _2)); + + LLUICtrl::EnableCallbackRegistry::ScopedRegistrar enable_registrar; + enable_registrar.add("IMWellChicletMenu.EnableItem", + boost::bind(&LLIMWellChiclet::enableMenuItem, this, _2)); + + mContextMenu = LLUICtrlFactory::getInstance()->createFromFile<LLContextMenu> + ("menu_im_well_button.xml", + LLMenuGL::sMenuContainer, + LLViewerMenuHolderGL::child_registry_t::instance()); } void LLIMWellChiclet::messageCountChanged(const LLSD& session_data) |
