874 |
874 |
875 if( HighlightEnabled() ) |
875 if( HighlightEnabled() ) |
876 { |
876 { |
877 SetFocusedItem( focusedItem, index, ETrue ); |
877 SetFocusedItem( focusedItem, index, ETrue ); |
878 } |
878 } |
|
879 else |
|
880 { |
|
881 // This block moves visible view after layout switch |
|
882 // if there are not enough items to fill whole screen |
|
883 TInt visibleItemIndex = iTree.VisibleItemIndex( focusedItem ); |
|
884 if ( visibleItemIndex != KErrNotFound ) |
|
885 { |
|
886 TInt visibleItemCount( iTree.VisibleItemCount() ); |
|
887 TInt itemCountLimit = iItems.Count(); |
|
888 if ( visibleItemCount <= itemCountLimit - KAdditionalItems ) |
|
889 { |
|
890 UpdateVisibleItems( visibleItemIndex, focusedItem ); |
|
891 } |
|
892 } |
|
893 } |
|
894 |
879 } |
895 } |
880 else |
896 else |
881 { |
897 { |
882 SetFocusedItem( focusedItem, FocusIndex(), ETrue ); |
898 SetFocusedItem( focusedItem, FocusIndex(), ETrue ); |
883 |
899 |
897 TInt itemCountLimit = iItems.Count(); |
913 TInt itemCountLimit = iItems.Count(); |
898 |
914 |
899 if ( height < itemCountLimit && |
915 if ( height < itemCountLimit && |
900 height < visibleItemCount ) |
916 height < visibleItemCount ) |
901 { |
917 { |
902 TInt move = itemCountLimit - height; |
918 TInt move = itemCountLimit - height; |
903 UpdateVisibleItems( |
919 UpdateVisibleItems( focusedItemIndex + move, focusedItem ); |
904 focusedItemIndex + move, focusedItem ); |
|
905 } |
920 } |
906 } |
921 } |
907 } |
922 } |
908 // end of block |
923 // end of block |
909 } |
924 } |
2034 for ( TInt ii = iItems.Count(); ii < itemCountLimit; ++ii ) |
2049 for ( TInt ii = iItems.Count(); ii < itemCountLimit; ++ii ) |
2035 { |
2050 { |
2036 // This should not fail, if enough space was reserved for the |
2051 // This should not fail, if enough space was reserved for the |
2037 // array, and if it fails, it results only fewer items being |
2052 // array, and if it fails, it results only fewer items being |
2038 // shown in the list. |
2053 // shown in the list. |
2039 iItems.Append( TAknTreeListViewItem() ); |
2054 if ( KErrNone != iItems.Append( TAknTreeListViewItem() ) ) |
|
2055 { |
|
2056 return; |
|
2057 } |
2040 } |
2058 } |
2041 } |
2059 } |
2042 |
2060 |
2043 // Get iterator and set it to point at the first item in the view, or at |
2061 // Get iterator and set it to point at the first item in the view, or at |
2044 // the first item in the list, if the view does not contain any items. |
2062 // the first item in the list, if the view does not contain any items. |
2048 { |
2066 { |
2049 iterator.SetCurrent( first ); |
2067 iterator.SetCurrent( first ); |
2050 iterator.Previous(); |
2068 iterator.Previous(); |
2051 } |
2069 } |
2052 if ( iFlags.IsSet( EFlagMarkingMode ) ) |
2070 if ( iFlags.IsSet( EFlagMarkingMode ) ) |
2053 |
2071 { |
2054 { |
2072 if ( iFlags.IsSet( EFlagMirroredLayoutInUse )) |
2055 itemRect.iBr.iX -= |
2073 { |
2056 AknLayoutScalable_Avkon::list_double_graphic_pane_t1( |
2074 itemRect.iBr.iX -= |
2057 0 ).LayoutLine().il; |
2075 AknLayoutScalable_Avkon::list_double_graphic_pane_t1( |
|
2076 0 ).LayoutLine().ir; |
|
2077 } |
|
2078 else |
|
2079 { |
|
2080 itemRect.iBr.iX -= |
|
2081 AknLayoutScalable_Avkon::list_double_graphic_pane_t1( |
|
2082 0 ).LayoutLine().il; |
|
2083 } |
2058 } |
2084 } |
2059 |
2085 |
2060 // Update items and their rectangles. |
2086 // Update items and their rectangles. |
2061 for ( TInt ii = 0; ii < iItems.Count(); ++ii ) |
2087 for ( TInt ii = 0; ii < iItems.Count(); ++ii ) |
2062 { |
2088 { |
2842 CWindowGc& gc = iGc && !empty ? *iGc : SystemGc(); |
2868 CWindowGc& gc = iGc && !empty ? *iGc : SystemGc(); |
2843 #else |
2869 #else |
2844 CWindowGc& gc = SystemGc(); |
2870 CWindowGc& gc = SystemGc(); |
2845 #endif |
2871 #endif |
2846 |
2872 |
2847 TInt checkBoxOffset = |
2873 TInt checkBoxOffset ( 0 ); |
2848 AknLayoutScalable_Avkon::list_double_graphic_pane_t1( |
2874 if ( iFlags.IsSet( EFlagMarkingMode ) ) |
2849 0 ).LayoutLine().il; |
2875 { |
|
2876 if ( iFlags.IsSet( EFlagMirroredLayoutInUse ) ) |
|
2877 { |
|
2878 checkBoxOffset = |
|
2879 AknLayoutScalable_Avkon::list_double_graphic_pane_t1( |
|
2880 0 ).LayoutLine().ir; |
|
2881 } |
|
2882 else |
|
2883 { |
|
2884 checkBoxOffset = |
|
2885 AknLayoutScalable_Avkon::list_double_graphic_pane_t1( |
|
2886 0 ).LayoutLine().il; |
|
2887 } |
|
2888 } |
2850 #ifdef RD_UI_TRANSITION_EFFECTS_LIST |
2889 #ifdef RD_UI_TRANSITION_EFFECTS_LIST |
2851 MAknListBoxTfxInternal* transApi = CAknListLoader::TfxApiInternal( &gc ); |
2890 MAknListBoxTfxInternal* transApi = CAknListLoader::TfxApiInternal( &gc ); |
2852 if ( !empty && transApi ) |
2891 if ( !empty && transApi ) |
2853 { |
2892 { |
2854 |
2893 |
2980 { |
3019 { |
2981 transApi->StopDrawing(); |
3020 transApi->StopDrawing(); |
2982 } |
3021 } |
2983 #endif |
3022 #endif |
2984 |
3023 |
2985 if ( iFlags.IsSet( EFlagMarkingMode ) && iMarkingIconArray |
|
2986 && iMarkingIconArray->Count() == |
|
2987 KMarkingModeIconArraySize ) |
|
2988 { |
|
2989 // Rect for the marking icon |
|
2990 TRect iconRect = RectFromLayout( drawRect, |
|
2991 AknLayoutScalable_Avkon::list_single_graphic_pane_g1( 0 ) ); |
|
2992 |
|
2993 iconRect.Move( 0, -offset ); |
|
2994 // unchecked icon |
|
2995 CGulIcon* icon = ( *iMarkingIconArray )[1]; |
|
2996 |
|
2997 TBool marked = ( iItems[ii].Item()->IsMarked() ); |
|
2998 if ( marked ) |
|
2999 { |
|
3000 icon = (*iMarkingIconArray)[0]; |
|
3001 } |
|
3002 |
|
3003 CFbsBitmap* bitmap = icon->Bitmap(); |
|
3004 |
|
3005 if ( bitmap ) |
|
3006 { |
|
3007 gc.BitBltMasked( iconRect.iTl, bitmap, |
|
3008 iconRect.Size(), icon->Mask(), EFalse ); |
|
3009 } |
|
3010 } |
|
3011 |
|
3012 if ( iItems[ii].Item() != iBottomItem ) |
3024 if ( iItems[ii].Item() != iBottomItem ) |
3013 { |
3025 { |
3014 TRect offsetRect( drawRect ); |
3026 TRect offsetRect( drawRect ); |
3015 offsetRect.Move( 0, -offset ); |
3027 offsetRect.Move( 0, -offset ); |
3016 AknListUtils::DrawSeparator( gc, offsetRect, textColor, skin ); |
3028 AknListUtils::DrawSeparator( gc, offsetRect, textColor, skin ); |
3017 } |
3029 } |
3018 |
3030 |
3019 if ( iFlags.IsSet( EFlagMarkingMode ) ) |
|
3020 { |
|
3021 gc.SetOrigin( TPoint( checkBoxOffset, 0 ) ); |
|
3022 drawRect.iBr.iX -= checkBoxOffset; |
|
3023 } |
|
3024 |
|
3025 TBool focused = ( FocusedItem() && |
3031 TBool focused = ( FocusedItem() && |
3026 iItems[ii].Item() == FocusedItem() ); |
3032 iItems[ii].Item() == FocusedItem() ); |
3027 |
3033 |
3028 if ( SingleClickEnabled() && !HighlightEnabled() ) |
3034 if ( SingleClickEnabled() && !HighlightEnabled() ) |
3029 { |
3035 { |
3033 if ( focused ) |
3039 if ( focused ) |
3034 { |
3040 { |
3035 // Draw highlight for focused item. |
3041 // Draw highlight for focused item. |
3036 TRect highlightRect( iItems[ii].HighlightRect( |
3042 TRect highlightRect( iItems[ii].HighlightRect( |
3037 iViewLevel, Indention(), IndentionWidth() ) ); |
3043 iViewLevel, Indention(), IndentionWidth() ) ); |
|
3044 |
|
3045 if ( iFlags.IsSet( EFlagMarkingMode ) ) |
|
3046 { |
|
3047 highlightRect.iBr.iX = drawRect.iBr.iX; |
|
3048 highlightRect.iTl.iX = drawRect.iTl.iX; |
|
3049 } |
3038 |
3050 |
3039 #ifdef RD_UI_TRANSITION_EFFECTS_LIST |
3051 #ifdef RD_UI_TRANSITION_EFFECTS_LIST |
3040 TRect tfxHighlightRect( highlightRect ); |
3052 TRect tfxHighlightRect( highlightRect ); |
3041 tfxHighlightRect.Move( 0, -offset ); |
3053 tfxHighlightRect.Move( 0, -offset ); |
3042 #endif //RD_UI_TRANSITION_EFFECTS_LIST |
3054 #endif //RD_UI_TRANSITION_EFFECTS_LIST |
3071 #ifdef RD_UI_TRANSITION_EFFECTS_LIST |
3083 #ifdef RD_UI_TRANSITION_EFFECTS_LIST |
3072 tfxDrawRect.BoundingRect( tfxHighlightRect ); |
3084 tfxDrawRect.BoundingRect( tfxHighlightRect ); |
3073 #endif //RD_UI_TRANSITION_EFFECTS_LIST |
3085 #endif //RD_UI_TRANSITION_EFFECTS_LIST |
3074 } |
3086 } |
3075 |
3087 |
|
3088 if ( iFlags.IsSet( EFlagMarkingMode ) && iMarkingIconArray |
|
3089 && iMarkingIconArray->Count() == |
|
3090 KMarkingModeIconArraySize ) |
|
3091 { |
|
3092 // Rect for the marking icon |
|
3093 TRect iconRect = RectFromLayout( drawRect, |
|
3094 AknLayoutScalable_Avkon::list_single_graphic_pane_g1( 0 ) ); |
|
3095 |
|
3096 iconRect.Move( 0, -offset ); |
|
3097 // unchecked icon |
|
3098 CGulIcon* icon = ( *iMarkingIconArray )[1]; |
|
3099 |
|
3100 TBool marked = ( iItems[ii].Item()->IsMarked() ); |
|
3101 if ( marked ) |
|
3102 { |
|
3103 icon = (*iMarkingIconArray)[0]; |
|
3104 } |
|
3105 |
|
3106 CFbsBitmap* bitmap = icon->Bitmap(); |
|
3107 |
|
3108 if ( bitmap ) |
|
3109 { |
|
3110 gc.BitBltMasked( iconRect.iTl, bitmap, |
|
3111 iconRect.Size(), icon->Mask(), EFalse ); |
|
3112 } |
|
3113 } |
|
3114 |
|
3115 if ( iFlags.IsSet( EFlagMarkingMode ) ) |
|
3116 { |
|
3117 drawRect.iBr.iX -= checkBoxOffset; |
|
3118 if ( iFlags.IsClear( EFlagMirroredLayoutInUse ) ) |
|
3119 { |
|
3120 gc.SetOrigin( TPoint( checkBoxOffset, 0 ) ); |
|
3121 } |
|
3122 } |
|
3123 |
3076 #ifdef RD_UI_TRANSITION_EFFECTS_LIST |
3124 #ifdef RD_UI_TRANSITION_EFFECTS_LIST |
3077 if (iItems[ii].Item()) |
3125 if (iItems[ii].Item()) |
3078 { |
3126 { |
3079 if ( transApi ) |
3127 if ( transApi ) |
3080 { |
3128 { |