36 #include <aknlayoutscalable_avkon.cdl.h> |
36 #include <aknlayoutscalable_avkon.cdl.h> |
37 #include <akniconconfig.h> |
37 #include <akniconconfig.h> |
38 |
38 |
39 #include <AknTasHook.h> |
39 #include <AknTasHook.h> |
40 #include <touchfeedback.h> |
40 #include <touchfeedback.h> |
41 #include <AknPriv.hrh> |
|
42 |
41 |
43 // USER INCLUDE FILES |
42 // USER INCLUDE FILES |
44 #include "aknappui.h" |
43 #include "aknappui.h" |
45 #include "avkon.hrh" |
44 #include "avkon.hrh" |
46 #include "AknNaviObserver.h" |
45 #include "AknNaviObserver.h" |
103 /** Indicates whether or not this tab is drawn using multi-color mode. */ |
102 /** Indicates whether or not this tab is drawn using multi-color mode. */ |
104 TBool iMultiColorMode; |
103 TBool iMultiColorMode; |
105 |
104 |
106 /** Indicates whether or not the tab is shown in long tab group layout. */ |
105 /** Indicates whether or not the tab is shown in long tab group layout. */ |
107 TBool iLongTab; |
106 TBool iLongTab; |
108 |
|
109 /** Indicates the hilight status of the tab*/ |
|
110 TBool iHighlight; |
|
111 }; |
107 }; |
112 |
108 |
113 CAknTabExtension* CAknTabExtension::NewL() |
109 CAknTabExtension* CAknTabExtension::NewL() |
114 { |
110 { |
115 CAknTabExtension* self = new ( ELeave ) CAknTabExtension(); |
111 CAknTabExtension* self = new ( ELeave ) CAknTabExtension(); |
297 void CAknTab::ConstructL( const TDesC& aTabText ) |
293 void CAknTab::ConstructL( const TDesC& aTabText ) |
298 { |
294 { |
299 if ( !iExtension ) |
295 if ( !iExtension ) |
300 { |
296 { |
301 iExtension = CAknTabExtension::NewL(); |
297 iExtension = CAknTabExtension::NewL(); |
302 //set the default highlight status of the tab |
|
303 iExtension->iHighlight = EFalse; |
|
304 } |
298 } |
305 |
299 |
306 iLabel = new (ELeave) CEikLabel; |
300 iLabel = new (ELeave) CEikLabel; |
307 iLabel->SetContainerWindowL( *this ); |
301 iLabel->SetContainerWindowL( *this ); |
308 iLabel->SetTextL( aTabText ); |
302 iLabel->SetTextL( aTabText ); |
811 } |
805 } |
812 } |
806 } |
813 |
807 |
814 } |
808 } |
815 |
809 |
816 // --------------------------------------------------------------------------- |
810 |
817 // sets the highlight status of a tab |
|
818 // --------------------------------------------------------------------------- |
|
819 // |
|
820 void CAknTab::SetHighlight(TBool aHighlight) |
|
821 { |
|
822 iExtension->iHighlight = aHighlight; |
|
823 } |
|
824 // --------------------------------------------------------------------------- |
811 // --------------------------------------------------------------------------- |
825 // Handles size change events in flat status pane layouts. |
812 // Handles size change events in flat status pane layouts. |
826 // --------------------------------------------------------------------------- |
813 // --------------------------------------------------------------------------- |
827 // |
814 // |
828 void CAknTab::SizeChangedInFlatLayout() |
815 void CAknTab::SizeChangedInFlatLayout() |
1082 CFbsBitmap* colorBitmap = NULL; |
1069 CFbsBitmap* colorBitmap = NULL; |
1083 if (iColorBitmaps && |
1070 if (iColorBitmaps && |
1084 iColorBitmaps->At(KTabColorBitmapActiveColorIndex) && |
1071 iColorBitmaps->At(KTabColorBitmapActiveColorIndex) && |
1085 iColorBitmaps->At(KTabColorBitmapPassiveColorIndex) ) |
1072 iColorBitmaps->At(KTabColorBitmapPassiveColorIndex) ) |
1086 { |
1073 { |
1087 if (iActive || iExtension->iHighlight) |
1074 if( iActive ) |
1088 { |
1075 { |
1089 colorBitmap = iColorBitmaps->At(KTabColorBitmapActiveColorIndex); |
1076 colorBitmap = iColorBitmaps->At(KTabColorBitmapActiveColorIndex); |
1090 } |
1077 } |
1091 else |
1078 else |
1092 { |
1079 { |
1410 /** X-value of the pointer down event position. */ |
1397 /** X-value of the pointer down event position. */ |
1411 TInt iPointerDownXPosition; |
1398 TInt iPointerDownXPosition; |
1412 |
1399 |
1413 /** This is the tab width that is set by the application. */ |
1400 /** This is the tab width that is set by the application. */ |
1414 TInt iRequestedTabWidth; |
1401 TInt iRequestedTabWidth; |
1415 |
|
1416 /** Indicates whether highlight tab is being drawn or not*/ |
|
1417 TBool iHighlight; |
|
1418 }; |
1402 }; |
1419 |
1403 |
1420 |
1404 |
1421 CAknTabGroupExtension::CAknTabGroupExtension() |
1405 CAknTabGroupExtension::CAknTabGroupExtension() |
1422 { |
1406 { |
1423 iPointerDownTab = -1; |
1407 iPointerDownTab = -1; |
1424 iPointerDownXPosition = -1; |
1408 iPointerDownXPosition = -1; |
1425 //Highlight is disabled by default. |
|
1426 iHighlight = EFalse; |
|
1427 } |
1409 } |
1428 |
1410 |
1429 |
1411 |
1430 // |
1412 // |
1431 // CAknTabGroup |
1413 // CAknTabGroup |
1887 iExtension->iTabSvgGraphics && |
1869 iExtension->iTabSvgGraphics && |
1888 iExtension->iTabSvgGraphics->TabGroupBackgroundAvailable() ) |
1870 iExtension->iTabSvgGraphics->TabGroupBackgroundAvailable() ) |
1889 { |
1871 { |
1890 iExtension->iTabBackgroundLayout.iUse = EFalse; |
1872 iExtension->iTabBackgroundLayout.iUse = EFalse; |
1891 |
1873 |
1892 iExtension->iTabSvgGraphics->DrawTabGroupBackground( |
1874 iExtension->iTabSvgGraphics->DrawTabGroupBackgroundL( |
1893 CAknTabGroupGraphics::ENoDraw, |
1875 CAknTabGroupGraphics::ENoDraw, |
1894 iLongTabs, |
1876 iLongTabs, |
1895 iNumberOfTabsShown, |
1877 iNumberOfTabsShown, |
1896 1, |
1878 1, |
1897 NULL, |
1879 NULL, |
2633 && iExtension->iTabSvgGraphics->TabGroupBackgroundAvailable()) |
2615 && iExtension->iTabSvgGraphics->TabGroupBackgroundAvailable()) |
2634 { |
2616 { |
2635 |
2617 |
2636 if (iExtension->iNarrowTabLayout) |
2618 if (iExtension->iNarrowTabLayout) |
2637 { |
2619 { |
2638 iExtension->iTabSvgGraphics->DrawTabGroupNarrowBackground( |
2620 iExtension->iTabSvgGraphics->DrawTabGroupNarrowBackgroundL( |
2639 CAknTabGroupGraphics::ENormal, |
2621 CAknTabGroupGraphics::ENormal, iLongTabs, |
2640 iLongTabs, |
2622 iNumberOfTabsShown, positionActive + 1, &gc, |
2641 iNumberOfTabsShown, |
2623 iExtension->iTabBackgroundLayout); |
2642 positionActive + 1, |
2624 |
2643 &gc, |
|
2644 iExtension->iTabBackgroundLayout); |
|
2645 } |
2625 } |
2646 else |
2626 else |
2647 { |
2627 { |
2648 CAknTabGroupGraphics::TTabAnimationType animation( |
2628 CAknTabGroupGraphics::TTabAnimationType animation( |
2649 CAknTabGroupGraphics::ENoAnimation); |
2629 CAknTabGroupGraphics::ENoAnimation); |
2650 TBool animationOngoing( iExtension->iTabCycleAnimationOngoing ); |
2630 TBool animationOngoing( iExtension->iTabCycleAnimationOngoing ); |
2651 |
2631 |
2652 if ( animationOngoing ) |
2632 if ( animationOngoing ) |
2653 { |
2633 { |
2654 animation = iExtension->iTabCycleAnimationDirection == ELeft ? |
2634 animation |
2655 CAknTabGroupGraphics::ECycleToLeft : CAknTabGroupGraphics::ECycleToRight; |
2635 = iExtension->iTabCycleAnimationDirection == ELeft |
2656 } |
2636 ? CAknTabGroupGraphics::ECycleToLeft |
2657 |
2637 : CAknTabGroupGraphics::ECycleToRight; |
2658 if (!iExtension->iHighlight) |
2638 } |
2659 { |
2639 iExtension->iTabSvgGraphics->DrawTabGroupBackgroundL( |
2660 // if highlight is not active |
2640 CAknTabGroupGraphics::ENormal, iLongTabs, |
2661 iExtension->iTabSvgGraphics->DrawTabGroupBackground( |
2641 iNumberOfTabsShown, positionActive + 1, &gc, |
2662 CAknTabGroupGraphics::ENormal, |
2642 animationOngoing ? iExtension->iNextTabBackgroundLayout |
2663 iLongTabs, |
2643 : iExtension->iTabBackgroundLayout, |
2664 iNumberOfTabsShown, |
2644 iExtension->iTabsHidden, animation); |
2665 positionActive + 1, |
2645 |
2666 &gc, |
|
2667 animationOngoing ? iExtension->iNextTabBackgroundLayout : iExtension->iTabBackgroundLayout, |
|
2668 iExtension->iTabsHidden, |
|
2669 animation); |
|
2670 } |
|
2671 else |
|
2672 { |
|
2673 // Highlight is active |
|
2674 TInt highlightTab = iExtension->iPointerDownTab - iFirstShownTab + 1; //pointer down tab index w.r.t shown tabs |
|
2675 iExtension->iTabSvgGraphics->DrawTabGroupBackground( |
|
2676 CAknTabGroupGraphics::ENormal, |
|
2677 iLongTabs, |
|
2678 iNumberOfTabsShown, |
|
2679 positionActive + 1, |
|
2680 &gc, |
|
2681 animationOngoing ? iExtension->iNextTabBackgroundLayout : iExtension->iTabBackgroundLayout, |
|
2682 iExtension->iTabsHidden, animation, highlightTab ); |
|
2683 } |
|
2684 } |
2646 } |
2685 } |
2647 } |
2686 else |
2648 else |
2687 { |
2649 { |
2688 // Old legacy draw code |
2650 // Old legacy draw code |
2915 { |
2877 { |
2916 // In one tab layout handle the navigation always by |
2878 // In one tab layout handle the navigation always by |
2917 // pointer position. |
2879 // pointer position. |
2918 newTab = iActiveTab; |
2880 newTab = iActiveTab; |
2919 } |
2881 } |
2920 |
2882 iExtension->iPointerDownTab = newTab; |
2921 //Activates highlight drawing for pressed tab. |
2883 iExtension->iPointerDownXPosition = aPointerEvent.iPosition.iX; |
2922 EnableHighlight( ETrue, newTab, aPointerEvent.iPosition.iX ); |
|
2923 |
|
2924 return; |
2884 return; |
2925 } |
2885 } |
2926 else if ( aPointerEvent.iType == TPointerEvent::EButton1Up ) |
2886 else if ( aPointerEvent.iType == TPointerEvent::EButton1Up ) |
2927 { |
2887 { |
2928 if( newTab > -1 && newTab == iExtension->iPointerDownTab ) |
2888 if( newTab > -1 && newTab == iExtension->iPointerDownTab ) |
2948 } |
2908 } |
2949 |
2909 |
2950 // if the button up event occurs ouside tabgroup, ignore it. |
2910 // if the button up event occurs ouside tabgroup, ignore it. |
2951 if ( !Rect().Contains( aPointerEvent.iPosition ) || iExtension->iPointerDownTab != newTab ) |
2911 if ( !Rect().Contains( aPointerEvent.iPosition ) || iExtension->iPointerDownTab != newTab ) |
2952 { |
2912 { |
2953 EnableHighlight( EFalse ); |
2913 iExtension->iPointerDownTab = -1; |
2954 return; |
2914 iExtension->iPointerDownXPosition = -1; |
|
2915 return ; |
2955 } |
2916 } |
2956 |
2917 |
2957 if ( newTab != iActiveTab && |
2918 if ( newTab != iActiveTab && |
2958 newTab > -1 && |
2919 newTab > -1 && |
2959 newTab == iExtension->iPointerDownTab && |
2920 newTab == iExtension->iPointerDownTab && |
3409 // If this fails, svg tab graphics are not available. |
3371 // If this fails, svg tab graphics are not available. |
3410 // Then defaults to bitmaps if possible. |
3372 // Then defaults to bitmaps if possible. |
3411 TRAP_IGNORE( InitTabGroupGraphicsL() ); |
3373 TRAP_IGNORE( InitTabGroupGraphicsL() ); |
3412 TRAP_IGNORE( LoadTabBitmapsL( iNumberOfTabsShown, iLongTabs ) ); |
3374 TRAP_IGNORE( LoadTabBitmapsL( iNumberOfTabsShown, iLongTabs ) ); |
3413 } |
3375 } |
3414 |
|
3415 // Stop highlighting the pressed tab when receives KAknMessageFocusLost event. |
|
3416 if( aType == KAknMessageFocusLost ) |
|
3417 { |
|
3418 EnableHighlight(EFalse); |
|
3419 } |
|
3420 |
3376 |
3421 if ( aType == KEikDynamicLayoutVariantSwitch ) |
3377 if ( aType == KEikDynamicLayoutVariantSwitch ) |
3422 { |
3378 { |
3423 // If double buffers are used in this layout, |
3379 // If double buffers are used in this layout, |
3424 // then initialize its layouts at this point. |
3380 // then initialize its layouts at this point. |
3430 |
3386 |
3431 iExtension->iTabSvgGraphics->SetTabGroupBackgroundParent( |
3387 iExtension->iTabSvgGraphics->SetTabGroupBackgroundParent( |
3432 ParentRect( iExtension->iNaviArrowsUsed ) ); |
3388 ParentRect( iExtension->iNaviArrowsUsed ) ); |
3433 |
3389 |
3434 iExtension->iTabBackgroundLayout.iUse = EFalse; |
3390 iExtension->iTabBackgroundLayout.iUse = EFalse; |
3435 iExtension->iTabSvgGraphics->DrawTabGroupBackground( |
3391 TRAP_IGNORE( iExtension->iTabSvgGraphics->DrawTabGroupBackgroundL( |
3436 CAknTabGroupGraphics::ENoDraw, |
3392 CAknTabGroupGraphics::ENoDraw, |
3437 iLongTabs, |
3393 iLongTabs, |
3438 iNumberOfTabsShown, |
3394 iNumberOfTabsShown, |
3439 1, |
3395 1, |
3440 NULL, |
3396 NULL, |
3441 iExtension->iTabBackgroundLayout, |
3397 iExtension->iTabBackgroundLayout, |
3442 CAknTabGroupGraphics::ENone ); |
3398 CAknTabGroupGraphics::ENone ) ); |
3443 iExtension->iTabBackgroundLayout.iUse = ETrue; |
3399 iExtension->iTabBackgroundLayout.iUse = ETrue; |
3444 SetDecoratorLayout( EFalse ); |
3400 SetDecoratorLayout( EFalse ); |
3445 } |
3401 } |
3446 |
3402 |
3447 if ( iExtension ) |
3403 if ( iExtension ) |
3448 { |
3404 { |
3449 iExtension->iNarrowTabLayout = EFalse; |
3405 iExtension->iNarrowTabLayout = EFalse; |
3450 EnableHighlight(EFalse); |
|
3451 } |
3406 } |
3452 |
3407 |
3453 if ( !COMPARE_BOOLS( iMirrored, AknLayoutUtils::LayoutMirrored() ) ) |
3408 if ( !COMPARE_BOOLS( iMirrored, AknLayoutUtils::LayoutMirrored() ) ) |
3454 { |
3409 { |
3455 TInt active = ActiveTabIndex(); |
3410 TInt active = ActiveTabIndex(); |
4086 // Calculate new destination positions for animated tabs. |
4041 // Calculate new destination positions for animated tabs. |
4087 TInt positionActive = iActiveTab - iFirstShownTab; |
4042 TInt positionActive = iActiveTab - iFirstShownTab; |
4088 if ( aNarrow ) |
4043 if ( aNarrow ) |
4089 { |
4044 { |
4090 iExtension->iNextTabBackgroundLayout.iUse = EFalse; |
4045 iExtension->iNextTabBackgroundLayout.iUse = EFalse; |
4091 iExtension->iTabSvgGraphics->DrawTabGroupNarrowBackground( |
4046 iExtension->iTabSvgGraphics->DrawTabGroupNarrowBackgroundL( |
4092 CAknTabGroupGraphics::ENoDraw, |
4047 CAknTabGroupGraphics::ENoDraw, |
4093 iLongTabs, |
4048 iLongTabs, |
4094 iNumberOfTabsShown, |
4049 iNumberOfTabsShown, |
4095 positionActive + 1, |
4050 positionActive + 1, |
4096 NULL, |
4051 NULL, |
4098 iExtension->iNextTabBackgroundLayout.iUse = ETrue; |
4053 iExtension->iNextTabBackgroundLayout.iUse = ETrue; |
4099 |
4054 |
4100 if ( !aUseAnimation ) |
4055 if ( !aUseAnimation ) |
4101 { |
4056 { |
4102 iExtension->iTabBackgroundLayout.iUse = EFalse; |
4057 iExtension->iTabBackgroundLayout.iUse = EFalse; |
4103 iExtension->iTabSvgGraphics->DrawTabGroupNarrowBackground( |
4058 iExtension->iTabSvgGraphics->DrawTabGroupNarrowBackgroundL( |
4104 CAknTabGroupGraphics::ENoDraw, |
4059 CAknTabGroupGraphics::ENoDraw, |
4105 iLongTabs, |
4060 iLongTabs, |
4106 iNumberOfTabsShown, |
4061 iNumberOfTabsShown, |
4107 positionActive + 1, |
4062 positionActive + 1, |
4108 NULL, |
4063 NULL, |
4111 } |
4066 } |
4112 } |
4067 } |
4113 else |
4068 else |
4114 { |
4069 { |
4115 iExtension->iNextTabBackgroundLayout.iUse = EFalse; |
4070 iExtension->iNextTabBackgroundLayout.iUse = EFalse; |
4116 iExtension->iTabSvgGraphics->DrawTabGroupBackground( |
4071 iExtension->iTabSvgGraphics->DrawTabGroupBackgroundL( |
4117 CAknTabGroupGraphics::ENoDraw, |
4072 CAknTabGroupGraphics::ENoDraw, |
4118 iLongTabs, |
4073 iLongTabs, |
4119 iNumberOfTabsShown, |
4074 iNumberOfTabsShown, |
4120 positionActive + 1, |
4075 positionActive + 1, |
4121 NULL, |
4076 NULL, |
4122 iExtension->iNextTabBackgroundLayout, |
4077 iExtension->iNextTabBackgroundLayout, |
4123 CAknTabGroupGraphics::ENone ); |
4078 CAknTabGroupGraphics::ENone ); |
4124 iExtension->iNextTabBackgroundLayout.iUse = ETrue; |
4079 iExtension->iNextTabBackgroundLayout.iUse = ETrue; |
4125 |
4080 |
4126 iExtension->iTabBackgroundLayout.iUse = EFalse; |
4081 iExtension->iTabBackgroundLayout.iUse = EFalse; |
4127 iExtension->iTabSvgGraphics->DrawTabGroupBackground( |
4082 iExtension->iTabSvgGraphics->DrawTabGroupBackgroundL( |
4128 CAknTabGroupGraphics::ENoDraw, |
4083 CAknTabGroupGraphics::ENoDraw, |
4129 iLongTabs, |
4084 iLongTabs, |
4130 iNumberOfTabsShown, |
4085 iNumberOfTabsShown, |
4131 positionActive + 1, |
4086 positionActive + 1, |
4132 NULL, |
4087 NULL, |
4487 } |
4442 } |
4488 |
4443 |
4489 CancelTabAnimationEventTimer(); |
4444 CancelTabAnimationEventTimer(); |
4490 } |
4445 } |
4491 |
4446 |
4492 void CAknTabGroup::ResetHighlightStatus() |
|
4493 { |
|
4494 // Resets highlight status to EFalse |
|
4495 for( TInt i = 0; i < iTabArray->Count(); i++ ) |
|
4496 { |
|
4497 iTabArray->At(i)->SetHighlight( EFalse ); |
|
4498 } |
|
4499 } |
|
4500 |
|
4501 void CAknTabGroup::EnableHighlight( TBool aEnable, TInt aNewTab , TInt aPointX ) |
|
4502 { |
|
4503 iExtension->iPointerDownTab = aNewTab; |
|
4504 iExtension->iPointerDownXPosition = aPointX; |
|
4505 if( aEnable ) |
|
4506 { |
|
4507 //Activates highlight drawing for pressed tab. |
|
4508 if (!iExtension->iHighlight) |
|
4509 { |
|
4510 iExtension->iHighlight = ETrue; |
|
4511 |
|
4512 // Set the pressed tab to highlight |
|
4513 if ( iExtension->iPointerDownTab >= 0 ) |
|
4514 { |
|
4515 iTabArray->At( iExtension->iPointerDownTab )->SetHighlight( ETrue ); |
|
4516 } |
|
4517 DrawDeferred(); |
|
4518 } |
|
4519 } |
|
4520 else |
|
4521 { |
|
4522 if (iExtension->iHighlight) |
|
4523 { |
|
4524 iExtension->iHighlight = EFalse; |
|
4525 ResetHighlightStatus(); |
|
4526 DrawDeferred(); |
|
4527 } |
|
4528 } |
|
4529 } |
|
4530 // End of File |
4447 // End of File |