textinput/peninputarc/src/peninputlayoutcontrol/peninputlayoutchoicelist.cpp
changeset 0 eb1f2e154e89
child 3 f5a1e66df979
equal deleted inserted replaced
-1:000000000000 0:eb1f2e154e89
       
     1 /*
       
     2 * Copyright (c) 2005-2007 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0""
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  Implementation for choice list control
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #include <AknsDrawUtils.h>
       
    21 #include "peninputlayoutrootctrl.h"
       
    22 #include "peninputlayoutpopupwnd.h"
       
    23 #include "peninputlayout.h"
       
    24 #include "peninputlayoutchoicelist.h"
       
    25 #include <coecntrl.h>
       
    26 #include <eiklbx.h>
       
    27 
       
    28 //after display, freeze some time
       
    29 const TInt KFreezePerioid = 400000; // 400ms
       
    30 // ---------------------------------------------------------------------------
       
    31 // CFepLayoutChoiceList::NewL
       
    32 // Factory function
       
    33 // (other items were commented in a header).
       
    34 // ---------------------------------------------------------------------------
       
    35 //
       
    36 EXPORT_C CFepLayoutChoiceList* CFepLayoutChoiceList::NewL(CFepUiLayout* aUiLayout,
       
    37                                                           TInt aControlId)
       
    38     {
       
    39     CFepLayoutChoiceList* self = new(ELeave) CFepLayoutChoiceList(aUiLayout, aControlId);
       
    40     CleanupStack::PushL(self);
       
    41     self->ConstructL();
       
    42     CleanupStack::Pop(self);
       
    43     return self;
       
    44     }
       
    45 
       
    46 // ---------------------------------------------------------------------------
       
    47 // CFepLayoutChoiceList::~CFepLayoutChoiceList
       
    48 // Destructor
       
    49 // (other items were commented in a header).
       
    50 // ---------------------------------------------------------------------------
       
    51 //
       
    52 EXPORT_C CFepLayoutChoiceList::~CFepLayoutChoiceList()
       
    53     {
       
    54     delete iFreezeTimer;
       
    55     delete iItemFocusBmp;
       
    56     delete iItemFocusBmpMask;
       
    57     iItemList.ResetAndDestroy();
       
    58     iItemList.Close();
       
    59     }
       
    60     
       
    61 // ---------------------------------------------------------------------------
       
    62 // CFepLayoutChoiceList::SetItemRect
       
    63 // Set choice list item rectangle.
       
    64 // (other items were commented in a header).
       
    65 // ---------------------------------------------------------------------------
       
    66 //
       
    67 EXPORT_C void CFepLayoutChoiceList::SetItemRect(const TRect& aItemRect, const TRect& aFocusRect)
       
    68     {
       
    69     iItemRect = aItemRect;
       
    70     iItemFocusRect = aFocusRect;
       
    71     ReCalcLayout();    
       
    72     }
       
    73 
       
    74 // ---------------------------------------------------------------------------
       
    75 // CFepLayoutChoiceList::SetFocusBmp
       
    76 // Set bitmap for focus.
       
    77 // (other items were commented in a header).
       
    78 // ---------------------------------------------------------------------------
       
    79 //
       
    80 EXPORT_C void CFepLayoutChoiceList::SetFocusBmp(CFbsBitmap *aItemFocusBmp)
       
    81     {
       
    82     delete iItemFocusBmp;
       
    83     iItemFocusBmp = aItemFocusBmp;
       
    84     }
       
    85 
       
    86 // CFepLayoutChoiceList::SetFocusBmpMask
       
    87 // Set mask bitmap for focus.
       
    88 // (other items were commented in a header).
       
    89 // ---------------------------------------------------------------------------
       
    90 //
       
    91 EXPORT_C void CFepLayoutChoiceList::SetFocusBmpMask(CFbsBitmap *aItemFocusBmpMask)
       
    92     {
       
    93     delete iItemFocusBmpMask;
       
    94     iItemFocusBmpMask = aItemFocusBmpMask;
       
    95     }
       
    96 
       
    97 // CFepLayoutChoiceList::SetItemsL
       
    98 // Set choice list items.
       
    99 // (other items were commented in a header).
       
   100 // ---------------------------------------------------------------------------
       
   101 //
       
   102 EXPORT_C void CFepLayoutChoiceList::SetItemsL(
       
   103                           const RPointerArray<CFepLayoutChoiceList::SItem>& aItemList)
       
   104     {
       
   105     //remove all items
       
   106     iItemList.ResetAndDestroy();
       
   107     for(int ii = 0; ii < aItemList.Count(); ++ii)
       
   108         {
       
   109         AddItemL(*aItemList[ii]);
       
   110         }
       
   111     }
       
   112 
       
   113 // CFepLayoutChoiceList::AddItemL
       
   114 // Append a choice list item.
       
   115 // (other items were commented in a header).
       
   116 // ---------------------------------------------------------------------------
       
   117 //
       
   118 EXPORT_C void CFepLayoutChoiceList::AddItemL(const CFepLayoutChoiceList::SItem& aItem)
       
   119     {
       
   120     CFepLayoutChoiceList::SItem* item;
       
   121     item = new(ELeave)CFepLayoutChoiceList::SItem;
       
   122     item->iCommand = aItem.iCommand;
       
   123     item->iText.Copy( aItem.iText );
       
   124     CleanupStack::PushL(item);
       
   125     iItemList.AppendL(item);
       
   126     CleanupStack::Pop(item);
       
   127     //ReCalcLayout();
       
   128     }
       
   129 
       
   130 // CFepLayoutChoiceList::InsertItemL
       
   131 // Append a choice list item.
       
   132 // (other items were commented in a header).
       
   133 // ---------------------------------------------------------------------------
       
   134 //
       
   135 EXPORT_C void CFepLayoutChoiceList::InsertItemL(TInt aPostion, 
       
   136                                                 const CFepLayoutChoiceList::SItem& aItem)
       
   137     {
       
   138     CFepLayoutChoiceList::SItem* item;
       
   139     item = new(ELeave)CFepLayoutChoiceList::SItem;
       
   140     item->iCommand = aItem.iCommand;
       
   141     item->iText.Copy( aItem.iText );
       
   142     CleanupStack::PushL(item);
       
   143     iItemList.InsertL(item, aPostion);
       
   144     CleanupStack::Pop(item);
       
   145     //ReCalcLayout();
       
   146     }
       
   147 
       
   148 // CFepLayoutChoiceList::RemoveItemByCommand
       
   149 // Remove a choice list item by command.
       
   150 // (other items were commented in a header).
       
   151 // ---------------------------------------------------------------------------
       
   152 //
       
   153 EXPORT_C void CFepLayoutChoiceList::RemoveItemByCommand(TInt aCommand)
       
   154     {
       
   155     for(int ii = 0; ii < iItemList.Count(); ++ii)
       
   156         {
       
   157         if( iItemList[ii]->iCommand == aCommand )
       
   158             {
       
   159             RemoveItemByIndex(ii);
       
   160             }
       
   161         }
       
   162     //ReCalcLayout();
       
   163     }
       
   164 
       
   165 // CFepLayoutChoiceList::RemoveItemByIndex
       
   166 // Remove a choice list item by index.
       
   167 // (other items were commented in a header).
       
   168 // ---------------------------------------------------------------------------
       
   169 //
       
   170 EXPORT_C void CFepLayoutChoiceList::RemoveItemByIndex(TInt aIndex)
       
   171     {
       
   172     CFepLayoutChoiceList::SItem* item;
       
   173     item = iItemList[aIndex];
       
   174     iItemList.Remove(aIndex);
       
   175     delete item;
       
   176     //ReCalcLayout();
       
   177     }
       
   178 
       
   179 // CFepLayoutChoiceList::RemoveItemByIndex
       
   180 // Clear all choice list items.
       
   181 // (other items were commented in a header).
       
   182 // ---------------------------------------------------------------------------
       
   183 //
       
   184 EXPORT_C void CFepLayoutChoiceList::ClearItemsL()
       
   185     {
       
   186     iItemList.ResetAndDestroy();
       
   187     //ReCalcLayout();
       
   188     }
       
   189 
       
   190 // CFepLayoutChoiceList::RemoveItemByIndex
       
   191 // Clear all choice list items.
       
   192 // (other items were commented in a header).
       
   193 // ---------------------------------------------------------------------------
       
   194 //
       
   195 EXPORT_C TInt CFepLayoutChoiceList::ItemsCount()
       
   196     {
       
   197     return iItemList.Count();
       
   198     }
       
   199 
       
   200 // CFepLayoutChoiceList::ItemByIndex
       
   201 // Retrieve a choice list item by index.
       
   202 // (other items were commented in a header).
       
   203 // ---------------------------------------------------------------------------
       
   204 //
       
   205 EXPORT_C const CFepLayoutChoiceList::SItem* CFepLayoutChoiceList::ItemByIndex(TInt aIndex)
       
   206     {
       
   207     return iItemList[aIndex];
       
   208     }
       
   209 
       
   210 // CFepLayoutChoiceList::ItemByCommand
       
   211 // Retrieve a choice list item by item's command.
       
   212 // (other items were commented in a header).
       
   213 // ---------------------------------------------------------------------------
       
   214 //
       
   215 EXPORT_C TInt CFepLayoutChoiceList::FindCommand(TInt aCommand)
       
   216     {
       
   217     TInt ret = -1;
       
   218     for(int ii = 0; ii < iItemList.Count(); ++ii)
       
   219         {
       
   220         if( iItemList[ii]->iCommand == aCommand )
       
   221             {
       
   222             ret = ii;
       
   223             break;
       
   224             }
       
   225         }
       
   226     return ret;
       
   227     }
       
   228 
       
   229 // Constructor
       
   230 // 
       
   231 // (other items were commented in a header).
       
   232 // ---------------------------------------------------------------------------
       
   233 //
       
   234 EXPORT_C CFepLayoutChoiceList::CFepLayoutChoiceList(CFepUiLayout* aUiLayout,
       
   235                                                     TInt aControlId)
       
   236     :CFepLayoutPopupWnd(TSize(0,0), aUiLayout, aControlId)
       
   237     {
       
   238     SetControlType(ECtrlPopupChoiceList);
       
   239 	iSubItemSkinID 		= KAknsIIDNone;
       
   240 	iBackgroundSkinID   = KAknsIIDNone;
       
   241     }
       
   242 
       
   243 // CFepLayoutChoiceList::HitTest
       
   244 // Get item whose region contains the point.
       
   245 // (other items were commented in a header).
       
   246 // ---------------------------------------------------------------------------
       
   247 //
       
   248 EXPORT_C TInt CFepLayoutChoiceList::HitTest(const TPoint& aPoint)
       
   249     {
       
   250     if( !Rect().Contains(aPoint) )
       
   251         {
       
   252         return EListOutside;
       
   253         }
       
   254     if(iWndControl)
       
   255         {        
       
   256         return static_cast<CEikListBox*>(iWndControl)->CurrentItemIndex();
       
   257         }
       
   258     TInt index = (aPoint.iY - Rect().iTl.iY)/iItemRect.Height();
       
   259     if( index >= iItemList.Count() )
       
   260         {
       
   261         return EListOutside;
       
   262         }
       
   263     else
       
   264         {
       
   265         return index;
       
   266         }
       
   267     }
       
   268 
       
   269 // CFepLayoutChoiceList::HandlePointerDownEventL
       
   270 // Handle pointer down event.
       
   271 // (other items were commented in a header).
       
   272 // ---------------------------------------------------------------------------
       
   273 //
       
   274 EXPORT_C CFepUiBaseCtrl* CFepLayoutChoiceList::HandlePointerDownEventL(const TPoint& aPoint)
       
   275     {
       
   276     if( iFreezeTimer && iFreezeTimer->IsActive() )
       
   277         {
       
   278         return this;
       
   279         }
       
   280     CFepUiBaseCtrl* ctrl = CFepLayoutPopupWnd::HandlePointerDownEventL(aPoint);
       
   281     if( ctrl )
       
   282         {
       
   283         return ctrl;
       
   284         }
       
   285     TInt index = HitTest(aPoint);
       
   286     if( index == EListOutside )
       
   287         {
       
   288         SetPointerDown(EFalse);
       
   289         CloseWindow();
       
   290         CFepLayoutChoiceList::SEvent event;
       
   291         event.iIndex = -1;
       
   292         event.iCommand = 0;
       
   293         ReportChoiceEvent(event);
       
   294 		#ifdef RD_TACTILE_FEEDBACK
       
   295         if (UiLayout()->SupportTactileFeedback())
       
   296         	{
       
   297         	UiLayout()->DoTactileFeedback(ETouchFeedbackSensitiveInput, ETrue, EFalse);
       
   298         	}
       
   299 		#endif //RD_TACTILE_FEEDBACK     
       
   300         }
       
   301     else
       
   302         {
       
   303         SetPointerDown( ETrue );      
       
   304         if(  index >= EListItemFirst &&  index != iCurFocusItem )
       
   305             {
       
   306             //TInt prev = iCurFocusItem;
       
   307             iCurFocusItem = index;
       
   308        		Draw();
       
   309             UpdateArea(Rect(),EFalse);
       
   310 			#ifdef RD_TACTILE_FEEDBACK
       
   311             if (UiLayout()->SupportTactileFeedback())
       
   312             	{
       
   313             	UiLayout()->DoTactileFeedback(ETouchFeedbackSensitiveInput);
       
   314             	}
       
   315 			#endif //RD_TACTILE_FEEDBACK
       
   316             }
       
   317         }
       
   318     return this;
       
   319     }
       
   320 
       
   321 // CFepLayoutChoiceList::HandlePointerMoveEventL
       
   322 // Handle pointer move event.
       
   323 // (other items were commented in a header).
       
   324 // ---------------------------------------------------------------------------
       
   325 //
       
   326 EXPORT_C CFepUiBaseCtrl* CFepLayoutChoiceList::HandlePointerMoveEventL(const TPoint& aPoint)
       
   327     {
       
   328     if( iFreezeTimer && iFreezeTimer->IsActive() )
       
   329         {
       
   330         return this;
       
   331         }
       
   332     CFepLayoutPopupWnd::HandlePointerMoveEventL(aPoint);
       
   333     if( PointerDown() )
       
   334         {
       
   335         TInt index = HitTest(aPoint);
       
   336         if( index != iCurFocusItem && index >= 0)
       
   337             {
       
   338             //TInt prev = iCurFocusItem;
       
   339             iCurFocusItem = index;
       
   340 /*        
       
   341             if( prev != -1 )
       
   342                 {
       
   343                 DrawItem(prev, ETrue);
       
   344                 }
       
   345 
       
   346             if( iCurFocusItem != -1 )
       
   347                 {
       
   348                 DrawItem(iCurFocusItem, ETrue);
       
   349                 }
       
   350  */               
       
   351     #ifdef RD_TACTILE_FEEDBACK
       
   352         if (UiLayout()->SupportTactileFeedback())
       
   353             {
       
   354             if ( iLastSelIndex != iCurFocusItem) 
       
   355                 {
       
   356                 UiLayout()->DoTactileFeedback(ETouchFeedbackSensitiveInput);
       
   357                 iLastSelIndex = iCurFocusItem;
       
   358                 }
       
   359             }
       
   360     #endif //RD_TACTILE_FEEDBACK
       
   361 
       
   362            	Draw();
       
   363             UpdateArea(Rect(),EFalse);
       
   364             }
       
   365         }
       
   366     return this;
       
   367     }
       
   368 
       
   369 // CFepLayoutChoiceList::HandlePointerUpEventL
       
   370 // Handle pointer up event.
       
   371 // (other items were commented in a header).
       
   372 // ---------------------------------------------------------------------------
       
   373 //
       
   374 EXPORT_C CFepUiBaseCtrl* CFepLayoutChoiceList::HandlePointerUpEventL(const TPoint& aPoint)
       
   375     {
       
   376     if( iFreezeTimer && iFreezeTimer->IsActive() || !PointerDown())
       
   377         {
       
   378         return this;
       
   379         }
       
   380     CFepUiBaseCtrl* ctrl = CFepLayoutPopupWnd::HandlePointerUpEventL(aPoint);
       
   381     
       
   382     TInt index = HitTest(aPoint);
       
   383     if( index >= EListItemFirst )
       
   384         {
       
   385         CFepLayoutChoiceList::SEvent event;
       
   386         event.iIndex = index;
       
   387         event.iCommand = iItemList[index]->iCommand;
       
   388         CloseWindow();
       
   389         ReportChoiceEvent(event);
       
   390         
       
   391 		#ifdef RD_TACTILE_FEEDBACK
       
   392 		if (UiLayout()->SupportTactileFeedback())
       
   393 			{
       
   394 			UiLayout()->DoTactileFeedback(ETouchFeedbackSensitiveInput, ETrue, EFalse);
       
   395 			}
       
   396 		#endif //RD_TACTILE_FEEDBACK	
       
   397         }
       
   398     else if( index == EListOutside )
       
   399     	{
       
   400     	SetPointerDown( EFalse );	
       
   401         }
       
   402     return this;
       
   403     }
       
   404 
       
   405 // CFepLayoutChoiceList::DrawItem
       
   406 // Draw a choice list item.
       
   407 // (other items were commented in a header).
       
   408 // ---------------------------------------------------------------------------
       
   409 //
       
   410 void CFepLayoutChoiceList::DrawItem(TInt aIndex, TBool aErase)
       
   411     {
       
   412     //
       
   413     if(iWndControl)
       
   414         return;
       
   415     TRect rtItem;
       
   416     rtItem.iTl.iY = aIndex * iItemRect.Height();
       
   417     rtItem.iBr.iX = iItemRect.Width();
       
   418     rtItem.iBr.iY = rtItem.iTl.iY + iItemRect.Height();
       
   419     rtItem.Move(Rect().iTl);
       
   420     DrawItem(rtItem, *iItemList[aIndex], aErase, aIndex == iCurFocusItem );
       
   421     }
       
   422 
       
   423 // CFepLayoutChoiceList::DrawItem
       
   424 // Draw a choice list item.
       
   425 // (other items were commented in a header).
       
   426 // ---------------------------------------------------------------------------
       
   427 //
       
   428 void CFepLayoutChoiceList::DrawItem(const TRect& aRect, const CFepLayoutChoiceList::SItem& aItem, 
       
   429                                     TBool aErase, TBool aFocus)
       
   430     {
       
   431     if(iWndControl)
       
   432         return;
       
   433 
       
   434     CFbsBitGc* gc = static_cast<CFbsBitGc*>(BitGc());
       
   435     if( aErase )
       
   436         {
       
   437         SetBorderColor( BkColor() );
       
   438         //DrawChoiceListBackground( aRect );//, EFalse);
       
   439         }
       
   440     if( aFocus )
       
   441         {
       
   442         //draw focus bitmap
       
   443         TRect rtFocusRect(iItemFocusRect);
       
   444         TRect rtFocusInBmp(TPoint(0,0), iItemFocusRect.Size());
       
   445 
       
   446         rtFocusRect.Move(aRect.iTl);
       
   447         TRect rtInnerRect( rtFocusRect );
       
   448         rtInnerRect.Shrink( 5, 5 );
       
   449         
       
   450        	if( iSubItemSkinID.iMajor != EAknsMajorNone && 
       
   451        	    iSubItemSkinID.iMinor != EAknsMinorNone)
       
   452        		{
       
   453        		gc->Activate( BitmapDevice() ); 
       
   454 			AknsDrawUtils::DrawFrame( AknsUtils::SkinInstance(), 
       
   455                          *gc, 
       
   456                          rtFocusRect, 
       
   457                          rtInnerRect,
       
   458                          iSubItemSkinID,
       
   459                          KAknsIIDDefault );       	
       
   460        		}
       
   461        	else
       
   462        		{
       
   463 	        //mask bitmaps-------
       
   464 	        gc->Activate( MaskBitmapDevice() );
       
   465 	        if( iItemFocusBmpMask )
       
   466 	            {
       
   467 	            DrawBitmap(rtFocusRect, rtFocusInBmp, iItemFocusBmpMask,
       
   468 	                       iItemFocusBmpMask->SizeInPixels() == rtFocusInBmp.Size());
       
   469 	            }
       
   470 
       
   471 	        //front bitmaps-------
       
   472 	        gc->Activate( BitmapDevice() );
       
   473 	        
       
   474 	        if( iItemFocusBmp )
       
   475 	            {
       
   476 	            DrawBitmap(rtFocusRect, rtFocusInBmp, iItemFocusBmp,
       
   477 	                       iItemFocusBmp->SizeInPixels() == rtFocusInBmp.Size());
       
   478 	            }       			
       
   479        		}        
       
   480         }
       
   481     //draw text
       
   482     if (iFont)
       
   483         {
       
   484         gc->UseFont(iFont);
       
   485 
       
   486         gc->SetBrushStyle( CGraphicsContext::ENullBrush );
       
   487         gc->SetPenColor(iFontColor);
       
   488         gc->SetPenStyle(CGraphicsContext::ESolidPen);
       
   489 
       
   490         gc->DrawText(aItem.iText, aRect, iBaseline, CGraphicsContext::ELeft, iMargin);
       
   491 
       
   492         gc->DiscardFont();
       
   493         }
       
   494     }
       
   495 
       
   496 // CFepLayoutChoiceList::DrawChoiceListBackground
       
   497 // Draw choice list background.
       
   498 // (other items were commented in a header).
       
   499 // ---------------------------------------------------------------------------
       
   500 //
       
   501 void CFepLayoutChoiceList::DrawChoiceListBackground(const TRect& aRect)//, TBool aDrawBorder)
       
   502     {
       
   503  	if( iBackgroundSkinID.iMajor != EAknsMajorNone && 
       
   504  		iBackgroundSkinID.iMinor != EAknsMinorNone )
       
   505  		{	
       
   506  		//draw bitmap 		
       
   507 		DrawOpaqueMaskBackground( aRect );
       
   508 	    TRect rtInnerRect( aRect );
       
   509 	    rtInnerRect.Shrink( 1, 1 );
       
   510 	    CFbsBitGc* gc = static_cast<CFbsBitGc*>(BitGc());
       
   511 	    
       
   512 	    gc->Activate( BitmapDevice() ); 
       
   513 		AknsDrawUtils::DrawFrame( AknsUtils::SkinInstance(), 
       
   514 	                     *gc, 
       
   515 	                     aRect, 
       
   516 	                     rtInnerRect,
       
   517 	                     iBackgroundSkinID,
       
   518 	                     KAknsIIDDefault );       
       
   519  		}
       
   520  	else
       
   521  		{
       
   522     	//draw bitmap 		
       
   523 		DrawOpaqueMaskBackground();
       
   524 	    //front bitmaps-------
       
   525 	    DrawBackground();			
       
   526  		}	
       
   527     }
       
   528 
       
   529 // CFepLayoutChoiceList::DrawBitmap
       
   530 // Draw bitmap helper function.
       
   531 // (other items were commented in a header).
       
   532 // ---------------------------------------------------------------------------
       
   533 //
       
   534 void CFepLayoutChoiceList::DrawBitmap(const TRect& aDestRect, const TRect& aSrcRect, 
       
   535                                       CFbsBitmap* aBmp, TBool aFast)
       
   536     {
       
   537     CFbsBitGc* gc = static_cast<CFbsBitGc*>(BitGc());
       
   538     if( aFast )
       
   539         {
       
   540          gc->BitBlt(aDestRect.iTl, aBmp, aSrcRect);
       
   541         }
       
   542     else
       
   543         {
       
   544         gc->DrawBitmap(aDestRect, aBmp, aSrcRect);
       
   545         }
       
   546     }
       
   547 
       
   548 EXPORT_C void CFepLayoutChoiceList::ReportChoiceEvent(CFepLayoutChoiceList::SEvent& aEvent)
       
   549     {
       
   550     TPtrC ptr;
       
   551     ptr.Set(reinterpret_cast<TText*>(&aEvent), sizeof(aEvent));
       
   552     ReportEvent(EEventChoiceSelected, ptr);
       
   553     }
       
   554 
       
   555 // CFepLayoutChoiceList::Draw
       
   556 // Draw a choice list.
       
   557 // (other items were commented in a header).
       
   558 // ---------------------------------------------------------------------------
       
   559 //
       
   560 EXPORT_C void CFepLayoutChoiceList::Draw()
       
   561     {
       
   562     if(!AbleToDraw())
       
   563     	return;    
       
   564     
       
   565     SetBorderColor( PenColor() );
       
   566 
       
   567     DrawChoiceListBackground(Rect()); //draw with border
       
   568 
       
   569     if(iWndControl)
       
   570         {
       
   571         iWndControl->DrawNow();
       
   572         return;        
       
   573         }
       
   574     //draw background
       
   575     for(int ii = 0; ii < iItemList.Count(); ++ii)
       
   576         {
       
   577         DrawItem(ii, EFalse);
       
   578         }
       
   579     }
       
   580 
       
   581 // CFepLayoutChoiceList::OnDisplay
       
   582 // Prepare display.
       
   583 // (other items were commented in a header).
       
   584 // ---------------------------------------------------------------------------
       
   585 //
       
   586 EXPORT_C void CFepLayoutChoiceList::OnDisplay()
       
   587     {
       
   588     ReCalcLayout();
       
   589     }
       
   590 
       
   591 // CFepLayoutChoiceList::ReCalcLayout
       
   592 // Calculates the displaying rect.
       
   593 // (other items were commented in a header).
       
   594 // ---------------------------------------------------------------------------
       
   595 //
       
   596 EXPORT_C void CFepLayoutChoiceList::ReCalcLayout()
       
   597     {
       
   598     TRect poprect;
       
   599     poprect.iBr.iX = iItemRect.Width();
       
   600     poprect.iBr.iY = iItemRect.Height() * iItemList.Count();
       
   601     SetRect(poprect);
       
   602     }
       
   603     
       
   604 // CFepLayoutChoiceList::SetSkinID
       
   605 //
       
   606 // (other items were commented in a header).
       
   607 // ---------------------------------------------------------------------------
       
   608 //    
       
   609 EXPORT_C void CFepLayoutChoiceList::SetSkinID( TAknsItemID aSubItemID, 
       
   610 									  TAknsItemID aBackgroundID )
       
   611 	{
       
   612 	iSubItemSkinID = aSubItemID;
       
   613 	iBackgroundSkinID = aBackgroundID;
       
   614 	}
       
   615 	
       
   616 // CFepLayoutChoiceList::CurrentSelectedIndex
       
   617 //
       
   618 // (other items were commented in a header).
       
   619 // ---------------------------------------------------------------------------
       
   620 // 	
       
   621 EXPORT_C TInt CFepLayoutChoiceList::CurrentFocusedIndex( ) const
       
   622 	{
       
   623 	return iCurFocusItem;
       
   624 	}	
       
   625 	
       
   626 // CFepLayoutChoiceList::SetCurrentSelectedIndex
       
   627 //
       
   628 // (other items were commented in a header).
       
   629 // ---------------------------------------------------------------------------
       
   630 // 	
       
   631 EXPORT_C void CFepLayoutChoiceList::SetCurrentFocusedIndex(const TInt aIndex)
       
   632 	{
       
   633 	iCurFocusItem = aIndex;
       
   634 	}	
       
   635 TInt CFepLayoutChoiceList::FreezeCallBack( TAny *aPtr )
       
   636     {
       
   637     CFepLayoutChoiceList* pThis = (CFepLayoutChoiceList*)aPtr;
       
   638     pThis->iFreezeTimer->Cancel();
       
   639     return 0;
       
   640     }
       
   641 
       
   642 void CFepLayoutChoiceList::AfterDisplayedL()
       
   643     {
       
   644     if( !iFreezeTimer )
       
   645         {
       
   646         iFreezeTimer = CPeriodic::NewL(CActive::EPriorityStandard);
       
   647         }
       
   648     if( !iFreezeTimer->IsActive() )
       
   649         {
       
   650         iFreezeTimer->Start(KFreezePerioid, 
       
   651                             KFreezePerioid, 
       
   652                             TCallBack(FreezeCallBack, this));  
       
   653         }
       
   654     }
       
   655 
       
   656 EXPORT_C void CFepLayoutChoiceList::AfterDisplayed()
       
   657     {
       
   658     TRAP_IGNORE(AfterDisplayedL());
       
   659     }
       
   660 //End Of File