|
1 /* |
|
2 * Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: Slide set wallpaper timer. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef C_AKNSWALLPAPERTIMER_H |
|
20 #define C_AKNSWALLPAPERTIMER_H |
|
21 |
|
22 #include <e32base.h> |
|
23 |
|
24 /** |
|
25 * Observer interface for wallpaper slide set timer. |
|
26 * |
|
27 * This interface is called when timer fires according |
|
28 * to interval period defined when creating an instance. |
|
29 * |
|
30 * @lib aknssrv.lib |
|
31 * @since S60 v3.2 |
|
32 */ |
|
33 class MAknsSrvWallpaperListener |
|
34 { |
|
35 public: |
|
36 virtual void WallpaperTimerTimeoutL( TBool aForceChange = EFalse ) = 0; |
|
37 }; |
|
38 |
|
39 /** |
|
40 * Slideset wallpaper timer. |
|
41 * |
|
42 * This class defines a timer for changing the image |
|
43 * in a slide set. When timer fires according to interval |
|
44 * given when creating the class, observer interface |
|
45 * MAknsSrvWallpaperListener::WallpaperTimerTimeoutL is |
|
46 * called. |
|
47 * |
|
48 * @lib aknssrv.lib |
|
49 * @since S60 v3.2 |
|
50 */ |
|
51 NONSHARABLE_CLASS(CAknsSrvWallpaperTimer) : public CActive |
|
52 { |
|
53 public: |
|
54 |
|
55 /** |
|
56 * Creates a new instance of wallpaper slide set timer. |
|
57 * @param aListener observer for this timer's events. |
|
58 * |
|
59 * @return new instance of wallpaper slide set timer. |
|
60 */ |
|
61 static CAknsSrvWallpaperTimer* NewL( |
|
62 MAknsSrvWallpaperListener* aListener ); |
|
63 |
|
64 /** |
|
65 * Start the timer. |
|
66 * @param aInterval firing interval in seconds. |
|
67 * The timer is fired after each interval period, |
|
68 * until stopped. |
|
69 */ |
|
70 void Start( TInt aInterval ); |
|
71 |
|
72 /** |
|
73 * Stop the timer. |
|
74 */ |
|
75 void Stop(); |
|
76 |
|
77 /** |
|
78 * Returns the interval period of the timer. |
|
79 * @return interval period of the timer. |
|
80 */ |
|
81 TInt Interval(); |
|
82 |
|
83 /** |
|
84 * Destructor. Cancels and closes the timer. |
|
85 */ |
|
86 ~CAknsSrvWallpaperTimer(); |
|
87 |
|
88 protected: |
|
89 |
|
90 /** |
|
91 * Handles an active object's request completion event. |
|
92 * @from CActive. |
|
93 */ |
|
94 void RunL(); |
|
95 |
|
96 /** |
|
97 * Implements cancellation of an outstanding request. |
|
98 * @from CActive. |
|
99 */ |
|
100 void DoCancel(); |
|
101 |
|
102 private: |
|
103 |
|
104 // Second phase constructor. |
|
105 void ConstructL(); |
|
106 |
|
107 // C++ constructor. |
|
108 CAknsSrvWallpaperTimer( MAknsSrvWallpaperListener* aListener ); |
|
109 |
|
110 /** |
|
111 * Issues a new request. If active object is already running, |
|
112 * nothing happens. |
|
113 * @param aTempInterval a new interval to use. |
|
114 */ |
|
115 void IssueRequest( TInt aTempInterval = 0 ); |
|
116 |
|
117 private: |
|
118 /** |
|
119 * Pointer to timer firing event listener. |
|
120 * Not own. |
|
121 */ |
|
122 MAknsSrvWallpaperListener* iListener; |
|
123 |
|
124 /** |
|
125 * Interval when timer should fire. |
|
126 */ |
|
127 TInt iInterval; |
|
128 |
|
129 /** |
|
130 * Has the request been cancelled. |
|
131 */ |
|
132 TBool iCanceled; |
|
133 |
|
134 /** |
|
135 * Timer object. |
|
136 */ |
|
137 RTimer iTimer; |
|
138 |
|
139 /** |
|
140 * Previous time when timer was fired. |
|
141 */ |
|
142 TTime iPreviousTime; |
|
143 }; |
|
144 |
|
145 |
|
146 #endif // C_AKNSWALLPAPERTIMER_H |