|
1 /* |
|
2 * Copyright (c) 2007,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: Content that is shown inside a universal status |
|
15 * indicator popup. |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 // SYSTEM INCLUDE FILES |
|
21 |
|
22 #include <AknsDrawUtils.h> |
|
23 #include <aknlayoutscalable_avkon.cdl.h> |
|
24 #include <AknsConstants.h> |
|
25 #include <AknUtils.h> |
|
26 #include "akndigitalclock.h" |
|
27 #include <avkon.mbg> |
|
28 #include <gulicon.h> |
|
29 #include <barsread.h> |
|
30 #include <AknIndicator.h> |
|
31 #include <AknIndicatorPlugin.h> |
|
32 #include <AknIndicatorPluginImplUIDs.hrh> |
|
33 #include <AknIndicatorContainer.h> |
|
34 #include <apgcli.h> |
|
35 #include <aknconsts.h> |
|
36 #include <aknglobalpopupprioritycontroller.h> |
|
37 #include <AknTasHook.h> // for testability hooks |
|
38 #include <touchfeedback.h> |
|
39 |
|
40 |
|
41 // USER INCLUDE FILES |
|
42 #include "aknindicatorpopupcontent.h" |
|
43 #include "aknindicatorpopup.h" |
|
44 #include "AknBatteryIcon.h" |
|
45 #include "AknSignalIcon.h" |
|
46 |
|
47 |
|
48 // CONSTANTS |
|
49 |
|
50 /** Granularity of the indicator item array. */ |
|
51 const TInt KItemArrayGranularity = 8; |
|
52 |
|
53 /** Path to the clock application, launched directly from the popup. */ |
|
54 _LIT( KClockApplication, "\\sys\\bin\\clock.exe" ); |
|
55 |
|
56 /** Internal state flags. */ |
|
57 enum TIndicatorPopupContentFlags |
|
58 { |
|
59 /** Pointer down event has happened inside this control. */ |
|
60 EAknIndicatorPopupContentButton1Down = 0x00000001, |
|
61 /** Clock application is being launched. */ |
|
62 EAknIndicatorPopupContentClockBeingLaunched = 0x00000002 |
|
63 }; |
|
64 |
|
65 const TInt KBatteryAreaIndex = 0; |
|
66 const TInt KSignalAreaIndex = 1; |
|
67 |
|
68 |
|
69 // ============================================================================= |
|
70 // CAknIndicatorPopupItem |
|
71 // Item class declaration & definition. |
|
72 // ============================================================================= |
|
73 // |
|
74 NONSHARABLE_CLASS( CAknIndicatorPopupItem ) : public CBase |
|
75 { |
|
76 public: |
|
77 |
|
78 /** |
|
79 * Default constructor. |
|
80 * |
|
81 * @param aUid UID of the indicator. |
|
82 * @param aPlugin Pointer to the indicator's ECOM plugin, |
|
83 * can be NULL. |
|
84 * @param aPriority Display priority of the indicator. |
|
85 * @param aTextType Type of the item text. |
|
86 */ |
|
87 CAknIndicatorPopupItem( TInt aUid, |
|
88 CAknIndicatorPlugin* aPlugin, |
|
89 TInt aPriority, |
|
90 TInt aTextType ); |
|
91 |
|
92 /** |
|
93 * Destructor. |
|
94 */ |
|
95 ~CAknIndicatorPopupItem(); |
|
96 |
|
97 /** |
|
98 * Second-phase constructor to be used with custom icon. |
|
99 * |
|
100 * @param aText Item text. |
|
101 * @param aIcon Indicator icon. |
|
102 */ |
|
103 void ConstructL( const TDesC& aText, |
|
104 const CGulIcon* aIcon ); |
|
105 |
|
106 /** |
|
107 * Second-phase constructor to be used with the default |
|
108 * indicator icon. |
|
109 * |
|
110 * @param aText Item text. |
|
111 * @param aIconID Index of the indicator icon. |
|
112 * @param aIconID Index of the indicator icon mask. |
|
113 */ |
|
114 void ConstructL( const TDesC& aText, |
|
115 TInt aIconID, |
|
116 TInt aIconMaskID ); |
|
117 |
|
118 /** |
|
119 * Sets the area of this item in the popup. |
|
120 * |
|
121 * @param aRect Rectangle of this item, relative |
|
122 * to the popup. |
|
123 */ |
|
124 void SetRect( const TRect& aRect ); |
|
125 |
|
126 /** |
|
127 * Changes the indicator icon of the item or updates |
|
128 * the color when skin changes. |
|
129 * |
|
130 * @param aIcon Pointer to the new icon if the icon |
|
131 * is to be changed. |
|
132 */ |
|
133 void UpdateIndicatorIconL( const CGulIcon* aIcon = NULL ); |
|
134 |
|
135 /** |
|
136 * Updates the item text. |
|
137 * |
|
138 * @param aText Item text. |
|
139 */ |
|
140 void UpdateTextL( const TDesC& aText, TInt aTextType ); |
|
141 |
|
142 /** |
|
143 * Draws the item. |
|
144 * |
|
145 * @param aGc Reference to the window graphics context. |
|
146 */ |
|
147 void DrawItem( CWindowGc& aGc ); |
|
148 |
|
149 public: // Member data |
|
150 |
|
151 /** UID of the indicator. */ |
|
152 TInt iUid; |
|
153 |
|
154 /** Indicator priority. */ |
|
155 TInt iPriority; |
|
156 |
|
157 /** Item text, owned. */ |
|
158 HBufC* iText; |
|
159 |
|
160 /** Type of the text. */ |
|
161 TInt iTextType; |
|
162 |
|
163 /** Item area. */ |
|
164 TRect iRect; |
|
165 |
|
166 /** Indicator icon area. */ |
|
167 TRect iIconRect; |
|
168 |
|
169 /** Default indicator icon, owned. */ |
|
170 CGulIcon* iIcon; |
|
171 |
|
172 /** Custom indicator icon, not owned. */ |
|
173 const CGulIcon* iCustomIcon; |
|
174 |
|
175 /** Index of the default indicator icon. */ |
|
176 TInt iIconID; |
|
177 |
|
178 /** Index of the default indicator icon mask. */ |
|
179 TInt iIconMaskID; |
|
180 |
|
181 /** Pointer to the indicator plugin, not owned. */ |
|
182 CAknIndicatorPlugin* iPlugin; |
|
183 }; |
|
184 |
|
185 |
|
186 // ----------------------------------------------------------------------------- |
|
187 // CAknIndicatorPopupItem::CAknIndicatorPopupItem |
|
188 // Default constructor |
|
189 // ----------------------------------------------------------------------------- |
|
190 // |
|
191 CAknIndicatorPopupItem::CAknIndicatorPopupItem( TInt aUid, |
|
192 CAknIndicatorPlugin* aPlugin, |
|
193 TInt aPriority, |
|
194 TInt aTextType ) |
|
195 : iUid( aUid ), |
|
196 iPriority( aPriority ), |
|
197 iTextType( aTextType ), |
|
198 iPlugin( aPlugin ) |
|
199 { |
|
200 } |
|
201 |
|
202 |
|
203 // ----------------------------------------------------------------------------- |
|
204 // CAknIndicatorPopupItem::CAknIndicatorPopupItem |
|
205 // Destructor |
|
206 // ----------------------------------------------------------------------------- |
|
207 // |
|
208 CAknIndicatorPopupItem::~CAknIndicatorPopupItem() |
|
209 { |
|
210 delete iText; |
|
211 delete iIcon; |
|
212 } |
|
213 |
|
214 |
|
215 // ----------------------------------------------------------------------------- |
|
216 // CAknIndicatorPopupItem::ConstructL |
|
217 // Second-phase constructor |
|
218 // ----------------------------------------------------------------------------- |
|
219 // |
|
220 void CAknIndicatorPopupItem::ConstructL( const TDesC& aText, |
|
221 const CGulIcon* aIcon ) |
|
222 { |
|
223 delete iText; |
|
224 iText = NULL; |
|
225 iText = aText.AllocL(); |
|
226 |
|
227 iCustomIcon = aIcon; |
|
228 } |
|
229 |
|
230 |
|
231 // ----------------------------------------------------------------------------- |
|
232 // CAknIndicatorPopupItem::ConstructL |
|
233 // Second-phase constructor |
|
234 // ----------------------------------------------------------------------------- |
|
235 // |
|
236 void CAknIndicatorPopupItem::ConstructL( const TDesC& aText, |
|
237 TInt aIconID, |
|
238 TInt aIconMaskID ) |
|
239 { |
|
240 delete iText; |
|
241 iText = NULL; |
|
242 iText = aText.AllocL(); |
|
243 |
|
244 iIconID = aIconID; |
|
245 iIconMaskID = aIconMaskID; |
|
246 |
|
247 UpdateIndicatorIconL(); |
|
248 } |
|
249 |
|
250 |
|
251 // ----------------------------------------------------------------------------- |
|
252 // CAknIndicatorPopupItem::SetRect |
|
253 // ----------------------------------------------------------------------------- |
|
254 // |
|
255 void CAknIndicatorPopupItem::SetRect( const TRect& aRect ) |
|
256 { |
|
257 iRect = aRect; |
|
258 |
|
259 TAknLayoutRect layoutRect; |
|
260 layoutRect.LayoutRect( |
|
261 iRect, |
|
262 AknLayoutScalable_Avkon::list_single_uniindi_pane_g1() ); |
|
263 iIconRect = layoutRect.Rect(); |
|
264 |
|
265 CFbsBitmap* bitmap = NULL; |
|
266 |
|
267 if ( iCustomIcon ) |
|
268 { |
|
269 bitmap = iCustomIcon->Bitmap(); |
|
270 } |
|
271 else if ( iIcon ) |
|
272 { |
|
273 bitmap = iIcon->Bitmap(); |
|
274 } |
|
275 |
|
276 if ( bitmap ) |
|
277 { |
|
278 AknIconUtils::SetSize( bitmap, |
|
279 iIconRect.Size(), |
|
280 EAspectRatioPreserved ); |
|
281 } |
|
282 } |
|
283 |
|
284 |
|
285 // ----------------------------------------------------------------------------- |
|
286 // CAknIndicatorPopupItem::UpdateIndicatorIconL |
|
287 // ----------------------------------------------------------------------------- |
|
288 // |
|
289 void CAknIndicatorPopupItem::UpdateIndicatorIconL( const CGulIcon* aIcon ) |
|
290 { |
|
291 if ( iCustomIcon && |
|
292 !aIcon ) |
|
293 { |
|
294 // Custom icon in use |
|
295 if ( iPlugin ) |
|
296 { |
|
297 iCustomIcon = NULL; |
|
298 TRAPD( err, iCustomIcon = iPlugin->IconL( iUid ) ); |
|
299 |
|
300 if ( !err && iCustomIcon ) |
|
301 { |
|
302 // Icon update succeeded. |
|
303 AknIconUtils::SetSize( iCustomIcon->Bitmap(), |
|
304 iIconRect.Size(), |
|
305 EAspectRatioPreserved ); |
|
306 return; |
|
307 } |
|
308 |
|
309 // Else use the default icon. |
|
310 } |
|
311 } |
|
312 |
|
313 delete iIcon; |
|
314 iIcon = NULL; |
|
315 |
|
316 if ( aIcon ) |
|
317 { |
|
318 iCustomIcon = aIcon; |
|
319 |
|
320 AknIconUtils::SetSize( iCustomIcon->Bitmap(), |
|
321 iIconRect.Size(), |
|
322 EAspectRatioPreserved ); |
|
323 } |
|
324 else |
|
325 { |
|
326 CFbsBitmap* bitmap; |
|
327 CFbsBitmap* mask; |
|
328 |
|
329 MAknsSkinInstance* skin = AknsUtils::SkinInstance(); |
|
330 |
|
331 AknsUtils::CreateColorIconLC( |
|
332 skin, |
|
333 KAknsIIDDefault, |
|
334 KAknsIIDQsnIconColors, |
|
335 EAknsCIQsnIconColorsCG20, |
|
336 bitmap, |
|
337 mask, |
|
338 KAvkonBitmapFile, |
|
339 iIconID, |
|
340 iIconMaskID, |
|
341 KRgbGray ); |
|
342 |
|
343 AknIconUtils::SetSize( bitmap, |
|
344 iIconRect.Size(), |
|
345 EAspectRatioPreserved ); |
|
346 |
|
347 iIcon = CGulIcon::NewL( bitmap, mask ); |
|
348 |
|
349 CleanupStack::Pop( 2, bitmap ); |
|
350 } |
|
351 } |
|
352 |
|
353 |
|
354 // ----------------------------------------------------------------------------- |
|
355 // CAknIndicatorPopupItem::UpdateTextL |
|
356 // ----------------------------------------------------------------------------- |
|
357 // |
|
358 void CAknIndicatorPopupItem::UpdateTextL( const TDesC& aText, TInt aTextType ) |
|
359 { |
|
360 delete iText; |
|
361 iText = NULL; |
|
362 iText = aText.AllocL(); |
|
363 iTextType = aTextType; |
|
364 } |
|
365 |
|
366 |
|
367 // ----------------------------------------------------------------------------- |
|
368 // CAknIndicatorPopupItem::DrawItem |
|
369 // ----------------------------------------------------------------------------- |
|
370 // |
|
371 void CAknIndicatorPopupItem::DrawItem( CWindowGc& aGc ) |
|
372 { |
|
373 // Use custom icon if it exists. |
|
374 const CGulIcon* icon = iCustomIcon; |
|
375 if ( !icon ) |
|
376 { |
|
377 icon = iIcon; |
|
378 } |
|
379 |
|
380 if ( icon && icon->Bitmap() && icon->Mask() ) |
|
381 { |
|
382 aGc.BitBltMasked( iIconRect.iTl, |
|
383 icon->Bitmap(), |
|
384 iIconRect.Size(), |
|
385 icon->Mask(), |
|
386 ETrue ); |
|
387 } |
|
388 |
|
389 MAknsSkinInstance* skin = AknsUtils::SkinInstance(); |
|
390 |
|
391 TAknTextLineLayout textLayout( |
|
392 AknLayoutScalable_Avkon::list_single_uniindi_pane_t1().LayoutLine() ); |
|
393 |
|
394 TRgb textColor; |
|
395 |
|
396 if ( iTextType == CAknIndicatorPlugin::EAknIndicatorPluginLinkText ) |
|
397 { |
|
398 aGc.SetUnderlineStyle( EUnderlineOn ); |
|
399 AknsUtils::GetCachedColor( skin, |
|
400 textColor, |
|
401 KAknsIIDQsnHighlightColors, |
|
402 EAknsCIQsnHighlightColorsCG3 ); |
|
403 } |
|
404 else |
|
405 { |
|
406 AknsUtils::GetCachedColor( skin, |
|
407 textColor, |
|
408 KAknsIIDQsnTextColors, |
|
409 EAknsCIQsnTextColorsCG55 ); |
|
410 } |
|
411 |
|
412 TAknLayoutText layoutText; |
|
413 layoutText.LayoutText( iRect, textLayout ); |
|
414 layoutText.DrawText( aGc, *iText, ETrue, textColor ); |
|
415 |
|
416 aGc.SetUnderlineStyle( EUnderlineOff ); |
|
417 } |
|
418 |
|
419 |
|
420 // ============================================================================= |
|
421 // CAknIndicatorPopupContent |
|
422 // ============================================================================= |
|
423 // |
|
424 |
|
425 // ----------------------------------------------------------------------------- |
|
426 // CAknIndicatorPopupContent::NewL |
|
427 // ----------------------------------------------------------------------------- |
|
428 // |
|
429 CAknIndicatorPopupContent* CAknIndicatorPopupContent::NewL() |
|
430 { |
|
431 CAknIndicatorPopupContent* self = CAknIndicatorPopupContent::NewLC(); |
|
432 CleanupStack::Pop( self ); |
|
433 return self; |
|
434 } |
|
435 |
|
436 |
|
437 // ----------------------------------------------------------------------------- |
|
438 // CAknIndicatorPopupContent::NewLC |
|
439 // ----------------------------------------------------------------------------- |
|
440 // |
|
441 CAknIndicatorPopupContent* CAknIndicatorPopupContent::NewLC() |
|
442 { |
|
443 CAknIndicatorPopupContent* self = new (ELeave) CAknIndicatorPopupContent; |
|
444 CleanupStack::PushL( self ); |
|
445 self->ConstructL(); |
|
446 AKNTASHOOK_ADDL( self, "CAknIndicatorPopupContent" ); |
|
447 return self; |
|
448 } |
|
449 |
|
450 |
|
451 // ----------------------------------------------------------------------------- |
|
452 // Destructor. |
|
453 // ----------------------------------------------------------------------------- |
|
454 // |
|
455 CAknIndicatorPopupContent::~CAknIndicatorPopupContent() |
|
456 { |
|
457 AKNTASHOOK_REMOVE(); |
|
458 // Ensure here that this popup is removed from the global |
|
459 // popup priority stack. |
|
460 AknGlobalPopupPriorityController::RemovePopupPriority( *this ); |
|
461 |
|
462 iItems.ResetAndDestroy(); |
|
463 iItems.Close(); |
|
464 |
|
465 delete iClock; |
|
466 delete iBattery; |
|
467 delete iSignal; |
|
468 |
|
469 if ( iBatteryPlugin || iSignalPlugin ) |
|
470 { |
|
471 delete iBatteryPlugin; |
|
472 delete iSignalPlugin; |
|
473 REComSession::FinalClose(); |
|
474 } |
|
475 |
|
476 MTouchFeedback* feedback = MTouchFeedback::Instance(); |
|
477 if ( feedback ) |
|
478 { |
|
479 feedback->RemoveFeedbackForControl( this ); |
|
480 } |
|
481 |
|
482 delete iSeparatorIcon; |
|
483 } |
|
484 |
|
485 |
|
486 // ----------------------------------------------------------------------------- |
|
487 // From class CCoeControl |
|
488 // CAknIndicatorPopupContent::MinimumSize |
|
489 // ----------------------------------------------------------------------------- |
|
490 // |
|
491 TSize CAknIndicatorPopupContent::MinimumSize() |
|
492 { |
|
493 TInt items( iItems.Count() ); |
|
494 |
|
495 // Get the maximum number of indicator items from layout data. |
|
496 TAknLayoutScalableParameterLimits limits( |
|
497 AknLayoutScalable_Avkon::list_single_uniindi_pane_ParamLimits() ); |
|
498 TInt variety( limits.LastRow() + 1 ); // Last variety for no indicator items |
|
499 |
|
500 if ( items > 0 ) |
|
501 { |
|
502 if ( items <= variety ) |
|
503 { |
|
504 variety -= items; |
|
505 } |
|
506 else |
|
507 { |
|
508 variety = 0; // Maximum number of items. |
|
509 } |
|
510 } |
|
511 |
|
512 TRect applicationWindow; |
|
513 AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EApplicationWindow, |
|
514 applicationWindow ); |
|
515 |
|
516 TAknLayoutRect layoutRect; |
|
517 layoutRect.LayoutRect( |
|
518 applicationWindow, |
|
519 AknLayoutScalable_Avkon::popup_uni_indicator_window( variety ) ); |
|
520 |
|
521 return TSize( layoutRect.Rect().Size() ); |
|
522 } |
|
523 |
|
524 |
|
525 // ----------------------------------------------------------------------------- |
|
526 // From class CCoeControl |
|
527 // CAknIndicatorPopupContent::HandleResourceChange |
|
528 // ----------------------------------------------------------------------------- |
|
529 // |
|
530 void CAknIndicatorPopupContent::HandleResourceChange( TInt aType ) |
|
531 { |
|
532 CCoeControl::HandleResourceChange( aType ); |
|
533 |
|
534 TInt itemCount( iItems.Count() ); |
|
535 |
|
536 switch ( aType ) |
|
537 { |
|
538 case KAknsMessageSkinChange: |
|
539 { |
|
540 // Update clock text color. |
|
541 TRgb textColor; |
|
542 |
|
543 MAknsSkinInstance* skin = AknsUtils::SkinInstance(); |
|
544 |
|
545 AknsUtils::GetCachedColor( skin, |
|
546 textColor, |
|
547 KAknsIIDQsnTextColors, |
|
548 EAknsCIQsnTextColorsCG55 ); |
|
549 |
|
550 iClock->SetColor( textColor ); |
|
551 |
|
552 // Update signal icon. |
|
553 iSignal->SetColorIndex( 0 ); // reset skin color |
|
554 TRAP_IGNORE( SetSignalStateL( iSignalState ) ); |
|
555 // Color of the battery indicator is changed by it's container. |
|
556 iBattery->HandleResourceChange( aType ); |
|
557 // Update the signal icon and separator line color. |
|
558 TRAP_IGNORE( LoadIconsL() ); |
|
559 |
|
560 // Update the color of the indicator icons. |
|
561 for ( TInt i = 0; i < itemCount; i++ ) |
|
562 { |
|
563 TRAP_IGNORE( iItems[i]->UpdateIndicatorIconL() ); |
|
564 } |
|
565 break; |
|
566 } |
|
567 |
|
568 case KEikMessageFadeAllWindows: |
|
569 { |
|
570 if ( !Window().IsFaded() ) |
|
571 { |
|
572 Window().SetFaded( ETrue, |
|
573 RWindowTreeNode::EFadeIncludeChildren ); |
|
574 } |
|
575 break; |
|
576 } |
|
577 |
|
578 case KEikMessageUnfadeWindows: |
|
579 { |
|
580 if ( Window().IsFaded() ) |
|
581 { |
|
582 Window().SetFaded( EFalse, |
|
583 RWindowTreeNode::EFadeIncludeChildren ); |
|
584 } |
|
585 break; |
|
586 } |
|
587 |
|
588 default: |
|
589 break; |
|
590 } |
|
591 } |
|
592 |
|
593 |
|
594 // ----------------------------------------------------------------------------- |
|
595 // From class CCoeControl |
|
596 // CAknIndicatorPopupContent::HandlePointerEventL |
|
597 // ----------------------------------------------------------------------------- |
|
598 // |
|
599 void CAknIndicatorPopupContent::HandlePointerEventL( |
|
600 const TPointerEvent& aPointerEvent ) |
|
601 { |
|
602 if ( Rect().Contains( aPointerEvent.iPosition ) ) |
|
603 { |
|
604 CBase* currentFocusedItem = NULL; |
|
605 switch ( aPointerEvent.iType ) |
|
606 { |
|
607 case TPointerEvent::EButton1Down: |
|
608 // Set flag that down was inside the popup. |
|
609 iFlags |= EAknIndicatorPopupContentButton1Down; |
|
610 iPreviousPressedDownItem = NULL; |
|
611 |
|
612 if ( iClock->Rect().Contains( aPointerEvent.iPosition )) |
|
613 { |
|
614 currentFocusedItem = iClock; |
|
615 iPressedDownRect = iClockPressedDownArea; |
|
616 } |
|
617 else if ( iSignalArea.Contains( aPointerEvent.iPosition )) |
|
618 { |
|
619 currentFocusedItem = iSignal; |
|
620 iPressedDownRect = iSignalPressedDownArea; |
|
621 } |
|
622 else if ( iBatteryArea.Contains( aPointerEvent.iPosition )) |
|
623 { |
|
624 currentFocusedItem = iBattery; |
|
625 iPressedDownRect = iBatteryArea; |
|
626 } |
|
627 else |
|
628 { |
|
629 CAknIndicatorPopupItem* item = TappedItem( aPointerEvent.iPosition ); |
|
630 if ( item ) |
|
631 { |
|
632 currentFocusedItem = item; |
|
633 iPressedDownRect = item->iRect; |
|
634 } |
|
635 else |
|
636 // No item get tapped |
|
637 { |
|
638 return; |
|
639 } |
|
640 } |
|
641 iEnablePressedDownState = ETrue; |
|
642 Window().Invalidate( iPressedDownRect ); |
|
643 iPreviousPressedDownItem = currentFocusedItem; |
|
644 break; |
|
645 |
|
646 case TPointerEvent::EDrag: |
|
647 if ( iClock->Rect().Contains( aPointerEvent.iPosition )) |
|
648 { |
|
649 currentFocusedItem = iClock; |
|
650 } |
|
651 else if ( iSignalArea.Contains( aPointerEvent.iPosition )) |
|
652 { |
|
653 currentFocusedItem = iSignal; |
|
654 } |
|
655 else if ( iBatteryArea.Contains( aPointerEvent.iPosition )) |
|
656 { |
|
657 currentFocusedItem = iBattery; |
|
658 } |
|
659 else |
|
660 { |
|
661 currentFocusedItem = TappedItem( aPointerEvent.iPosition ); |
|
662 } |
|
663 |
|
664 if( currentFocusedItem != iPreviousPressedDownItem ) |
|
665 { |
|
666 iFlags &= ~EAknIndicatorPopupContentButton1Down; |
|
667 iEnablePressedDownState = EFalse; |
|
668 Window().Invalidate( iPressedDownRect ); |
|
669 } |
|
670 break; |
|
671 |
|
672 case TPointerEvent::EButton1Up: |
|
673 if ( iFlags & EAknIndicatorPopupContentButton1Down ) |
|
674 { |
|
675 // Up happened, reset button down flag. |
|
676 iFlags &= ( ~EAknIndicatorPopupContentButton1Down ); |
|
677 iEnablePressedDownState = EFalse; |
|
678 |
|
679 if ( iBatteryPlugin && |
|
680 iBatteryArea.Contains( aPointerEvent.iPosition ) ) |
|
681 { |
|
682 ReportEventL( |
|
683 static_cast<MCoeControlObserver::TCoeEvent>( |
|
684 EAknIndicatorPopupTapEvent ) ); |
|
685 |
|
686 // Dummy value used as indicator UID parameter, |
|
687 // as it's not used by the battery indicator plugin. |
|
688 iBatteryPlugin->HandleIndicatorTapL( 0 ); |
|
689 break; |
|
690 } |
|
691 else if ( iSignalPlugin && |
|
692 iSignalArea.Contains( aPointerEvent.iPosition ) ) |
|
693 { |
|
694 ReportEventL( |
|
695 static_cast<MCoeControlObserver::TCoeEvent>( |
|
696 EAknIndicatorPopupTapEvent ) ); |
|
697 |
|
698 // Dummy value used as indicator UID parameter, |
|
699 // as it's not used by the signal indicator plugin. |
|
700 iSignalPlugin->HandleIndicatorTapL( 0 ); |
|
701 break; |
|
702 } |
|
703 else if ( iClock && |
|
704 iClock->Rect().Contains( aPointerEvent.iPosition ) ) |
|
705 { |
|
706 ReportEventL( |
|
707 static_cast<MCoeControlObserver::TCoeEvent>( |
|
708 EAknIndicatorPopupTapEvent ) ); |
|
709 |
|
710 if ( !( iFlags & EAknIndicatorPopupContentClockBeingLaunched ) ) |
|
711 { |
|
712 // Start clock application directly when down event |
|
713 // happens in clock, this functionality was previously |
|
714 // in the CAknDigitalClock. |
|
715 RApaLsSession apa; |
|
716 User::LeaveIfError( apa.Connect() ); |
|
717 CleanupClosePushL( apa ); |
|
718 CApaCommandLine* cmdLine = CApaCommandLine::NewLC(); |
|
719 cmdLine->SetExecutableNameL( KClockApplication ); |
|
720 cmdLine->SetCommandL( EApaCommandRun ); |
|
721 User::LeaveIfError( apa.StartApp( *cmdLine ) ); |
|
722 CleanupStack::PopAndDestroy( 2, &apa ); // cmdLine and apa |
|
723 |
|
724 // Set the flag indicating that clock is being launched. |
|
725 iFlags |= EAknIndicatorPopupContentClockBeingLaunched; |
|
726 } |
|
727 } |
|
728 |
|
729 CAknIndicatorPopupItem* item = TappedItem( aPointerEvent.iPosition ); |
|
730 if ( item ) |
|
731 { |
|
732 ReportEventL( |
|
733 static_cast<MCoeControlObserver::TCoeEvent>( |
|
734 EAknIndicatorPopupTapEvent ) ); |
|
735 |
|
736 item->iPlugin->HandleIndicatorTapL( item->iUid ); |
|
737 break; |
|
738 } |
|
739 } |
|
740 break; |
|
741 |
|
742 default: |
|
743 break; |
|
744 } |
|
745 } |
|
746 else if ( iFlags & EAknIndicatorPopupContentButton1Down )// Drag to outside |
|
747 { |
|
748 iFlags &= ~EAknIndicatorPopupContentButton1Down; |
|
749 iEnablePressedDownState = EFalse; |
|
750 Window().Invalidate( iPressedDownRect ); |
|
751 } |
|
752 } |
|
753 |
|
754 |
|
755 // ----------------------------------------------------------------------------- |
|
756 // From class CCoeControl |
|
757 // CAknIndicatorPopupContent::CountComponentControls |
|
758 // ----------------------------------------------------------------------------- |
|
759 // |
|
760 TInt CAknIndicatorPopupContent::CountComponentControls() const |
|
761 { |
|
762 TInt count = 0; |
|
763 |
|
764 if ( iClock ) |
|
765 { |
|
766 count++; |
|
767 } |
|
768 |
|
769 if ( iBattery ) |
|
770 { |
|
771 count++; |
|
772 } |
|
773 |
|
774 if ( iSignal ) |
|
775 { |
|
776 count++; |
|
777 } |
|
778 |
|
779 return count; |
|
780 } |
|
781 |
|
782 |
|
783 // ----------------------------------------------------------------------------- |
|
784 // From class CCoeControl |
|
785 // CAknIndicatorPopupContent::ComponentControl |
|
786 // ----------------------------------------------------------------------------- |
|
787 // |
|
788 CCoeControl* CAknIndicatorPopupContent::ComponentControl( TInt aIndex ) const |
|
789 { |
|
790 CCoeControl* componentControl = NULL; |
|
791 |
|
792 switch ( aIndex ) |
|
793 { |
|
794 case 0: |
|
795 componentControl = iClock; |
|
796 break; |
|
797 case 1: |
|
798 componentControl = iBattery; |
|
799 break; |
|
800 case 2: |
|
801 componentControl = iSignal; |
|
802 break; |
|
803 default: |
|
804 break; |
|
805 } |
|
806 |
|
807 return componentControl; |
|
808 } |
|
809 |
|
810 |
|
811 // ----------------------------------------------------------------------------- |
|
812 // From class CCoeControl. |
|
813 // CAknIndicatorPopupContent::SetContainerWindowL |
|
814 // ----------------------------------------------------------------------------- |
|
815 // |
|
816 void CAknIndicatorPopupContent::SetContainerWindowL( |
|
817 const CCoeControl& aContainer ) |
|
818 { |
|
819 CCoeControl::SetContainerWindowL( aContainer ); |
|
820 |
|
821 if( iClock ) |
|
822 { |
|
823 iClock->SetContainerWindowL( aContainer ); |
|
824 } |
|
825 } |
|
826 |
|
827 |
|
828 // --------------------------------------------------------------------------- |
|
829 // CAknIndicatorPopupContent::AddItemL |
|
830 // --------------------------------------------------------------------------- |
|
831 // |
|
832 void CAknIndicatorPopupContent::AddItemL( TInt aIndicatorUid, |
|
833 const TDesC& aText, |
|
834 TInt aTextType, |
|
835 const CGulIcon* aIcon, |
|
836 CAknIndicatorPlugin* aPlugin, |
|
837 TInt aPriority ) |
|
838 { |
|
839 TInt itemCount( iItems.Count() ); |
|
840 for ( TInt i = 0; i < itemCount; i++ ) |
|
841 { |
|
842 if ( iItems[i]->iUid == aIndicatorUid ) |
|
843 { |
|
844 // Indicator item exists already. |
|
845 return; |
|
846 } |
|
847 } |
|
848 |
|
849 CAknIndicatorPopupItem* newItem = |
|
850 new (ELeave) CAknIndicatorPopupItem( aIndicatorUid, |
|
851 aPlugin, |
|
852 aPriority, |
|
853 aTextType ); |
|
854 |
|
855 if ( aIcon ) |
|
856 { |
|
857 // If the plugin provides an icon, use it. |
|
858 newItem->ConstructL( aText, aIcon ); |
|
859 } |
|
860 else |
|
861 { |
|
862 // Otherwise use the same icon as in the indicator pane. |
|
863 TInt bitmapID; |
|
864 TInt maskID; |
|
865 |
|
866 CAknIndicator::GetBitmapIndexL( |
|
867 CAknIndicatorContainer::EUniversalIndicators, |
|
868 aIndicatorUid, |
|
869 bitmapID, |
|
870 maskID ); |
|
871 |
|
872 newItem->ConstructL( aText, bitmapID, maskID ); |
|
873 } |
|
874 |
|
875 if ( aPlugin ) |
|
876 { |
|
877 aPlugin->SetPluginObserver( this ); |
|
878 } |
|
879 |
|
880 iItems.AppendL( newItem ); |
|
881 |
|
882 // Discard possible pressed down highlight when the popup size changes, |
|
883 // as the position of the highlighted item may change. |
|
884 iEnablePressedDownState = EFalse; |
|
885 |
|
886 SizeChanged(); |
|
887 } |
|
888 |
|
889 |
|
890 // --------------------------------------------------------------------------- |
|
891 // CAknIndicatorPopupContent::RemoveItem |
|
892 // --------------------------------------------------------------------------- |
|
893 // |
|
894 void CAknIndicatorPopupContent::RemoveItem( TInt aIndicatorUid ) |
|
895 { |
|
896 TInt itemCount( iItems.Count() ); |
|
897 for ( TInt i = 0; i < itemCount; i++ ) |
|
898 { |
|
899 if ( iItems[i]->iUid == aIndicatorUid ) |
|
900 { |
|
901 delete iItems[i]; |
|
902 iItems[i] = NULL; |
|
903 iItems.Remove( i ); |
|
904 break; |
|
905 } |
|
906 } |
|
907 |
|
908 // Discard possible pressed down highlight when the popup size changes, |
|
909 // as the position of the highlighted item may change. |
|
910 iEnablePressedDownState = EFalse; |
|
911 |
|
912 SizeChanged(); |
|
913 } |
|
914 |
|
915 |
|
916 // --------------------------------------------------------------------------- |
|
917 // CAknIndicatorPopupContent::SetContentVisible |
|
918 // --------------------------------------------------------------------------- |
|
919 // |
|
920 void CAknIndicatorPopupContent::SetContentVisible( TBool aVisible ) |
|
921 { |
|
922 if ( aVisible ) |
|
923 { |
|
924 SizeChanged(); // also includes UpdateFeedbackAreas() |
|
925 } |
|
926 if ( iClock ) |
|
927 { |
|
928 // The clock timer needs to be running only when the |
|
929 // popup is visible. |
|
930 if ( aVisible ) |
|
931 { |
|
932 // Error ignored, if this leaves then the clock |
|
933 // is not updated if time changes while popup is visible. |
|
934 iClock->StartTimer(); |
|
935 } |
|
936 else |
|
937 { |
|
938 iClock->StopTimer(); |
|
939 } |
|
940 } |
|
941 |
|
942 |
|
943 if ( !aVisible ) |
|
944 { |
|
945 // Remove this popup from the global popup priority stack. |
|
946 AknGlobalPopupPriorityController::RemovePopupPriority( *this ); |
|
947 |
|
948 // Clear the state flags. |
|
949 iFlags &= ( ~EAknIndicatorPopupContentButton1Down ); |
|
950 iFlags &= ( ~EAknIndicatorPopupContentClockBeingLaunched ); |
|
951 } |
|
952 else |
|
953 { |
|
954 // Add this popup from the global popup priority stack so |
|
955 // that it can receive key events. |
|
956 // Note that the popup priority is not set, so it has |
|
957 // priority the default priority, which is 0. |
|
958 AknGlobalPopupPriorityController::ShowPopup( *this, ETrue ); |
|
959 } |
|
960 } |
|
961 |
|
962 // --------------------------------------------------------------------------- |
|
963 // CAknIndicatorPopupContent::SetBatteryStateL |
|
964 // --------------------------------------------------------------------------- |
|
965 // |
|
966 void CAknIndicatorPopupContent::SetBatteryStateL( TInt aState ) |
|
967 { |
|
968 if ( iBattery ) |
|
969 { |
|
970 iBattery->SetBatteryIconL( aState ); |
|
971 } |
|
972 } |
|
973 // --------------------------------------------------------------------------- |
|
974 // CAknIndicatorPopupContent::SetSignalStateL |
|
975 // --------------------------------------------------------------------------- |
|
976 // |
|
977 void CAknIndicatorPopupContent::SetSignalStateL( TInt aState ) |
|
978 { |
|
979 TInt newState( aState ); |
|
980 |
|
981 if ( iSignal ) |
|
982 { |
|
983 if ( newState == KAknSignalOffLineMode ) |
|
984 { |
|
985 // Set offline state icon to the signal area. |
|
986 iSignal->SetOffLine( ETrue ); |
|
987 } |
|
988 else if ( newState == KAknSignalOffLineMode - 1 ) |
|
989 { |
|
990 // This aState parameter is used to inform about connection |
|
991 // state change from offline mode. Signal icon is set not |
|
992 // to be in offline state and the correct signal state is |
|
993 // used from iSignalState. |
|
994 iSignal->SetOffLine( EFalse ); |
|
995 newState = iSignalState; |
|
996 } |
|
997 iSignal->LoadIconL( newState, EAknsCIQsnIconColorsCG5 ); |
|
998 } |
|
999 |
|
1000 // Ensure that the new value is valid, offline mode state is |
|
1001 // not stored as a signal state. |
|
1002 if ( newState >= 0 && |
|
1003 newState <= EAknSignalHsdpaIndicatorMultipdp ) // last signal state |
|
1004 { |
|
1005 iSignalState = newState; |
|
1006 } |
|
1007 } |
|
1008 // ----------------------------------------------------------------------------- |
|
1009 // CAknIndicatorPopupContent::HandlePluginUpdateL |
|
1010 // ----------------------------------------------------------------------------- |
|
1011 // |
|
1012 void CAknIndicatorPopupContent::HandlePluginUpdateL( TInt aUid ) |
|
1013 { |
|
1014 TInt itemCount( iItems.Count() ); |
|
1015 for ( TInt i = 0; i < itemCount; i++ ) |
|
1016 { |
|
1017 if ( iItems[i]->iUid == aUid && |
|
1018 iItems[i]->iPlugin ) // Can update only if we have a |
|
1019 { // pointer to the plugin. |
|
1020 // Update text |
|
1021 TInt textType; |
|
1022 HBufC* text = iItems[i]->iPlugin->TextL( aUid, textType ); |
|
1023 if ( text ) |
|
1024 { |
|
1025 CleanupStack::PushL( text ); |
|
1026 iItems[i]->UpdateTextL( *text, textType ); |
|
1027 CleanupStack::PopAndDestroy( text ); |
|
1028 } |
|
1029 |
|
1030 // Update icon |
|
1031 const CGulIcon* icon = NULL; |
|
1032 TRAPD( err, icon = iItems[i]->iPlugin->IconL( aUid ) ); |
|
1033 if ( !err && icon ) |
|
1034 { |
|
1035 iItems[i]->UpdateIndicatorIconL( icon ); |
|
1036 } |
|
1037 |
|
1038 break; |
|
1039 } |
|
1040 } |
|
1041 |
|
1042 DrawDeferred(); |
|
1043 } |
|
1044 |
|
1045 |
|
1046 // ----------------------------------------------------------------------------- |
|
1047 // CAknIndicatorPopupContent::UpdateAllIndicatorsL |
|
1048 // ----------------------------------------------------------------------------- |
|
1049 // |
|
1050 void CAknIndicatorPopupContent::UpdateAllIndicatorsL() |
|
1051 { |
|
1052 CAknIndicatorPlugin* plugin = NULL; |
|
1053 TInt itemCount( iItems.Count() ); |
|
1054 |
|
1055 for ( TInt i = 0; i < itemCount; i++ ) |
|
1056 { |
|
1057 plugin = iItems[i]->iPlugin; |
|
1058 |
|
1059 if ( plugin ) // Can update only if we have a |
|
1060 { // pointer to the plugin. |
|
1061 TInt uid( iItems[i]->iUid ); |
|
1062 |
|
1063 // Update text |
|
1064 TInt textType; |
|
1065 HBufC* text = plugin->TextL( uid, textType ); |
|
1066 if ( text ) |
|
1067 { |
|
1068 CleanupStack::PushL( text ); |
|
1069 iItems[i]->UpdateTextL( *text, textType ); |
|
1070 CleanupStack::PopAndDestroy( text ); |
|
1071 } |
|
1072 |
|
1073 // Update icon |
|
1074 const CGulIcon* icon = NULL; |
|
1075 TRAPD( err, icon = plugin->IconL( uid ) ); |
|
1076 if ( !err && icon ) |
|
1077 { |
|
1078 iItems[i]->UpdateIndicatorIconL( icon ); |
|
1079 } |
|
1080 } |
|
1081 } |
|
1082 } |
|
1083 |
|
1084 |
|
1085 // ----------------------------------------------------------------------------- |
|
1086 // Default constructor. |
|
1087 // ----------------------------------------------------------------------------- |
|
1088 // |
|
1089 CAknIndicatorPopupContent::CAknIndicatorPopupContent() |
|
1090 : iItems( KItemArrayGranularity ) |
|
1091 { |
|
1092 } |
|
1093 |
|
1094 |
|
1095 // ----------------------------------------------------------------------------- |
|
1096 // CAknIndicatorPopupContent::ConstructL |
|
1097 // ----------------------------------------------------------------------------- |
|
1098 // |
|
1099 void CAknIndicatorPopupContent::ConstructL() |
|
1100 { |
|
1101 iClock = CAknDigitalClock::NewL( this ); |
|
1102 TAknTextLineLayout clockLayout( |
|
1103 AknLayoutScalable_Avkon::uniindi_top_pane_t1( 1 ).LayoutLine() ); |
|
1104 |
|
1105 // Ensure that the left and right values of the clock text layout |
|
1106 // are zero, currently the whole top area is set as the parent |
|
1107 // for this layout, so it's narrowed by reducting the |
|
1108 // signal pane area. |
|
1109 clockLayout.il = 0; |
|
1110 clockLayout.ir = 0; |
|
1111 iClock->SetTimeLayout( clockLayout ); |
|
1112 TRgb textColor; |
|
1113 |
|
1114 MAknsSkinInstance* skin = AknsUtils::SkinInstance(); |
|
1115 |
|
1116 AknsUtils::GetCachedColor( skin, |
|
1117 textColor, |
|
1118 KAknsIIDQsnTextColors, |
|
1119 EAknsCIQsnTextColorsCG55 ); |
|
1120 iClock->SetColor( textColor ); |
|
1121 |
|
1122 iBattery = CAknBatteryIcon::NewL(); |
|
1123 iBattery->SetContainerWindowL( *this ); |
|
1124 iSignal = CAknSignalIcon::NewL(); |
|
1125 iSignal->SetContainerWindowL( *this ); |
|
1126 |
|
1127 // Create default signal icon. |
|
1128 iSignal->LoadIconL( 0, EAknsCIQsnIconColorsCG5 ); |
|
1129 |
|
1130 // Set this to draw the icon also in offline mode. |
|
1131 iSignal->SetOffLineIconDraw( ETrue ); |
|
1132 TRAPD( err, iBatteryPlugin = CAknIndicatorPlugin::NewL( |
|
1133 TUid::Uid( KImplUIDBatteryIndicatorPlugin ) ) ); |
|
1134 if ( err == KErrNone ) |
|
1135 { |
|
1136 iBatteryPlugin->SetPluginObserver( this ); |
|
1137 } |
|
1138 TRAPD( err1, iSignalPlugin = CAknIndicatorPlugin::NewL( |
|
1139 TUid::Uid( KImplUIDSignalIndicatorPlugin ) ) ); |
|
1140 if ( err1 == KErrNone ) |
|
1141 { |
|
1142 iSignalPlugin->SetPluginObserver( this ); |
|
1143 } |
|
1144 |
|
1145 iFeedback = MTouchFeedback::Instance(); |
|
1146 |
|
1147 // Load the separator line and signal icon graphics. |
|
1148 LoadIconsL(); |
|
1149 |
|
1150 iEnablePressedDownState = EFalse; |
|
1151 iPreviousPressedDownItem = NULL; |
|
1152 } |
|
1153 |
|
1154 |
|
1155 // ----------------------------------------------------------------------------- |
|
1156 // CAknIndicatorPopupContent::PrioritizeIndicatorsL |
|
1157 // ----------------------------------------------------------------------------- |
|
1158 // |
|
1159 void CAknIndicatorPopupContent::PrioritizeIndicatorsL() |
|
1160 { |
|
1161 TInt count = iItems.Count(); |
|
1162 if ( count < 2 ) |
|
1163 { |
|
1164 return; |
|
1165 } |
|
1166 |
|
1167 CAknIndicatorPopupItem* temp; |
|
1168 for ( TInt ii = 1; ii < count; ii++ ) |
|
1169 { |
|
1170 temp = iItems[ii]; |
|
1171 TInt tempPriority = temp->iPriority; |
|
1172 |
|
1173 if ( tempPriority >= 0 ) |
|
1174 { |
|
1175 for ( TInt jj = 0; jj <= ii; jj++ ) |
|
1176 { |
|
1177 TInt indicatorPriority = iItems[jj]->iPriority; |
|
1178 |
|
1179 if ( tempPriority < indicatorPriority ) |
|
1180 { |
|
1181 iItems.Remove( ii ); |
|
1182 iItems.InsertL( temp, jj ); |
|
1183 break; |
|
1184 } |
|
1185 else if ( jj == ( ii - 1 ) ) |
|
1186 { |
|
1187 break; |
|
1188 } |
|
1189 } |
|
1190 } |
|
1191 } |
|
1192 } |
|
1193 |
|
1194 |
|
1195 // ----------------------------------------------------------------------------- |
|
1196 // CAknIndicatorPopupContent::UpdateFeedbackAreas |
|
1197 // |
|
1198 // Digital clock takes care of its own feedback, but we have to either |
|
1199 // enable or block feedback for signal indicator, according to |
|
1200 // wheather it has associated plug-in or not (if it has plug-in, then |
|
1201 // something happens when it is tapped and feedback should be produced). |
|
1202 // |
|
1203 // In addition we have to set feedback to every item, which acts as a link. |
|
1204 // ----------------------------------------------------------------------------- |
|
1205 // |
|
1206 void CAknIndicatorPopupContent::UpdateFeedbackAreas() |
|
1207 { |
|
1208 if ( iFeedback ) |
|
1209 { |
|
1210 // First remove all old feedback areas |
|
1211 iFeedback->RemoveFeedbackForControl( this ); |
|
1212 if ( iBatteryPlugin ) |
|
1213 { |
|
1214 // Set battery indicator's feedback area |
|
1215 CFeedbackSpec* fbSpec = CFeedbackSpec::New(); |
|
1216 if ( fbSpec ) |
|
1217 { |
|
1218 fbSpec->AddFeedback( ETouchEventStylusDown, |
|
1219 ETouchFeedbackSensitiveButton ); |
|
1220 fbSpec->AddFeedback( ETouchEventStylusUp, |
|
1221 ETouchFeedbackSensitiveButton, |
|
1222 ETouchFeedbackVibra ); |
|
1223 |
|
1224 iFeedback->SetFeedbackArea( this, |
|
1225 KBatteryAreaIndex, |
|
1226 iBatteryArea, |
|
1227 fbSpec ); |
|
1228 delete fbSpec; |
|
1229 } |
|
1230 } |
|
1231 |
|
1232 if ( iSignalPlugin ) |
|
1233 { |
|
1234 // Set signal indicator's feedback area |
|
1235 CFeedbackSpec* fbSpec = CFeedbackSpec::New(); |
|
1236 if ( fbSpec ) |
|
1237 { |
|
1238 fbSpec->AddFeedback( ETouchEventStylusDown, |
|
1239 ETouchFeedbackSensitiveButton ); |
|
1240 fbSpec->AddFeedback( ETouchEventStylusUp, |
|
1241 ETouchFeedbackSensitiveButton, |
|
1242 ETouchFeedbackVibra ); |
|
1243 |
|
1244 iFeedback->SetFeedbackArea( this, |
|
1245 KSignalAreaIndex, |
|
1246 iSignalArea, |
|
1247 fbSpec ); |
|
1248 delete fbSpec; |
|
1249 } |
|
1250 } |
|
1251 |
|
1252 // Go through the items, and set feedback areas for those which act |
|
1253 // as link (i.e. have associated plugin) |
|
1254 TInt itemCount( iItems.Count() ); |
|
1255 |
|
1256 for ( TInt i = 0; i < itemCount; i++ ) |
|
1257 { |
|
1258 if ( iItems[i]->iPlugin && |
|
1259 iItems[i]->iTextType == |
|
1260 CAknIndicatorPlugin::EAknIndicatorPluginLinkText && |
|
1261 iItems[i]->iRect != TRect( 0, 0, 0, 0 ) ) |
|
1262 { |
|
1263 CFeedbackSpec* fbSpec = CFeedbackSpec::New(); |
|
1264 if ( fbSpec ) |
|
1265 { |
|
1266 fbSpec->AddFeedback( ETouchEventStylusDown, |
|
1267 ETouchFeedbackSensitiveButton ); |
|
1268 |
|
1269 iFeedback->SetFeedbackArea( this, |
|
1270 KSignalAreaIndex + i + 1, |
|
1271 iItems[i]->iRect, |
|
1272 fbSpec ); |
|
1273 delete fbSpec; |
|
1274 } |
|
1275 } |
|
1276 } |
|
1277 } |
|
1278 } |
|
1279 |
|
1280 |
|
1281 // ----------------------------------------------------------------------------- |
|
1282 // CAknIndicatorPopupContent::LoadIconsL |
|
1283 // ----------------------------------------------------------------------------- |
|
1284 // |
|
1285 void CAknIndicatorPopupContent::LoadIconsL() |
|
1286 { |
|
1287 TRect rect( Rect() ); |
|
1288 |
|
1289 delete iSeparatorIcon; |
|
1290 iSeparatorIcon = NULL; |
|
1291 |
|
1292 CFbsBitmap* bitmap = NULL; |
|
1293 CFbsBitmap* mask = NULL; |
|
1294 |
|
1295 AknsUtils::CreateColorIconL( AknsUtils::SkinInstance(), |
|
1296 KAknsIIDQgnGrafLineVerticalFade, |
|
1297 KAknsIIDQsnLineColors, |
|
1298 EAknsCIQsnLineColorsCG3, |
|
1299 bitmap, |
|
1300 mask, |
|
1301 KNullDesC, |
|
1302 KErrNotFound, |
|
1303 KErrNotFound, |
|
1304 KRgbGray ); |
|
1305 |
|
1306 iSeparatorIcon = CGulIcon::NewL( bitmap, mask ); |
|
1307 |
|
1308 TAknLayoutRect layoutRect; |
|
1309 layoutRect.LayoutRect( |
|
1310 rect, |
|
1311 AknLayoutScalable_Avkon::uniindi_top_pane() ); |
|
1312 |
|
1313 layoutRect.LayoutRect( |
|
1314 layoutRect.Rect(), |
|
1315 AknLayoutScalable_Avkon::uniindi_top_pane_g3( 1 ) ); |
|
1316 |
|
1317 AknIconUtils::SetSize( iSeparatorIcon->Bitmap(), |
|
1318 layoutRect.Rect().Size(), |
|
1319 EAspectRatioNotPreserved ); |
|
1320 |
|
1321 // |
|
1322 // Create a custom signal icon for connectivity manager link. |
|
1323 // |
|
1324 |
|
1325 CFbsBitmap* signalBitmap = NULL; |
|
1326 CFbsBitmap* signalMask = NULL; |
|
1327 |
|
1328 AknsUtils::CreateColorIconL( AknsUtils::SkinInstance(), |
|
1329 KAknsIIDQgnPropLinkConnectionManager, |
|
1330 KAknsIIDQsnIconColors, |
|
1331 EAknsCIQsnIconColorsCG5, |
|
1332 signalBitmap, |
|
1333 signalMask, |
|
1334 AknIconUtils::AvkonIconFileName(), |
|
1335 EMbmAvkonQgn_prop_link_connection_manager, |
|
1336 EMbmAvkonQgn_prop_link_connection_manager_mask, |
|
1337 KRgbGray ); |
|
1338 |
|
1339 // Ownership is transferred. |
|
1340 iSignal->SetSignalIcon( signalBitmap ); |
|
1341 iSignal->SetSignalIconMask( signalMask ); |
|
1342 } |
|
1343 |
|
1344 // ----------------------------------------------------------------------------- |
|
1345 // CAknIndicatorPopupContent::TappedItem |
|
1346 // ----------------------------------------------------------------------------- |
|
1347 // |
|
1348 CAknIndicatorPopupItem* |
|
1349 CAknIndicatorPopupContent::TappedItem(const TPoint& aPoint) const |
|
1350 { |
|
1351 for ( TInt ii = 0; ii < iItems.Count(); ii++ ) |
|
1352 { |
|
1353 CAknIndicatorPopupItem* item = iItems[ii]; |
|
1354 if ( item->iRect.Contains( aPoint ) && item->iPlugin |
|
1355 && item->iTextType == |
|
1356 CAknIndicatorPlugin::EAknIndicatorPluginLinkText ) |
|
1357 { |
|
1358 return item; |
|
1359 } |
|
1360 } |
|
1361 return NULL; |
|
1362 } |
|
1363 |
|
1364 // ----------------------------------------------------------------------------- |
|
1365 // From class CCoeControl |
|
1366 // CAknIndicatorPopupContent::SizeChanged |
|
1367 // ----------------------------------------------------------------------------- |
|
1368 // |
|
1369 void CAknIndicatorPopupContent::SizeChanged() |
|
1370 { |
|
1371 TRect rect( Rect() ); |
|
1372 |
|
1373 // Popup window top area |
|
1374 TAknLayoutRect layoutRect; |
|
1375 layoutRect.LayoutRect( rect, |
|
1376 AknLayoutScalable_Avkon::uniindi_top_pane() ); |
|
1377 TRect topRect( layoutRect.Rect() ); |
|
1378 |
|
1379 // Signal pane area |
|
1380 layoutRect.LayoutRect( topRect, |
|
1381 AknLayoutScalable_Avkon::uniindi_top_pane_g1() ); |
|
1382 TRect signalRect( layoutRect.Rect() ); |
|
1383 |
|
1384 // Battery pane area |
|
1385 layoutRect.LayoutRect( topRect, |
|
1386 AknLayoutScalable_Avkon::uniindi_top_pane_g2() ); |
|
1387 TRect batteryRect( layoutRect.Rect() ); |
|
1388 |
|
1389 // Clock pane area |
|
1390 layoutRect.LayoutRect( topRect, |
|
1391 AknLayoutScalable_Avkon::aid_area_touch_clock() ); |
|
1392 TRect clockRect( layoutRect.Rect() ); |
|
1393 |
|
1394 // Separator line size |
|
1395 layoutRect.LayoutRect( |
|
1396 topRect, |
|
1397 AknLayoutScalable_Avkon::uniindi_top_pane_g3() ); |
|
1398 TRect separatorRect = layoutRect.Rect(); |
|
1399 TSize separatorSize( layoutRect.Rect().Size() ); |
|
1400 |
|
1401 TBool layoutMirrored( AknLayoutUtils::LayoutMirrored() ); |
|
1402 |
|
1403 iClock->SetRect( clockRect ); |
|
1404 iBattery->SetRect( batteryRect ); |
|
1405 iSignal->SetRect( signalRect ); |
|
1406 |
|
1407 // Make the touch responsive areas of signal pane |
|
1408 // slightly larger by not taking into account the margins from |
|
1409 // top and sides. |
|
1410 iBatteryArea = batteryRect; |
|
1411 iSignalArea = signalRect; |
|
1412 |
|
1413 if ( layoutMirrored ) |
|
1414 { |
|
1415 iBatteryArea.iTl = topRect.iTl; |
|
1416 iBatteryArea.iBr.iY = topRect.iBr.iY; |
|
1417 iSignalArea.iBr = topRect.iBr; |
|
1418 iSignalArea.iTl.iY = topRect.iTl.iY; |
|
1419 } |
|
1420 else |
|
1421 { |
|
1422 iBatteryArea.iBr = topRect.iBr; |
|
1423 iBatteryArea.iTl.iY = topRect.iTl.iY; |
|
1424 iBatteryArea.iTl.iX = clockRect.iBr.iX; |
|
1425 iSignalArea.iTl = topRect.iTl; |
|
1426 iSignalArea.iBr.iY = topRect.iBr.iY; |
|
1427 } |
|
1428 |
|
1429 // Calculate permanent component press down effect rect |
|
1430 iSignalPressedDownArea = iSignalArea; |
|
1431 iClockPressedDownArea = clockRect; |
|
1432 |
|
1433 // Indicator area |
|
1434 layoutRect.LayoutRect( rect, |
|
1435 AknLayoutScalable_Avkon::list_uniindi_pane() ); |
|
1436 TRect listRect( layoutRect.Rect() ); |
|
1437 |
|
1438 TRAP_IGNORE( PrioritizeIndicatorsL() ); |
|
1439 |
|
1440 TAknLayoutScalableParameterLimits limits( |
|
1441 AknLayoutScalable_Avkon::list_single_uniindi_pane_ParamLimits() ); |
|
1442 TInt maxNumberOfIndicatorsShown = limits.LastRow(); |
|
1443 |
|
1444 TInt itemCount( iItems.Count() ); |
|
1445 |
|
1446 for ( TInt i = 0; i < itemCount; i++ ) |
|
1447 { |
|
1448 if ( i <= maxNumberOfIndicatorsShown ) |
|
1449 { |
|
1450 layoutRect.LayoutRect( |
|
1451 listRect, |
|
1452 AknLayoutScalable_Avkon::list_single_uniindi_pane( 0, 0, i ) ); |
|
1453 iItems[i]->SetRect( layoutRect.Rect() ); |
|
1454 } |
|
1455 else |
|
1456 { |
|
1457 iItems[i]->SetRect( TRect( 0, 0, 0, 0 ) ); |
|
1458 } |
|
1459 } |
|
1460 |
|
1461 UpdateFeedbackAreas(); |
|
1462 |
|
1463 AknIconUtils::SetSize( iSeparatorIcon->Bitmap(), |
|
1464 separatorSize, |
|
1465 EAspectRatioNotPreserved ); |
|
1466 |
|
1467 DrawDeferred(); |
|
1468 } |
|
1469 |
|
1470 |
|
1471 // ----------------------------------------------------------------------------- |
|
1472 // From class CCoeControl |
|
1473 // CAknIndicatorPopupContent::Draw |
|
1474 // ----------------------------------------------------------------------------- |
|
1475 // |
|
1476 void CAknIndicatorPopupContent::Draw( const TRect& aRect ) const |
|
1477 { |
|
1478 if ( AknLayoutUtils::PenEnabled() ) |
|
1479 { |
|
1480 CWindowGc& gc = SystemGc(); |
|
1481 |
|
1482 MAknsSkinInstance* skin = AknsUtils::SkinInstance(); |
|
1483 |
|
1484 TRect rect( Rect() ); |
|
1485 |
|
1486 TAknLayoutRect layoutRect; |
|
1487 layoutRect.LayoutRect( |
|
1488 rect, |
|
1489 AknLayoutScalable_Avkon::uniindi_top_pane() ); |
|
1490 TRect topRect( layoutRect.Rect() ); |
|
1491 |
|
1492 layoutRect.LayoutRect( |
|
1493 topRect, |
|
1494 AknLayoutScalable_Avkon::bg_uniindi_top_pane( 1 ) ); |
|
1495 TRect topCenterRect( layoutRect.Rect() ); |
|
1496 layoutRect.LayoutRect( |
|
1497 topRect, |
|
1498 AknLayoutScalable_Avkon::uniindi_top_pane_g3() ); |
|
1499 TRect leftSeparatorRect( layoutRect.Rect() ); |
|
1500 |
|
1501 layoutRect.LayoutRect( |
|
1502 topRect, |
|
1503 AknLayoutScalable_Avkon::uniindi_top_pane_g3( 1 ) ); |
|
1504 TRect separatorRect( layoutRect.Rect() ); |
|
1505 |
|
1506 layoutRect.LayoutRect( |
|
1507 topRect, |
|
1508 AknLayoutScalable_Avkon::uniindi_top_pane_g4() ); |
|
1509 TRect rightSeparatorRect( layoutRect.Rect() ); |
|
1510 |
|
1511 // Draw the button frame to the permanent items area. |
|
1512 AknsDrawUtils::DrawFrame( skin, |
|
1513 gc, |
|
1514 topRect, |
|
1515 topCenterRect, |
|
1516 KAknsIIDQsnFrPopupHeading, |
|
1517 KAknsIIDQsnFrPopupHeadingCenter ); |
|
1518 if ( iEnablePressedDownState ) |
|
1519 { |
|
1520 AknsDrawUtils::DrawFrame( skin, |
|
1521 gc, |
|
1522 iPressedDownRect, |
|
1523 iPressedDownRect, |
|
1524 KAknsIIDQsnFrListPressed, |
|
1525 KAknsIIDQsnFrListCenterPressed); |
|
1526 } |
|
1527 CFbsBitmap* bitmap = iSeparatorIcon->Bitmap(); |
|
1528 CFbsBitmap* mask = iSeparatorIcon->Mask(); |
|
1529 |
|
1530 // Draw the separator line on the top pane. |
|
1531 gc.BitBltMasked( leftSeparatorRect.iTl, |
|
1532 bitmap, |
|
1533 leftSeparatorRect.Size(), |
|
1534 mask, |
|
1535 ETrue ); |
|
1536 |
|
1537 gc.BitBltMasked( rightSeparatorRect.iTl, |
|
1538 bitmap, |
|
1539 rightSeparatorRect.Size(), |
|
1540 mask, |
|
1541 ETrue ); |
|
1542 |
|
1543 // Draw the indicator items. |
|
1544 for ( TInt i = 0; i < iItems.Count(); i++ ) |
|
1545 { |
|
1546 if ( aRect.Intersects( iItems[i]->iRect ) ) |
|
1547 { |
|
1548 iItems[i]->DrawItem( gc ); |
|
1549 } |
|
1550 } |
|
1551 } |
|
1552 } |