summaryrefslogtreecommitdiff
path: root/indra/newview/lltoast.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/lltoast.cpp')
-rw-r--r--indra/newview/lltoast.cpp68
1 files changed, 47 insertions, 21 deletions
diff --git a/indra/newview/lltoast.cpp b/indra/newview/lltoast.cpp
index 8176b8c1f9..fd5582d6f7 100644
--- a/indra/newview/lltoast.cpp
+++ b/indra/newview/lltoast.cpp
@@ -113,7 +113,7 @@ LLToast::LLToast(const LLToast::Params& p)
mHideBtnPressed(false),
mIsTip(p.is_tip),
mWrapperPanel(NULL),
- mIsTransparent(false)
+ mIsFading(false)
{
mTimer.reset(new LLToastLifeTimer(this, p.lifetime_secs));
@@ -125,6 +125,9 @@ LLToast::LLToast(const LLToast::Params& p)
mWrapperPanel->setMouseEnterCallback(boost::bind(&LLToast::onToastMouseEnter, this));
mWrapperPanel->setMouseLeaveCallback(boost::bind(&LLToast::onToastMouseLeave, this));
+ setBackgroundOpaque(TRUE); // *TODO: obsolete
+ updateTransparency();
+
if(mPanel)
{
insertPanel(mPanel);
@@ -141,10 +144,6 @@ LLToast::LLToast(const LLToast::Params& p)
// init callbacks if present
if(!p.on_delete_toast().empty())
mOnDeleteToastSignal.connect(p.on_delete_toast());
-
- // *TODO: This signal doesn't seem to be used at all.
- if(!p.on_mouse_enter().empty())
- mOnMouseEnterSignal.connect(p.on_mouse_enter());
}
void LLToast::reshape(S32 width, S32 height, BOOL called_from_parent)
@@ -183,7 +182,7 @@ LLToast::~LLToast()
void LLToast::hide()
{
setVisible(FALSE);
- setTransparentState(false);
+ setFading(false);
mTimer->stop();
mIsHidden = true;
mOnFadeSignal(this);
@@ -194,7 +193,7 @@ void LLToast::onFocusLost()
if(mWrapperPanel && !isBackgroundVisible())
{
// Lets make wrapper panel behave like a floater
- setBackgroundOpaque(FALSE);
+ updateTransparency();
}
}
@@ -203,7 +202,7 @@ void LLToast::onFocusReceived()
if(mWrapperPanel && !isBackgroundVisible())
{
// Lets make wrapper panel behave like a floater
- setBackgroundOpaque(TRUE);
+ updateTransparency();
}
}
@@ -248,22 +247,24 @@ void LLToast::expire()
{
if (mCanFade)
{
- if (mIsTransparent)
+ if (mIsFading)
{
+ // Fade timer expired. Time to hide.
hide();
}
else
{
- setTransparentState(true);
+ // "Life" time has ended. Time to fade.
+ setFading(true);
mTimer->restart();
}
}
}
-void LLToast::setTransparentState(bool transparent)
+void LLToast::setFading(bool transparent)
{
- setBackgroundOpaque(!transparent);
- mIsTransparent = transparent;
+ mIsFading = transparent;
+ updateTransparency();
if (transparent)
{
@@ -279,7 +280,7 @@ F32 LLToast::getTimeLeftToLive()
{
F32 time_to_live = mTimer->getRemainingTimeF32();
- if (!mIsTransparent)
+ if (!mIsFading)
{
time_to_live += mToastFadingTime;
}
@@ -351,7 +352,6 @@ void LLToast::setVisible(BOOL show)
if(show)
{
- setBackgroundOpaque(TRUE);
if(!mTimer->getStarted() && mCanFade)
{
mTimer->start();
@@ -393,7 +393,7 @@ void LLToast::onToastMouseEnter()
{
mOnToastHoverSignal(this, MOUSE_ENTER);
- setBackgroundOpaque(TRUE);
+ updateTransparency();
//toasts fading is management by Screen Channel
@@ -402,7 +402,6 @@ void LLToast::onToastMouseEnter()
{
mHideBtn->setVisible(TRUE);
}
- mOnMouseEnterSignal(this);
mToastMouseEnterSignal(this, getValue());
}
}
@@ -423,6 +422,8 @@ void LLToast::onToastMouseLeave()
{
mOnToastHoverSignal(this, MOUSE_LEAVE);
+ updateTransparency();
+
//toasts fading is management by Screen Channel
if(mHideBtn && mHideBtn->getEnabled())
@@ -450,20 +451,45 @@ void LLToast::setBackgroundOpaque(BOOL b)
}
}
-void LLNotificationsUI::LLToast::stopFading()
+void LLToast::updateTransparency()
+{
+ ETypeTransparency transparency_type;
+
+ if (mCanFade)
+ {
+ // Notification toasts (including IM/chat toasts) change their transparency on hover.
+ if (isHovered())
+ {
+ transparency_type = TT_ACTIVE;
+ }
+ else
+ {
+ transparency_type = mIsFading ? TT_FADING : TT_INACTIVE;
+ }
+ }
+ else
+ {
+ // Transparency of alert toasts depends on focus.
+ transparency_type = hasFocus() ? TT_ACTIVE : TT_INACTIVE;
+ }
+
+ LLFloater::updateTransparency(transparency_type);
+}
+
+void LLNotificationsUI::LLToast::stopTimer()
{
if(mCanFade)
{
- setTransparentState(false);
+ setFading(false);
mTimer->stop();
}
}
-void LLNotificationsUI::LLToast::startFading()
+void LLNotificationsUI::LLToast::startTimer()
{
if(mCanFade)
{
- setTransparentState(false);
+ setFading(false);
mTimer->start();
}
}