phonebookui/Phonebook2/UIControls/src/cpbk2contactviewcustomlistboxdata.cpp
branchRCL_3
changeset 58 d4f567ce2e7c
parent 35 4ae315f230bc
child 64 c1e8ba0c2b16
equal deleted inserted replaced
57:2666d9724c76 58:d4f567ce2e7c
   362 #endif // RD_LIST_STRETCH
   362 #endif // RD_LIST_STRETCH
   363 
   363 
   364     
   364     
   365     iKineticScrolling = CAknPhysics::FeatureEnabled();
   365     iKineticScrolling = CAknPhysics::FeatureEnabled();
   366 
   366 
   367 #ifdef PBK2_AVKON_TOUCH_MARKINGMODE_CHANGES
       
   368     LoadMarkingIconsL();
   367     LoadMarkingIconsL();
   369 #endif // PBK2_AVKON_TOUCH_MARKINGMODE_CHANGES
       
   370 
   368 
   371     }
   369     }
   372 
   370 
   373 CPbk2ContactViewCustomListBoxDataExtension::~CPbk2ContactViewCustomListBoxDataExtension()
   371 CPbk2ContactViewCustomListBoxDataExtension::~CPbk2ContactViewCustomListBoxDataExtension()
   374     {
   372     {
   589 // CPbk2ContactViewCustomListBoxDataExtension::SkinChangedL
   587 // CPbk2ContactViewCustomListBoxDataExtension::SkinChangedL
   590 // -----------------------------------------------------------------------------
   588 // -----------------------------------------------------------------------------
   591 //
   589 //
   592 void CPbk2ContactViewCustomListBoxDataExtension::SkinChangedL()
   590 void CPbk2ContactViewCustomListBoxDataExtension::SkinChangedL()
   593     {
   591     {
   594 #ifdef PBK2_AVKON_TOUCH_MARKINGMODE_CHANGES
       
   595     DeleteAnim();
   592     DeleteAnim();
   596     TryCreateAnimation();
   593     TryCreateAnimation();
   597     CreateColorBitmapsL();
   594     CreateColorBitmapsL();
   598     LoadMarkingIconsL();
   595     LoadMarkingIconsL();
   599 #endif // PBK2_AVKON_TOUCH_MARKINGMODE_CHANGES
       
   600     }
   596     }
   601 // -----------------------------------------------------------------------------
   597 // -----------------------------------------------------------------------------
   602 // CPbk2ContactViewCustomListBoxDataExtension::SkinChanged
   598 // CPbk2ContactViewCustomListBoxDataExtension::SkinChanged
   603 // -----------------------------------------------------------------------------
   599 // -----------------------------------------------------------------------------
   604 //
   600 //
  1186 // CPbk2ContactViewCustomListBoxDataExtension::LoadMarkingIconsL
  1182 // CPbk2ContactViewCustomListBoxDataExtension::LoadMarkingIconsL
  1187 // -----------------------------------------------------------------------------
  1183 // -----------------------------------------------------------------------------
  1188 //
  1184 //
  1189 void CPbk2ContactViewCustomListBoxDataExtension::LoadMarkingIconsL()
  1185 void CPbk2ContactViewCustomListBoxDataExtension::LoadMarkingIconsL()
  1190     {
  1186     {
  1191 #ifdef PBK2_AVKON_TOUCH_MARKINGMODE_CHANGES
       
  1192     if ( !iMarkingIconArray )
  1187     if ( !iMarkingIconArray )
  1193         {
  1188         {
  1194         iMarkingIconArray = new ( ELeave ) CAknIconArray( 2 );
  1189         iMarkingIconArray = new ( ELeave ) CAknIconArray( 2 );
  1195         }
  1190         }
  1196     else
  1191     else
  1215             EMbmAvkonQgn_prop_checkbox_off_mask );
  1210             EMbmAvkonQgn_prop_checkbox_off_mask );
  1216 
  1211 
  1217     CleanupStack::PushL( icon );
  1212     CleanupStack::PushL( icon );
  1218     iMarkingIconArray->AppendL( icon );
  1213     iMarkingIconArray->AppendL( icon );
  1219     CleanupStack::Pop( icon );
  1214     CleanupStack::Pop( icon );
  1220 #endif // PBK2_AVKON_TOUCH_MARKINGMODE_CHANGES
       
  1221     }
  1215     }
  1222 
  1216 
  1223 CCoeControl *CPbk2ContactViewCustomListBoxData::Control() const 
  1217 CCoeControl *CPbk2ContactViewCustomListBoxData::Control() const 
  1224     {
  1218     {
  1225     return iExtension->iControl;
  1219     return iExtension->iControl;
  2039     TPtrC text;
  2033     TPtrC text;
  2040     TPtrC tempText;
  2034     TPtrC tempText;
  2041 
  2035 
  2042     TRgb aTextColor = aHighlight ? aColors.iHighlightedText : aColors.iText;
  2036     TRgb aTextColor = aHighlight ? aColors.iHighlightedText : aColors.iText;
  2043     
  2037     
  2044 #ifdef PBK2_AVKON_TOUCH_MARKINGMODE_CHANGES
       
  2045     TBool markingMode = EFalse;
  2038     TBool markingMode = EFalse;
  2046     TRect itemRect( aRect );
  2039     TRect itemRect( aRect );
  2047     
  2040     
  2048     if ( listbox->View() && listbox->View()->ItemDrawer() )
  2041     if ( listbox->View() && listbox->View()->ItemDrawer() )
  2049         {
  2042         {
  2055             markingMode = ETrue;
  2048             markingMode = ETrue;
  2056             itemRect.iTl.iX += 
  2049             itemRect.iTl.iX += 
  2057                     AknLayoutScalable_Avkon::list_single_graphic_pane_t1( 0 ).LayoutLine().il;
  2050                     AknLayoutScalable_Avkon::list_single_graphic_pane_t1( 0 ).LayoutLine().il;
  2058             }
  2051             }
  2059         }
  2052         }
  2060 #endif // PBK2_AVKON_TOUCH_MARKINGMODE_CHANGES
       
  2061 
  2053 
  2062     MAknsSkinInstance *skin = AknsUtils::SkinInstance();
  2054     MAknsSkinInstance *skin = AknsUtils::SkinInstance();
  2063     MAknsControlContext *cc = AknsDrawUtils::ControlContext( Control() );
  2055     MAknsControlContext *cc = AknsDrawUtils::ControlContext( Control() );
  2064     if (!cc)
  2056     if (!cc)
  2065         {
  2057         {
  2071     
  2063     
  2072     Mem::FillZ( &rectClipped[0], KMaxColumn * sizeof( TBool ) );
  2064     Mem::FillZ( &rectClipped[0], KMaxColumn * sizeof( TBool ) );
  2073     
  2065     
  2074     if ( iExtension->iSubCellsMightIntersect )
  2066     if ( iExtension->iSubCellsMightIntersect )
  2075         {
  2067         {
  2076 #ifdef PBK2_AVKON_TOUCH_MARKINGMODE_CHANGES
       
  2077         CheckIfSubCellsIntersectL( &textLines[0], &rectClipped[0], *aText, itemRect );
  2068         CheckIfSubCellsIntersectL( &textLines[0], &rectClipped[0], *aText, itemRect );
  2078         }
  2069         }
  2079 #else
       
  2080         CheckIfSubCellsIntersectL( &textLines[0], &rectClipped[0], *aText, aRect );
       
  2081         }
       
  2082 #endif // PBK2_AVKON_TOUCH_MARKINGMODE_CHANGES
       
  2083 #ifdef RD_UI_TRANSITION_EFFECTS_LIST
  2070 #ifdef RD_UI_TRANSITION_EFFECTS_LIST
  2084     MAknListBoxTfxInternal *transApi = CAknListLoader::TfxApiInternal( &aGc );
  2071     MAknListBoxTfxInternal *transApi = CAknListLoader::TfxApiInternal( &aGc );
  2085 #endif // RD_UI_TRANSITION_EFFECTS_LIST
  2072 #endif // RD_UI_TRANSITION_EFFECTS_LIST
  2086 
  2073 
  2087     if ( !listbox || !listbox->BackgroundDrawingSuppressed() )
  2074     if ( !listbox || !listbox->BackgroundDrawingSuppressed() )
  2118         {
  2105         {
  2119         AknListUtils::DrawSeparator( aGc, aRect, aColors.iText, skin );
  2106         AknListUtils::DrawSeparator( aGc, aRect, aColors.iText, skin );
  2120         }
  2107         }
  2121     DrawHighLight( aGc, aRect, aHighlight, skin );
  2108     DrawHighLight( aGc, aRect, aHighlight, skin );
  2122     
  2109     
  2123 #ifdef PBK2_AVKON_TOUCH_MARKINGMODE_CHANGES
       
  2124     if ( markingMode && !aItemProperties.IsSelectionHidden() )
  2110     if ( markingMode && !aItemProperties.IsSelectionHidden() )
  2125         {
  2111         {
  2126         TAknLayoutRect layoutRect;
  2112         TAknLayoutRect layoutRect;
  2127         layoutRect.LayoutRect( aRect, 
  2113         layoutRect.LayoutRect( aRect, 
  2128                 AknLayoutScalable_Avkon::list_single_graphic_pane_g1( 0 ) );
  2114                 AknLayoutScalable_Avkon::list_single_graphic_pane_g1( 0 ) );
  2152 
  2138 
  2153             aGc.BitBltMasked( layoutRect.Rect().iTl, bitmap, TRect( layoutRect.Rect().Size() ), icon->Mask(), EFalse );
  2139             aGc.BitBltMasked( layoutRect.Rect().iTl, bitmap, TRect( layoutRect.Rect().Size() ), icon->Mask(), EFalse );
  2154             }
  2140             }
  2155         
  2141         
  2156         }
  2142         }
  2157 #endif // PBK2_AVKON_TOUCH_MARKINGMODE_CHANGES
       
  2158     
  2143     
  2159     // The column draw loop
  2144     // The column draw loop
  2160     column = 0;
  2145     column = 0;
  2161     TInt subCellIndex = 0;
  2146     TInt subCellIndex = 0;
  2162     // Whether need to redraw the PopupCharacter
  2147     // Whether need to redraw the PopupCharacter
  2268                     default:  break;
  2253                     default:  break;
  2269                     };
  2254                     };
  2270                 }
  2255                 }
  2271             
  2256             
  2272             TAknLayoutText textLayout;
  2257             TAknLayoutText textLayout;
  2273 #ifdef PBK2_AVKON_TOUCH_MARKINGMODE_CHANGES
       
  2274             textLayout.LayoutText( itemRect, textLineLayout, usedFont );
  2258             textLayout.LayoutText( itemRect, textLineLayout, usedFont );
  2275             TRect layoutedRect( itemRect);
  2259             TRect layoutedRect( itemRect);
  2276 #else
       
  2277             textLayout.LayoutText( aRect, textLineLayout, usedFont );
       
  2278             TRect layoutedRect( aRect );
       
  2279 #endif // PBK2_AVKON_TOUCH_MARKINGMODE_CHANGES
       
  2280                           
  2260                           
  2281             // *2 == leave some room for marquee
  2261             // *2 == leave some room for marquee
  2282             const TInt maxlen( KMaxColumnDataLength * 2 ); 
  2262             const TInt maxlen( KMaxColumnDataLength * 2 ); 
  2283             TBuf<maxlen> convBuf = text.Left(maxlen);
  2263             TBuf<maxlen> convBuf = text.Left(maxlen);
  2284 
  2264 
  2321             
  2301             
  2322             if ( iExtension->IsMarqueeOn() && doesNotFit && !marqueeDisabled )
  2302             if ( iExtension->IsMarqueeOn() && doesNotFit && !marqueeDisabled )
  2323                 {
  2303                 {
  2324                 iExtension->iMarquee->UseLogicalToVisualConversion( bidiConv );
  2304                 iExtension->iMarquee->UseLogicalToVisualConversion( bidiConv );
  2325                 
  2305                 
  2326 #ifdef PBK2_AVKON_TOUCH_MARKINGMODE_CHANGES
       
  2327                 if ( iExtension->iMarquee->DrawText( aGc, itemRect, textLineLayout, convBuf, usedFont, textColor ) )
  2306                 if ( iExtension->iMarquee->DrawText( aGc, itemRect, textLineLayout, convBuf, usedFont, textColor ) )
  2328 #else
       
  2329                 if ( iExtension->iMarquee->DrawText( aGc, aRect, textLineLayout, convBuf, usedFont, textColor ) )
       
  2330 #endif // PBK2_AVKON_TOUCH_MARKINGMODE_CHANGES
       
  2331                     {
  2307                     {
  2332                     // all the loops have been executed
  2308                     // all the loops have been executed
  2333                     textLayout.DrawText( aGc, convBuf, bidiConv, textColor );
  2309                     textLayout.DrawText( aGc, convBuf, bidiConv, textColor );
  2334                     }
  2310                     }
  2335                 }
  2311                 }
  2427             __ASSERT_DEBUG((index>=0 && index<IconArray()->Count()),Panic(EPanicColumnListInvalidBitmapIndexListBoxData));
  2403             __ASSERT_DEBUG((index>=0 && index<IconArray()->Count()),Panic(EPanicColumnListInvalidBitmapIndexListBoxData));
  2428             
  2404             
  2429             TAknWindowLineLayout graphicLayout = iExtension->AtSL(subCellIndex).iGraphicLayout;
  2405             TAknWindowLineLayout graphicLayout = iExtension->AtSL(subCellIndex).iGraphicLayout;
  2430             TAknLayoutRect graphicRect; 
  2406             TAknLayoutRect graphicRect; 
  2431             
  2407             
  2432 #ifdef PBK2_AVKON_TOUCH_MARKINGMODE_CHANGES
       
  2433             graphicRect.LayoutRect( itemRect,graphicLayout );
  2408             graphicRect.LayoutRect( itemRect,graphicLayout );
  2434 #else
       
  2435             graphicRect.LayoutRect(aRect,graphicLayout);
       
  2436 #endif // PBK2_AVKON_TOUCH_MARKINGMODE_CHANGES
       
  2437             TSize graphicSize( graphicRect.Rect().Size() );
  2409             TSize graphicSize( graphicRect.Rect().Size() );
  2438             
  2410             
  2439             if (index>=0 && IconArray())
  2411             if (index>=0 && IconArray())
  2440                 {
  2412                 {
  2441                 CGulIcon* icon=(*IconArray())[index];
  2413                 CGulIcon* icon=(*IconArray())[index];
  2526             aGc.DiscardFont();
  2498             aGc.DiscardFont();
  2527             }
  2499             }
  2528         return;
  2500         return;
  2529         }
  2501         }
  2530 
  2502 
  2531 #ifdef PBK2_AVKON_TOUCH_MARKINGMODE_CHANGES
       
  2532     CEikListBox* listbox = static_cast<CEikListBox*>( iExtension->iControl );
  2503     CEikListBox* listbox = static_cast<CEikListBox*>( iExtension->iControl );
  2533     TBool markingMode = EFalse;
  2504     TBool markingMode = EFalse;
  2534     TRect itemRect( aRect );
  2505     TRect itemRect( aRect );
  2535     
  2506     
  2536     if ( listbox->View() && listbox->View()->ItemDrawer() )
  2507     if ( listbox->View() && listbox->View()->ItemDrawer() )
  2543             markingMode = ETrue;
  2514             markingMode = ETrue;
  2544             itemRect.iTl.iX += 
  2515             itemRect.iTl.iX += 
  2545                 AknLayoutScalable_Avkon::list_single_graphic_pane_t1( 0 ).LayoutLine().il;
  2516                 AknLayoutScalable_Avkon::list_single_graphic_pane_t1( 0 ).LayoutLine().il;
  2546             }
  2517             }
  2547         }
  2518         }
  2548 #endif // PBK2_AVKON_TOUCH_MARKINGMODE_CHANGES
       
  2549     
  2519     
  2550     TInt extraVerticalSpace=(aRect.Height()-font->HeightInPixels());
  2520     TInt extraVerticalSpace=(aRect.Height()-font->HeightInPixels());
  2551     TInt baseLineOffset=extraVerticalSpace/2+font->AscentInPixels();
  2521     TInt baseLineOffset=extraVerticalSpace/2+font->AscentInPixels();
  2552 #ifdef PBK2_AVKON_TOUCH_MARKINGMODE_CHANGES
       
  2553     TRect textRect( itemRect );
  2522     TRect textRect( itemRect );
  2554     TRect textMRect; // textrect with margins.
  2523     TRect textMRect; // textrect with margins.
  2555     textRect.iBr.iX = itemRect.iTl.iX;
  2524     textRect.iBr.iX = itemRect.iTl.iX;
  2556 #else
       
  2557     TRect textRect( aRect );
       
  2558     TRect textMRect; // textrect with margins.
       
  2559     textRect.iBr.iX=aRect.iTl.iX;
       
  2560 #endif // PBK2_AVKON_TOUCH_MARKINGMODE_CHANGES
       
  2561     TInt column=0;
  2525     TInt column=0;
  2562     TPtrC text;
  2526     TPtrC text;
  2563 
  2527 
  2564     TRgb aTextColor = aHighlight ? aColors.iHighlightedText : aColors.iText;
  2528     TRgb aTextColor = aHighlight ? aColors.iHighlightedText : aColors.iText;
  2565 
  2529 
  2566     // Turned the drawing to multipass algorithm, because optionalcolumns drawing will
  2530     // Turned the drawing to multipass algorithm, because optionalcolumns drawing will
  2567     // be too difficult to do without - and this is cleaner solution.
  2531     // be too difficult to do without - and this is cleaner solution.
  2568     
  2532     
  2569     // pass 1, figures out x-coordinates for columns.
  2533     // pass 1, figures out x-coordinates for columns.
  2570 #ifdef PBK2_AVKON_TOUCH_MARKINGMODE_CHANGES
       
  2571     TInt x = itemRect.iTl.iX;
  2534     TInt x = itemRect.iTl.iX;
  2572 #else
       
  2573     TInt x = aRect.iTl.iX;
       
  2574 #endif // PBK2_AVKON_TOUCH_MARKINGMODE_CHANGES
       
  2575     
  2535     
  2576     TBool mirror = AknLayoutUtils::LayoutMirrored();
  2536     TBool mirror = AknLayoutUtils::LayoutMirrored();
  2577     if (mirror)
  2537     if (mirror)
  2578         {
  2538         {
  2579 #ifdef PBK2_AVKON_TOUCH_MARKINGMODE_CHANGES
       
  2580         x = itemRect.iBr.iX;
  2539         x = itemRect.iBr.iX;
  2581 #else
       
  2582         x = aRect.iBr.iX;
       
  2583 #endif // PBK2_AVKON_TOUCH_MARKINGMODE_CHANGES
       
  2584         }
  2540         }
  2585     TInt maxx = x;
  2541     TInt maxx = x;
  2586     while(column <= lastColumn)
  2542     while(column <= lastColumn)
  2587         {
  2543         {
  2588         // order of instructions is important here, do not change.
  2544         // order of instructions is important here, do not change.
  2651     if (!cc)
  2607     if (!cc)
  2652         {
  2608         {
  2653         cc = SkinBackgroundContext();
  2609         cc = SkinBackgroundContext();
  2654         }
  2610         }
  2655 
  2611 
  2656 #ifndef PBK2_AVKON_TOUCH_MARKINGMODE_CHANGES
       
  2657     // aRect is list item's rect, width of which is smaller than width of the list
       
  2658     // with a scroll bar. List needs to draw under scroll bar anyway, so we need to
       
  2659     // modify given rect here.
       
  2660     TRect r(aRect);
       
  2661     
       
  2662     CEikListBox* listbox = static_cast<CEikListBox*>( iExtension->iControl );
       
  2663 #endif // !PBK2_AVKON_TOUCH_MARKINGMODE_CHANGES
       
  2664 
       
  2665 #ifdef RD_UI_TRANSITION_EFFECTS_LIST
  2612 #ifdef RD_UI_TRANSITION_EFFECTS_LIST
  2666 
  2613 
  2667     MAknListBoxTfxInternal *transApi = CAknListLoader::TfxApiInternal( &aGc );
  2614     MAknListBoxTfxInternal *transApi = CAknListLoader::TfxApiInternal( &aGc );
  2668 
  2615 
  2669 #endif // RD_UI_TRANSITION_EFFECTS_LIST
  2616 #endif // RD_UI_TRANSITION_EFFECTS_LIST
  2695             transApi->StopDrawing();
  2642             transApi->StopDrawing();
  2696             }
  2643             }
  2697 #endif // RD_UI_TRANSITION_EFFECTS_LIST
  2644 #endif // RD_UI_TRANSITION_EFFECTS_LIST
  2698         }
  2645         }
  2699     
  2646     
  2700 #ifdef PBK2_AVKON_TOUCH_MARKINGMODE_CHANGES
       
  2701     if ( iExtension->iCurrentRow < listbox->BottomItemIndex() )
  2647     if ( iExtension->iCurrentRow < listbox->BottomItemIndex() )
  2702 #else
  2648 
  2703     CEikListBox* list = static_cast<CEikListBox*>( iExtension->iControl );
       
  2704 
       
  2705     if ( iExtension->iCurrentRow < list->BottomItemIndex() )
       
  2706 #endif // PBK2_AVKON_TOUCH_MARKINGMODE_CHANGES
       
  2707         {
  2649         {
  2708         AknListUtils::DrawSeparator( aGc, aRect, aColors.iText, skin );
  2650         AknListUtils::DrawSeparator( aGc, aRect, aColors.iText, skin );
  2709         }
  2651         }
  2710 
  2652 
  2711  // LISTBOX LINES NEED TO BE DRAWN HERE.
  2653  // LISTBOX LINES NEED TO BE DRAWN HERE.
  2718         CListBoxView* view = static_cast<CEikListBox*>( iExtension->iControl )->View();
  2660         CListBoxView* view = static_cast<CEikListBox*>( iExtension->iControl )->View();
  2719         aGc.SetClippingRect( view->ViewRect() );
  2661         aGc.SetClippingRect( view->ViewRect() );
  2720         }
  2662         }
  2721 #endif // RD_UI_TRANSITION_EFFECTS_LIST
  2663 #endif // RD_UI_TRANSITION_EFFECTS_LIST
  2722 
  2664 
  2723 #ifdef PBK2_AVKON_TOUCH_MARKINGMODE_CHANGES
       
  2724     if ( markingMode && !aItemProperties.IsSelectionHidden() )
  2665     if ( markingMode && !aItemProperties.IsSelectionHidden() )
  2725         {
  2666         {
  2726         TAknLayoutRect layoutRect;
  2667         TAknLayoutRect layoutRect;
  2727         layoutRect.LayoutRect(
  2668         layoutRect.LayoutRect(
  2728             aRect, 
  2669             aRect, 
  2759                               TRect( layoutRect.Rect().Size() ),
  2700                               TRect( layoutRect.Rect().Size() ),
  2760                               icon->Mask(),
  2701                               icon->Mask(),
  2761                               EFalse );
  2702                               EFalse );
  2762             }
  2703             }
  2763         }
  2704         }
  2764 #endif // PBK2_AVKON_TOUCH_MARKINGMODE_CHANGES
       
  2765     
  2705     
  2766     // The column draw loop
  2706     // The column draw loop
  2767     column = 0;
  2707     column = 0;
  2768     FOREVER
  2708     FOREVER
  2769         {
  2709         {
  3380     {
  3320     {
  3381     // Animation is skin dependent, whenever skin changes animation changes
  3321     // Animation is skin dependent, whenever skin changes animation changes
  3382     // too.
  3322     // too.
  3383     if( KAknsMessageSkinChange == aType )
  3323     if( KAknsMessageSkinChange == aType )
  3384         {
  3324         {
  3385 #ifdef PBK2_AVKON_TOUCH_MARKINGMODE_CHANGES
       
  3386         TRAP_IGNORE( iExtension->SkinChangedL() );
  3325         TRAP_IGNORE( iExtension->SkinChangedL() );
  3387 #else
  3326 
  3388         iExtension->SkinChanged();
       
  3389 #endif // PBK2_AVKON_TOUCH_MARKINGMODE_CHANGES
       
  3390         }
  3327         }
  3391     else if(aType == KEikDynamicLayoutVariantSwitch)
  3328     else if(aType == KEikDynamicLayoutVariantSwitch)
  3392         {
  3329         {
  3393         // What is under highlight may have changed -> we need to update
  3330         // What is under highlight may have changed -> we need to update
  3394         // highlight background to animation.
  3331         // highlight background to animation.