summaryrefslogtreecommitdiff
path: root/include/vcl
diff options
context:
space:
mode:
authorTobias Madl <tobias.madl.dev@gmail.com>2015-01-14 08:29:37 +0100
committerTobias Madl <tobias.madl.dev@gmail.com>2015-03-06 12:27:05 +0000
commitd8305248f687ffa522b56955508d82d60ad5b8c6 (patch)
tree9061eca3a38e56946722fc0ae87b2cd3b44e7266 /include/vcl
parenta74efa665c8199899cd778900de686e2b8710fee (diff)
Idle: Idle and Timer completely independend
Now the Idle and Timer are divided in two seperate classes. But now all changed idles need a new import, before the programm is working again. Change-Id: I5be7424622b6fcc993c621fa4a11fbee1b6d9bf2
Diffstat (limited to 'include/vcl')
-rw-r--r--include/vcl/idle.hxx84
-rw-r--r--include/vcl/timer.hxx45
2 files changed, 85 insertions, 44 deletions
diff --git a/include/vcl/idle.hxx b/include/vcl/idle.hxx
new file mode 100644
index 000000000000..9da841490f2f
--- /dev/null
+++ b/include/vcl/idle.hxx
@@ -0,0 +1,84 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_VCL_IDLE_HXX
+#define INCLUDED_VCL_IDLE_HXX
+
+#include <tools/link.hxx>
+#include <tools/solar.h>
+#include <vcl/dllapi.h>
+
+struct ImplIdleData;
+struct ImplSVData;
+
+enum class IdlePriority {
+ VCL_IDLE_PRIORITY_HIGHEST = 0, // -> 0ms
+ VCL_IDLE_PRIORITY_HIGH = 1, // -> 1ms
+ VCL_IDLE_PRIORITY_REPAINT = 2, // -> 30ms
+ VCL_IDLE_PRIORITY_RESIZE = 3, // -> 50ms
+ VCL_IDLE_PRIORITY_MEDIUM = 4, // -> 50ms
+ VCL_IDLE_PRIORITY_LOW = 5, // -> 100ms
+ VCL_IDLE_PRIORITY_LOWER = 6, // -> 200ms
+ VCL_IDLE_PRIORITY_LOWEST = 7 // -> 400ms
+};
+
+
+// To port from Timer -> Idle switch class name,
+// s/Timeout/DoIdle/ etc. and select priority
+class VCL_DLLPUBLIC Idle
+{
+protected:
+ ImplIdleData* mpIdleData;
+ IdlePriority mePriority;
+ bool mbActive;
+ Link maIdleHdl;
+
+ friend struct ImplIdleData;
+
+public:
+ Idle();
+ Idle( const Idle& rIdle );
+ virtual ~Idle();
+
+ void SetPriority( IdlePriority ePriority ) { mePriority = ePriority; }
+ IdlePriority GetPriority() const { return mePriority; }
+
+ /// 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 ) { maIdleHdl = rLink; }
+ const Link& GetIdleHdl() const { return maIdleHdl; }
+
+ virtual void DoIdle();
+
+ void Start();
+ void Stop();
+
+ bool IsActive() const { return mbActive; }
+
+ Idle& operator=( const Idle& rIdle );
+ static void ImplDeInitIdle();
+ static void ImplIdleCallbackProc();
+
+ /// Process all pending idle tasks ahead of time in priority order.
+ static void ProcessAllIdleHandlers();
+};
+
+#endif // INCLUDED_VCL_IDLE_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/timer.hxx b/include/vcl/timer.hxx
index d93e7c01cdac..d2302275cff9 100644
--- a/include/vcl/timer.hxx
+++ b/include/vcl/timer.hxx
@@ -35,7 +35,6 @@ protected:
sal_uLong mnTimeout;
bool mbActive;
bool mbAuto;
- bool mbIdle;
Link maTimeoutHdl;
friend struct ImplTimerData;
@@ -63,12 +62,7 @@ public:
/// @internal
static void ImplDeInitTimer();
- /// @internal
- /// @p idle - allow also idle timers
- static void ImplTimerCallbackProc( bool idle );
-
- /// Process all pending idle tasks ahead of time in priority order.
- static void ProcessAllIdleHandlers();
+ static void ImplTimerCallbackProc();
};
/// An auto-timer is a multi-shot timer re-emitting itself at
@@ -81,43 +75,6 @@ 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(); }
-
- void DoIdle();
-
- virtual void Timeout() SAL_OVERRIDE { DoIdle(); }
-};
-
#endif // INCLUDED_VCL_TIMER_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */