summaryrefslogtreecommitdiff
path: root/indra/newview/lltoast.cpp
diff options
context:
space:
mode:
authorSteven Bennetts <steve@lindenlab.com>2009-08-12 01:12:27 +0000
committerSteven Bennetts <steve@lindenlab.com>2009-08-12 01:12:27 +0000
commit0bf4b5f2222ffb8171be094613363427f3b8470a (patch)
tree4b742d6815f44a85c98113e9c5a3017eafc5968d /indra/newview/lltoast.cpp
parent8d7e56f219d0915e2c4a19baf2809dbc6ede7fa5 (diff)
merge https://svn.aws.productengine.com/secondlife/export-from-ll@1277 https://svn.aws.productengine.com/secondlife/pe/stable-1@1297 -> viewer-2-0
Fixes: EXT 208 EXT 366 EXT-211 EXT-245 EXT-246 EXT-278 EXT-279 EXT-280 EXT-298 EXT-301 EXT-304 EXT-311 EXT-317 EXT-318 EXT-319 EXT-339 EXT-343 EXT-344 EXT-346 EXT-349 EXT-350 EXT-351 EXT-354 EXT-355 EXT-358 EXT-360 EXT-362 EXT-369 EXT-372 EXT-374 EXT-381 EXT-382 EXT-383 EXT-395 EXT-396 EXT-412 Other changes: Movement & Caemra controls work Profile and Me panel refactoring Notification refactoring
Diffstat (limited to 'indra/newview/lltoast.cpp')
-rw-r--r--indra/newview/lltoast.cpp99
1 files changed, 72 insertions, 27 deletions
diff --git a/indra/newview/lltoast.cpp b/indra/newview/lltoast.cpp
index 8a7c7708b9..a67ef85f87 100644
--- a/indra/newview/lltoast.cpp
+++ b/indra/newview/lltoast.cpp
@@ -41,36 +41,61 @@
using namespace LLNotificationsUI;
//--------------------------------------------------------------------------
-LLToast::LLToast(LLPanel* panel) :
- LLFloater(LLSD()),
- mTimerValue(5),
- mIsViewed(false),
- mPanel(panel),
- mCanFade(true),
- mHideBtn(NULL),
- mIsModal(false),
- mCanBeStored(true),
- mHideBtnPressed(false)
+LLToast::LLToast(LLToast::Params p) : LLFloater(LLSD()),
+ mPanel(p.panel),
+ mTimerValue(p.timer_period),
+ mID(p.id),
+ mCanFade(p.can_fade),
+ mCanBeStored(p.can_be_stored),
+ mHideBtnEnabled(p.enable_hide_btn),
+ mIsModal(p.is_modal),
+ mIsTipNotification(p.is_tip),
+ mHideBtn(NULL),
+ mNotification(p.notification),
+ mIsViewed(false),
+ mHideBtnPressed(false)
{
- LLUICtrlFactory::getInstance()->buildPanel(this, "panel_toast.xml");
+ LLUICtrlFactory::getInstance()->buildFloater(this, "panel_toast.xml", NULL);
- mHideBtn = getChild<LLButton>("hide_btn");
- if(mHideBtn)
+ if(mPanel)
+ {
+ insertPanel(mPanel);
+ }
+
+ if(mHideBtnEnabled)
{
+ mHideBtn = getChild<LLButton>("hide_btn");
mHideBtn->setClickedCallback(boost::bind(&LLToast::hide,this));
}
- if(mPanel)
+
+ if(mIsModal)
{
- arrange(mPanel);
+ gFocusMgr.setMouseCapture( this );
+ gFocusMgr.setTopCtrl( this );
+ setFocus(TRUE);
}
- // disable unnecessary Floater's functionality
- setTitleVisible(FALSE);
- setCanMinimize(FALSE);
- setCanClose(FALSE);
- setCanTearOff(FALSE);
- setCanResize(FALSE);
- setCanDrag(FALSE);
+
+ if(!p.on_toast_destroy.empty())
+ mOnToastDestroy.connect(p.on_toast_destroy);
+
+ if(!p.on_mouse_enter.empty())
+ mOnMousEnter.connect(p.on_mouse_enter);
+}
+
+//--------------------------------------------------------------------------
+BOOL LLToast::postBuild()
+{
+ if(mCanFade)
+ {
+ mTimer.start();
+ }
+ else
+ {
+ mTimer.stop();
+ }
+
+ return TRUE;
}
//--------------------------------------------------------------------------
@@ -124,7 +149,7 @@ void LLToast::hide()
setVisible(FALSE);
mIsViewed = false;
mTimer.stop();
- mOnFade(this, LLSD());
+ mOnFade(this);
}
//--------------------------------------------------------------------------
@@ -142,12 +167,12 @@ void LLToast::tick()
{
setVisible(FALSE);
mTimer.stop();
- mOnFade(this, LLSD());
+ mOnFade(this);
}
}
//--------------------------------------------------------------------------
-void LLToast::arrange(LLPanel* panel)
+void LLToast::insertPanel(LLPanel* panel)
{
LLRect panel_rect, toast_rect;
@@ -213,13 +238,12 @@ void LLToast::onMouseEnter(S32 x, S32 y, MASK mask)
sendChildToFront(mHideBtn);
if(mHideBtn && mHideBtn->getEnabled())
mHideBtn->setVisible(TRUE);
- mOnMousEnter(this, LLSD());
+ mOnMousEnter(this);
}
//--------------------------------------------------------------------------
void LLToast::onMouseLeave(S32 x, S32 y, MASK mask)
{
- llinfos << "MOUSE LEAVE: x = " << x << "y = " << y << llendl;
mOnToastHover(this, MOUSE_LEAVE);
if(mCanFade && !mIsViewed)
@@ -249,5 +273,26 @@ BOOL LLToast::handleMouseDown(S32 x, S32 y, MASK mask)
return LLFloater::handleMouseDown(x, y, mask);
}
+//--------------------------------------------------------------------------
+void LLToast::discardNotification()
+{
+ if(mNotification)
+ {
+ mNotification->setIgnored(TRUE);
+ mNotification->respond(mNotification->getResponseTemplate());
+ }
+}
+
+//--------------------------------------------------------------------------
+bool LLToast::getIsNotificationUnResponded()
+{
+ if(mNotification)
+ {
+ return !mNotification->isRespondedTo();
+ }
+ return false;
+}
+
+//--------------------------------------------------------------------------