diff options
author | Jan-Marek Glogowski <glogow@fbihome.de> | 2016-09-14 13:48:02 +0200 |
---|---|---|
committer | Jan-Marek Glogowski <glogow@fbihome.de> | 2017-01-17 16:22:57 +0100 |
commit | 59b84bc78dff2adb265d9fa8edb4c42794cf9771 (patch) | |
tree | 929a0dd7e3d16dfc9d49dac3470fd11546819504 /vcl | |
parent | 1531152eff8061d63be5d98641fcafaa1da05167 (diff) |
Change Idle to be a Timer subclass
Drops a lot of duplicated code, as Idle is just a convenience
class for instant, mostly low priority timers.
Change-Id: I847592e92e86d15ab1cab168bf0e667322e48048
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/source/app/idle.cxx | 20 | ||||
-rw-r--r-- | vcl/source/app/timer.cxx | 38 | ||||
-rw-r--r-- | vcl/source/control/edit.cxx | 2 | ||||
-rw-r--r-- | vcl/source/edit/textdata.cxx | 4 | ||||
-rw-r--r-- | vcl/source/window/paint.cxx | 2 | ||||
-rw-r--r-- | vcl/source/window/window.cxx | 2 |
6 files changed, 15 insertions, 53 deletions
diff --git a/vcl/source/app/idle.cxx b/vcl/source/app/idle.cxx index 52b8d980218f..895000a9f504 100644 --- a/vcl/source/app/idle.cxx +++ b/vcl/source/app/idle.cxx @@ -20,25 +20,9 @@ #include <vcl/idle.hxx> #include "saltimer.hxx" -void Idle::Invoke() +Idle::Idle( const sal_Char *pDebugName ) + : Timer( pDebugName ) { - maIdleHdl.Call( this ); -} - -Idle& Idle::operator=( const Idle& rIdle ) -{ - Task::operator=(rIdle); - maIdleHdl = rIdle.maIdleHdl; - return *this; -} - -Idle::Idle( const sal_Char *pDebugName ) : Task( pDebugName ) -{ -} - -Idle::Idle( const Idle& rIdle ) : Task(rIdle) -{ - maIdleHdl = rIdle.maIdleHdl; } void Idle::Start() diff --git a/vcl/source/app/timer.cxx b/vcl/source/app/timer.cxx index 96485ae90ebd..77704db3835b 100644 --- a/vcl/source/app/timer.cxx +++ b/vcl/source/app/timer.cxx @@ -53,25 +53,22 @@ sal_uInt64 Timer::UpdateMinPeriod( sal_uInt64 nMinPeriod, sal_uInt64 nTimeNow ) } } -Timer::Timer(const sal_Char *pDebugName) : - Task(pDebugName), - mnTimeout(Scheduler::ImmediateTimeoutMs), - mbAuto(false) +Timer::Timer(const sal_Char *pDebugName) + : Task( pDebugName ) + , mnTimeout( Scheduler::ImmediateTimeoutMs ) + , mbAuto( false ) { mePriority = TaskPriority::HIGHEST; } -Timer::Timer( const Timer& rTimer ) : - Task(rTimer), - mnTimeout(rTimer.mnTimeout), - mbAuto(rTimer.mbAuto) +void Timer::Invoke() { - maTimeoutHdl = rTimer.maTimeoutHdl; + maInvokeHandler.Call( this ); } -void Timer::Invoke() +void Timer::Invoke( Timer *arg ) { - maTimeoutHdl.Call( this ); + maInvokeHandler.Call( arg ); } void Timer::Start() @@ -88,29 +85,10 @@ void Timer::SetTimeout( sal_uInt64 nNewTimeout ) StartTimer( mnTimeout ); } -Timer& Timer::operator=( const Timer& rTimer ) -{ - Task::operator=(rTimer); - maTimeoutHdl = rTimer.maTimeoutHdl; - mnTimeout = rTimer.mnTimeout; - mbAuto = rTimer.mbAuto; - return *this; -} - AutoTimer::AutoTimer( const sal_Char *pDebugName ) : Timer( pDebugName ) { mbAuto = true; } -AutoTimer::AutoTimer( const AutoTimer& rTimer ) : Timer( rTimer ) -{ - mbAuto = true; -} - -AutoTimer& AutoTimer::operator=( const AutoTimer& rTimer ) -{ - Timer::operator=( rTimer ); - return *this; -} /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/control/edit.cxx b/vcl/source/control/edit.cxx index 610e492ef56c..8ee93fb9b2c8 100644 --- a/vcl/source/control/edit.cxx +++ b/vcl/source/control/edit.cxx @@ -1909,7 +1909,7 @@ void Edit::LoseFocus() { //notify an update latest when the focus is lost mpUpdateDataTimer->Stop(); - mpUpdateDataTimer->Timeout(); + mpUpdateDataTimer->Invoke(); } if ( !mpSubEdit ) diff --git a/vcl/source/edit/textdata.cxx b/vcl/source/edit/textdata.cxx index ceb42d053019..6b8abdfbec83 100644 --- a/vcl/source/edit/textdata.cxx +++ b/vcl/source/edit/textdata.cxx @@ -293,7 +293,7 @@ void IdleFormatter::DoIdleFormat( TextView* pV, sal_uInt16 nMaxRestarts ) if ( mnRestarts > nMaxRestarts ) { mnRestarts = 0; - ((Link<Idle *, void>&)GetIdleHdl()).Call( this ); + Invoke(); } else { @@ -307,7 +307,7 @@ void IdleFormatter::ForceTimeout() { Stop(); mnRestarts = 0; - ((Link<Idle *, void>&)GetIdleHdl()).Call( this ); + Invoke(); } } diff --git a/vcl/source/window/paint.cxx b/vcl/source/window/paint.cxx index e0e1a936f5d9..8e8dfcc64a5d 100644 --- a/vcl/source/window/paint.cxx +++ b/vcl/source/window/paint.cxx @@ -660,7 +660,7 @@ IMPL_LINK_NOARG(Window, ImplHandleResizeTimerHdl, Idle *, void) if( mpWindowImpl->mpFrameData->maPaintIdle.IsActive() ) { mpWindowImpl->mpFrameData->maPaintIdle.Stop(); - mpWindowImpl->mpFrameData->maPaintIdle.GetIdleHdl().Call( nullptr ); + mpWindowImpl->mpFrameData->maPaintIdle.Invoke( nullptr ); } } } diff --git a/vcl/source/window/window.cxx b/vcl/source/window/window.cxx index 2757800751f5..46d949ae611f 100644 --- a/vcl/source/window/window.cxx +++ b/vcl/source/window/window.cxx @@ -2407,7 +2407,7 @@ Size Window::GetSizePixel() const { VclPtr<vcl::Window> xWindow( const_cast<Window*>(this) ); mpWindowImpl->mpFrameData->maResizeIdle.Stop(); - mpWindowImpl->mpFrameData->maResizeIdle.GetIdleHdl().Call( nullptr ); + mpWindowImpl->mpFrameData->maResizeIdle.Invoke( nullptr ); if( xWindow->IsDisposed() ) return Size(0,0); } |