diff options
author | Tobias Madl <tobias.madl.dev@gmail.com> | 2014-10-30 20:07:59 +0100 |
---|---|---|
committer | Michael Meeks <michael.meeks@collabora.com> | 2014-11-05 20:59:44 +0000 |
commit | d6e89e7516271d246b255ec5ebc752713da3dfd5 (patch) | |
tree | bcbcf58593f6191eb88057f2da2ea8ff2fa15410 /include/vcl/timer.hxx | |
parent | 9632045906baf165076d11a97f45b153d8e2acb7 (diff) |
Basic Idle handler implementation
An idle handler will ultimately be a zero time timeout with
prioritisation layered on top of that.
Change-Id: I3f0802d5001172fc7b8409274bc5a3632e5dad34
Diffstat (limited to 'include/vcl/timer.hxx')
-rw-r--r-- | include/vcl/timer.hxx | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/include/vcl/timer.hxx b/include/vcl/timer.hxx index d3ebe1a256e5..10dd3fca730f 100644 --- a/include/vcl/timer.hxx +++ b/include/vcl/timer.hxx @@ -73,6 +73,42 @@ public: AutoTimer& operator=( const AutoTimer& rTimer ); }; +enum IdlePriority { + VCL_IDLE_PRIORITY_HIGHEST, // -> 0ms + VCL_IDLE_PRIORITY_HIGH, // -> 1ms + VCL_IDLE_PRIORITY_REPAINT, // -> 30ms + VCL_IDLE_PRIORITY_RESIZE, // -> 50ms + VCL_IDLE_PRIORITY_MEDIUM, // -> 50ms + VCL_IDLE_PRIORITY_LOW, // -> 100ms + VCL_IDLE_PRIORITY_LOWER, // -> 200ms + VCL_IDLE_PRIORITY_LOWEST // -> 400ms +}; + + +// To port from Timer -> Idle switch class name, +// s/Timeout/DoIdle/ etc. and select priority +class VCL_DLLPUBLIC Idle : public Timer +{ + public: + Idle(); + Idle( IdlePriority ePriority ); + virtual ~Idle(); + + void SetPriority( IdlePriority ePriority ); + + /// Make it possible to associate a callback with this idle handler + /// of course, you can also sub-class and override 'DoIdle' + void SetIdleHdl( const Link& rLink ) { SetTimeoutHdl( rLink ); } + const Link& GetIdleHdl() const { return GetTimeoutHdl(); } + + void Start() { Timer::Start(); } + void Stop() { Timer::Stop(); } + + virtual void DoIdle(); + + virtual void Timeout() SAL_OVERRIDE { DoIdle(); } +}; + #endif // INCLUDED_VCL_TIMER_HXX /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |