phonebookui/Phonebook2/UIControls/src/CPbk2ContactViewListBox.cpp
branchRCL_3
changeset 23 5586b4d2ec3e
parent 21 b3431bff8c19
child 32 2828b4d142c0
equal deleted inserted replaced
21:b3431bff8c19 23:5586b4d2ec3e
   578 // --------------------------------------------------------------------------
   578 // --------------------------------------------------------------------------
   579 //
   579 //
   580 void CPbk2ContactViewListBox::Draw( const TRect& aRect ) const
   580 void CPbk2ContactViewListBox::Draw( const TRect& aRect ) const
   581     {
   581     {
   582     CAknSingleGraphicStyleListBox::Draw(aRect);
   582     CAknSingleGraphicStyleListBox::Draw(aRect);
   583     
   583     HandlePopupCharacter(NULL, Rect());
   584     CPbk2NamesListControl& listControl = static_cast<CPbk2NamesListControl&>(iContainer);
       
   585     TInt itemIndex = TopItemIndex() - listControl.CommandItemCount();
       
   586    
       
   587     // itemIndex >= 0 filter out command item
       
   588     if ( itemIndex >= 0 && iShowPopupChar )
       
   589         {
       
   590         // Handle showing of popupcharacter when user scrolls list using using scroll bar
       
   591         CWindowGc& gc = SystemGc();
       
   592 
       
   593         TRgb normal;
       
   594         AknsUtils::GetCachedColor(AknsUtils::SkinInstance(),
       
   595                 normal,
       
   596                 KAknsIIDQsnTextColors,
       
   597                 EAknsCIQsnTextColorsCG6 );
       
   598 
       
   599         TAknLayoutRect layout;
       
   600         layout.LayoutRect(Rect(), AknLayoutScalable_Apps::popup_navstr_preview_pane(0));
       
   601 
       
   602         TAknLayoutRect cornerRect;
       
   603         // skinned draw uses submenu popup window skin (skinned border)
       
   604         
       
   605         cornerRect.LayoutRect(
       
   606             layout.Rect(),
       
   607             SkinLayout::Submenu_skin_placing_Line_2() );
       
   608 
       
   609         TRect innerRect( layout.Rect() );
       
   610         innerRect.Shrink( cornerRect.Rect().Width(), cornerRect.Rect().Height() );
       
   611 
       
   612         if ( !AknsDrawUtils::DrawFrame(
       
   613                 AknsUtils::SkinInstance(),
       
   614                 gc,
       
   615                 layout.Rect(),
       
   616                 innerRect,
       
   617                 KAknsIIDQsnFrPopupSub,
       
   618                 KAknsIIDQsnFrPopupCenterSubmenu ) )
       
   619             {
       
   620             // skinned border failed -> black border
       
   621             gc.SetPenStyle( CGraphicsContext::ESolidPen );
       
   622             gc.SetBrushColor( KRgbBlack );
       
   623             gc.DrawRect( layout.Rect() );
       
   624             }
       
   625 
       
   626         TAknLayoutText textLayout;
       
   627         textLayout.LayoutText(layout.Rect(), AknLayoutScalable_Apps::popup_navstr_preview_pane_t1(0).LayoutLine());
       
   628 
       
   629         TPtrC desc(Model()->ItemTextArray()->MdcaPoint(View()->TopItemIndex()));
       
   630 
       
   631         HBufC* buf = desc.Mid(desc.Find(_L("\t")) + 1, 1).AllocL();
       
   632         TPtr textPtr = buf->Des();
       
   633         textPtr.UpperCase();
       
   634         
       
   635         textLayout.DrawText(gc, textPtr, ETrue, normal );
       
   636         
       
   637         delete buf;
       
   638         }
       
   639 
       
   640     }
   584     }
   641 
   585 
   642 // --------------------------------------------------------------------------
   586 // --------------------------------------------------------------------------
   643 // CPbk2ContactViewListBox::CreateItemDrawerL
   587 // CPbk2ContactViewListBox::CreateItemDrawerL
   644 // --------------------------------------------------------------------------
   588 // --------------------------------------------------------------------------
   682         PointEvent.iType = TPointerEvent::EButton1Up ;
   626         PointEvent.iType = TPointerEvent::EButton1Up ;
   683         TRAP_IGNORE( ScrollBarFrame()->VerticalScrollBar()->HandlePointerEventL( PointEvent ) );
   627         TRAP_IGNORE( ScrollBarFrame()->VerticalScrollBar()->HandlePointerEventL( PointEvent ) );
   684         DrawDeferred();
   628         DrawDeferred();
   685         }
   629         }
   686     }
   630     }
       
   631 
       
   632 // --------------------------------------------------------------------------
       
   633 // CPbk2ContactViewListBox::HandlePopupCharacter
       
   634 // --------------------------------------------------------------------------
       
   635 //
       
   636 void CPbk2ContactViewListBox::HandlePopupCharacter( CWindowGc* aGc, const TRect& aRectOfListBoxItem ) const
       
   637     {
       
   638     CPbk2NamesListControl& listControl = static_cast<CPbk2NamesListControl&>(iContainer);
       
   639     TInt itemIndex = TopItemIndex() - listControl.CommandItemCount();
       
   640    
       
   641     // itemIndex >= 0 filter out command item
       
   642     if ( itemIndex >= 0 && iShowPopupChar )
       
   643         {
       
   644         TAknLayoutRect layout;
       
   645         layout.LayoutRect(Rect(), AknLayoutScalable_Apps::popup_navstr_preview_pane(0));
       
   646         
       
   647         if (!layout.Rect().Intersects(aRectOfListBoxItem))
       
   648             {
       
   649             // If the rect of PopupCharacter not overlapped
       
   650             // with aRectOfListBoxItem, do nothing.
       
   651             return;
       
   652             }
       
   653 
       
   654         // Handle showing of popupcharacter when user scrolls list using using scroll bar
       
   655         CWindowGc* gc = aGc;
       
   656         if (!gc)
       
   657             {
       
   658             gc = &SystemGc();
       
   659             }
       
   660 
       
   661         TRgb normal;
       
   662         AknsUtils::GetCachedColor(AknsUtils::SkinInstance(),
       
   663                 normal,
       
   664                 KAknsIIDQsnTextColors,
       
   665                 EAknsCIQsnTextColorsCG6 );
       
   666 
       
   667         TAknLayoutRect cornerRect;
       
   668         // skinned draw uses submenu popup window skin (skinned border)
       
   669         cornerRect.LayoutRect(
       
   670             layout.Rect(),
       
   671             SkinLayout::Submenu_skin_placing_Line_2() );
       
   672 
       
   673         TRect innerRect( layout.Rect() );
       
   674         innerRect.Shrink( cornerRect.Rect().Width(), cornerRect.Rect().Height() );
       
   675 
       
   676         if ( !AknsDrawUtils::DrawFrame(
       
   677                 AknsUtils::SkinInstance(),
       
   678                 *gc,
       
   679                 layout.Rect(),
       
   680                 innerRect,
       
   681                 KAknsIIDQsnFrPopupSub,
       
   682                 KAknsIIDQsnFrPopupCenterSubmenu ) )
       
   683             {
       
   684             // skinned border failed -> black border
       
   685             gc->SetPenStyle( CGraphicsContext::ESolidPen );
       
   686             gc->SetBrushColor( KRgbBlack );
       
   687             gc->DrawRect( layout.Rect() );
       
   688             }
       
   689 
       
   690         TAknLayoutText textLayout;
       
   691         textLayout.LayoutText(layout.Rect(), AknLayoutScalable_Apps::popup_navstr_preview_pane_t1(0).LayoutLine());
       
   692 
       
   693         TPtrC desc(Model()->ItemTextArray()->MdcaPoint(View()->TopItemIndex()));
       
   694 
       
   695         HBufC* buf = desc.Mid(desc.Find(_L("\t")) + 1, 1).AllocL();
       
   696         TPtr textPtr = buf->Des();
       
   697         textPtr.UpperCase();
       
   698         
       
   699         textLayout.DrawText(*gc, textPtr, ETrue, normal );
       
   700         
       
   701         delete buf;
       
   702         }
       
   703     }
   687 // End of File
   704 // End of File