|
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 base class of display object |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #ifndef C_SCREENSAVERBASE_H |
|
21 #define C_SCREENSAVERBASE_H |
|
22 |
|
23 #include <coeccntx.h> |
|
24 #include <coecntrl.h> |
|
25 #include <AknPictographDrawerInterface.h> |
|
26 |
|
27 #include "screensaverplugin.h" |
|
28 #include "screensaver.hrh" |
|
29 #include "screensaverengine.h" |
|
30 #include "screensaverindicator.h" |
|
31 #include "screensaverindicatorarray.h" |
|
32 |
|
33 |
|
34 /** |
|
35 * The base class of all the different display object |
|
36 */ |
|
37 class CScreensaverBase : public CCoeControl, public MCoeControlContext, |
|
38 public MAknPictographAnimatorCallBack |
|
39 { |
|
40 public: |
|
41 /** |
|
42 * Default c++ constructor |
|
43 */ |
|
44 CScreensaverBase(); |
|
45 |
|
46 /** |
|
47 * Destructor |
|
48 */ |
|
49 virtual ~CScreensaverBase(); |
|
50 |
|
51 /** |
|
52 * Show the control and start the refresh timer |
|
53 */ |
|
54 virtual void StartDrawObject(); |
|
55 |
|
56 /** |
|
57 * Stop display the control and cancel the timers |
|
58 */ |
|
59 virtual void StopDrawObject(); |
|
60 |
|
61 /** |
|
62 * Start the control needed timer |
|
63 */ |
|
64 virtual void StartTimer() = 0; |
|
65 |
|
66 /** |
|
67 * Cancels the timer |
|
68 */ |
|
69 virtual void CancelTimer() = 0; |
|
70 |
|
71 /** |
|
72 * Show the control |
|
73 */ |
|
74 virtual void DrawObject(); |
|
75 |
|
76 /** |
|
77 * Clear the screen |
|
78 */ |
|
79 virtual void ClearScreen() = 0; |
|
80 |
|
81 /* |
|
82 * Refresh the display |
|
83 */ |
|
84 virtual void Refresh() = 0; |
|
85 |
|
86 /** |
|
87 * Get the screensaver view |
|
88 */ |
|
89 CScreensaverView* View() const; |
|
90 |
|
91 /** |
|
92 * Returns the Screensaver Model which is owned by AppUi |
|
93 * |
|
94 * @return CScreensaverModel |
|
95 */ |
|
96 const CScreensaverEngine& Model() const; |
|
97 |
|
98 /** |
|
99 * Returns the Indicator Array which is owned by Screensaver Model |
|
100 * |
|
101 * @return CScreensaverIndicatorArray |
|
102 */ |
|
103 CScreensaverIndicatorArray& Array() const; |
|
104 public: |
|
105 //From CCoeControl |
|
106 |
|
107 /** |
|
108 * Resource change handling |
|
109 */ |
|
110 virtual void HandleResourceChange( TInt aType ) = 0; |
|
111 |
|
112 /** |
|
113 * Responds to changes to the size and position of the contents |
|
114 * of this control. |
|
115 */ |
|
116 virtual void SizeChanged() = 0; |
|
117 |
|
118 // Power save mode related functions |
|
119 |
|
120 /** |
|
121 * Used to define the active area of display in power save mode |
|
122 * |
|
123 * @param aRect |
|
124 */ |
|
125 TInt SetPowerSaveDisplayActiveArea( TRect& aRect ); |
|
126 |
|
127 /** |
|
128 * Activates power save display mode |
|
129 * |
|
130 * @param aFullColors |
|
131 */ |
|
132 TInt ActivatePowerSaveDisplay( TBool aFullColors = EFalse ) const; |
|
133 |
|
134 public: |
|
135 // From MAknPictograpAnimatorCallback |
|
136 /** |
|
137 * This function is called when a redraw is needed for drawing |
|
138 * new frames of animated pictographs. It should |
|
139 * |
|
140 * 1) Draw or clear the background of pictographs |
|
141 * 2) If the pictographs are amongst text, draw the text |
|
142 * 3) Draw the pictographs using MAknPictographDrawer interface |
|
143 * |
|
144 * In many cases, it is sufficient to implement this simply by |
|
145 * calling CCoeControl::DrawNow for the appropriate control. |
|
146 */ |
|
147 virtual void DrawPictographArea(); |
|
148 |
|
149 protected: |
|
150 |
|
151 /** |
|
152 * Start capturing timer |
|
153 */ |
|
154 void StartCaptureScreenTimer(); |
|
155 |
|
156 /** |
|
157 * Initial the initial refresh rate |
|
158 */ |
|
159 TInt InitialRefreshRate(); |
|
160 |
|
161 /** |
|
162 * Kill the timer |
|
163 * |
|
164 * @param aTimer the timer you want stop |
|
165 */ |
|
166 void DeleteTimer( CPeriodic*& aTimer ); |
|
167 |
|
168 /** |
|
169 * for Lcd Partial mode. |
|
170 */ |
|
171 void ConstructAndConnectLCDL(); |
|
172 |
|
173 /** |
|
174 * Returns the powersave display mode |
|
175 */ |
|
176 CPowerSaveDisplayMode* LcdPartialMode() const; |
|
177 |
|
178 /** |
|
179 * If the timer expired, excute the refresh action |
|
180 */ |
|
181 static TInt HandleRefreshTimerExpiry( TAny* aPtr ); |
|
182 |
|
183 /** |
|
184 * Callback fuction. Called when the window server heartbeat tiemr time out |
|
185 */ |
|
186 static TInt HandleCaptureTimerExpiry( TAny* aPtr ); |
|
187 |
|
188 /** |
|
189 * Capture screen, and get the first pixel address of the bitmap |
|
190 */ |
|
191 TInt CaptureScreen(); |
|
192 |
|
193 protected: |
|
194 |
|
195 // Area of screen that is displayed when in power save mode |
|
196 TRect iPowerSaveDisplayActiveArea; |
|
197 |
|
198 /** |
|
199 * The capturing screen timer |
|
200 */ |
|
201 CPeriodic* iCaptureScreenTimer; |
|
202 |
|
203 |
|
204 /** |
|
205 * The pointer to the powersaver display mode |
|
206 * |
|
207 * Owned |
|
208 */ |
|
209 CPowerSaveDisplayMode* iPowerSaveDisplayMode; |
|
210 |
|
211 /** |
|
212 * store the bitmap data |
|
213 */ |
|
214 CFbsBitmap* iOffScrnBmp; |
|
215 |
|
216 }; |
|
217 |
|
218 #endif // C_SCREENSAVERBASE_H |
|
219 |