102 /** 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. */ |
103 TBool iMultiColorMode; |
103 TBool iMultiColorMode; |
104 |
104 |
105 /** 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. */ |
106 TBool iLongTab; |
106 TBool iLongTab; |
|
107 |
|
108 /** Indicates the hilight status of the tab*/ |
|
109 TBool iHighlight; |
107 }; |
110 }; |
108 |
111 |
109 CAknTabExtension* CAknTabExtension::NewL() |
112 CAknTabExtension* CAknTabExtension::NewL() |
110 { |
113 { |
111 CAknTabExtension* self = new ( ELeave ) CAknTabExtension(); |
114 CAknTabExtension* self = new ( ELeave ) CAknTabExtension(); |
293 void CAknTab::ConstructL( const TDesC& aTabText ) |
296 void CAknTab::ConstructL( const TDesC& aTabText ) |
294 { |
297 { |
295 if ( !iExtension ) |
298 if ( !iExtension ) |
296 { |
299 { |
297 iExtension = CAknTabExtension::NewL(); |
300 iExtension = CAknTabExtension::NewL(); |
|
301 //set the default highlight status of the tab |
|
302 iExtension->iHighlight = EFalse; |
298 } |
303 } |
299 |
304 |
300 iLabel = new (ELeave) CEikLabel; |
305 iLabel = new (ELeave) CEikLabel; |
301 iLabel->SetContainerWindowL( *this ); |
306 iLabel->SetContainerWindowL( *this ); |
302 iLabel->SetTextL( aTabText ); |
307 iLabel->SetTextL( aTabText ); |
805 } |
810 } |
806 } |
811 } |
807 |
812 |
808 } |
813 } |
809 |
814 |
810 |
815 // --------------------------------------------------------------------------- |
|
816 // sets the highlight status of a tab |
|
817 // --------------------------------------------------------------------------- |
|
818 // |
|
819 void CAknTab::SetHighlight(TBool aHighlight) |
|
820 { |
|
821 iExtension->iHighlight = aHighlight; |
|
822 } |
811 // --------------------------------------------------------------------------- |
823 // --------------------------------------------------------------------------- |
812 // Handles size change events in flat status pane layouts. |
824 // Handles size change events in flat status pane layouts. |
813 // --------------------------------------------------------------------------- |
825 // --------------------------------------------------------------------------- |
814 // |
826 // |
815 void CAknTab::SizeChangedInFlatLayout() |
827 void CAknTab::SizeChangedInFlatLayout() |
1069 CFbsBitmap* colorBitmap = NULL; |
1081 CFbsBitmap* colorBitmap = NULL; |
1070 if (iColorBitmaps && |
1082 if (iColorBitmaps && |
1071 iColorBitmaps->At(KTabColorBitmapActiveColorIndex) && |
1083 iColorBitmaps->At(KTabColorBitmapActiveColorIndex) && |
1072 iColorBitmaps->At(KTabColorBitmapPassiveColorIndex) ) |
1084 iColorBitmaps->At(KTabColorBitmapPassiveColorIndex) ) |
1073 { |
1085 { |
1074 if( iActive ) |
1086 if (iActive || iExtension->iHighlight) |
1075 { |
1087 { |
1076 colorBitmap = iColorBitmaps->At(KTabColorBitmapActiveColorIndex); |
1088 colorBitmap = iColorBitmaps->At(KTabColorBitmapActiveColorIndex); |
1077 } |
1089 } |
1078 else |
1090 else |
1079 { |
1091 { |
1397 /** X-value of the pointer down event position. */ |
1409 /** X-value of the pointer down event position. */ |
1398 TInt iPointerDownXPosition; |
1410 TInt iPointerDownXPosition; |
1399 |
1411 |
1400 /** This is the tab width that is set by the application. */ |
1412 /** This is the tab width that is set by the application. */ |
1401 TInt iRequestedTabWidth; |
1413 TInt iRequestedTabWidth; |
|
1414 |
|
1415 /** Indicates whether highlight tab is being drawn or not*/ |
|
1416 TBool iHighlight; |
1402 }; |
1417 }; |
1403 |
1418 |
1404 |
1419 |
1405 CAknTabGroupExtension::CAknTabGroupExtension() |
1420 CAknTabGroupExtension::CAknTabGroupExtension() |
1406 { |
1421 { |
1407 iPointerDownTab = -1; |
1422 iPointerDownTab = -1; |
1408 iPointerDownXPosition = -1; |
1423 iPointerDownXPosition = -1; |
|
1424 //Highlight is disabled by default. |
|
1425 iHighlight = EFalse; |
1409 } |
1426 } |
1410 |
1427 |
1411 |
1428 |
1412 // |
1429 // |
1413 // CAknTabGroup |
1430 // CAknTabGroup |
1869 iExtension->iTabSvgGraphics && |
1886 iExtension->iTabSvgGraphics && |
1870 iExtension->iTabSvgGraphics->TabGroupBackgroundAvailable() ) |
1887 iExtension->iTabSvgGraphics->TabGroupBackgroundAvailable() ) |
1871 { |
1888 { |
1872 iExtension->iTabBackgroundLayout.iUse = EFalse; |
1889 iExtension->iTabBackgroundLayout.iUse = EFalse; |
1873 |
1890 |
1874 iExtension->iTabSvgGraphics->DrawTabGroupBackgroundL( |
1891 iExtension->iTabSvgGraphics->DrawTabGroupBackground( |
1875 CAknTabGroupGraphics::ENoDraw, |
1892 CAknTabGroupGraphics::ENoDraw, |
1876 iLongTabs, |
1893 iLongTabs, |
1877 iNumberOfTabsShown, |
1894 iNumberOfTabsShown, |
1878 1, |
1895 1, |
1879 NULL, |
1896 NULL, |
2615 && iExtension->iTabSvgGraphics->TabGroupBackgroundAvailable()) |
2632 && iExtension->iTabSvgGraphics->TabGroupBackgroundAvailable()) |
2616 { |
2633 { |
2617 |
2634 |
2618 if (iExtension->iNarrowTabLayout) |
2635 if (iExtension->iNarrowTabLayout) |
2619 { |
2636 { |
2620 iExtension->iTabSvgGraphics->DrawTabGroupNarrowBackgroundL( |
2637 iExtension->iTabSvgGraphics->DrawTabGroupNarrowBackground( |
2621 CAknTabGroupGraphics::ENormal, iLongTabs, |
2638 CAknTabGroupGraphics::ENormal, |
2622 iNumberOfTabsShown, positionActive + 1, &gc, |
2639 iLongTabs, |
2623 iExtension->iTabBackgroundLayout); |
2640 iNumberOfTabsShown, |
2624 |
2641 positionActive + 1, |
|
2642 &gc, |
|
2643 iExtension->iTabBackgroundLayout); |
2625 } |
2644 } |
2626 else |
2645 else |
2627 { |
2646 { |
2628 CAknTabGroupGraphics::TTabAnimationType animation( |
2647 CAknTabGroupGraphics::TTabAnimationType animation( |
2629 CAknTabGroupGraphics::ENoAnimation); |
2648 CAknTabGroupGraphics::ENoAnimation); |
2630 TBool animationOngoing( iExtension->iTabCycleAnimationOngoing ); |
2649 TBool animationOngoing( iExtension->iTabCycleAnimationOngoing ); |
2631 |
2650 |
2632 if ( animationOngoing ) |
2651 if ( animationOngoing ) |
2633 { |
2652 { |
2634 animation |
2653 animation = iExtension->iTabCycleAnimationDirection == ELeft ? |
2635 = iExtension->iTabCycleAnimationDirection == ELeft |
2654 CAknTabGroupGraphics::ECycleToLeft : CAknTabGroupGraphics::ECycleToRight; |
2636 ? CAknTabGroupGraphics::ECycleToLeft |
2655 } |
2637 : CAknTabGroupGraphics::ECycleToRight; |
2656 |
2638 } |
2657 if (!iExtension->iHighlight) |
2639 iExtension->iTabSvgGraphics->DrawTabGroupBackgroundL( |
2658 { |
2640 CAknTabGroupGraphics::ENormal, iLongTabs, |
2659 // if highlight is not active |
2641 iNumberOfTabsShown, positionActive + 1, &gc, |
2660 iExtension->iTabSvgGraphics->DrawTabGroupBackground( |
2642 animationOngoing ? iExtension->iNextTabBackgroundLayout |
2661 CAknTabGroupGraphics::ENormal, |
2643 : iExtension->iTabBackgroundLayout, |
2662 iLongTabs, |
2644 iExtension->iTabsHidden, animation); |
2663 iNumberOfTabsShown, |
2645 |
2664 positionActive + 1, |
|
2665 &gc, |
|
2666 animationOngoing ? iExtension->iNextTabBackgroundLayout : iExtension->iTabBackgroundLayout, |
|
2667 iExtension->iTabsHidden, |
|
2668 animation); |
|
2669 } |
|
2670 else |
|
2671 { |
|
2672 // Highlight is active |
|
2673 TInt highlightTab = iExtension->iPointerDownTab - iFirstShownTab + 1; //pointer down tab index w.r.t shown tabs |
|
2674 iExtension->iTabSvgGraphics->DrawTabGroupBackground( |
|
2675 CAknTabGroupGraphics::ENormal, |
|
2676 iLongTabs, |
|
2677 iNumberOfTabsShown, |
|
2678 positionActive + 1, |
|
2679 &gc, |
|
2680 animationOngoing ? iExtension->iNextTabBackgroundLayout : iExtension->iTabBackgroundLayout, |
|
2681 iExtension->iTabsHidden, animation, highlightTab ); |
|
2682 } |
2646 } |
2683 } |
2647 } |
2684 } |
2648 else |
2685 else |
2649 { |
2686 { |
2650 // Old legacy draw code |
2687 // Old legacy draw code |
2879 // pointer position. |
2916 // pointer position. |
2880 newTab = iActiveTab; |
2917 newTab = iActiveTab; |
2881 } |
2918 } |
2882 iExtension->iPointerDownTab = newTab; |
2919 iExtension->iPointerDownTab = newTab; |
2883 iExtension->iPointerDownXPosition = aPointerEvent.iPosition.iX; |
2920 iExtension->iPointerDownXPosition = aPointerEvent.iPosition.iX; |
|
2921 |
|
2922 //Activates highlight drawing for pressed tab. |
|
2923 if (!iExtension->iHighlight) |
|
2924 { |
|
2925 iExtension->iHighlight = ETrue; |
|
2926 |
|
2927 // Set the pressed tab to highlight |
|
2928 if ( iExtension->iPointerDownTab >= 0 ) |
|
2929 { |
|
2930 iTabArray->At( iExtension->iPointerDownTab )->SetHighlight( ETrue ); |
|
2931 } |
|
2932 DrawDeferred(); |
|
2933 } |
|
2934 |
2884 return; |
2935 return; |
2885 } |
2936 } |
2886 else if ( aPointerEvent.iType == TPointerEvent::EButton1Up ) |
2937 else if ( aPointerEvent.iType == TPointerEvent::EButton1Up ) |
2887 { |
2938 { |
2888 if( newTab > -1 && newTab == iExtension->iPointerDownTab ) |
2939 if( newTab > -1 && newTab == iExtension->iPointerDownTab ) |
2908 } |
2959 } |
2909 |
2960 |
2910 // if the button up event occurs ouside tabgroup, ignore it. |
2961 // if the button up event occurs ouside tabgroup, ignore it. |
2911 if ( !Rect().Contains( aPointerEvent.iPosition ) || iExtension->iPointerDownTab != newTab ) |
2962 if ( !Rect().Contains( aPointerEvent.iPosition ) || iExtension->iPointerDownTab != newTab ) |
2912 { |
2963 { |
2913 iExtension->iPointerDownTab = -1; |
2964 iExtension->iPointerDownTab = -1; |
2914 iExtension->iPointerDownXPosition = -1; |
2965 iExtension->iPointerDownXPosition = -1; |
2915 return ; |
2966 if (iExtension->iHighlight) |
|
2967 { |
|
2968 iExtension->iHighlight = EFalse; |
|
2969 ResetHighlightStatus(); |
|
2970 DrawDeferred(); |
|
2971 } |
|
2972 return; |
2916 } |
2973 } |
2917 |
2974 |
2918 if ( newTab != iActiveTab && |
2975 if ( newTab != iActiveTab && |
2919 newTab > -1 && |
2976 newTab > -1 && |
2920 newTab == iExtension->iPointerDownTab && |
2977 newTab == iExtension->iPointerDownTab && |
3386 |
3449 |
3387 iExtension->iTabSvgGraphics->SetTabGroupBackgroundParent( |
3450 iExtension->iTabSvgGraphics->SetTabGroupBackgroundParent( |
3388 ParentRect( iExtension->iNaviArrowsUsed ) ); |
3451 ParentRect( iExtension->iNaviArrowsUsed ) ); |
3389 |
3452 |
3390 iExtension->iTabBackgroundLayout.iUse = EFalse; |
3453 iExtension->iTabBackgroundLayout.iUse = EFalse; |
3391 TRAP_IGNORE( iExtension->iTabSvgGraphics->DrawTabGroupBackgroundL( |
3454 iExtension->iTabSvgGraphics->DrawTabGroupBackground( |
3392 CAknTabGroupGraphics::ENoDraw, |
3455 CAknTabGroupGraphics::ENoDraw, |
3393 iLongTabs, |
3456 iLongTabs, |
3394 iNumberOfTabsShown, |
3457 iNumberOfTabsShown, |
3395 1, |
3458 1, |
3396 NULL, |
3459 NULL, |
3397 iExtension->iTabBackgroundLayout, |
3460 iExtension->iTabBackgroundLayout, |
3398 CAknTabGroupGraphics::ENone ) ); |
3461 CAknTabGroupGraphics::ENone ); |
3399 iExtension->iTabBackgroundLayout.iUse = ETrue; |
3462 iExtension->iTabBackgroundLayout.iUse = ETrue; |
3400 SetDecoratorLayout( EFalse ); |
3463 SetDecoratorLayout( EFalse ); |
3401 } |
3464 } |
3402 |
3465 |
3403 if ( iExtension ) |
3466 if ( iExtension ) |
3404 { |
3467 { |
3405 iExtension->iNarrowTabLayout = EFalse; |
3468 iExtension->iNarrowTabLayout = EFalse; |
|
3469 if( iExtension->iHighlight ) |
|
3470 { |
|
3471 iExtension->iHighlight = EFalse; |
|
3472 ResetHighlightStatus(); |
|
3473 } |
3406 } |
3474 } |
3407 |
3475 |
3408 if ( !COMPARE_BOOLS( iMirrored, AknLayoutUtils::LayoutMirrored() ) ) |
3476 if ( !COMPARE_BOOLS( iMirrored, AknLayoutUtils::LayoutMirrored() ) ) |
3409 { |
3477 { |
3410 TInt active = ActiveTabIndex(); |
3478 TInt active = ActiveTabIndex(); |
4041 // Calculate new destination positions for animated tabs. |
4109 // Calculate new destination positions for animated tabs. |
4042 TInt positionActive = iActiveTab - iFirstShownTab; |
4110 TInt positionActive = iActiveTab - iFirstShownTab; |
4043 if ( aNarrow ) |
4111 if ( aNarrow ) |
4044 { |
4112 { |
4045 iExtension->iNextTabBackgroundLayout.iUse = EFalse; |
4113 iExtension->iNextTabBackgroundLayout.iUse = EFalse; |
4046 iExtension->iTabSvgGraphics->DrawTabGroupNarrowBackgroundL( |
4114 iExtension->iTabSvgGraphics->DrawTabGroupNarrowBackground( |
4047 CAknTabGroupGraphics::ENoDraw, |
4115 CAknTabGroupGraphics::ENoDraw, |
4048 iLongTabs, |
4116 iLongTabs, |
4049 iNumberOfTabsShown, |
4117 iNumberOfTabsShown, |
4050 positionActive + 1, |
4118 positionActive + 1, |
4051 NULL, |
4119 NULL, |
4053 iExtension->iNextTabBackgroundLayout.iUse = ETrue; |
4121 iExtension->iNextTabBackgroundLayout.iUse = ETrue; |
4054 |
4122 |
4055 if ( !aUseAnimation ) |
4123 if ( !aUseAnimation ) |
4056 { |
4124 { |
4057 iExtension->iTabBackgroundLayout.iUse = EFalse; |
4125 iExtension->iTabBackgroundLayout.iUse = EFalse; |
4058 iExtension->iTabSvgGraphics->DrawTabGroupNarrowBackgroundL( |
4126 iExtension->iTabSvgGraphics->DrawTabGroupNarrowBackground( |
4059 CAknTabGroupGraphics::ENoDraw, |
4127 CAknTabGroupGraphics::ENoDraw, |
4060 iLongTabs, |
4128 iLongTabs, |
4061 iNumberOfTabsShown, |
4129 iNumberOfTabsShown, |
4062 positionActive + 1, |
4130 positionActive + 1, |
4063 NULL, |
4131 NULL, |
4066 } |
4134 } |
4067 } |
4135 } |
4068 else |
4136 else |
4069 { |
4137 { |
4070 iExtension->iNextTabBackgroundLayout.iUse = EFalse; |
4138 iExtension->iNextTabBackgroundLayout.iUse = EFalse; |
4071 iExtension->iTabSvgGraphics->DrawTabGroupBackgroundL( |
4139 iExtension->iTabSvgGraphics->DrawTabGroupBackground( |
4072 CAknTabGroupGraphics::ENoDraw, |
4140 CAknTabGroupGraphics::ENoDraw, |
4073 iLongTabs, |
4141 iLongTabs, |
4074 iNumberOfTabsShown, |
4142 iNumberOfTabsShown, |
4075 positionActive + 1, |
4143 positionActive + 1, |
4076 NULL, |
4144 NULL, |
4077 iExtension->iNextTabBackgroundLayout, |
4145 iExtension->iNextTabBackgroundLayout, |
4078 CAknTabGroupGraphics::ENone ); |
4146 CAknTabGroupGraphics::ENone ); |
4079 iExtension->iNextTabBackgroundLayout.iUse = ETrue; |
4147 iExtension->iNextTabBackgroundLayout.iUse = ETrue; |
4080 |
4148 |
4081 iExtension->iTabBackgroundLayout.iUse = EFalse; |
4149 iExtension->iTabBackgroundLayout.iUse = EFalse; |
4082 iExtension->iTabSvgGraphics->DrawTabGroupBackgroundL( |
4150 iExtension->iTabSvgGraphics->DrawTabGroupBackground( |
4083 CAknTabGroupGraphics::ENoDraw, |
4151 CAknTabGroupGraphics::ENoDraw, |
4084 iLongTabs, |
4152 iLongTabs, |
4085 iNumberOfTabsShown, |
4153 iNumberOfTabsShown, |
4086 positionActive + 1, |
4154 positionActive + 1, |
4087 NULL, |
4155 NULL, |