|
1 /* |
|
2 * Copyright (c) 2009 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: Definitions for the display object of plugin type |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #ifndef C_SCREENSAVERCTRLPLUGIN_H |
|
21 #define C_SCREENSAVERCTRLPLUGIN_H |
|
22 |
|
23 #include <babitflags.h> |
|
24 |
|
25 #include "screensaverbase.h" |
|
26 |
|
27 /** |
|
28 * The plugin type of display object which is derived from the |
|
29 * CScreensaverBase class |
|
30 */ |
|
31 class CScreensaverCtrlPlugin : public CScreensaverBase, |
|
32 public MScreensaverPluginHost |
|
33 { |
|
34 public: |
|
35 enum TScreensaverPluginFlag |
|
36 { |
|
37 // Indicates that plugin module wants to draw indicators |
|
38 EPluginFlagOverrideIndicators = 0, |
|
39 // Indicates that plugin does not use refresh timer and should not get |
|
40 // Draw() calls |
|
41 EPluginFlagTimerNotUsed, |
|
42 EPluginFlagSuspend |
|
43 }; |
|
44 public: |
|
45 /** |
|
46 * Two-phased constructor. |
|
47 */ |
|
48 static CScreensaverCtrlPlugin* NewL(); |
|
49 |
|
50 /** |
|
51 * Destructor |
|
52 */ |
|
53 ~CScreensaverCtrlPlugin(); |
|
54 |
|
55 /** |
|
56 * Start the control needed timer |
|
57 */ |
|
58 void StartTimer(); |
|
59 |
|
60 /** |
|
61 * Cancels the timer |
|
62 */ |
|
63 void CancelTimer(); |
|
64 |
|
65 |
|
66 /** |
|
67 * Show the control |
|
68 */ |
|
69 void DrawObject(); |
|
70 |
|
71 /** |
|
72 * Clear the screen |
|
73 */ |
|
74 void ClearScreen(); |
|
75 |
|
76 /* |
|
77 * Refresh the display |
|
78 */ |
|
79 void Refresh(); |
|
80 |
|
81 /** |
|
82 * Send the event to plugin to deal with |
|
83 * |
|
84 * @param aEvent the event send to plugin |
|
85 * @return TInt |
|
86 */ |
|
87 TInt SendPluginEvent( TScreensaverEvent aEvent ); |
|
88 |
|
89 /** |
|
90 * Returns the implemenataion UID of the plugin |
|
91 * |
|
92 * @return TUid Implementation UID |
|
93 */ |
|
94 TUid PluginImplementationUid() const; |
|
95 |
|
96 public: |
|
97 // From MScreensaverPluginHost |
|
98 void UseStandardIndicators(); |
|
99 void OverrideStandardIndicators(); |
|
100 TBool StandardIndicatorsUsed() const; |
|
101 void SetRefreshTimerValue( TInt aValue ); |
|
102 TInt RefreshTimerValue() const; |
|
103 TInt GetIndicatorPayload( TScreensaverIndicatorIndex aIndex, |
|
104 TIndicatorPayload& aResult ) const; |
|
105 TInt SetActiveDisplayArea( TRect& aRect, |
|
106 const TScreensaverPartialMode& aMode ); |
|
107 TInt SetActiveDisplayArea( TInt aStartRow, TInt aEndRow, |
|
108 const TScreensaverPartialMode& aMode ); |
|
109 void ExitPartialMode(); |
|
110 const TScreensaverColorModel& GetColorModel() const; |
|
111 void Suspend( TInt aTime ); |
|
112 void RequestLights( TInt aSecs ); |
|
113 TInt DisplayInfo( TScreensaverDisplayInfo* aDisplayInfo ); |
|
114 void UseRefreshTimer( TBool aOn = ETrue ); |
|
115 void RequestTimeout( TInt aSecs ); |
|
116 void RevertToDefaultSaver(); |
|
117 // End MScreensaverPluginHost |
|
118 |
|
119 protected: |
|
120 /** |
|
121 * The default C++ constuctor |
|
122 * |
|
123 * @param aType the type of the display object. |
|
124 * @param aPlugin the plugin which the screensaver is setted. |
|
125 */ |
|
126 CScreensaverCtrlPlugin(); |
|
127 |
|
128 /** |
|
129 * Symbian default constructor. |
|
130 */ |
|
131 void ConstructL(); |
|
132 |
|
133 protected: |
|
134 // From CCoeControl |
|
135 |
|
136 /** |
|
137 * Resource change handling |
|
138 */ |
|
139 virtual void HandleResourceChange( TInt aType ); |
|
140 |
|
141 /** |
|
142 * Responds to changes to the size and position of the contents |
|
143 * of this control. |
|
144 */ |
|
145 virtual void SizeChanged(); |
|
146 |
|
147 /** |
|
148 * Drawing (override this to draw) |
|
149 */ |
|
150 virtual void Draw( const TRect& aRect ) const; |
|
151 |
|
152 private: |
|
153 /* |
|
154 * LoadPluginL() |
|
155 */ |
|
156 void LoadPluginL( MScreensaverPluginHost* aPluginHost ); |
|
157 |
|
158 /* |
|
159 * Get the poiter of the plugin |
|
160 */ |
|
161 void LoadPluginModuleL(); |
|
162 |
|
163 /* |
|
164 * Delete the plugin |
|
165 */ |
|
166 void DeletePlugin(); |
|
167 |
|
168 /** |
|
169 * Starts the plugin refresh timer |
|
170 */ |
|
171 void StartPluginRefreshTimer(); |
|
172 |
|
173 /** |
|
174 * Starts the plugin time out timer |
|
175 */ |
|
176 void StartPluginTimeoutTimer( TInt aSecs ); |
|
177 |
|
178 |
|
179 /** |
|
180 * Callback fuction. Called when the Plugin tiemr time out |
|
181 */ |
|
182 static TInt HandlePluginTimeoutTimerExpiry( TAny* aPtr ); |
|
183 |
|
184 |
|
185 private://data |
|
186 /** |
|
187 * Plugin interface. |
|
188 */ |
|
189 MScreensaverPlugin* iPlugin; |
|
190 |
|
191 /** |
|
192 * The plugin refresh timer |
|
193 */ |
|
194 CPeriodic* iPluginRefreshTimer; |
|
195 |
|
196 /** |
|
197 * The plugin timeout timer |
|
198 */ |
|
199 CPeriodic* iPluginTimeoutTimer; |
|
200 |
|
201 |
|
202 /** |
|
203 * The plugin flag |
|
204 */ |
|
205 mutable TBitFlagsT<TUint32> iPluginFlag; |
|
206 |
|
207 /** |
|
208 * The refresh rate of plugin |
|
209 */ |
|
210 TInt iPluginRefreshRate; |
|
211 |
|
212 /** |
|
213 * The implementation UID of the plugin |
|
214 */ |
|
215 TUid iPluginImplUid; |
|
216 |
|
217 }; |
|
218 #endif // C_SCREENSAVERCTRLPLUGIN_H |