|
1 /* |
|
2 Copyright (C) 2004, 2005 Nikolas Zimmermann <wildfox@kde.org> |
|
3 2004, 2005 Rob Buis <buis@kde.org> |
|
4 Copyright (C) 2006 Apple Computer, Inc. |
|
5 |
|
6 This file is part of the KDE project |
|
7 |
|
8 This library is free software; you can redistribute it and/or |
|
9 modify it under the terms of the GNU Library General Public |
|
10 License as published by the Free Software Foundation; either |
|
11 version 2 of the License, or (at your option) any later version. |
|
12 |
|
13 This library is distributed in the hope that it will be useful, |
|
14 but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
16 Library General Public License for more details. |
|
17 |
|
18 You should have received a copy of the GNU Library General Public License |
|
19 along with this library; see the file COPYING.LIB. If not, write to |
|
20 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
|
21 Boston, MA 02110-1301, USA. |
|
22 */ |
|
23 |
|
24 #ifndef TimeScheduler_h |
|
25 #define TimeScheduler_h |
|
26 #if ENABLE(SVG) |
|
27 |
|
28 #include <wtf/HashSet.h> |
|
29 |
|
30 namespace WebCore { |
|
31 class Document; |
|
32 class SVGAnimationElement; |
|
33 class SVGTimer; |
|
34 |
|
35 template <typename T> class Timer; |
|
36 |
|
37 typedef HashSet<SVGTimer*> SVGTimerSet; |
|
38 |
|
39 class TimeScheduler { |
|
40 public: |
|
41 TimeScheduler(Document*); |
|
42 ~TimeScheduler(); |
|
43 |
|
44 // Adds singleShot Timers |
|
45 void addTimer(SVGAnimationElement*, unsigned int ms); |
|
46 |
|
47 // (Dis-)Connects to interval timer with 'staticTimerInterval' |
|
48 void connectIntervalTimer(SVGAnimationElement*); |
|
49 void disconnectIntervalTimer(SVGAnimationElement*); |
|
50 |
|
51 void startAnimations(); |
|
52 void toggleAnimations(); |
|
53 bool animationsPaused() const; |
|
54 |
|
55 // time elapsed in seconds after creation of this object |
|
56 double elapsed() const; |
|
57 |
|
58 private: |
|
59 friend class SVGTimer; |
|
60 void timerFired(Timer<TimeScheduler>*); |
|
61 Document* document() const { return m_document; } |
|
62 |
|
63 private: |
|
64 double m_creationTime; |
|
65 double m_savedTime; |
|
66 |
|
67 SVGTimerSet m_timerSet; |
|
68 |
|
69 SVGTimer* m_intervalTimer; |
|
70 Document* m_document; |
|
71 }; |
|
72 } |
|
73 |
|
74 #endif // ENABLE(SVG) |
|
75 #endif |
|
76 |
|
77 // vim:ts=4:noet |