diff options
author | Yuri Chebotarev <ychebotarev@productengine.com> | 2009-12-18 14:57:26 +0200 |
---|---|---|
committer | Yuri Chebotarev <ychebotarev@productengine.com> | 2009-12-18 14:57:26 +0200 |
commit | d1a857de1f0bb3e7f38ffae6cd4901e188c37ba3 (patch) | |
tree | af3d2d919b3281460f39a59dc7ce6ca155b50256 /indra/newview/llchiclet.cpp | |
parent | 198587423d0eb343c6091d9af97e4ad12860166e (diff) | |
parent | 5f237f8559da76d3c2fd6251b324360fcf25515f (diff) |
merge
--HG--
branch : product-engine
Diffstat (limited to 'indra/newview/llchiclet.cpp')
-rw-r--r-- | indra/newview/llchiclet.cpp | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/indra/newview/llchiclet.cpp b/indra/newview/llchiclet.cpp index c6fe076911..5695f7cac1 100644 --- a/indra/newview/llchiclet.cpp +++ b/indra/newview/llchiclet.cpp @@ -154,6 +154,7 @@ LLSysWellChiclet::LLSysWellChiclet(const Params& p) , mMaxDisplayedCount(p.max_displayed_count) , mIsNewMessagesState(false) , mFlashToLitTimer(NULL) +, mContextMenu(NULL) { LLButton::Params button_params = p.button; mButton = LLUICtrlFactory::create<LLButton>(button_params); @@ -229,6 +230,21 @@ void LLSysWellChiclet::setNewMessagesState(bool new_messages) mIsNewMessagesState = new_messages; } +// virtual +BOOL LLSysWellChiclet::handleRightMouseDown(S32 x, S32 y, MASK mask) +{ + if(!mContextMenu) + { + createMenu(); + } + if (mContextMenu) + { + mContextMenu->show(x, y); + LLMenuGL::showPopup(this, mContextMenu, x, y); + } + return TRUE; +} + /************************************************************************/ /* LLIMWellChiclet implementation */ /************************************************************************/ @@ -248,6 +264,11 @@ LLIMWellChiclet::~LLIMWellChiclet() LLIMMgr::getInstance()->removeSessionObserver(this); } +void LLIMWellChiclet::createMenu() +{ + // TODO: implement context menu for IM well +} + void LLIMWellChiclet::messageCountChanged(const LLSD& session_data) { setCounter(LLBottomTray::getInstance()->getTotalUnreadIMCount()); @@ -281,6 +302,47 @@ void LLNotificationChiclet::connectCounterUpdatersToSignal(const std::string& no } } +void LLNotificationChiclet::onMenuItemClicked(const LLSD& user_data) +{ + std::string action = user_data.asString(); + if("close all" == action) + { + LLNotificationWellWindow::getInstance()->closeAll(); + } +} + +bool LLNotificationChiclet::enableMenuItem(const LLSD& user_data) +{ + std::string item = user_data.asString(); + if (item == "can close all") + { + return mUreadSystemNotifications != 0; + } + return true; +} + +void LLNotificationChiclet::createMenu() +{ + if(mContextMenu) + { + llwarns << "Menu already exists" << llendl; + return; + } + + LLUICtrl::CommitCallbackRegistry::ScopedRegistrar registrar; + registrar.add("NotificationWellChicletMenu.Action", + boost::bind(&LLNotificationChiclet::onMenuItemClicked, this, _2)); + + LLUICtrl::EnableCallbackRegistry::ScopedRegistrar enable_registrar; + enable_registrar.add("NotificationWellChicletMenu.EnableItem", + boost::bind(&LLNotificationChiclet::enableMenuItem, this, _2)); + + mContextMenu = LLUICtrlFactory::getInstance()->createFromFile<LLContextMenu> + ("menu_notification_well_button.xml", + LLMenuGL::sMenuContainer, + LLViewerMenuHolderGL::child_registry_t::instance()); +} + ////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////// |