diff options
author | Xiaohong Bao <bao@lindenlab.com> | 2011-02-23 10:44:59 -0700 |
---|---|---|
committer | Xiaohong Bao <bao@lindenlab.com> | 2011-02-23 10:44:59 -0700 |
commit | 01cdeb0cdd8c48b76a229d42ced4e5563cd18c5c (patch) | |
tree | e7b7ca976f17c8af3c8a2648a801030594e94c8c /indra/newview/lltoast.h | |
parent | 7daa3d1ca10199468946feef0ce8eb67489deee0 (diff) | |
parent | ff5e3f5c2e566f3a8e86efaa763f7b12e07eeb53 (diff) |
Merge from viewer-development
Diffstat (limited to 'indra/newview/lltoast.h')
-rw-r--r-- | indra/newview/lltoast.h | 50 |
1 files changed, 32 insertions, 18 deletions
diff --git a/indra/newview/lltoast.h b/indra/newview/lltoast.h index 0a96c092a0..242f786bf2 100644 --- a/indra/newview/lltoast.h +++ b/indra/newview/lltoast.h @@ -49,14 +49,16 @@ class LLToast; class LLToastLifeTimer: public LLEventTimer { public: - LLToastLifeTimer(LLToast* toast, F32 period) : mToast(toast), LLEventTimer(period){} + LLToastLifeTimer(LLToast* toast, F32 period); /*virtual*/ BOOL tick(); - void stop() { mEventTimer.stop(); } - void start() { mEventTimer.start(); } - void restart() {mEventTimer.reset(); } - BOOL getStarted() { return mEventTimer.getStarted(); } + void stop(); + void start(); + void restart(); + BOOL getStarted(); + void setPeriod(F32 period); + F32 getRemainingTimeF32(); LLTimer& getEventTimer() { return mEventTimer;} private : @@ -80,10 +82,15 @@ public: Optional<LLUUID> notif_id, //notification ID session_id; //im session ID Optional<LLNotificationPtr> notification; - Optional<F32> lifetime_secs, - fading_time_secs; // Number of seconds while a toast is fading - Optional<toast_callback_t> on_delete_toast, - on_mouse_enter; + + //NOTE: Life time of a toast (i.e. period of time from the moment toast was shown + //till the moment when toast was hidden) is the sum of lifetime_secs and fading_time_secs. + + Optional<F32> lifetime_secs, // Number of seconds while a toast is non-transparent + fading_time_secs; // Number of seconds while a toast is transparent + + + Optional<toast_callback_t> on_delete_toast; Optional<bool> can_fade, can_be_stored, enable_hide_btn, @@ -107,11 +114,11 @@ public: //Fading - /** Stop fading timer */ - virtual void stopFading(); + /** Stop lifetime/fading timer */ + virtual void stopTimer(); - /** Start fading timer */ - virtual void startFading(); + /** Start lifetime/fading timer */ + virtual void startTimer(); bool isHovered(); @@ -125,10 +132,8 @@ public: LLPanel* getPanel() { return mPanel; } // enable/disable Toast's Hide button void setHideButtonEnabled(bool enabled); - // - void resetTimer() { mTimer->start(); } // - void stopTimer() { mTimer->stop(); } + F32 getTimeLeftToLive(); // LLToastLifeTimer* getTimer() { return mTimer.get();} // @@ -144,6 +149,10 @@ public: /*virtual*/ void onFocusReceived(); + void setLifetime(S32 seconds); + + void setFadingTime(S32 seconds); + /** * Returns padding between floater top and wrapper_panel top. * This padding should be taken into account when positioning or reshaping toasts @@ -172,7 +181,6 @@ public: // Registers signals/callbacks for events toast_signal_t mOnFadeSignal; - toast_signal_t mOnMouseEnterSignal; toast_signal_t mOnDeleteToastSignal; toast_signal_t mOnToastDestroyedSignal; boost::signals2::connection setOnFadeCallback(toast_callback_t cb) { return mOnFadeSignal.connect(cb); } @@ -190,13 +198,18 @@ public: LLHandle<LLToast> getHandle() { mHandle.bind(this); return mHandle; } +protected: + void updateTransparency(); + private: void onToastMouseEnter(); void onToastMouseLeave(); - void expire(); + void expire(); + + void setFading(bool fading); LLUUID mNotificationID; LLUUID mSessionID; @@ -222,6 +235,7 @@ private: bool mHideBtnPressed; bool mIsHidden; // this flag is TRUE when a toast has faded or was hidden with (x) button (EXT-1849) bool mIsTip; + bool mIsFading; commit_signal_t mToastMouseEnterSignal; commit_signal_t mToastMouseLeaveSignal; |