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() |
1393 /** X-value of the pointer down event position. */ |
1409 /** X-value of the pointer down event position. */ |
1394 TInt iPointerDownXPosition; |
1410 TInt iPointerDownXPosition; |
1395 |
1411 |
1396 /** This is the tab width that is set by the application. */ |
1412 /** This is the tab width that is set by the application. */ |
1397 TInt iRequestedTabWidth; |
1413 TInt iRequestedTabWidth; |
|
1414 |
|
1415 /** Indicates whether highlight tab is being drawn or not*/ |
|
1416 TBool iHighlight; |
1398 }; |
1417 }; |
1399 |
1418 |
1400 |
1419 |
1401 CAknTabGroupExtension::CAknTabGroupExtension() |
1420 CAknTabGroupExtension::CAknTabGroupExtension() |
1402 { |
1421 { |
1403 iPointerDownTab = -1; |
1422 iPointerDownTab = -1; |
1404 iPointerDownXPosition = -1; |
1423 iPointerDownXPosition = -1; |
|
1424 //Highlight is disabled by default. |
|
1425 iHighlight = EFalse; |
1405 } |
1426 } |
1406 |
1427 |
1407 |
1428 |
1408 // |
1429 // |
1409 // CAknTabGroup |
1430 // CAknTabGroup |
2611 && iExtension->iTabSvgGraphics->TabGroupBackgroundAvailable()) |
2632 && iExtension->iTabSvgGraphics->TabGroupBackgroundAvailable()) |
2612 { |
2633 { |
2613 |
2634 |
2614 if (iExtension->iNarrowTabLayout) |
2635 if (iExtension->iNarrowTabLayout) |
2615 { |
2636 { |
2616 iExtension->iTabSvgGraphics->DrawTabGroupNarrowBackgroundL( |
2637 iExtension->iTabSvgGraphics->DrawTabGroupNarrowBackground( |
2617 CAknTabGroupGraphics::ENormal, iLongTabs, |
2638 CAknTabGroupGraphics::ENormal, |
2618 iNumberOfTabsShown, positionActive + 1, &gc, |
2639 iLongTabs, |
2619 iExtension->iTabBackgroundLayout); |
2640 iNumberOfTabsShown, |
2620 |
2641 positionActive + 1, |
2621 iExtension->iTabSvgGraphics->DrawTabGroupNarrowBackgroundL( |
2642 &gc, |
2622 CAknTabGroupGraphics::EMaskOnly, iLongTabs, |
2643 iExtension->iTabBackgroundLayout); |
2623 iNumberOfTabsShown, positionActive + 1, &gc, |
|
2624 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, |
|
2644 iExtension->iTabsHidden, animation); |
|
2645 |
|
2646 iExtension->iTabSvgGraphics->DrawTabGroupBackgroundL( |
|
2647 CAknTabGroupGraphics::EMaskOnly, |
|
2648 iLongTabs, |
2662 iLongTabs, |
2649 iNumberOfTabsShown, |
2663 iNumberOfTabsShown, |
2650 positionActive + 1, |
2664 positionActive + 1, |
2651 &gc, |
2665 &gc, |
2652 animationOngoing ? iExtension->iNextTabBackgroundLayout |
2666 animationOngoing ? iExtension->iNextTabBackgroundLayout : iExtension->iTabBackgroundLayout, |
2653 : iExtension->iTabBackgroundLayout, |
2667 iExtension->iTabsHidden, |
2654 iExtension->iTabsHidden, animation); |
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 } |
2655 } |
2683 } |
2656 } |
2684 } |
2657 else |
2685 else |
2658 { |
2686 { |
2659 // Old legacy draw code |
2687 // Old legacy draw code |
2888 // pointer position. |
2916 // pointer position. |
2889 newTab = iActiveTab; |
2917 newTab = iActiveTab; |
2890 } |
2918 } |
2891 iExtension->iPointerDownTab = newTab; |
2919 iExtension->iPointerDownTab = newTab; |
2892 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 |
2893 return; |
2935 return; |
2894 } |
2936 } |
2895 else if ( aPointerEvent.iType == TPointerEvent::EButton1Up ) |
2937 else if ( aPointerEvent.iType == TPointerEvent::EButton1Up ) |
2896 { |
2938 { |
2897 if( newTab> -1 ) |
2939 if( newTab > -1 && newTab == iExtension->iPointerDownTab ) |
2898 { |
2940 { |
2899 MTouchFeedback* feedback = MTouchFeedback::Instance(); |
2941 MTouchFeedback* feedback = MTouchFeedback::Instance(); |
2900 |
2942 |
2901 // Feedback is given only if new tab wasn't already active |
2943 // Feedback is given only if new tab wasn't already active |
2902 // Use two convertTabIndex to cancel the mirror effects, because the newTab is always the phsical index. |
2944 // Use two convertTabIndex to cancel the mirror effects, because the newTab is always the phsical index. |
2903 TBool isActiveTab = iTabArray->At( ConvertTabIndex( ConvertTabIndex( newTab ) ) )->Active(); |
2945 TBool isActiveTab = iTabArray->At( ConvertTabIndex( ConvertTabIndex( newTab ) ) )->Active(); |
2904 if ( feedback && !isActiveTab ) |
2946 if ( feedback && !isActiveTab ) |
2905 { |
2947 { |
2906 feedback->InstantFeedback( this, |
2948 feedback->InstantFeedback( this, |
2907 ETouchFeedbackBasic, |
2949 ETouchFeedbackTab, |
2908 ETouchFeedbackVibra, |
2950 ETouchFeedbackVibra, |
2909 aPointerEvent ); |
2951 aPointerEvent ); |
2910 } |
2952 } |
2911 } |
2953 } |
2912 if ( !tabBackgroundUsed ) |
2954 if ( !tabBackgroundUsed ) |
2915 // pointer position. |
2957 // pointer position. |
2916 newTab = -1; |
2958 newTab = -1; |
2917 } |
2959 } |
2918 |
2960 |
2919 // if the button up event occurs ouside tabgroup, ignore it. |
2961 // if the button up event occurs ouside tabgroup, ignore it. |
2920 if ( !Rect().Contains( aPointerEvent.iPosition ) ) |
2962 if ( !Rect().Contains( aPointerEvent.iPosition ) || iExtension->iPointerDownTab != newTab ) |
2921 { |
2963 { |
2922 iExtension->iPointerDownTab = -1; |
2964 iExtension->iPointerDownTab = -1; |
2923 iExtension->iPointerDownXPosition = -1; |
2965 iExtension->iPointerDownXPosition = -1; |
2924 return ; |
2966 if (iExtension->iHighlight) |
|
2967 { |
|
2968 iExtension->iHighlight = EFalse; |
|
2969 ResetHighlightStatus(); |
|
2970 DrawDeferred(); |
|
2971 } |
|
2972 return; |
2925 } |
2973 } |
2926 |
2974 |
2927 if ( newTab != iActiveTab && |
2975 if ( newTab != iActiveTab && |
2928 newTab > -1 && |
2976 newTab > -1 && |
2929 newTab == iExtension->iPointerDownTab && |
2977 newTab == iExtension->iPointerDownTab && |
3395 |
3449 |
3396 iExtension->iTabSvgGraphics->SetTabGroupBackgroundParent( |
3450 iExtension->iTabSvgGraphics->SetTabGroupBackgroundParent( |
3397 ParentRect( iExtension->iNaviArrowsUsed ) ); |
3451 ParentRect( iExtension->iNaviArrowsUsed ) ); |
3398 |
3452 |
3399 iExtension->iTabBackgroundLayout.iUse = EFalse; |
3453 iExtension->iTabBackgroundLayout.iUse = EFalse; |
3400 TRAP_IGNORE( iExtension->iTabSvgGraphics->DrawTabGroupBackgroundL( |
3454 iExtension->iTabSvgGraphics->DrawTabGroupBackground( |
3401 CAknTabGroupGraphics::ENoDraw, |
3455 CAknTabGroupGraphics::ENoDraw, |
3402 iLongTabs, |
3456 iLongTabs, |
3403 iNumberOfTabsShown, |
3457 iNumberOfTabsShown, |
3404 1, |
3458 1, |
3405 NULL, |
3459 NULL, |
3406 iExtension->iTabBackgroundLayout, |
3460 iExtension->iTabBackgroundLayout, |
3407 CAknTabGroupGraphics::ENone ) ); |
3461 CAknTabGroupGraphics::ENone ); |
3408 iExtension->iTabBackgroundLayout.iUse = ETrue; |
3462 iExtension->iTabBackgroundLayout.iUse = ETrue; |
3409 SetDecoratorLayout( EFalse ); |
3463 SetDecoratorLayout( EFalse ); |
3410 } |
3464 } |
3411 |
3465 |
3412 if ( iExtension ) |
3466 if ( iExtension ) |
3413 { |
3467 { |
3414 iExtension->iNarrowTabLayout = EFalse; |
3468 iExtension->iNarrowTabLayout = EFalse; |
|
3469 if( iExtension->iHighlight ) |
|
3470 { |
|
3471 iExtension->iHighlight = EFalse; |
|
3472 ResetHighlightStatus(); |
|
3473 } |
3415 } |
3474 } |
3416 |
3475 |
3417 if ( !COMPARE_BOOLS( iMirrored, AknLayoutUtils::LayoutMirrored() ) ) |
3476 if ( !COMPARE_BOOLS( iMirrored, AknLayoutUtils::LayoutMirrored() ) ) |
3418 { |
3477 { |
3419 TInt active = ActiveTabIndex(); |
3478 TInt active = ActiveTabIndex(); |
4075 } |
4134 } |
4076 } |
4135 } |
4077 else |
4136 else |
4078 { |
4137 { |
4079 iExtension->iNextTabBackgroundLayout.iUse = EFalse; |
4138 iExtension->iNextTabBackgroundLayout.iUse = EFalse; |
4080 iExtension->iTabSvgGraphics->DrawTabGroupBackgroundL( |
4139 iExtension->iTabSvgGraphics->DrawTabGroupBackground( |
4081 CAknTabGroupGraphics::ENoDraw, |
4140 CAknTabGroupGraphics::ENoDraw, |
4082 iLongTabs, |
4141 iLongTabs, |
4083 iNumberOfTabsShown, |
4142 iNumberOfTabsShown, |
4084 positionActive + 1, |
4143 positionActive + 1, |
4085 NULL, |
4144 NULL, |
4086 iExtension->iNextTabBackgroundLayout, |
4145 iExtension->iNextTabBackgroundLayout, |
4087 CAknTabGroupGraphics::ENone ); |
4146 CAknTabGroupGraphics::ENone ); |
4088 iExtension->iNextTabBackgroundLayout.iUse = ETrue; |
4147 iExtension->iNextTabBackgroundLayout.iUse = ETrue; |
4089 |
4148 |
4090 iExtension->iTabBackgroundLayout.iUse = EFalse; |
4149 iExtension->iTabBackgroundLayout.iUse = EFalse; |
4091 iExtension->iTabSvgGraphics->DrawTabGroupBackgroundL( |
4150 iExtension->iTabSvgGraphics->DrawTabGroupBackground( |
4092 CAknTabGroupGraphics::ENoDraw, |
4151 CAknTabGroupGraphics::ENoDraw, |
4093 iLongTabs, |
4152 iLongTabs, |
4094 iNumberOfTabsShown, |
4153 iNumberOfTabsShown, |
4095 positionActive + 1, |
4154 positionActive + 1, |
4096 NULL, |
4155 NULL, |