1 /* |
|
2 * Copyright (c) 2003 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: Implementation of screensaver moving text display class. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #include <e32def.h> |
|
21 #include <eikdef.h> |
|
22 #include <AknUtils.h> |
|
23 #include <e32math.h> |
|
24 #include <aknlayoutscalable_avkon.cdl.h> |
|
25 #include <screensaver.rsg> |
|
26 |
|
27 #include "screensaverappui.h" |
|
28 #include "screensavershareddatai.h" |
|
29 #include "ScreensaverUtils.h" |
|
30 #include "screensaverutility.h" |
|
31 #include "screensaverctrlmovingtext.h" |
|
32 |
|
33 const TInt KInvertedColors = 1; |
|
34 |
|
35 //The color for text and background |
|
36 const TInt KInvertedBgColor = 215; |
|
37 const TInt KInvertedTextColor = 0; |
|
38 const TInt KInvertedTextBgColor = 215; |
|
39 |
|
40 const TInt KBgColor = 0; |
|
41 const TInt KTextColor = 215; |
|
42 const TInt KTextBgColor = 210; |
|
43 |
|
44 // the minimum top value |
|
45 const TInt KMinTop = 4; |
|
46 |
|
47 const TInt KRefreshRate = 60000000; // 60 sec |
|
48 // |
|
49 // Class CScreensaverCtrlMovingText |
|
50 // |
|
51 // ----------------------------------------------------------------------------- |
|
52 // CScreensaverCtrlMovingText::NewL |
|
53 // ----------------------------------------------------------------------------- |
|
54 // |
|
55 CScreensaverCtrlMovingText* CScreensaverCtrlMovingText::NewL( TDisplayObjectType aType ) |
|
56 { |
|
57 CScreensaverCtrlMovingText* obj = new( ELeave ) CScreensaverCtrlMovingText( aType ); |
|
58 CleanupStack::PushL( obj ); |
|
59 obj->ConstructL(); |
|
60 CleanupStack::Pop(); |
|
61 return obj; |
|
62 } |
|
63 |
|
64 // ----------------------------------------------------------------------------- |
|
65 // CScreensaverCtrlMovingText::~CScreensaverCtrlMovingText |
|
66 // ----------------------------------------------------------------------------- |
|
67 // |
|
68 CScreensaverCtrlMovingText::~CScreensaverCtrlMovingText() |
|
69 { |
|
70 iEikonEnv->RemoveFromStack( this ); |
|
71 |
|
72 DeleteTimer( iBarRefreshTimer ); |
|
73 DeleteTimer( iCaptureScreenTimer ); |
|
74 } |
|
75 |
|
76 // ----------------------------------------------------------------------------- |
|
77 // CScreensaverCtrlMovingText::HandleResourceChange |
|
78 // ----------------------------------------------------------------------------- |
|
79 // |
|
80 void CScreensaverCtrlMovingText::HandleResourceChange( TInt aType ) |
|
81 { |
|
82 if ( aType == KEikDynamicLayoutVariantSwitch )//&& iType != EDisplayNone) |
|
83 { |
|
84 // Screen layout has changed - resize |
|
85 SetRect( iCoeEnv->ScreenDevice()->SizeInPixels() ); |
|
86 } |
|
87 } |
|
88 |
|
89 // ----------------------------------------------------------------------------- |
|
90 // CScreensaverCtrlMovingText::SizeChanged |
|
91 // ----------------------------------------------------------------------------- |
|
92 // |
|
93 void CScreensaverCtrlMovingText::SizeChanged() |
|
94 { |
|
95 GenerateDisplayAttributesForScreensaverBar(); |
|
96 } |
|
97 |
|
98 // ----------------------------------------------------------------------------- |
|
99 // CScreensaverCtrlMovingText::Draw |
|
100 // ----------------------------------------------------------------------------- |
|
101 // |
|
102 void CScreensaverCtrlMovingText::Draw( const TRect& aRect ) const |
|
103 { |
|
104 if ( !Model().ScreenSaverIsOn() && !Model().ScreenSaverIsPreviewing() ) |
|
105 { |
|
106 return; |
|
107 } |
|
108 SCRLOGGER_WRITEF( _L("SCR:CScreensaverCtrlMovingText::Draw, screensaver is on or previewing") ); |
|
109 // Graphics context to draw on. |
|
110 CWindowGc& gc = SystemGc(); |
|
111 |
|
112 // Fix for error ESMG-74Y4PE - S60 3.2 wk26, Power Saver: |
|
113 // Flickering when power saver is deactivated. |
|
114 // We now clear the screen with a black brush so the screensaver |
|
115 // background is changed to black. There will no longer be a white |
|
116 // intermediate screen and this will reduce the "flicker" effect. |
|
117 gc.SetBrushColor( KRgbBlack ); |
|
118 |
|
119 // Start with a clear screen |
|
120 gc.Clear( aRect ); |
|
121 // If there is no plugin module, indicator view overrides plugin module or |
|
122 // plugin drawing is suspended then the standard screensaver bar is shown, |
|
123 // let's draw it. |
|
124 |
|
125 DrawNew( gc, aRect ); |
|
126 |
|
127 // Activate power save display mode after draw, so that |
|
128 // the image is already in screen buffer |
|
129 ScreensaverUtility::FlushDrawBuffer(); |
|
130 SCRLOGGER_WRITEF( _L("SCR:CScreensaverCtrlMovingText::Draw, draw finished") ); |
|
131 } |
|
132 |
|
133 // ----------------------------------------------------------------------------- |
|
134 // CScreensaverCtrlMovingText::SetMoving |
|
135 // ----------------------------------------------------------------------------- |
|
136 // |
|
137 void CScreensaverCtrlMovingText::SetMoving( TBool aMove ) |
|
138 { |
|
139 iMoveBar = aMove; |
|
140 } |
|
141 |
|
142 // ----------------------------------------------------------------------------- |
|
143 // CScreensaverCtrlMovingText::StartTimer |
|
144 // ----------------------------------------------------------------------------- |
|
145 // |
|
146 void CScreensaverCtrlMovingText::StartTimer() |
|
147 { |
|
148 SCRLOGGER_WRITEF( _L("SCR:CScreensaverCtrlMovingText::StartTimer start") ); |
|
149 StartCaptureScreenTimer(); |
|
150 |
|
151 StartBarRefreshTimer(); |
|
152 SCRLOGGER_WRITEF( _L("SCR:CScreensaverCtrlMovingText::StartTimer finish") ); |
|
153 } |
|
154 |
|
155 // ----------------------------------------------------------------------------- |
|
156 // CScreensaverCtrlMovingText::CancelTimer |
|
157 // ----------------------------------------------------------------------------- |
|
158 // |
|
159 void CScreensaverCtrlMovingText::CancelTimer() |
|
160 { |
|
161 DeleteTimer( iBarRefreshTimer ); |
|
162 DeleteTimer( iCaptureScreenTimer ); |
|
163 } |
|
164 |
|
165 // ----------------------------------------------------------------------------- |
|
166 // CScreensaverCtrlMovingText::ClearScreen |
|
167 // Date & time saver |
|
168 // ----------------------------------------------------------------------------- |
|
169 // |
|
170 void CScreensaverCtrlMovingText::ClearScreen() |
|
171 { |
|
172 |
|
173 } |
|
174 |
|
175 // ----------------------------------------------------------------------------- |
|
176 // CScreensaverCtrlMovingText::Refresh |
|
177 // ----------------------------------------------------------------------------- |
|
178 // |
|
179 void CScreensaverCtrlMovingText::Refresh() |
|
180 { |
|
181 SCRLOGGER_WRITEF( _L("SCR:CScreensaverCtrlMovingText::Refresh start") ); |
|
182 // Currently only keylock indicator is updated, because |
|
183 // thats the only indicator whose state may change while screensaver |
|
184 // is displaying. Other indicators' state changing also dismisses |
|
185 // screensaver. Once redisplaying, the indicators are updated anyway. |
|
186 // Key lock indicator depends on status of key guard. |
|
187 Array().SetDependencyStatus( ESsKeyLockInd, !Model().SharedDataInterface()->IsKeyguardOn() ); |
|
188 SCRLOGGER_WRITEF( _L("SCR:CScreensaverCtrlMovingText::Refresh move") ); |
|
189 // Don't move bar during this refresh |
|
190 SetMoving( EFalse ); |
|
191 SCRLOGGER_WRITEF( _L("SCR:CScreensaverCtrlMovingText::Refresh DrawObject") ); |
|
192 // Cause a redraw |
|
193 DrawObject(); |
|
194 SCRLOGGER_WRITEF( _L("SCR:CScreensaverCtrlMovingText::Refresh move") ); |
|
195 // Allow moving |
|
196 SetMoving(); |
|
197 SCRLOGGER_WRITEF( _L("SCR:CScreensaverCtrlMovingText::Refresh finish") ); |
|
198 } |
|
199 |
|
200 // ----------------------------------------------------------------------------- |
|
201 // CScreensaverCtrlMovingText::CScreensaverCtrlMovingText |
|
202 // Date & time saver |
|
203 // ----------------------------------------------------------------------------- |
|
204 // |
|
205 CScreensaverCtrlMovingText::CScreensaverCtrlMovingText( TDisplayObjectType aType ) |
|
206 :iType( aType ) |
|
207 { |
|
208 // No implementation required |
|
209 } |
|
210 |
|
211 // ----------------------------------------------------------------------------- |
|
212 // CScreensaverCtrlMovingText::ConstructL |
|
213 // ----------------------------------------------------------------------------- |
|
214 // |
|
215 void CScreensaverCtrlMovingText::ConstructL() |
|
216 { |
|
217 SCRLOGGER_WRITEF( _L("SCR:CScreensaverCtrlMovingText::ConstructL start") ); |
|
218 |
|
219 if ( iType == EDisplayText ) |
|
220 { |
|
221 iPictoI = CAknPictographInterface::NewL( *this, *this ); |
|
222 } |
|
223 |
|
224 iTop = KMinTop; |
|
225 iRandSeed = RandomSeed(); |
|
226 iMoveBar = ETrue; |
|
227 |
|
228 GetTextAndBgColor(); |
|
229 |
|
230 CreateWindowL(); |
|
231 |
|
232 // Cannot do this earlier - it'll cause a SizeChanged() |
|
233 SetRect( iCoeEnv->ScreenDevice()->SizeInPixels() ); |
|
234 |
|
235 iEikonEnv->EikAppUi()->AddToStackL( |
|
236 this, ECoeStackPriorityEnvironmentFilter, ECoeStackFlagRefusesFocus ); |
|
237 ConstructAndConnectLCDL(); |
|
238 ActivateL(); |
|
239 } |
|
240 |
|
241 // ----------------------------------------------------------------------------- |
|
242 // CScreensaverCtrlMovingText::DrawNew |
|
243 // ----------------------------------------------------------------------------- |
|
244 // |
|
245 void CScreensaverCtrlMovingText::DrawNew( CWindowGc& aGc, const TRect& /* aRect */) const |
|
246 { |
|
247 SCRLOGGER_WRITEF( _L("SCR:CScreensaverCtrlMovingText::DrawNew start") ); |
|
248 // Draw bar background |
|
249 iLayoutBar.DrawRect( aGc ); |
|
250 |
|
251 // Draw clock |
|
252 iLayoutClock.DrawRect( aGc ); |
|
253 iLayoutClockText.DrawText( aGc, iTextTime ); |
|
254 |
|
255 // Draw date / user text |
|
256 iLayoutDate.DrawRect( aGc ); |
|
257 |
|
258 DrawText( aGc ); |
|
259 |
|
260 // Draw indicators |
|
261 Array().Draw( aGc ); |
|
262 } |
|
263 |
|
264 // ----------------------------------------------------------------------------- |
|
265 // CScreensaverCtrlMovingText::DrawPictoText |
|
266 // Draws text with pictographs |
|
267 // ----------------------------------------------------------------------------- |
|
268 // |
|
269 void CScreensaverCtrlMovingText::DrawPictoText( CWindowGc &aGc ) const |
|
270 { |
|
271 SCRLOGGER_WRITEF( _L("SCR:CScreensaverCtrlMovingText::DrawPictoText start") ); |
|
272 // Draw text and possible pictographs |
|
273 MAknPictographDrawer* pictoDrawer = iPictoI->Interface(); |
|
274 ASSERT( pictoDrawer ); |
|
275 |
|
276 if ( ( !pictoDrawer ) || ( !pictoDrawer->ContainsPictographs( iText ) ) ) |
|
277 { |
|
278 // Just draw normally |
|
279 iLayoutDateText.DrawText( aGc, iText ); |
|
280 return; |
|
281 } |
|
282 |
|
283 // Else draw normal text with pictographs |
|
284 aGc.UseFont( iLayoutDateText.Font() ); |
|
285 aGc.SetPenColor( iLayoutDateText.Color() ); |
|
286 |
|
287 // Calculating the offset (unfortunately not public in TAknLayoutText) |
|
288 // copied from AknUtils TAknLayoutText::LayoutText() |
|
289 pictoDrawer->DrawText( aGc, *iLayoutDateText.Font(), iText, |
|
290 iLayoutDateText.TextRect(), iLayoutDateText.Font()->AscentInPixels(), |
|
291 iLayoutDateText.Align() ); |
|
292 } |
|
293 |
|
294 // ----------------------------------------------------------------------------- |
|
295 // CScreensaverCtrlMovingText::DrawText |
|
296 // ----------------------------------------------------------------------------- |
|
297 // |
|
298 void CScreensaverCtrlMovingText::DrawText( CWindowGc& aGc ) const |
|
299 { |
|
300 SCRLOGGER_WRITEF( _L("SCR:CScreensaverCtrlMovingText::DrawText start") ); |
|
301 if ( iPictoI ) |
|
302 { |
|
303 // Draw text and pictographs in the layout |
|
304 DrawPictoText( aGc ); |
|
305 } |
|
306 else |
|
307 { |
|
308 // Draw just text |
|
309 iLayoutDateText.DrawText( aGc, iText ); |
|
310 } |
|
311 } |
|
312 |
|
313 // ----------------------------------------------------------------------------- |
|
314 // CScreensaverCtrlMovingText::UpdateCurrentTimeL |
|
315 // ----------------------------------------------------------------------------- |
|
316 // |
|
317 void CScreensaverCtrlMovingText::UpdateCurrentTimeL() |
|
318 { |
|
319 SCRLOGGER_WRITEF( _L("SCR:CScreensaverCtrlMovingText::UpdateCurrentTimeL start") ); |
|
320 // AVKON does not have proper format string for just time, |
|
321 // load from own resources |
|
322 FormatTextFromResourceL( iTextTime, R_SCREENSAVER_TIME_USUAL_WITHOUT_AMPM ); |
|
323 |
|
324 if ( iType == EDisplayTime ) |
|
325 { |
|
326 FormatTextFromResourceL( iText, R_QTN_DATE_USUAL_WITH_ZERO ); |
|
327 } |
|
328 else |
|
329 { |
|
330 Model().SharedDataInterface()->GetDisplayObjectText( iText ); |
|
331 } |
|
332 |
|
333 SetAmPmIndicatorPayloadL(); |
|
334 // Convert numbers according to language |
|
335 } |
|
336 |
|
337 // ----------------------------------------------------------------------------- |
|
338 // CScreensaverCtrlMovingText::GenerateDisplayAttributesForScreensaverBar |
|
339 // ----------------------------------------------------------------------------- |
|
340 // |
|
341 void CScreensaverCtrlMovingText::GenerateDisplayAttributesForScreensaverBar( ) |
|
342 { |
|
343 SCRLOGGER_WRITEF( _L("SCR:CScreensaverCtrlMovingText::GenerateDisplayAttributesForScreensaverBar start") ); |
|
344 // Zero out power save area, it should then be set before power save |
|
345 // mode can be activated (also by plugins) |
|
346 iPowerSaveDisplayActiveArea.SetRect( 0, 0, 0, 0 ); |
|
347 |
|
348 // Cool! We got scalable layouts. Use them. |
|
349 TAknWindowComponentLayout barLayoutComponent = |
|
350 AknLayoutScalable_Avkon::power_save_pane(); |
|
351 iLayoutBar.LayoutRect( Rect(), barLayoutComponent.LayoutLine() ); |
|
352 |
|
353 // Add bar height from layout to get total bar height |
|
354 TInt barHeight = iLayoutBar.Rect().Height(); |
|
355 |
|
356 // Plain refresh, no move? |
|
357 if ( iMoveBar ) |
|
358 { |
|
359 // Get random values for bar position and color. |
|
360 GetRandomTopValue( iLayoutBar.Rect().Height() ); |
|
361 } |
|
362 |
|
363 // Create a rect with the new top to be used as layout rect |
|
364 TRect fakeScreen( Rect() ); |
|
365 fakeScreen.iTl.iY = iTop; |
|
366 |
|
367 // Layout components |
|
368 |
|
369 // Bar itself |
|
370 iLayoutBar.LayoutRect( fakeScreen, barLayoutComponent.LayoutLine() ); |
|
371 TRect barRect = iLayoutBar.Rect(); |
|
372 |
|
373 // Clock (area + text) |
|
374 GetClockLayout( barRect ); |
|
375 |
|
376 // Date (area + text) |
|
377 GetDateLayout( barRect ); |
|
378 |
|
379 // Indicators (area + text) |
|
380 GetIndicatorAreaLayout( barRect ); |
|
381 |
|
382 // Update current time |
|
383 TRAP_IGNORE( UpdateCurrentTimeL() ); |
|
384 |
|
385 // Since it is known for sure at this point that screensaver |
|
386 // bar will be drawn the partial mode can activated for bar area |
|
387 // if it is supported by display hardware. |
|
388 const TScreensaverColorModel& colorModel = Model().GetColorModel(); |
|
389 |
|
390 if ( colorModel.iNumberOfPartialModes > 0 ) |
|
391 { |
|
392 TRect psRect( iLayoutBar.Rect() ); |
|
393 SetPowerSaveDisplayActiveArea( psRect ); |
|
394 } |
|
395 } |
|
396 |
|
397 // ----------------------------------------------------------------------------- |
|
398 // CScreensaverCtrlMovingText::GetRandomTopValue |
|
399 // ----------------------------------------------------------------------------- |
|
400 // |
|
401 void CScreensaverCtrlMovingText::GetRandomTopValue( TInt aBarHight ) |
|
402 { |
|
403 SCRLOGGER_WRITEF( _L("SCR:CScreensaverCtrlMovingText::GetRandomTopValue start") ); |
|
404 TInt range( iCoeEnv->ScreenDevice()->SizeInPixels().iHeight - aBarHight - 1 - 4 ); |
|
405 TInt rand = Math::Rand( iRandSeed ); |
|
406 rand %= range; |
|
407 iTop = ( rand > 3 ) ? ( rand/4 ) * 4 : 4; |
|
408 } |
|
409 |
|
410 // ----------------------------------------------------------------------------- |
|
411 // CScreensaverCtrlMovingText::RandomValue |
|
412 // ----------------------------------------------------------------------------- |
|
413 // |
|
414 TInt CScreensaverCtrlMovingText::RandomSeed() |
|
415 { |
|
416 SCRLOGGER_WRITEF( _L("SCR:CScreensaverCtrlMovingText::RandomSeed start") ); |
|
417 TTime time; |
|
418 time.HomeTime(); |
|
419 return time.DateTime().MicroSecond(); |
|
420 } |
|
421 |
|
422 // ----------------------------------------------------------------------------- |
|
423 // CScreensaverCtrlMovingText::GetTextAndBgColor |
|
424 // ----------------------------------------------------------------------------- |
|
425 // |
|
426 void CScreensaverCtrlMovingText::GetTextAndBgColor() |
|
427 { |
|
428 SCRLOGGER_WRITEF( _L("SCR:CScreensaverCtrlMovingText::GetTextAndBgColor start") ); |
|
429 if( Model().SharedDataInterface()->IsInvertedColors() == KInvertedColors ) |
|
430 { |
|
431 iBgColor = KInvertedBgColor; |
|
432 iTextColor = KInvertedTextColor; |
|
433 iTextBgColor = KInvertedTextBgColor; |
|
434 } |
|
435 else |
|
436 { |
|
437 iBgColor = KBgColor; |
|
438 iTextColor = KTextColor; |
|
439 iTextBgColor = KTextBgColor; |
|
440 } |
|
441 } |
|
442 |
|
443 // ----------------------------------------------------------------------------- |
|
444 // CScreensaverCtrlMovingText::FormatTextL |
|
445 // ----------------------------------------------------------------------------- |
|
446 // |
|
447 void CScreensaverCtrlMovingText::FormatTextL( TDes& aText, const TDesC& aFormat ) |
|
448 { |
|
449 SCRLOGGER_WRITEF( _L("SCR:CScreensaverCtrlMovingText::FormatTextL start") ); |
|
450 TTime curTime; |
|
451 curTime.HomeTime(); |
|
452 // Since screensaver is updated on the minute, make sure it displays |
|
453 // the time of the passing minute by adding a few seconds to the |
|
454 // time at the moment of the update. |
|
455 curTime += TTimeIntervalSeconds( 5 ); |
|
456 |
|
457 TRAPD( err, curTime.FormatL( aText, aFormat ) ); |
|
458 if ( err != KErrNone ) |
|
459 { |
|
460 // If time can't be displayed then display an empty text |
|
461 aText = KNullDesC; |
|
462 } |
|
463 } |
|
464 |
|
465 // ----------------------------------------------------------------------------- |
|
466 // CScreensaverCtrlMovingText::SetAmPmIndicatorPayload |
|
467 // ----------------------------------------------------------------------------- |
|
468 // |
|
469 void CScreensaverCtrlMovingText::SetAmPmIndicatorPayloadL() |
|
470 { |
|
471 SCRLOGGER_WRITEF( _L("SCR:CScreensaverCtrlMovingText::SetAmPmIndicatorPayloadL start") ); |
|
472 _LIT(KAmPmFormat, "%*A"); |
|
473 TBuf<10> textAmPm; |
|
474 FormatTextL( textAmPm, KAmPmFormat ); |
|
475 |
|
476 TIndicatorPayload payload; |
|
477 payload.iType = EPayloadTypeText; |
|
478 payload.iText.Zero(); |
|
479 payload.iText.Append( textAmPm ); |
|
480 Array().SetIndicatorPayload( ESsAmPmInd, payload ); |
|
481 } |
|
482 |
|
483 // ----------------------------------------------------------------------------- |
|
484 // CScreensaverCtrlMovingText::FormatTextFromResourceL |
|
485 // ----------------------------------------------------------------------------- |
|
486 // |
|
487 void CScreensaverCtrlMovingText::FormatTextFromResourceL( TDes &aText, TInt aResourceId ) |
|
488 { |
|
489 SCRLOGGER_WRITEF( _L("SCR:CScreensaverCtrlMovingText::FormatTextFromResourceL start") ); |
|
490 TBuf<30> timeFormat; |
|
491 iCoeEnv->ReadResourceL( timeFormat, aResourceId ); |
|
492 FormatTextL( aText, timeFormat ); |
|
493 AknTextUtils::DisplayTextLanguageSpecificNumberConversion( aText ); |
|
494 } |
|
495 |
|
496 // ----------------------------------------------------------------------------- |
|
497 // CScreensaverCtrlMovingText::GetClockLayout |
|
498 // ----------------------------------------------------------------------------- |
|
499 // |
|
500 void CScreensaverCtrlMovingText::GetClockLayout( const TRect& aRect ) |
|
501 { |
|
502 SCRLOGGER_WRITEF( _L("SCR:CScreensaverCtrlMovingText::GetClockLayout start") ); |
|
503 TAknWindowComponentLayout clockarea = |
|
504 AknLayoutScalable_Avkon::aid_ps_clock_pane( 0 ); |
|
505 TAknWindowLineLayout clockline = clockarea.LayoutLine(); |
|
506 clockline.iC = iBgColor; |
|
507 iLayoutClock.LayoutRect( aRect, clockarea.LayoutLine() ); |
|
508 |
|
509 TAknTextComponentLayout clocktext = |
|
510 AknLayoutScalable_Avkon::power_save_t2( 0 ); |
|
511 clocktext.SetC( iTextColor ); |
|
512 iLayoutClockText.LayoutText( aRect, clocktext.LayoutLine() ); |
|
513 } |
|
514 |
|
515 // ----------------------------------------------------------------------------- |
|
516 // CScreensaverCtrlMovingText::GetClockLayout |
|
517 // ----------------------------------------------------------------------------- |
|
518 // |
|
519 void CScreensaverCtrlMovingText::GetDateLayout( const TRect& aRect ) |
|
520 { |
|
521 SCRLOGGER_WRITEF( _L("SCR:CScreensaverCtrlMovingText::GetDateLayout start") ); |
|
522 TAknWindowComponentLayout datearea = |
|
523 AknLayoutScalable_Avkon::power_save_pane_g1( 0 ); |
|
524 TAknWindowLineLayout dateline = datearea.LayoutLine(); |
|
525 dateline.iC = iTextBgColor; |
|
526 iLayoutDate.LayoutRect( aRect, dateline ); |
|
527 |
|
528 TAknTextComponentLayout datetext = |
|
529 AknLayoutScalable_Avkon::power_save_pane_t1( 0 ); |
|
530 TAknTextLineLayout datetextline = datetext.LayoutLine(); |
|
531 iLayoutDateText.LayoutText( aRect, datetextline ); |
|
532 } |
|
533 |
|
534 // ----------------------------------------------------------------------------- |
|
535 // CScreensaverCtrlMovingText::GetClockLayout |
|
536 // ----------------------------------------------------------------------------- |
|
537 // |
|
538 void CScreensaverCtrlMovingText::GetIndicatorAreaLayout( const TRect& aRect ) |
|
539 { |
|
540 SCRLOGGER_WRITEF( _L("SCR:CScreensaverCtrlMovingText::GetIndicatorAreaLayout start") ); |
|
541 TAknWindowComponentLayout indicatorarea = |
|
542 AknLayoutScalable_Avkon::aid_ps_indicator_pane( 0 ); |
|
543 TAknWindowLineLayout indicatorline = indicatorarea.LayoutLine(); |
|
544 indicatorline.iC = iBgColor; |
|
545 TAknLayoutRect layoutIndicatorArea; |
|
546 layoutIndicatorArea.LayoutRect( aRect, indicatorline ); |
|
547 |
|
548 // Indicator texts |
|
549 TAknTextComponentLayout indtext = |
|
550 AknLayoutScalable_Avkon::power_save_pane_t4( 0 ); |
|
551 TAknTextLineLayout indline = indtext.LayoutLine(); |
|
552 TAknLayoutText layoutIndicatorText; |
|
553 layoutIndicatorText.LayoutText( aRect, indline ); |
|
554 |
|
555 // Indicator icons |
|
556 TAknWindowComponentLayout inds = |
|
557 AknLayoutScalable_Avkon::indicator_ps_pane( 0 ); |
|
558 TAknWindowLineLayout indsline = inds.LayoutLine(); |
|
559 TAknLayoutRect layoutInds; |
|
560 layoutInds.LayoutRect( aRect, indsline ); |
|
561 |
|
562 // Tell indicator array where to draw (this should be moved to |
|
563 // the array itself) |
|
564 Array().Setup( layoutIndicatorArea, layoutIndicatorText, layoutInds ); |
|
565 } |
|
566 |
|
567 // ----------------------------------------------------------------------------- |
|
568 // CScreensaverCtrlMovingText::StartBarRefreshTimer |
|
569 // ----------------------------------------------------------------------------- |
|
570 // |
|
571 void CScreensaverCtrlMovingText::StartBarRefreshTimer() |
|
572 { |
|
573 SCRLOGGER_WRITEF( _L("SCR:CScreensaverCtrlMovingText::StartBarRefreshTimer start") ); |
|
574 DeleteTimer( iBarRefreshTimer ); |
|
575 |
|
576 TRAP_IGNORE( iBarRefreshTimer = CPeriodic::NewL( CActive::EPriorityStandard ) ); |
|
577 |
|
578 TInt initialRefreshRate = InitialRefreshRate(); |
|
579 |
|
580 iBarRefreshTimer->Start( initialRefreshRate, KRefreshRate, TCallBack( |
|
581 HandleRefreshTimerExpiry, this ) ); |
|
582 |
|
583 SCRLOGGER_WRITEF( _L("SCR: BarRefreshTimer->Start(%d, %d, HandleRefreshTimerExpiry)"), |
|
584 initialRefreshRate, KRefreshRate ); |
|
585 } |
|
586 |
|
587 // End of file. |
|