summaryrefslogtreecommitdiff
path: root/indra/newview/lltoast.h
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/lltoast.h')
-rw-r--r--indra/newview/lltoast.h50
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;