diff options
-rw-r--r-- | indra/newview/llscreenchannel.cpp | 33 | ||||
-rw-r--r-- | indra/newview/llscreenchannel.h | 7 | ||||
-rw-r--r-- | indra/newview/lltoast.cpp | 33 | ||||
-rw-r--r-- | indra/newview/lltoast.h | 9 |
4 files changed, 74 insertions, 8 deletions
diff --git a/indra/newview/llscreenchannel.cpp b/indra/newview/llscreenchannel.cpp index 44bdf98a86..4f0c873c61 100644 --- a/indra/newview/llscreenchannel.cpp +++ b/indra/newview/llscreenchannel.cpp @@ -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() { diff --git a/indra/newview/llscreenchannel.h b/indra/newview/llscreenchannel.h index f39b94b89d..67f1c9bdc6 100644 --- a/indra/newview/llscreenchannel.h +++ b/indra/newview/llscreenchannel.h @@ -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 diff --git a/indra/newview/lltoast.cpp b/indra/newview/lltoast.cpp index bf485b7e65..fc7c029a17 100644 --- a/indra/newview/lltoast.cpp +++ b/indra/newview/lltoast.cpp @@ -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(); + } } //-------------------------------------------------------------------------- diff --git a/indra/newview/lltoast.h b/indra/newview/lltoast.h index 769b2ba122..d08e46e160 100644 --- a/indra/newview/lltoast.h +++ b/indra/newview/lltoast.h @@ -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); |