summaryrefslogtreecommitdiff
path: root/indra/newview/llchiclet.cpp
diff options
context:
space:
mode:
authorSergey Borushevsky <sborushevsky@productengine.com>2009-12-01 17:13:35 +0200
committerSergey Borushevsky <sborushevsky@productengine.com>2009-12-01 17:13:35 +0200
commit32887cdc5407c7ced2d030cc8423fb0ab688170f (patch)
treeb507b04f1e295763d8b342b625fa93a7337a581d /indra/newview/llchiclet.cpp
parentf5e64315e27877e994b755d0de9d35dde0ccc674 (diff)
Implemented normal task EXT-2750 (Add context menu for group and ad-hoc chiclet)
Added menu to ad-hoc chiclet, which contains one 'End Session' item. --HG-- branch : product-engine
Diffstat (limited to 'indra/newview/llchiclet.cpp')
-rw-r--r--indra/newview/llchiclet.cpp41
1 files changed, 41 insertions, 0 deletions
diff --git a/indra/newview/llchiclet.cpp b/indra/newview/llchiclet.cpp
index f41e326dd0..d533743cfc 100644
--- a/indra/newview/llchiclet.cpp
+++ b/indra/newview/llchiclet.cpp
@@ -595,8 +595,49 @@ void LLAdHocChiclet::setCounter(S32 counter)
setShowNewMessagesIcon(counter);
}
+void LLAdHocChiclet::createPopupMenu()
+{
+ if(mPopupMenu)
+ {
+ llwarns << "Menu already exists" << llendl;
+ return;
+ }
+ if(getSessionId().isNull())
+ {
+ return;
+ }
+
+ LLUICtrl::CommitCallbackRegistry::ScopedRegistrar registrar;
+ registrar.add("IMChicletMenu.Action", boost::bind(&LLAdHocChiclet::onMenuItemClicked, this, _2));
+
+ mPopupMenu = LLUICtrlFactory::getInstance()->createFromFile<LLMenuGL>
+ ("menu_imchiclet_adhoc.xml", gMenuHolder, LLViewerMenuHolderGL::child_registry_t::instance());
+}
+
+void LLAdHocChiclet::onMenuItemClicked(const LLSD& user_data)
+{
+ std::string level = user_data.asString();
+ LLUUID group_id = getSessionId();
+
+ if("end" == level)
+ {
+ LLGroupActions::endIM(group_id);
+ }
+}
+
BOOL LLAdHocChiclet::handleRightMouseDown(S32 x, S32 y, MASK mask)
{
+ if(!mPopupMenu)
+ {
+ createPopupMenu();
+ }
+
+ if (mPopupMenu)
+ {
+ mPopupMenu->arrangeAndClear();
+ LLMenuGL::showPopup(this, mPopupMenu, x, y);
+ }
+
return TRUE;
}