tast EXT-3096 (Notification toasts mouse hovering behavior), fade behavior is now being reset for all toasts on hovering

--HG--
branch : product-engine
meow-7.2.2
Igor Borovkov 2009-12-07 19:09:25 +02:00
parent 4a1bb89faf
commit 0a88e412cc
4 changed files with 74 additions and 8 deletions

View File

@ -162,6 +162,8 @@ void LLScreenChannel::addToast(const LLToast::Params& p)
if(mControlHovering)
{
new_toast_elem.toast->setOnToastHoverCallback(boost::bind(&LLScreenChannel::onToastHover, this, _1, _2));
new_toast_elem.toast->setMouseEnterCallback(boost::bind(&LLScreenChannel::stopFadingToasts, this));
new_toast_elem.toast->setMouseLeaveCallback(boost::bind(&LLScreenChannel::startFadingToasts, this));
}
if(show_toast)
@ -586,6 +588,37 @@ void LLScreenChannel::closeStartUpToast()
}
}
void LLNotificationsUI::LLScreenChannel::stopFadingToasts()
{
if (!mToastList.size()) return;
if (!mHoveredToast) return;
std::vector<ToastElem>::iterator it = mToastList.begin();
while (it != mToastList.end())
{
ToastElem& elem = *it;
elem.toast->stopFading();
++it;
}
}
void LLNotificationsUI::LLScreenChannel::startFadingToasts()
{
if (!mToastList.size()) return;
//because onMouseLeave is processed after onMouseEnter
if (mHoveredToast) return;
std::vector<ToastElem>::iterator it = mToastList.begin();
while (it != mToastList.end())
{
ToastElem& elem = *it;
elem.toast->startFading();
++it;
}
}
//--------------------------------------------------------------------------
void LLScreenChannel::hideToastsFromScreen()
{

View File

@ -184,6 +184,13 @@ public:
// close the StartUp Toast
void closeStartUpToast();
/** Stop fading all toasts */
virtual void stopFadingToasts();
/** Start fading all toasts */
virtual void startFadingToasts();
// get StartUp Toast's state
static bool getStartUpToastShown() { return mWasStartUpToastShown; }
// tell all channels that the StartUp toast was shown and allow them showing of toasts

View File

@ -244,15 +244,15 @@ void LLToast::onMouseEnter(S32 x, S32 y, MASK mask)
mOnToastHoverSignal(this, MOUSE_ENTER);
setBackgroundOpaque(TRUE);
if(mCanFade)
{
mTimer.stop();
}
//toasts fading is management by Screen Channel
sendChildToFront(mHideBtn);
if(mHideBtn && mHideBtn->getEnabled())
mHideBtn->setVisible(TRUE);
mOnMouseEnterSignal(this);
LLModalDialog::onMouseEnter(x, y, mask);
}
//--------------------------------------------------------------------------
@ -260,10 +260,8 @@ void LLToast::onMouseLeave(S32 x, S32 y, MASK mask)
{
mOnToastHoverSignal(this, MOUSE_LEAVE);
if(mCanFade)
{
mTimer.start();
}
//toasts fading is management by Screen Channel
if(mHideBtn && mHideBtn->getEnabled())
{
if( mHideBtnPressed )
@ -273,6 +271,25 @@ void LLToast::onMouseLeave(S32 x, S32 y, MASK mask)
}
mHideBtn->setVisible(FALSE);
}
LLModalDialog::onMouseLeave(x, y, mask);
}
void LLNotificationsUI::LLToast::stopFading()
{
if(mCanFade)
{
stopTimer();
}
}
void LLNotificationsUI::LLToast::startFading()
{
if(mCanFade)
{
resetTimer();
}
}
//--------------------------------------------------------------------------

View File

@ -88,6 +88,15 @@ public:
virtual void onMouseEnter(S32 x, S32 y, MASK mask);
virtual void onMouseLeave(S32 x, S32 y, MASK mask);
//Fading
/** Stop fading timer */
virtual void stopFading();
/** Start fading timer */
virtual void startFading();
// Operating with toasts
// insert a panel to a toast
void insertPanel(LLPanel* panel);