summaryrefslogtreecommitdiff
path: root/indra/newview/lltoast.h
diff options
context:
space:
mode:
authorTofu Linden <tofu.linden@lindenlab.com>2010-04-07 12:16:36 +0100
committerTofu Linden <tofu.linden@lindenlab.com>2010-04-07 12:16:36 +0100
commit8da371b0f08f92fb1fef083f0bfb526f0698afd7 (patch)
treeb2ca851a0ef32e0994fb151a5457e615b4ea69c2 /indra/newview/lltoast.h
parent1e7ae7a69398a1bca88812545da7bc86db9f3c38 (diff)
parent244de628f2a71ea773cdcabb8328df26f20e3120 (diff)
merge
Diffstat (limited to 'indra/newview/lltoast.h')
-rw-r--r--indra/newview/lltoast.h37
1 files changed, 26 insertions, 11 deletions
diff --git a/indra/newview/lltoast.h b/indra/newview/lltoast.h
index 64855020a9..20198a9398 100644
--- a/indra/newview/lltoast.h
+++ b/indra/newview/lltoast.h
@@ -36,7 +36,7 @@
#include "llpanel.h"
#include "llmodaldialog.h"
-#include "lltimer.h"
+#include "lleventtimer.h"
#include "llnotificationptr.h"
#include "llviewercontrol.h"
@@ -48,12 +48,32 @@
namespace LLNotificationsUI
{
+class LLToast;
+/**
+ * Timer for toasts.
+ */
+class LLToastLifeTimer: public LLEventTimer
+{
+public:
+ LLToastLifeTimer(LLToast* toast, F32 period) : mToast(toast), LLEventTimer(period){}
+
+ /*virtual*/
+ BOOL tick();
+ void stop() { mEventTimer.stop(); }
+ void start() { mEventTimer.start(); }
+ void restart() {mEventTimer.reset(); }
+ BOOL getStarted() { return mEventTimer.getStarted(); }
+private :
+ LLToast* mToast;
+};
+
/**
* Represents toast pop-up.
* This is a parent view for all toast panels.
*/
class LLToast : public LLModalDialog
{
+ friend class LLToastLifeTimer;
public:
typedef boost::function<void (LLToast* toast)> toast_callback_t;
typedef boost::signals2::signal<void (LLToast* toast)> toast_signal_t;
@@ -107,12 +127,10 @@ public:
LLPanel* getPanel() { return mPanel; }
// enable/disable Toast's Hide button
void setHideButtonEnabled(bool enabled);
- // initialize and start Toast's timer
- void setAndStartTimer(F32 period);
//
- void resetTimer() { mTimer.start(); }
+ void resetTimer() { mTimer->start(); }
//
- void stopTimer() { mTimer.stop(); }
+ void stopTimer() { mTimer->stop(); }
//
virtual void draw();
//
@@ -176,10 +194,7 @@ private:
void handleTipToastClick(S32 x, S32 y, MASK mask);
- // check timer
- bool lifetimeHasExpired();
- // on timer finished function
- void tick();
+ void expire();
LLUUID mNotificationID;
LLUUID mSessionID;
@@ -188,8 +203,8 @@ private:
LLPanel* mWrapperPanel;
// timer counts a lifetime of a toast
- LLTimer mTimer;
- F32 mToastLifetime; // in seconds
+ std::auto_ptr<LLToastLifeTimer> mTimer;
+
F32 mToastFadingTime; // in seconds
LLPanel* mPanel;