|
1 /* |
|
2 * Copyright (c) 2002-2008 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: Control for status pane's signal pane. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 // INCLUDE FILES |
|
20 #include <AknSignal.h> |
|
21 #include <barsread.h> |
|
22 #include <eikspane.h> |
|
23 #include <avkon.mbg> |
|
24 #include <AknsDrawUtils.h> |
|
25 #include <AknsUtils.h> |
|
26 #include <AknIconUtils.h> |
|
27 #include <AknUtils.h> |
|
28 #include <aknconsts.h> |
|
29 #include <aknenv.h> |
|
30 #include <AknStatuspaneUtils.h> |
|
31 #include <aknlayoutscalable_avkon.cdl.h> |
|
32 #include <AknDef.h> |
|
33 |
|
34 #include <AknTasHook.h> |
|
35 #include "AknSignalIcon.h" |
|
36 #include "AknSignalStrength.h" |
|
37 #include "aknsignaldataobserver.h" |
|
38 |
|
39 /** Frame delay for signal state animations. */ |
|
40 const TInt KAknIndicatorAnimationDelay = 500000; // microseconds |
|
41 |
|
42 /** Frame interval for signal state animations. */ |
|
43 const TInt KAknIndicatorAnimationInterval = 500000; // microseconds |
|
44 |
|
45 |
|
46 /** Number of bitmap frames for CDMA animations. */ |
|
47 const TInt KAknCdmaAnimationFrames = 14; |
|
48 |
|
49 // Flags for Signal Pane |
|
50 enum TSignalPaneControlFlags |
|
51 { |
|
52 EAknSignalPaneButton1DownInSignalRect = 0x00000001 |
|
53 }; |
|
54 |
|
55 |
|
56 class CAknSignalPaneExtension: public CBase |
|
57 { |
|
58 public: |
|
59 |
|
60 CAknSignalPaneExtension(); |
|
61 ~CAknSignalPaneExtension(); |
|
62 |
|
63 public: // new methods |
|
64 |
|
65 TBool CdmaSignalIconInUse(); |
|
66 CFbsBitmap* CdmaSignalIcon(); |
|
67 void CdmaSignalAnimate(); |
|
68 |
|
69 public: |
|
70 |
|
71 // General signal indicators |
|
72 TAny* iSpare1; // was iSignalIcon |
|
73 TAny* iSpare2; // was iSignalIconMask |
|
74 |
|
75 // CDMA Signal indicators |
|
76 TInt iCdmaAnimationIndex; |
|
77 TInt iCdmaSignalState; |
|
78 CFbsBitmap* iCdmaReceiveIcons[KAknCdmaAnimationFrames]; // animation frames |
|
79 CFbsBitmap* iCdmaReceiveMasks[KAknCdmaAnimationFrames]; // animation frame masks (needed because of AknIconUtils) |
|
80 CFbsBitmap* iCdmaSendIcons[KAknCdmaAnimationFrames]; // animation frames |
|
81 CFbsBitmap* iCdmaSendMasks[KAknCdmaAnimationFrames]; // animation frame masks (needed because of AknIconUtils) |
|
82 CFbsBitmap* iCdmaStaticIcons[5]; // non-animated icons |
|
83 CFbsBitmap* iCdmaStaticMasks[5]; // non-animated masks (needed because of AknIconUtils) |
|
84 |
|
85 TBool iIsActiveIdle; |
|
86 }; |
|
87 |
|
88 |
|
89 // --------------------------------------------------------------------------- |
|
90 // CAknSignalPaneExtension::CAknSignalPaneExtension |
|
91 // Default constructor. |
|
92 // --------------------------------------------------------------------------- |
|
93 // |
|
94 CAknSignalPaneExtension::CAknSignalPaneExtension() |
|
95 { |
|
96 } |
|
97 |
|
98 |
|
99 // --------------------------------------------------------------------------- |
|
100 // CAknSignalPaneExtension::~CAknSignalPaneExtension |
|
101 // Destructor |
|
102 // --------------------------------------------------------------------------- |
|
103 // |
|
104 CAknSignalPaneExtension::~CAknSignalPaneExtension() |
|
105 { |
|
106 } |
|
107 |
|
108 |
|
109 // --------------------------------------------------------------------------- |
|
110 // CAknSignalPaneExtension::CdmaSignalIconInUse |
|
111 // Determine if any CDMA indicator is being used. |
|
112 // --------------------------------------------------------------------------- |
|
113 // |
|
114 TBool CAknSignalPaneExtension::CdmaSignalIconInUse() |
|
115 { |
|
116 if ( iCdmaSignalState != EAknSignalCdmaIndicatorOff ) |
|
117 { |
|
118 return ETrue; |
|
119 } |
|
120 return EFalse; |
|
121 } |
|
122 |
|
123 |
|
124 // --------------------------------------------------------------------------- |
|
125 // CAknSignalPaneExtension::CdmaSignalIcon |
|
126 // Get the current CDMA icon to be displayed. |
|
127 // --------------------------------------------------------------------------- |
|
128 // |
|
129 CFbsBitmap* CAknSignalPaneExtension::CdmaSignalIcon() |
|
130 { |
|
131 if ( iCdmaSignalState == EAknSignalCdmaIndicatorReceiving ) |
|
132 { |
|
133 return iCdmaReceiveMasks[iCdmaAnimationIndex]; |
|
134 } |
|
135 else if ( iCdmaSignalState == EAknSignalCdmaIndicatorSending ) |
|
136 { |
|
137 return iCdmaSendMasks[iCdmaAnimationIndex]; |
|
138 } |
|
139 else |
|
140 { |
|
141 return iCdmaStaticMasks[iCdmaSignalState - EAknSignalCdmaIndicatorNoService]; |
|
142 } |
|
143 } |
|
144 |
|
145 |
|
146 // --------------------------------------------------------------------------- |
|
147 // CAknSignalPaneExtension::CdmaSignalAnimate |
|
148 // Adjusts the animation of the CDMA signal icon. |
|
149 // --------------------------------------------------------------------------- |
|
150 // |
|
151 void CAknSignalPaneExtension::CdmaSignalAnimate() |
|
152 { |
|
153 iCdmaAnimationIndex++; |
|
154 if ( iCdmaAnimationIndex >= KAknCdmaAnimationFrames ) |
|
155 { |
|
156 iCdmaAnimationIndex = 0; |
|
157 } |
|
158 } |
|
159 |
|
160 |
|
161 // --------------------------------------------------------------------------- |
|
162 // CAknSignalPane::CAknSignalPane |
|
163 // Default contructor. |
|
164 // --------------------------------------------------------------------------- |
|
165 // |
|
166 EXPORT_C CAknSignalPane::CAknSignalPane() |
|
167 { |
|
168 AKNTASHOOK_ADD( this, "CAknSignalPane" ); |
|
169 } |
|
170 |
|
171 |
|
172 // --------------------------------------------------------------------------- |
|
173 // CAknSignalPane::~CAknSignalPane |
|
174 // Destructor |
|
175 // --------------------------------------------------------------------------- |
|
176 // |
|
177 EXPORT_C CAknSignalPane::~CAknSignalPane() |
|
178 { |
|
179 AKNTASHOOK_REMOVE(); |
|
180 AknsUtils::DeregisterControlPosition( this ); |
|
181 |
|
182 delete iDataObserver; |
|
183 delete iTicker; |
|
184 for ( TInt ll = 0; ll < KAknCdmaAnimationFrames; ll++ ) |
|
185 { |
|
186 delete iExtension->iCdmaReceiveIcons[ll]; |
|
187 delete iExtension->iCdmaReceiveMasks[ll]; |
|
188 } |
|
189 |
|
190 for ( TInt mm = 0; mm < KAknCdmaAnimationFrames; mm++ ) |
|
191 { |
|
192 delete iExtension->iCdmaSendIcons[mm]; |
|
193 delete iExtension->iCdmaSendMasks[mm]; |
|
194 } |
|
195 |
|
196 for ( TInt nn = 0; nn < 5; nn++ ) |
|
197 { |
|
198 delete iExtension->iCdmaStaticIcons[nn]; |
|
199 delete iExtension->iCdmaStaticMasks[nn]; |
|
200 } |
|
201 delete iSignalIconControl; |
|
202 delete iSignalStrengthControl; |
|
203 |
|
204 delete iExtension; |
|
205 } |
|
206 |
|
207 |
|
208 // --------------------------------------------------------------------------- |
|
209 // CAknSignalPane::ConstructL |
|
210 // Second-phase constructor. |
|
211 // --------------------------------------------------------------------------- |
|
212 // |
|
213 EXPORT_C void CAknSignalPane::ConstructL() |
|
214 { |
|
215 iExtension = new (ELeave) CAknSignalPaneExtension(); |
|
216 |
|
217 MAknsSkinInstance* skin = AknsUtils::SkinInstance(); |
|
218 |
|
219 #ifdef __PROTOCOL_CDMA |
|
220 // Create CDMA indicator icons |
|
221 for ( TInt mm = 0; mm < KAknCdmaAnimationFrames; mm++ ) |
|
222 { |
|
223 AknIconUtils::CreateIconL( |
|
224 iExtension->iCdmaReceiveIcons[mm], |
|
225 iExtension->iCdmaReceiveMasks[mm], |
|
226 AknIconUtils::AvkonIconFileName(), |
|
227 EMbmAvkonQgn_indi_signal_receiving_cdma_01 + mm, |
|
228 EMbmAvkonQgn_indi_signal_receiving_cdma_01 + mm ); |
|
229 |
|
230 AknIconUtils::CreateIconL( |
|
231 iExtension->iCdmaSendIcons[mm], |
|
232 iExtension->iCdmaSendMasks[mm], |
|
233 AknIconUtils::AvkonIconFileName(), |
|
234 EMbmAvkonQgn_indi_signal_sending_cdma_01 + mm, |
|
235 EMbmAvkonQgn_indi_signal_sending_cdma_01 + mm ); |
|
236 } |
|
237 |
|
238 // No service |
|
239 AknsUtils::CreateColorIconL( |
|
240 skin, |
|
241 KAknsIIDQgnIndiSignalNoService, |
|
242 iExtension->iCdmaStaticIcons[0], |
|
243 iExtension->iCdmaStaticMasks[0], |
|
244 AknIconUtils::AvkonIconFileName(), |
|
245 EMbmAvkonQgn_indi_signal_no_service, |
|
246 EMbmAvkonQgn_indi_signal_no_service ); |
|
247 |
|
248 // Packet data available, uses standard signal icon |
|
249 AknsUtils::CreateColorIconL( |
|
250 skin, |
|
251 KAknsIIDQgnPropSignalIcon, |
|
252 iExtension->iCdmaStaticIcons[1], |
|
253 iExtension->iCdmaStaticMasks[1], |
|
254 AknIconUtils::AvkonIconFileName(), |
|
255 EMbmAvkonQgn_prop_signal_icon, |
|
256 EMbmAvkonQgn_prop_signal_icon ); |
|
257 |
|
258 // Packet data unavailable |
|
259 AknsUtils::CreateColorIconL( |
|
260 skin, |
|
261 KAknsIIDQgnIndiSignalNotAvailCdma, |
|
262 iExtension->iCdmaStaticIcons[2], |
|
263 iExtension->iCdmaStaticMasks[2], |
|
264 AknIconUtils::AvkonIconFileName(), |
|
265 EMbmAvkonQgn_indi_signal_not_avail_cdma, |
|
266 EMbmAvkonQgn_indi_signal_not_avail_cdma ); |
|
267 |
|
268 // Packet data active |
|
269 AknsUtils::CreateColorIconL( |
|
270 skin, |
|
271 KAknsIIDQgnIndiSignalActiveCdma, |
|
272 iExtension->iCdmaStaticIcons[3], |
|
273 iExtension->iCdmaStaticMasks[3], |
|
274 AknIconUtils::AvkonIconFileName(), |
|
275 EMbmAvkonQgn_indi_signal_active_cdma, |
|
276 EMbmAvkonQgn_indi_signal_active_cdma ); |
|
277 |
|
278 // Packet data dormant |
|
279 AknsUtils::CreateColorIconL( |
|
280 skin, |
|
281 KAknsIIDQgnIndiSignalDormantCdma, |
|
282 iExtension->iCdmaStaticIcons[4], |
|
283 iExtension->iCdmaStaticMasks[4], |
|
284 AknIconUtils::AvkonIconFileName(), |
|
285 EMbmAvkonQgn_indi_signal_dormant_cdma, |
|
286 EMbmAvkonQgn_indi_signal_dormant_cdma ); |
|
287 #endif // __PROTOCOL_CDMA |
|
288 |
|
289 // off by default |
|
290 iExtension->iCdmaSignalState = EAknSignalCdmaIndicatorOff; |
|
291 iExtension->iCdmaAnimationIndex = 0; |
|
292 iExtension->iIsActiveIdle = AknStatuspaneUtils::IsActiveIdle(); |
|
293 |
|
294 iSignalIconControl = CAknSignalIcon::NewL(); |
|
295 iSignalIconControl->SetDrawBlank( EFalse ); |
|
296 |
|
297 // Load default icon |
|
298 LoadSignalIconL( 0, 0 ); |
|
299 |
|
300 iSignalStrengthControl = CAknSignalStrength::NewL(); |
|
301 |
|
302 iSignalIconControl->SetContainerWindowL( *this ); |
|
303 iSignalStrengthControl->SetContainerWindowL( *this ); |
|
304 |
|
305 iTicker = CPeriodic::NewL( CActive::EPriorityLow ); |
|
306 |
|
307 // Set flags to default values |
|
308 iPrivateFlags = 0; |
|
309 |
|
310 iDataObserver = new (ELeave) CAknSignalDataObserver( this ); |
|
311 } |
|
312 |
|
313 |
|
314 // --------------------------------------------------------------------------- |
|
315 // CAknSignalPane::ConstructFromResourceL |
|
316 // Resource constructor. |
|
317 // --------------------------------------------------------------------------- |
|
318 // |
|
319 EXPORT_C void CAknSignalPane::ConstructFromResourceL( |
|
320 TResourceReader& aReader ) |
|
321 { |
|
322 ConstructL(); |
|
323 SetSignalLevel( aReader.ReadInt16() ); // Initial signal level. |
|
324 } |
|
325 |
|
326 |
|
327 // --------------------------------------------------------------------------- |
|
328 // CAknSignalPane::SetSignalLevel |
|
329 // Sets the signal level. |
|
330 // --------------------------------------------------------------------------- |
|
331 // |
|
332 EXPORT_C void CAknSignalPane::SetSignalLevel( TInt aLevel ) |
|
333 { |
|
334 if ( aLevel == KAknSignalOffLineMode ) |
|
335 { |
|
336 iSignalIconControl->SetOffLine( ETrue ); |
|
337 } |
|
338 else |
|
339 { |
|
340 iSignalIconControl->SetOffLine( EFalse ); |
|
341 } |
|
342 |
|
343 iSignalStrengthControl->SetSignalLevel( aLevel ); |
|
344 } |
|
345 |
|
346 |
|
347 // --------------------------------------------------------------------------- |
|
348 // CAknSignalPane::SignalLevel |
|
349 // Returns the current signal level. |
|
350 // --------------------------------------------------------------------------- |
|
351 // |
|
352 TInt CAknSignalPane::SignalLevel() |
|
353 { |
|
354 if ( iSignalStrengthControl ) |
|
355 { |
|
356 return iSignalStrengthControl->SignalLevel(); |
|
357 } |
|
358 else |
|
359 { |
|
360 return 0; |
|
361 } |
|
362 } |
|
363 |
|
364 |
|
365 // --------------------------------------------------------------------------- |
|
366 // CAknSignalPane::SignalState |
|
367 // Returns the current signal state. |
|
368 // --------------------------------------------------------------------------- |
|
369 // |
|
370 TInt CAknSignalPane::SignalState() |
|
371 { |
|
372 return iSignalState; |
|
373 } |
|
374 |
|
375 |
|
376 // --------------------------------------------------------------------------- |
|
377 // CAknSignalPane::DisableAnimation |
|
378 // Stops ongoing signal state animation. |
|
379 // --------------------------------------------------------------------------- |
|
380 // |
|
381 void CAknSignalPane::DisableAnimation() |
|
382 { |
|
383 if ( iTicker && iTicker->IsActive() ) |
|
384 { |
|
385 iTicker->Cancel(); |
|
386 } |
|
387 } |
|
388 |
|
389 |
|
390 // --------------------------------------------------------------------------- |
|
391 // CAknSignalPane::ShowGprsIcon |
|
392 // Displays a GRPS state icon. |
|
393 // --------------------------------------------------------------------------- |
|
394 // |
|
395 EXPORT_C void CAknSignalPane::ShowGprsIcon( TInt aGprsIconState ) |
|
396 { |
|
397 // Gprs state is not changed if illegal value was given. |
|
398 if ( aGprsIconState >= EAknSignalGprsIndicatorOff && |
|
399 aGprsIconState <= EAknSignalGprsIndicatorMultipdp ) |
|
400 { |
|
401 TRAP_IGNORE( LoadSignalIconL( aGprsIconState, |
|
402 iSignalIconControl->ColorIndex() ) ); |
|
403 |
|
404 iSignalIconControl->SetDrawBlank( EFalse ); |
|
405 |
|
406 if ( aGprsIconState != EAknSignalGprsIndicatorEstablishingContext && |
|
407 iTicker ) |
|
408 { |
|
409 iTicker->Cancel(); |
|
410 } |
|
411 else if ( aGprsIconState == EAknSignalGprsIndicatorEstablishingContext ) |
|
412 { |
|
413 if ( iTicker && !iTicker->IsActive() ) |
|
414 { |
|
415 iTicker->Start( KAknIndicatorAnimationDelay, |
|
416 KAknIndicatorAnimationInterval, |
|
417 TCallBack( TickerCallback, this ) ); |
|
418 } |
|
419 } |
|
420 } |
|
421 } |
|
422 |
|
423 |
|
424 // --------------------------------------------------------------------------- |
|
425 // From class CCoeControl. |
|
426 // CAknSignalPane::SizeChanged |
|
427 // Handles size change events. |
|
428 // --------------------------------------------------------------------------- |
|
429 // |
|
430 EXPORT_C void CAknSignalPane::SizeChanged() |
|
431 { |
|
432 // No fading if staconpane is active. |
|
433 SetContainerWindowNonFading( AknStatuspaneUtils::StaconPaneActive() ); |
|
434 |
|
435 TAknWindowComponentLayout signalIconLayout; |
|
436 TAknWindowComponentLayout signalStrenghtLayout; |
|
437 |
|
438 TRect parent( Rect() ); |
|
439 |
|
440 TAknLayoutRect rect; |
|
441 |
|
442 if ( AknStatuspaneUtils::StaconPaneActive() ) |
|
443 { |
|
444 // Signal pane in STACON PANE. |
|
445 TInt varietyIndex = AknStatuspaneUtils::StaconSoftKeysLeft() ? 1 : 0; |
|
446 signalIconLayout = |
|
447 AknLayoutScalable_Avkon::signal_pane_stacon_g2( varietyIndex ); |
|
448 signalStrenghtLayout = |
|
449 AknLayoutScalable_Avkon::signal_pane_stacon_g1( varietyIndex ); |
|
450 |
|
451 AknLayoutUtils::LayoutControl( iSignalIconControl, |
|
452 parent, |
|
453 signalIconLayout ); |
|
454 AknLayoutUtils::LayoutControl( iSignalStrengthControl, |
|
455 parent, |
|
456 signalStrenghtLayout ); |
|
457 } |
|
458 else if ( AknStatuspaneUtils::FlatLayoutActive() ) |
|
459 { |
|
460 // Signal pane in FLAT STATUSPANE. |
|
461 signalIconLayout = AknLayoutScalable_Avkon::signal_pane_g2( 1 ); |
|
462 signalStrenghtLayout = AknLayoutScalable_Avkon::signal_pane_g1( 1 ); |
|
463 |
|
464 AknLayoutUtils::LayoutControl( iSignalIconControl, |
|
465 parent, |
|
466 signalIconLayout); |
|
467 AknLayoutUtils::LayoutControl( iSignalStrengthControl, |
|
468 parent, |
|
469 signalStrenghtLayout ); |
|
470 } |
|
471 else if ( AknStatuspaneUtils::SmallLayoutActive() ) |
|
472 { |
|
473 // Signal pane in SMALL STATUSPANE, only icon shown. |
|
474 signalIconLayout = AknLayoutScalable_Avkon::status_small_pane_g2( 0 ); |
|
475 AknLayoutUtils::LayoutControl( iSignalIconControl, |
|
476 parent, |
|
477 signalIconLayout ); |
|
478 iSignalStrengthControl->SetRect( TRect( 0, 0, 0, 0 ) ); |
|
479 } |
|
480 else |
|
481 { |
|
482 // Signal pane in NORMAL or WIDESCREEN STATUS PANE. |
|
483 TBool hdLayout( AknStatuspaneUtils::HDLayoutActive() ); |
|
484 signalIconLayout = |
|
485 AknLayoutScalable_Avkon::signal_pane_g2( hdLayout ? 2 : 0 ); |
|
486 signalStrenghtLayout = |
|
487 AknLayoutScalable_Avkon::signal_pane_g1( hdLayout ? 2 : 0 ); |
|
488 |
|
489 AknLayoutUtils::LayoutControl( iSignalIconControl, |
|
490 parent, |
|
491 signalIconLayout ); |
|
492 |
|
493 AknLayoutUtils::LayoutControl( iSignalStrengthControl, |
|
494 parent, |
|
495 signalStrenghtLayout ); |
|
496 } |
|
497 |
|
498 TInt iconColorIndex = 0; |
|
499 if ( AknStatuspaneUtils::StaconPaneActive() || |
|
500 AknStatuspaneUtils::FlatLayoutActive() ) |
|
501 { |
|
502 iconColorIndex = EAknsCIQsnIconColorsCG23; |
|
503 } |
|
504 else |
|
505 { |
|
506 iconColorIndex = EAknsCIQsnIconColorsCG5; |
|
507 } |
|
508 |
|
509 TRAP_IGNORE( LoadSignalIconL( iSignalState, iconColorIndex ) ); |
|
510 |
|
511 AknsUtils::RegisterControlPosition( this ); |
|
512 } |
|
513 |
|
514 |
|
515 // --------------------------------------------------------------------------- |
|
516 // From class CCoeControl. |
|
517 // CAknSignalPane::PositionChanged |
|
518 // Handles position change events. |
|
519 // --------------------------------------------------------------------------- |
|
520 // |
|
521 EXPORT_C void CAknSignalPane::PositionChanged() |
|
522 { |
|
523 AknsUtils::RegisterControlPosition( this ); |
|
524 } |
|
525 |
|
526 |
|
527 // --------------------------------------------------------------------------- |
|
528 // From class CCoeControl. |
|
529 // CAknSignalPane::Draw |
|
530 // Draws the signal pane. |
|
531 // --------------------------------------------------------------------------- |
|
532 // |
|
533 EXPORT_C void CAknSignalPane::Draw( const TRect& /*aRect*/ ) const |
|
534 { |
|
535 if ( iExtension->iIsActiveIdle ) |
|
536 { |
|
537 return; |
|
538 } |
|
539 |
|
540 if ( AknStatuspaneUtils::StaconPaneActive() ) |
|
541 { |
|
542 // Signal pane in STACON PANE layout |
|
543 DrawInStaconPane( Rect() ); |
|
544 } |
|
545 else if ( AknStatuspaneUtils::FlatLayoutActive() ) |
|
546 { |
|
547 // Signal pane in FLAT STATUSPANE layout |
|
548 DrawInFlatStatusPane( Rect() ); |
|
549 } |
|
550 else if ( AknStatuspaneUtils::SmallLayoutActive() ) |
|
551 { |
|
552 // Signal pane in SMALL STATUSPANE layout |
|
553 DrawInSmallStatusPane( Rect() ); |
|
554 } |
|
555 else |
|
556 { |
|
557 // Signal pane in NORMAL STATUSPANE layout |
|
558 DrawInNormalStatusPane( Rect() ); |
|
559 } |
|
560 } |
|
561 |
|
562 |
|
563 // --------------------------------------------------------------------------- |
|
564 // CAknSignalPane::TickerCallback |
|
565 // Static callback function for signal state animation timer. |
|
566 // --------------------------------------------------------------------------- |
|
567 // |
|
568 TInt CAknSignalPane::TickerCallback( TAny* aThis ) |
|
569 { |
|
570 return static_cast<CAknSignalPane*>( aThis )->DoTick(); |
|
571 } |
|
572 |
|
573 |
|
574 // --------------------------------------------------------------------------- |
|
575 // CAknSignalPane::DoTick |
|
576 // Callback function for signal state animation timer. |
|
577 // --------------------------------------------------------------------------- |
|
578 // |
|
579 TInt CAknSignalPane::DoTick() |
|
580 { |
|
581 if ( iExtension->CdmaSignalIconInUse() ) |
|
582 { |
|
583 // tick used for cdma animation |
|
584 iExtension->CdmaSignalAnimate(); |
|
585 iSignalIconControl->SetSignalIcon( iExtension->CdmaSignalIcon() ); |
|
586 iSignalIconControl->SetSignalIconMask( iExtension->CdmaSignalIcon() ); |
|
587 } |
|
588 else |
|
589 { |
|
590 // default tick blinks icon |
|
591 iSignalIconControl->SetDrawBlank( !iSignalIconControl->DrawBlank() ); |
|
592 } |
|
593 |
|
594 // Must be DrawDeferred (not DrawNow) so that we don't block |
|
595 // application thread in high load situations. |
|
596 DrawDeferred(); |
|
597 |
|
598 return ETrue; |
|
599 } |
|
600 |
|
601 |
|
602 // --------------------------------------------------------------------------- |
|
603 // From class CCoeControl. |
|
604 // CAknSignalPane::HandleResourceChange |
|
605 // Handles resource change events. |
|
606 // --------------------------------------------------------------------------- |
|
607 // |
|
608 EXPORT_C void CAknSignalPane::HandleResourceChange( TInt aType ) |
|
609 { |
|
610 CCoeControl::HandleResourceChange( aType ); |
|
611 |
|
612 if ( aType == KEikDynamicLayoutVariantSwitch ) |
|
613 { |
|
614 DrawDeferred(); |
|
615 } |
|
616 |
|
617 if ( aType == KEikColorResourceChange || aType == KAknsMessageSkinChange ) |
|
618 { |
|
619 if ( iSignalIconControl ) |
|
620 { |
|
621 iSignalIconControl->SetColorIndex( 0 ); // reset skin color |
|
622 } |
|
623 SizeChanged(); // Sizechanged updates the color |
|
624 DrawDeferred(); |
|
625 } |
|
626 } |
|
627 |
|
628 |
|
629 // --------------------------------------------------------------------------- |
|
630 // CAknSignalPane::SetNaviPaneBackgroundType |
|
631 // Not used anymore. |
|
632 // --------------------------------------------------------------------------- |
|
633 // |
|
634 EXPORT_C void CAknSignalPane::SetNaviPaneBackgroundType( TInt /*aType*/ ) |
|
635 { |
|
636 } |
|
637 |
|
638 |
|
639 // --------------------------------------------------------------------------- |
|
640 // CAknSignalPane::DrawInNormalStatusPane |
|
641 // Draws the signal pane in normal status pane layout. |
|
642 // --------------------------------------------------------------------------- |
|
643 // |
|
644 void CAknSignalPane::DrawInNormalStatusPane( const TRect& /*aRect*/ ) const |
|
645 { |
|
646 CWindowGc& gc = SystemGc(); |
|
647 |
|
648 MAknsSkinInstance* skin = AknsUtils::SkinInstance(); |
|
649 MAknsControlContext* cc = AknsDrawUtils::ControlContext( this ); |
|
650 |
|
651 TRect rect( Rect() ); |
|
652 |
|
653 // Solid or wipe comes from background |
|
654 if( !AknsDrawUtils::Background( skin, cc, this, gc, rect ) ) |
|
655 { |
|
656 // Default drawing if skinning is not available |
|
657 gc.Clear( rect ); |
|
658 // Default solid |
|
659 gc.SetPenStyle( CGraphicsContext::ENullPen ); |
|
660 gc.SetBrushStyle( CGraphicsContext::ESolidBrush ); |
|
661 gc.SetBrushColor( |
|
662 AKN_LAF_COLOR( KStatusPaneBackgroundGraphicsColorUsual ) ); |
|
663 gc.DrawRect( rect ); |
|
664 } |
|
665 } |
|
666 |
|
667 |
|
668 // --------------------------------------------------------------------------- |
|
669 // CAknSignalPane::DrawInSmallStatusPane |
|
670 // Draws the signal pane in small status pane layout. |
|
671 // --------------------------------------------------------------------------- |
|
672 // |
|
673 void CAknSignalPane::DrawInSmallStatusPane( const TRect& /*aRect*/ ) const |
|
674 { |
|
675 CWindowGc& gc = SystemGc(); |
|
676 |
|
677 MAknsSkinInstance* skin = AknsUtils::SkinInstance(); |
|
678 MAknsControlContext* cc = AknsDrawUtils::ControlContext( this ); |
|
679 |
|
680 TRect rect( Rect() ); |
|
681 |
|
682 if( !AknsDrawUtils::Background( skin, cc, this, gc, rect ) ) |
|
683 { |
|
684 gc.Clear( rect ); |
|
685 // If there is no background, draw navi pane part |
|
686 gc.SetPenStyle( CGraphicsContext::ENullPen ); |
|
687 gc.SetBrushStyle( CGraphicsContext::ESolidBrush ); |
|
688 gc.SetBrushColor( |
|
689 AKN_LAF_COLOR( KStatusPaneBackgroundGraphicsColorUsual ) ); |
|
690 gc.DrawRect( rect ); |
|
691 } |
|
692 } |
|
693 |
|
694 |
|
695 // --------------------------------------------------------------------------- |
|
696 // CAknSignalPane::DrawInStaconPane |
|
697 // Draws the signal pane in stacon pane layout. |
|
698 // --------------------------------------------------------------------------- |
|
699 // |
|
700 void CAknSignalPane::DrawInStaconPane( const TRect& /*aRect*/ ) const |
|
701 { |
|
702 CWindowGc& gc = SystemGc(); |
|
703 TRect rect( Rect() ); |
|
704 MAknsSkinInstance* skin = AknsUtils::SkinInstance(); |
|
705 MAknsControlContext* cc = AknsDrawUtils::ControlContext( this ); |
|
706 |
|
707 if( !AknsDrawUtils::Background( skin, cc, this, gc, rect ) ) |
|
708 { |
|
709 gc.SetPenStyle( CGraphicsContext::ENullPen ); |
|
710 gc.SetBrushStyle( CGraphicsContext::ESolidBrush ); |
|
711 gc.SetBrushColor( |
|
712 AKN_LAF_COLOR( KStatusPaneBackgroundGraphicsColorUsual ) ); |
|
713 gc.DrawRect( rect ); |
|
714 } |
|
715 } |
|
716 |
|
717 |
|
718 // --------------------------------------------------------------------------- |
|
719 // CAknSignalPane::DrawInFlatStatusPane |
|
720 // Draws the signal pane in flat status pane layout. |
|
721 // --------------------------------------------------------------------------- |
|
722 // |
|
723 void CAknSignalPane::DrawInFlatStatusPane( const TRect& /*aRect*/ ) const |
|
724 { |
|
725 CWindowGc& gc = SystemGc(); |
|
726 TRect rect( Rect() ); |
|
727 MAknsSkinInstance* skin = AknsUtils::SkinInstance(); |
|
728 MAknsControlContext* cc = AknsDrawUtils::ControlContext( this ); |
|
729 |
|
730 if( !AknsDrawUtils::Background( skin, cc, this, gc, rect ) ) |
|
731 { |
|
732 gc.SetPenStyle( CGraphicsContext::ENullPen ); |
|
733 gc.SetBrushStyle( CGraphicsContext::ESolidBrush ); |
|
734 gc.SetBrushColor( |
|
735 AKN_LAF_COLOR( KStatusPaneBackgroundGraphicsColorUsual ) ); |
|
736 gc.DrawRect( rect ); |
|
737 } |
|
738 } |
|
739 |
|
740 |
|
741 // --------------------------------------------------------------------------- |
|
742 // CAknSignalPane::ShowCommonPacketDataIcon |
|
743 // Displays a common packet data state icon. |
|
744 // --------------------------------------------------------------------------- |
|
745 // |
|
746 EXPORT_C void CAknSignalPane::ShowCommonPacketDataIcon( |
|
747 TInt aCommonPacketDataIconState ) |
|
748 { |
|
749 // State is not changed if illegal value was given. |
|
750 if ( aCommonPacketDataIconState >= EAknSignalCommonPacketDataIndicatorOff && |
|
751 aCommonPacketDataIconState <= EAknSignalCommonPacketDataIndicatorMultipdp ) |
|
752 { |
|
753 TRAP_IGNORE( LoadSignalIconL( aCommonPacketDataIconState, |
|
754 iSignalIconControl->ColorIndex() ) ); |
|
755 |
|
756 iSignalIconControl->SetDrawBlank( EFalse ); |
|
757 |
|
758 if ( aCommonPacketDataIconState != EAknSignalCommonPacketDataIndicatorEstablishingContext && |
|
759 iTicker ) |
|
760 { |
|
761 iTicker->Cancel(); |
|
762 } |
|
763 else if ( aCommonPacketDataIconState == EAknSignalCommonPacketDataIndicatorEstablishingContext ) |
|
764 { |
|
765 if ( iTicker && !iTicker->IsActive() ) |
|
766 { |
|
767 iTicker->Start( KAknIndicatorAnimationDelay, |
|
768 KAknIndicatorAnimationInterval, |
|
769 TCallBack( TickerCallback, this ) ); |
|
770 } |
|
771 } |
|
772 } |
|
773 } |
|
774 |
|
775 |
|
776 // --------------------------------------------------------------------------- |
|
777 // CAknSignalPane::ShowEdgeIcon |
|
778 // Displays an EDGE state icon. |
|
779 // --------------------------------------------------------------------------- |
|
780 // |
|
781 EXPORT_C void CAknSignalPane::ShowEdgeIcon( TInt aEdgeIconState ) |
|
782 { |
|
783 // State is not changed if illegal value was given. |
|
784 if ( aEdgeIconState >= EAknSignalEdgeIndicatorOff && |
|
785 aEdgeIconState <= EAknSignalEdgeIndicatorMultipdp ) |
|
786 { |
|
787 TRAP_IGNORE( LoadSignalIconL( aEdgeIconState, |
|
788 iSignalIconControl->ColorIndex() ) ); |
|
789 |
|
790 iSignalIconControl->SetDrawBlank( EFalse ); |
|
791 |
|
792 if ( aEdgeIconState != EAknSignalEdgeIndicatorEstablishingContext && |
|
793 iTicker ) |
|
794 { |
|
795 iTicker->Cancel(); |
|
796 } |
|
797 else if ( aEdgeIconState == EAknSignalEdgeIndicatorEstablishingContext ) |
|
798 { |
|
799 if ( iTicker && !iTicker->IsActive() ) |
|
800 { |
|
801 iTicker->Start( KAknIndicatorAnimationDelay, |
|
802 KAknIndicatorAnimationInterval, |
|
803 TCallBack( TickerCallback, this ) ); |
|
804 } |
|
805 } |
|
806 } |
|
807 } |
|
808 |
|
809 |
|
810 // --------------------------------------------------------------------------- |
|
811 // CAknSignalPane::ShowWcdmaIcon |
|
812 // Displays a WCDMA state icon. |
|
813 // --------------------------------------------------------------------------- |
|
814 // |
|
815 EXPORT_C void CAknSignalPane::ShowWcdmaIcon( TInt aWcdmaIconState ) |
|
816 { |
|
817 // State is not changed if illegal value was given. |
|
818 if ( aWcdmaIconState >= EAknSignalWcdmaIndicatorOff && |
|
819 aWcdmaIconState <= EAknSignalWcdmaIndicatorSuspended ) |
|
820 { |
|
821 TRAP_IGNORE( LoadSignalIconL( aWcdmaIconState, |
|
822 iSignalIconControl->ColorIndex() ) ); |
|
823 |
|
824 iSignalIconControl->SetDrawBlank( EFalse ); |
|
825 |
|
826 if ( aWcdmaIconState != EAknSignalWcdmaIndicatorEstablishingContext && |
|
827 iTicker ) |
|
828 { |
|
829 iTicker->Cancel(); |
|
830 } |
|
831 else if ( aWcdmaIconState == EAknSignalWcdmaIndicatorEstablishingContext ) |
|
832 { |
|
833 if ( iTicker && !iTicker->IsActive() ) |
|
834 { |
|
835 iTicker->Start( KAknIndicatorAnimationDelay, |
|
836 KAknIndicatorAnimationInterval, |
|
837 TCallBack( TickerCallback, this ) ); |
|
838 } |
|
839 } |
|
840 } |
|
841 } |
|
842 |
|
843 |
|
844 // --------------------------------------------------------------------------- |
|
845 // CAknSignalPane::ShowHsdpaIcon |
|
846 // Displays an HSDPA state icon. |
|
847 // --------------------------------------------------------------------------- |
|
848 // |
|
849 EXPORT_C void CAknSignalPane::ShowHsdpaIcon( TInt aHsdpaIconState ) |
|
850 { |
|
851 // State is not changed if illegal value was given. |
|
852 if ( aHsdpaIconState >= EAknSignalHsdpaIndicatorOff && |
|
853 aHsdpaIconState <= EAknSignalHsdpaIndicatorMultipdp ) |
|
854 { |
|
855 TRAP_IGNORE( LoadSignalIconL( aHsdpaIconState, |
|
856 iSignalIconControl->ColorIndex() ) ); |
|
857 |
|
858 iSignalIconControl->SetDrawBlank( EFalse ); |
|
859 |
|
860 if ( aHsdpaIconState != EAknSignalHsdpaIndicatorEstablishingContext && |
|
861 iTicker ) |
|
862 { |
|
863 iTicker->Cancel(); |
|
864 } |
|
865 else if ( aHsdpaIconState == EAknSignalHsdpaIndicatorEstablishingContext ) |
|
866 { |
|
867 if ( iTicker && !iTicker->IsActive() ) |
|
868 { |
|
869 iTicker->Start( KAknIndicatorAnimationDelay, |
|
870 KAknIndicatorAnimationInterval, |
|
871 TCallBack( TickerCallback, this ) ); |
|
872 } |
|
873 } |
|
874 } |
|
875 } |
|
876 |
|
877 |
|
878 // --------------------------------------------------------------------------- |
|
879 // CAknSignalPane::ShowCdmaIcon |
|
880 // Displays a CDMA state icon. |
|
881 // --------------------------------------------------------------------------- |
|
882 // |
|
883 #ifdef __PROTOCOL_CDMA |
|
884 EXPORT_C void CAknSignalPane::ShowCdmaIcon( TInt aCdmaIconState ) |
|
885 { |
|
886 // Cdma state is not changed if illegal value was given, or if there was no change |
|
887 if ( aCdmaIconState >= EAknSignalCdmaIndicatorOff && |
|
888 aCdmaIconState <= EAknSignalCdmaIndicatorReceiving && |
|
889 aCdmaIconState != iExtension->iCdmaSignalState ) |
|
890 { |
|
891 TRAP_IGNORE( LoadSignalIconL( aCdmaIconState, |
|
892 iSignalIconControl->ColorIndex() ) ); |
|
893 |
|
894 iExtension->iCdmaSignalState = aCdmaIconState; |
|
895 |
|
896 // Tick timer is only used when animating. |
|
897 if ( aCdmaIconState != EAknSignalCdmaIndicatorSending && |
|
898 aCdmaIconState != EAknSignalCdmaIndicatorReceiving && |
|
899 iTicker ) |
|
900 { |
|
901 iTicker->Cancel(); |
|
902 } |
|
903 |
|
904 switch ( aCdmaIconState ) |
|
905 { |
|
906 case EAknSignalCdmaIndicatorSending: |
|
907 case EAknSignalCdmaIndicatorReceiving: |
|
908 if ( iTicker && !iTicker->IsActive() ) |
|
909 { |
|
910 // restart animation |
|
911 iExtension->iCdmaAnimationIndex = 0; |
|
912 iTicker->Start( KAknIndicatorShortAnimationInterval, |
|
913 KAknIndicatorShortAnimationInterval, |
|
914 TCallBack( TickerCallback, this ) ); |
|
915 } |
|
916 break; |
|
917 default: |
|
918 break; |
|
919 } |
|
920 } |
|
921 } |
|
922 #else |
|
923 EXPORT_C void CAknSignalPane::ShowCdmaIcon(TInt /*aCdmaIconState*/ ) |
|
924 { |
|
925 } |
|
926 #endif // __PROTOCOL_CDMA |
|
927 |
|
928 |
|
929 // --------------------------------------------------------------------------- |
|
930 // From class CCoeControl. |
|
931 // CAknSignalPane::CountComponentControls |
|
932 // Returns the amount of component controls. |
|
933 // --------------------------------------------------------------------------- |
|
934 // |
|
935 EXPORT_C TInt CAknSignalPane::CountComponentControls() const |
|
936 { |
|
937 return 2; |
|
938 } |
|
939 |
|
940 |
|
941 // --------------------------------------------------------------------------- |
|
942 // From class CCoeControl. |
|
943 // CAknSignalPane::ComponentControl |
|
944 // Gets a component control by a control index. |
|
945 // --------------------------------------------------------------------------- |
|
946 // |
|
947 EXPORT_C CCoeControl* CAknSignalPane::ComponentControl( TInt aIndex ) const |
|
948 { |
|
949 CCoeControl* control = NULL; |
|
950 |
|
951 switch ( aIndex ) |
|
952 { |
|
953 case 0: |
|
954 { |
|
955 control = iSignalStrengthControl; |
|
956 break; |
|
957 } |
|
958 case 1: |
|
959 { |
|
960 control = iSignalIconControl; |
|
961 break; |
|
962 } |
|
963 } |
|
964 |
|
965 return control; |
|
966 } |
|
967 |
|
968 |
|
969 // --------------------------------------------------------------------------- |
|
970 // From class CAknControl. |
|
971 // CAknSignalPane::ExtensionInterface |
|
972 // Not implemented. |
|
973 // --------------------------------------------------------------------------- |
|
974 // |
|
975 EXPORT_C void* CAknSignalPane::ExtensionInterface( TUid /*aInterface*/ ) |
|
976 { |
|
977 return NULL; |
|
978 } |
|
979 |
|
980 |
|
981 // --------------------------------------------------------------------------- |
|
982 // From class CCoeControl. |
|
983 // CAknSignalPane::HandlePointerEventL() |
|
984 // Processes signal pane's pointer events. Actually this does nothing yet |
|
985 // --------------------------------------------------------------------------- |
|
986 // |
|
987 void CAknSignalPane::HandlePointerEventL( const TPointerEvent& aPointerEvent ) |
|
988 { |
|
989 if ( AknLayoutUtils::PenEnabled() ) |
|
990 { |
|
991 if ( IsDimmed() ) |
|
992 { |
|
993 iPrivateFlags &= (~EAknSignalPaneButton1DownInSignalRect); |
|
994 return; |
|
995 } |
|
996 |
|
997 // Get rect of signal pane. |
|
998 TRect rect( Rect() ); |
|
999 |
|
1000 // Switch by type |
|
1001 switch ( aPointerEvent.iType ) |
|
1002 { |
|
1003 case TPointerEvent::EButton1Down: |
|
1004 { |
|
1005 // if signal pane's rect contains pointer down position |
|
1006 if ( rect.Contains( aPointerEvent.iPosition ) ) |
|
1007 { |
|
1008 // set flag that down was inside signal pane |
|
1009 iPrivateFlags |= EAknSignalPaneButton1DownInSignalRect; |
|
1010 } |
|
1011 } |
|
1012 break; |
|
1013 |
|
1014 case TPointerEvent::EButton1Up: |
|
1015 { |
|
1016 // if signalPane's rect contains pointer down position |
|
1017 if ( iPrivateFlags&EAknSignalPaneButton1DownInSignalRect && |
|
1018 rect.Contains( aPointerEvent.iPosition ) ) |
|
1019 { |
|
1020 // Up happened inside signal pane's rect |
|
1021 // activate something |
|
1022 } |
|
1023 |
|
1024 // Up happened, reset button down flag |
|
1025 iPrivateFlags &= (~EAknSignalPaneButton1DownInSignalRect); |
|
1026 } |
|
1027 break; |
|
1028 |
|
1029 default: |
|
1030 break; |
|
1031 } |
|
1032 } |
|
1033 } |
|
1034 |
|
1035 |
|
1036 // --------------------------------------------------------------------------- |
|
1037 // CAknSignalPane::SetContainerWindowNonFading |
|
1038 // Allows/disallows fading of signal pane. |
|
1039 // --------------------------------------------------------------------------- |
|
1040 // |
|
1041 void CAknSignalPane::SetContainerWindowNonFading( TBool aNonFading ) |
|
1042 { |
|
1043 CEikStatusPaneBase* statusPane = CEikStatusPaneBase::Current(); |
|
1044 if ( statusPane ) |
|
1045 { |
|
1046 CCoeControl* control = NULL; |
|
1047 TRAP_IGNORE( |
|
1048 control = statusPane->ContainerControlL( |
|
1049 TUid::Uid( EEikStatusPaneUidSignal ) ) ); |
|
1050 if ( control ) |
|
1051 { |
|
1052 control->DrawableWindow()->SetNonFading( aNonFading ); |
|
1053 } |
|
1054 } |
|
1055 } |
|
1056 |
|
1057 |
|
1058 // --------------------------------------------------------------------------- |
|
1059 // CAknSignalPane::LoadSignalIconL |
|
1060 // Changes the signal state icon of the signal icon control. |
|
1061 // --------------------------------------------------------------------------- |
|
1062 // |
|
1063 void CAknSignalPane::LoadSignalIconL( TInt aIconState, TInt aIconColorIndex ) |
|
1064 { |
|
1065 if ( iSignalIconControl ) |
|
1066 { |
|
1067 iSignalIconControl->LoadIconL( aIconState, aIconColorIndex ); |
|
1068 } |
|
1069 |
|
1070 iSignalState = aIconState; |
|
1071 } |
|
1072 |
|
1073 // End of File |