From dcb786b5a477acd74ed7450a4975de0a7a1d66bd Mon Sep 17 00:00:00 2001 From: Andrew Polunin Date: Tue, 8 Dec 2009 16:28:47 +0200 Subject: implemented normal task EXT-3086 Update non-interactive system toasts behavior --HG-- branch : product-engine --- indra/newview/lltoast.cpp | 23 ++++++++++++++++++++++- indra/newview/lltoast.h | 9 +++++++-- 2 files changed, 29 insertions(+), 3 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/lltoast.cpp b/indra/newview/lltoast.cpp index fc7c029a17..4131e2755a 100644 --- a/indra/newview/lltoast.cpp +++ b/indra/newview/lltoast.cpp @@ -67,7 +67,8 @@ LLToast::LLToast(const LLToast::Params& p) mHideBtn(NULL), mNotification(p.notification), mIsHidden(false), - mHideBtnPressed(false) + mHideBtnPressed(false), + mIsTip(p.is_tip) { LLUICtrlFactory::getInstance()->buildFloater(this, "panel_toast.xml", NULL); @@ -98,9 +99,29 @@ BOOL LLToast::postBuild() mTimer.stop(); } + if (mIsTip) + { + mTextEditor = mPanel->getChild("text_editor_box"); + + if (mTextEditor) + { + mTextEditor->setMouseUpCallback(boost::bind(&LLToast::hide,this)); + mPanel->setMouseUpCallback(boost::bind(&LLToast::handleTipToastClick, this, _2, _3, _4)); + } + } + return TRUE; } +//-------------------------------------------------------------------------- +void LLToast::handleTipToastClick(S32 x, S32 y, MASK mask) +{ + if (!mTextEditor->getRect().pointInRect(x, y)) + { + hide(); + } +} + //-------------------------------------------------------------------------- void LLToast::setHideButtonEnabled(bool enabled) { diff --git a/indra/newview/lltoast.h b/indra/newview/lltoast.h index d08e46e160..0c3c598704 100644 --- a/indra/newview/lltoast.h +++ b/indra/newview/lltoast.h @@ -40,6 +40,7 @@ #include "llnotificationptr.h" #include "llviewercontrol.h" +#include "lltexteditor.h" #define MOUSE_LEAVE false #define MOUSE_ENTER true @@ -155,6 +156,8 @@ public: private: + void handleTipToastClick(S32 x, S32 y, MASK mask); + // check timer bool lifetimeHasExpired(); // on timer finished function @@ -169,8 +172,9 @@ private: F32 mToastLifetime; // in seconds F32 mToastFadingTime; // in seconds - LLPanel* mPanel; - LLButton* mHideBtn; + LLPanel* mPanel; + LLButton* mHideBtn; + LLTextEditor* mTextEditor; LLColor4 mBgColor; bool mCanFade; @@ -178,6 +182,7 @@ private: bool mHideBtnEnabled; bool mHideBtnPressed; bool mIsHidden; // this flag is TRUE when a toast has faded or was hidden with (x) button (EXT-1849) + bool mIsTip; }; } -- cgit v1.2.3