diff options
author | Tobias Madl <tobias.madl.dev@gmail.com> | 2015-02-26 07:33:59 +0000 |
---|---|---|
committer | Tobias Madl <tobias.madl.dev@gmail.com> | 2015-03-06 12:27:10 +0000 |
commit | f33d6800fbdc42aa75477e31be0bba5a4a5a52c1 (patch) | |
tree | 031608831e7cc2b3ceb1decc45eab74fb1f06041 /include/vcl/timer.hxx | |
parent | Idle: Changed to new enum name (diff) | |
download | core-f33d6800fbdc42aa75477e31be0bba5a4a5a52c1.tar.gz core-f33d6800fbdc42aa75477e31be0bba5a4a5a52c1.zip |
Idle Timer: Invented Base Class
Change-Id: I03db46afcc0cb5e5d7a134b1bdd327abb542e63c
Diffstat (limited to 'include/vcl/timer.hxx')
-rw-r--r-- | include/vcl/timer.hxx | 43 |
1 files changed, 13 insertions, 30 deletions
diff --git a/include/vcl/timer.hxx b/include/vcl/timer.hxx index 2d0f31076db0..01fd36c82a16 100644 --- a/include/vcl/timer.hxx +++ b/include/vcl/timer.hxx @@ -21,50 +21,32 @@ #define INCLUDED_VCL_TIMER_HXX #include <tools/link.hxx> -#include <tools/solar.h> -#include <vcl/dllapi.h> +#include <vcl/scheduler.hxx> -struct ImplTimerData; -struct ImplSVData; - -/// Base-class for timers - usually a simple, one-shot timeout -class VCL_DLLPUBLIC Timer +class VCL_DLLPUBLIC Timer : public Scheduler { protected: - ImplTimerData* mpTimerData; + Link maTimeoutHdl; // Callback Link sal_uLong mnTimeout; - bool mbActive; bool mbAuto; - Link maTimeoutHdl; - friend struct ImplTimerData; + void SetDeletionFlags() SAL_OVERRIDE; + bool ReadyForSchedule( bool bTimer ) SAL_OVERRIDE; public: - Timer(); - Timer( const Timer& rTimer ); - virtual ~Timer(); - - virtual void Timeout(); + Timer(); + Timer( const Timer& rTimer ); - void Start(); - void Stop(); - - /// set the timeout in milliseconds + /// Make it possible to associate a callback with this timer handler + /// of course, you can also sub-class and override 'Invoke' void SetTimeout( sal_uLong nTimeoutMs ); sal_uLong GetTimeout() const { return mnTimeout; } - bool IsActive() const { return mbActive; } - - /// Make it possible to associate a callback with this timeout void SetTimeoutHdl( const Link& rLink ) { maTimeoutHdl = rLink; } const Link& GetTimeoutHdl() const { return maTimeoutHdl; } - + virtual void Invoke() SAL_OVERRIDE; + virtual void Timeout() { Invoke(); } Timer& operator=( const Timer& rTimer ); - - /// @internal - static void ImplDeInitTimer(); - static void ImplTimerCallbackProc(); - static bool TimerReady(); - static bool CheckExpiredTimer(const bool bDoInvoke); + void Start() SAL_OVERRIDE; }; /// An auto-timer is a multi-shot timer re-emitting itself at @@ -77,6 +59,7 @@ public: AutoTimer& operator=( const AutoTimer& rTimer ); }; + #endif // INCLUDED_VCL_TIMER_HXX /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |