textinput/peninputcommonctrls/src/peninputdropdownlist/peninputdropdownlist.cpp
branchRCL_3
changeset 44 ecbabf52600f
equal deleted inserted replaced
43:ebd48d2de13c 44:ecbabf52600f
       
     1 /*
       
     2 * Copyright (c) 2002-2005 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:  drop-down list control
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 // INCLUDE FILES
       
    20 
       
    21 
       
    22 #include "peninputlistmanager.h"
       
    23 #include "peninputbitmapdb.h"
       
    24 #include "peninputcandidate.h"
       
    25 #include "peninputpages.h"
       
    26 #include "peninputlayoutbubblectrl.h"
       
    27 
       
    28 // added by txin
       
    29 //#include "peninputlistmultirowrollwithicon.h"
       
    30 // end
       
    31 #include "peninputlist.h"
       
    32 #include <peninputlayoutrootctrl.h>
       
    33 #include <peninputlayoutbasecontrol.h>
       
    34 #include <peninputlayout.h>
       
    35 #include <peninputdropdownlist.h>
       
    36 #include <coemain.h>
       
    37 #include <AknUtils.h>
       
    38 
       
    39 // constant definition
       
    40 const TInt32 KInvalidResId = -1;
       
    41 
       
    42 // added by txin
       
    43 const TInt KInvalidCandIndex = -1;
       
    44 // end adding
       
    45 
       
    46 const TInt KPreviewBubbleOffset = 20;
       
    47 
       
    48 // ======== MEMBER FUNCTIONS ========
       
    49 
       
    50 // Implementation of Class CFepCtrlDropdownList 
       
    51 
       
    52 // -----------------------------------------------------------------------------
       
    53 // CFepCtrlDropdownList::NewL
       
    54 // factory function
       
    55 // (other items were commented in a header).
       
    56 // -----------------------------------------------------------------------------
       
    57 //
       
    58 EXPORT_C CFepCtrlDropdownList* CFepCtrlDropdownList::NewL( const TPoint& aTopLeftPoint,
       
    59                                                            CFepUiLayout* aUiLayout,
       
    60                                                            TInt aControlId,
       
    61                                                            TResourceReader& aReader,
       
    62                                                            const TInt aCellWidth,
       
    63                                                            const TInt aCellHeight,
       
    64                                                            const TInt aNaviWidth,
       
    65                                                            const TInt aColNum,
       
    66                                                            const TInt aRowNum,
       
    67                                                            const CFont* aFont,
       
    68                                                            MListEventHandler* aHandler,
       
    69                                                            const CGraphicsContext::TTextAlign aAlignment,
       
    70                                                            const TInt aTextMargin,
       
    71                                                            const TRgb aBorderColor,
       
    72                                                            const TRgb aBgColor,
       
    73                                                            const TRgb aNavigationBgColor,
       
    74                                                            const TRgb aTextColor,
       
    75                                                            const TRgb aSpecialTextColor,
       
    76                                                            const TRgb aHighLightTextColor,
       
    77                                                            const TRgb aHighLightBgColor,
       
    78                                                            const TRgb aButtonDownBgColor )
       
    79     {
       
    80     CFepCtrlDropdownList* self = NewLC(aTopLeftPoint,
       
    81                                        aUiLayout,
       
    82                                        aControlId,
       
    83                                        aReader,
       
    84                                        aCellWidth,
       
    85                                        aCellHeight,
       
    86                                        aNaviWidth,
       
    87                                        aColNum,
       
    88                                        aRowNum,
       
    89                                        aFont,
       
    90                                        aHandler,
       
    91                                        aAlignment,
       
    92                                        aTextMargin,                                       
       
    93                                        aBorderColor,
       
    94                                        aBgColor,
       
    95                                        aNavigationBgColor,
       
    96                                        aTextColor,
       
    97                                        aSpecialTextColor,
       
    98                                        aHighLightTextColor,
       
    99                                        aHighLightBgColor,
       
   100                                        aButtonDownBgColor);
       
   101     CleanupStack::Pop();
       
   102     return self;  
       
   103     } 
       
   104 
       
   105 // -----------------------------------------------------------------------------
       
   106 // CFepCtrlDropdownList::NewLC
       
   107 // factory function
       
   108 // (other items were commented in a header).
       
   109 // -----------------------------------------------------------------------------
       
   110 //
       
   111 
       
   112 EXPORT_C CFepCtrlDropdownList* CFepCtrlDropdownList::NewLC(const TPoint& aTopLeftPoint,
       
   113                                                            CFepUiLayout* aUiLayout,
       
   114                                                            TInt aControlId,
       
   115                                                            TResourceReader& aReader,
       
   116                                                            const TInt aCellWidth,
       
   117                                                            const TInt aCellHeight,
       
   118                                                            const TInt aNaviWidth,
       
   119                                                            const TInt aColNum,
       
   120                                                            const TInt aRowNum,
       
   121                                                            const CFont* aFont,
       
   122                                                            MListEventHandler* aHandler,
       
   123                                                      const CGraphicsContext::TTextAlign aAlignment,
       
   124                                                            const TInt aTextMargin,
       
   125                                                            const TRgb aBorderColor,
       
   126                                                            const TRgb aBgColor,
       
   127                                                            const TRgb aNavigationBgColor,
       
   128                                                            const TRgb aTextColor,
       
   129                                                            const TRgb aSpecialTextColor,
       
   130                                                            const TRgb aHighLightTextColor,
       
   131                                                            const TRgb aHighLightBgColor,
       
   132                                                            const TRgb aButtonDownBgColor)
       
   133     {
       
   134     CFepCtrlDropdownList* self = new (ELeave) CFepCtrlDropdownList(aTopLeftPoint,
       
   135                                                                   aUiLayout,
       
   136                                                                   aControlId,
       
   137                                                                   aCellWidth,
       
   138                                                                   aCellHeight,
       
   139                                                                   aNaviWidth,
       
   140                                                                   aColNum,
       
   141                                                                   aRowNum,
       
   142                                                                   aFont,
       
   143                                                                   aHandler,
       
   144                                                                   aAlignment,
       
   145                                                                   aTextMargin,
       
   146                                                                   aBorderColor,
       
   147                                                                   aBgColor,
       
   148                                                                   aNavigationBgColor,
       
   149                                                                   aTextColor,
       
   150                                                                   aSpecialTextColor,
       
   151                                                                   aHighLightTextColor,
       
   152                                                                   aHighLightBgColor,
       
   153                                                                   aButtonDownBgColor);
       
   154     CleanupStack::PushL(self);
       
   155     self->ConstructL(aTopLeftPoint,aReader);
       
   156     return self;  
       
   157     } 
       
   158     
       
   159 // txin
       
   160 EXPORT_C CFepCtrlDropdownList* CFepCtrlDropdownList::NewL(CFepUiLayout* aUiLayout,
       
   161                                                           TInt aControlId,
       
   162                                                           TInt aResId,
       
   163                                                           TPoint aTopLeftPoint,
       
   164                                                           TSize aCellSize,
       
   165                                                           TInt aColNum,
       
   166                                                           TInt aRowNum)
       
   167     {
       
   168     CFepCtrlDropdownList* self = new (ELeave) CFepCtrlDropdownList(aUiLayout,
       
   169                                                                    aControlId,
       
   170                                                                    aTopLeftPoint,
       
   171                                                                    aCellSize,
       
   172                                                                    aColNum,
       
   173                                                                    aRowNum);
       
   174     CleanupStack::PushL(self);
       
   175     self->ConstructL(aTopLeftPoint, aResId);
       
   176     CleanupStack::Pop(self);
       
   177     return self;
       
   178     }
       
   179     
       
   180 EXPORT_C CFepCtrlDropdownList* CFepCtrlDropdownList::NewL(CFepUiLayout* aUiLayout,
       
   181                                                           TInt aControlId,
       
   182                                                           TInt aResId,
       
   183                                                           TPoint aTopLeftPoint,
       
   184                                                           const CFont* aFont,
       
   185                                                           TSize aCellSize,
       
   186                                                           TInt aNaviWidth,
       
   187                                                           TInt aColNum,
       
   188                                                           TInt aRowNum,
       
   189                                                           TInt aSpinBtnHeight,
       
   190                                                           TInt aHorizontalCellMargin,
       
   191                                                           TInt aVerticalCellMargin,
       
   192                                                           THDirection aDirection,
       
   193                                                           TBool aPageShown)
       
   194     {
       
   195     CFepCtrlDropdownList* self = new (ELeave) CFepCtrlDropdownList(aUiLayout,
       
   196                                                                    aControlId,
       
   197                                                                    aResId,
       
   198                                                                    aTopLeftPoint,
       
   199                                                                    aFont,
       
   200                                                                    aCellSize,
       
   201                                                                    aNaviWidth,
       
   202                                                                    aColNum,
       
   203                                                                    aRowNum,
       
   204                                                                    aSpinBtnHeight,
       
   205                                                                    aHorizontalCellMargin,
       
   206                                                                    aVerticalCellMargin,
       
   207                                                                    aDirection,
       
   208                                                                    aPageShown);
       
   209     CleanupStack::PushL(self);
       
   210     self->ConstructL(aTopLeftPoint, aResId);
       
   211     CleanupStack::Pop(self);
       
   212     return self;
       
   213     }
       
   214     
       
   215     
       
   216 // end
       
   217     
       
   218 // -----------------------------------------------------------------------------
       
   219 // CFepCtrlDropdownList::CFepCtrlDropdownList
       
   220 // construtor function
       
   221 // (other items were commented in a header).
       
   222 // -----------------------------------------------------------------------------
       
   223 //  
       
   224 CFepCtrlDropdownList::CFepCtrlDropdownList(const TPoint& aTopLeftPoint,
       
   225                                            CFepUiLayout* aUiLayout,
       
   226                                            TInt aControlId,                           
       
   227                                            const TInt aCellWidth,
       
   228                                            const TInt aCellHeight,
       
   229                                            const TInt aNaviWidth,                               
       
   230                                            const TInt aColNum,
       
   231                                            const TInt aRowNum,
       
   232                                            const CFont* aFont,
       
   233                                            MListEventHandler* aHandler,
       
   234                                            const CGraphicsContext::TTextAlign aAlignment,
       
   235                                            const TInt aTextMargin,
       
   236                                            const TRgb aBorderColor,
       
   237                                            const TRgb aBgColor,
       
   238                                            const TRgb aNavigationBgColor,
       
   239                                            const TRgb aTextColor,
       
   240                                            const TRgb aSpecialTextColor,
       
   241                                            const TRgb aHighLightTextColor,
       
   242                                            const TRgb aHighLightBgColor,
       
   243                                            const TRgb aButtonDownBgColor)
       
   244     : CFepUiBaseCtrl(TRect(), aUiLayout, aControlId),
       
   245     iEnableSecondary(EFalse),
       
   246     iFirstCandidateIndex(0),
       
   247     iLastCandidateIndex(0),
       
   248     iFont(aFont), iCellWidth(aCellWidth), iCellHeight(aCellHeight), iNaviWidth(aNaviWidth),
       
   249     iSpinBtnHeight(aCellHeight), 
       
   250     iCellHorizontalMargin(0),
       
   251     iCellVerticalMargin(0),
       
   252     iOriginalCandIdx(KInvalidCandIndex),
       
   253     iOriginalFirstCandIdx(KInvalidCandIndex),
       
   254     iUpdateListReDraw(ETrue),
       
   255     iAlignment(aAlignment), iTextMargin(aTextMargin), iColNum(aColNum), iRowNum(aRowNum), 
       
   256     iBorderColor(aBorderColor), iBgColor(aBgColor), iNavigationBgColor(aNavigationBgColor),
       
   257     iTextColor(aTextColor), iSpecialTextColor(aSpecialTextColor), 
       
   258     iHighLightTextColor(aHighLightTextColor),
       
   259     iHighLightBgColor(aHighLightBgColor), iButtonDownBgColor(aButtonDownBgColor), 
       
   260     iTopLeftPoint(aTopLeftPoint), 
       
   261     iEventIdForCandidateSelected(-1),
       
   262     iEventIdForNextPageCandidate(-1),
       
   263     iEventIdForPreviousPageCandidate(-1),
       
   264     iEventIdForCandidateExisted(-1),
       
   265     iListEventHandler(aHandler), iFirstTimeConstruct(ETrue), iListType(EListNoExpandable), 
       
   266     iFuzzyBoundry(0),
       
   267     iCandExpandType(ECandExpandDownward),
       
   268     iCandHDirection(ECandFromLToR),
       
   269     iPageCtrlShown(ETrue)
       
   270     {
       
   271     SetControlType(KDropDownListCtrlType);
       
   272     }
       
   273 
       
   274 // txin
       
   275 CFepCtrlDropdownList::CFepCtrlDropdownList(CFepUiLayout* aUiLayout,
       
   276                                            TInt aControlId,
       
   277                                            TPoint aTopLeftPoint,
       
   278                                            TSize aCellSize,
       
   279                                            TInt aColNum,
       
   280                                            TInt aRowNum)
       
   281     : CFepUiBaseCtrl(TRect(), aUiLayout, aControlId),
       
   282     iEnableSecondary(EFalse),
       
   283     iFirstCandidateIndex(0),
       
   284     iLastCandidateIndex(0),
       
   285     iCellWidth(aCellSize.iWidth), iCellHeight(aCellSize.iHeight), iNaviWidth(iCellWidth),
       
   286     iSpinBtnHeight(iCellHeight), 
       
   287     iCellHorizontalMargin(0),
       
   288     iCellVerticalMargin(0),
       
   289     iOriginalCandIdx(KInvalidCandIndex),
       
   290     iOriginalFirstCandIdx(KInvalidCandIndex),
       
   291     iUpdateListReDraw(ETrue),
       
   292     iAlignment(CGraphicsContext::ECenter), iTextMargin(3), iColNum(aColNum), iRowNum(aRowNum), 
       
   293     iBorderColor(KRgbBlack), iBgColor(TRgb(0xeeeeee)), iNavigationBgColor(TRgb(0xeeeeee)),
       
   294     iTextColor(KRgbBlack), iSpecialTextColor(KRgbBlack), iHighLightTextColor(KRgbBlack),
       
   295     iHighLightBgColor(TRgb(0xcccccc)), iButtonDownBgColor(KRgbGray), iTopLeftPoint(aTopLeftPoint), 
       
   296     iEventIdForCandidateSelected(-1),
       
   297     iEventIdForNextPageCandidate(-1),
       
   298     iEventIdForPreviousPageCandidate(-1),
       
   299     iEventIdForCandidateExisted(-1),
       
   300     iFirstTimeConstruct(ETrue), iListType(EListNoExpandable), 
       
   301     iFuzzyBoundry(0),
       
   302     iCandExpandType(ECandExpandDownward),
       
   303     iCandHDirection(ECandFromLToR),
       
   304     iPageCtrlShown(ETrue)
       
   305     {
       
   306     SetControlType(KDropDownListCtrlType);
       
   307     }
       
   308 
       
   309 CFepCtrlDropdownList::CFepCtrlDropdownList(CFepUiLayout* aUiLayout,
       
   310                          TInt aControlId,
       
   311                          TInt /*aResId*/,
       
   312                          TPoint aTopLeftPoint,
       
   313                          const CFont* /*aFont*/,
       
   314                          TSize aCellSize,
       
   315                          TInt aNaviWidth,
       
   316                          TInt aColNum,
       
   317                          TInt aRowNum,
       
   318                          TInt aSpinBtnHeight,
       
   319                          TInt aHorizontalCellMargin,
       
   320                          TInt aVerticalCellMargin,
       
   321                                                THDirection aDirection,
       
   322                                                TBool aPageShown)
       
   323     : CFepUiBaseCtrl(TRect(), aUiLayout, aControlId),
       
   324     iEnableSecondary(EFalse),
       
   325     iFirstCandidateIndex(0),
       
   326     iLastCandidateIndex(0),
       
   327     iCellWidth(aCellSize.iWidth), iCellHeight(aCellSize.iHeight), iNaviWidth(aNaviWidth),
       
   328     iSpinBtnHeight(aSpinBtnHeight), 
       
   329     iCellHorizontalMargin(aHorizontalCellMargin),
       
   330     iCellVerticalMargin(aVerticalCellMargin),
       
   331     iOriginalCandIdx(KInvalidCandIndex),
       
   332     iOriginalFirstCandIdx(KInvalidCandIndex),
       
   333     iUpdateListReDraw(ETrue),
       
   334     iAlignment(CGraphicsContext::ECenter), iTextMargin(3), iColNum(aColNum), iRowNum(aRowNum), 
       
   335     iBorderColor(KRgbBlack), iBgColor(TRgb(0xeeeeee)), iNavigationBgColor(TRgb(0xeeeeee)),
       
   336     iTextColor(KRgbBlack), iSpecialTextColor(KRgbBlack), iHighLightTextColor(KRgbBlack),
       
   337     iHighLightBgColor(TRgb(0xcccccc)), iButtonDownBgColor(KRgbGray), iTopLeftPoint(aTopLeftPoint), 
       
   338     iEventIdForCandidateSelected(-1),
       
   339     iEventIdForNextPageCandidate(-1),
       
   340     iEventIdForPreviousPageCandidate(-1),
       
   341     iEventIdForCandidateExisted(-1),
       
   342     iFirstTimeConstruct(ETrue), iListType(EListNoExpandable), 
       
   343     iFuzzyBoundry(0),
       
   344     iCandExpandType(ECandExpandDownward),
       
   345     iCandHDirection(aDirection),
       
   346     iPageCtrlShown(aPageShown)
       
   347     {
       
   348     SetControlType(KDropDownListCtrlType);
       
   349     }
       
   350 
       
   351 // end
       
   352 
       
   353 // -----------------------------------------------------------------------------
       
   354 // CFepCtrlDropdownList::ConstructL
       
   355 // 2nd construct function
       
   356 // (other items were commented in a header).
       
   357 // -----------------------------------------------------------------------------
       
   358 //
       
   359 void CFepCtrlDropdownList::ConstructL(const TPoint& aTopLeftPoint, TResourceReader& aReader)
       
   360     {
       
   361     BaseConstructL();
       
   362 
       
   363     iBitmapDb = CBitmapDb::NewL(aReader, 
       
   364                                 TSize(iCellWidth, iCellHeight),
       
   365                                 TSize(iNaviWidth, iCellHeight),
       
   366                                 TSize(iNaviWidth, iSpinBtnHeight));
       
   367 
       
   368     SetTextColor(iBitmapDb->TextColor());
       
   369     SetBorderColor(iBitmapDb->FrameColor());
       
   370     iFirstTimeConstruct = EFalse;
       
   371 
       
   372     iPages = CPages::NewL();
       
   373 
       
   374     iListManager = CListManager::NewL(this);
       
   375 
       
   376     iListManager->SetActiveList(iListManager->ListOneRowWithoutIcon());
       
   377 
       
   378     SetRect( iListManager->ActiveList()->Rect() );
       
   379 
       
   380     const TSize& size = Rect().Size();
       
   381     TRect rect(aTopLeftPoint,size);
       
   382     SetRect(rect);
       
   383     }
       
   384     
       
   385 // txin
       
   386 void CFepCtrlDropdownList::ConstructL(TPoint aTopLeftPoint, TInt aResId)
       
   387     {
       
   388     SetResourceId(aResId);
       
   389 
       
   390     TResourceReader reader;
       
   391     CCoeEnv::Static()->CreateResourceReaderLC(reader, aResId);
       
   392     ConstructL(aTopLeftPoint, reader);
       
   393     CleanupStack::PopAndDestroy(); // reader
       
   394     }
       
   395 // end    
       
   396 
       
   397 // -----------------------------------------------------------------------------
       
   398 // CFepCtrlDropdownList::~CFepCtrlDropdownList
       
   399 // destructor function
       
   400 // (other items were commented in a header).
       
   401 // -----------------------------------------------------------------------------
       
   402 //    
       
   403 EXPORT_C CFepCtrlDropdownList::~CFepCtrlDropdownList()
       
   404     {
       
   405     delete iBubbleCtrl;
       
   406     
       
   407     // destroy list objects
       
   408     delete iListManager;
       
   409 
       
   410     // Delete bitmapDb
       
   411     delete iBitmapDb;
       
   412     
       
   413     // Delete pages
       
   414     delete iPages;
       
   415     
       
   416     // Delete all candidate
       
   417     iCandidatelist.ResetAndDestroy();
       
   418     
       
   419     // Clear and close iSecondaryList
       
   420     iSecondaryList.Close();   
       
   421 
       
   422     // Clear and close iHighlightList
       
   423     iHighlightList.Close();       
       
   424     }
       
   425 
       
   426 // -----------------------------------------------------------------------------
       
   427 // CFepCtrlDropdownList::SizeChanged
       
   428 // size change function
       
   429 // (other items were commented in a header).
       
   430 // -----------------------------------------------------------------------------
       
   431 //    
       
   432 EXPORT_C void CFepCtrlDropdownList::SizeChanged(const TInt aCellWidth,
       
   433                                                  const TInt aCellHeight,
       
   434                                                  const TInt aNaviWidth,
       
   435                                                  const TPoint aTopLeftPoint,
       
   436                                                  const TInt aColNum,
       
   437                                                  const TInt aRowNum)
       
   438     {
       
   439     iCellWidth = aCellWidth; 
       
   440     iCellHeight = aCellHeight; 
       
   441     iNaviWidth = aNaviWidth;
       
   442     iSpinBtnHeight = aCellHeight;
       
   443     
       
   444     iBitmapDb->SizeChanged(TSize(aNaviWidth, aCellHeight));
       
   445     
       
   446     if ( aTopLeftPoint != TPoint(0,0) )
       
   447         {
       
   448         iTopLeftPoint = aTopLeftPoint;        
       
   449         }
       
   450     
       
   451     if ( aColNum )
       
   452         iColNum = aColNum;
       
   453     if ( aRowNum )
       
   454         iRowNum = aRowNum;  
       
   455     
       
   456     iListManager->SizeChanged();
       
   457     
       
   458 	switch ( iListType )
       
   459 		{
       
   460 		case EListNoExpandable:
       
   461 	        ChangeActiveList( iListManager->ListOneRowWithoutIcon() );
       
   462 			break;
       
   463 		case EListNoExpandableWithBubble:
       
   464 	        {
       
   465 	        ChangeActiveList(iListManager->ListOneRowWithoutIconWithBubble());
       
   466 	        }
       
   467 		    break;
       
   468 		case EListExpandable:
       
   469 		case EListExpandableWithoutIcon:
       
   470             {
       
   471             ChangeActiveList(iListManager->ListOneRowWithIcon());
       
   472             }
       
   473             break;
       
   474 		case EListExpandableWithBubble:
       
   475 		    {
       
   476 		    ChangeActiveList(iListManager->ListOneRowWithIconWithBubble());
       
   477             }
       
   478             break;
       
   479 		// txin
       
   480 		case EListExpandableRollWithIcon:
       
   481             {
       
   482             TInt onerowCandIdx = OneRowStartCandIdx();
       
   483 
       
   484             if (onerowCandIdx != KInvalidCandIndex)
       
   485                 {
       
   486                 ChangeActiveList(iListManager->ListOneRowRollWithIcon(), onerowCandIdx);
       
   487                 return;
       
   488                 }
       
   489 
       
   490             ChangeActiveList(iListManager->ListOneRowRollWithIcon());
       
   491             }
       
   492 	        break;
       
   493 		case EListExpandableRollWithIconWithBubble:
       
   494             {
       
   495             TInt onerowCandIdx = OneRowStartCandIdx();
       
   496 
       
   497             if (onerowCandIdx != KInvalidCandIndex)
       
   498                 {
       
   499                 ChangeActiveList(iListManager->ListOneRowRollWithIconWithBubble(), onerowCandIdx);
       
   500                 return;
       
   501                 }
       
   502 
       
   503             ChangeActiveList(iListManager->ListOneRowRollWithIconWithBubble());
       
   504             }
       
   505 	        break;
       
   506 	        
       
   507         case EListExpandableMultiRowWithoutIcon:
       
   508             {
       
   509             ChangeActiveList(iListManager->ListExpandableMultiRowWithoutIcon());
       
   510             }
       
   511             break;
       
   512         case EListExpandableMultiRowWithoutIconWithBubble:
       
   513         	{
       
   514         	ChangeActiveList(iListManager->ListMultiRowWithoutIconWithBubble());
       
   515         	}  
       
   516         	break;                
       
   517 	    default:
       
   518 	    	__ASSERT_DEBUG( EFalse, 
       
   519 	    			User::Panic( _L("TListType Error::SizeChanged()"), 0 ) );
       
   520 	    	break;
       
   521 		}
       
   522     }
       
   523 
       
   524 // ---------------------------------------------------------------------------
       
   525 // CFepUiBaseCtrl::HandlePointerDownEventL
       
   526 // Handle pointer down event
       
   527 // (other items were commented in a header).
       
   528 // ---------------------------------------------------------------------------
       
   529 //      
       
   530 EXPORT_C CFepUiBaseCtrl* CFepCtrlDropdownList::HandlePointerDownEventL(const TPoint& aPoint)
       
   531     {
       
   532     CFepUiBaseCtrl::HandlePointerDownEventL(aPoint);
       
   533     
       
   534     iListManager->ActiveList()->HandlePointerDownL(aPoint);
       
   535     
       
   536     return this;
       
   537     }
       
   538 
       
   539 // ---------------------------------------------------------------------------
       
   540 // CFepUiBaseCtrl::HandlePointerUpEventL
       
   541 // Handle pointer up event
       
   542 // (other items were commented in a header).
       
   543 // ---------------------------------------------------------------------------
       
   544 //    
       
   545 EXPORT_C CFepUiBaseCtrl*  CFepCtrlDropdownList::HandlePointerUpEventL(const TPoint& aPoint)
       
   546     {
       
   547     CFepUiBaseCtrl::HandlePointerUpEventL(aPoint);
       
   548     
       
   549     iListManager->ActiveList()->HandlePointerUpL(aPoint);
       
   550     
       
   551     return this;
       
   552     }
       
   553 
       
   554 // ---------------------------------------------------------------------------
       
   555 // CFepUiBaseCtrl::HandlePointerMoveEventL
       
   556 // Handle pointer move event
       
   557 // (other items were commented in a header).
       
   558 // ---------------------------------------------------------------------------
       
   559 //
       
   560 EXPORT_C CFepUiBaseCtrl* CFepCtrlDropdownList::HandlePointerMoveEventL(const TPoint& aPoint)
       
   561     {
       
   562     
       
   563     if(!PointerDown())
       
   564         {
       
   565         return NULL;
       
   566         }
       
   567     
       
   568     iListManager->ActiveList()->HandlePointerDragL(aPoint);
       
   569     
       
   570     return this;
       
   571     }
       
   572 
       
   573 EXPORT_C void CFepCtrlDropdownList::HandlePointerLeave(const TPoint& aPoint)
       
   574     {
       
   575     CFepUiBaseCtrl::HandlePointerLeave(aPoint);
       
   576     if(!Hiden())
       
   577         iListManager->ActiveList()->HandlePointerLeave(aPoint);
       
   578     ClearBubble();
       
   579     }
       
   580 
       
   581 // -----------------------------------------------------------------------------
       
   582 // CFepCtrlDropdownList::AddCandidatesL
       
   583 // Add candidate
       
   584 // (other items were commented in a header).
       
   585 // -----------------------------------------------------------------------------
       
   586 //    
       
   587 EXPORT_C void CFepCtrlDropdownList::AddCandidatesL(const RPointerArray<HBufC>& aCandidates,
       
   588                                                    const TListType /*aListType*/)
       
   589     {
       
   590     // add new candidates
       
   591     for (TInt i = iCandidatelist.Count(); i < aCandidates.Count(); i++)
       
   592         {
       
   593         CCandidate* candidate = CCandidate::NewL(*aCandidates[i], this);
       
   594 
       
   595         if (iCandidatelist.Append(candidate) != KErrNone)
       
   596             {
       
   597             delete candidate;
       
   598             }
       
   599         }
       
   600     }
       
   601 
       
   602 // -----------------------------------------------------------------------------
       
   603 // CFepCtrlDropdownList::SetCandidatesL
       
   604 // Set candidate
       
   605 // (other items were commented in a header).
       
   606 // -----------------------------------------------------------------------------
       
   607 //    
       
   608 EXPORT_C void CFepCtrlDropdownList::SetCandidatesL(const RPointerArray<HBufC>& aCandidates, 
       
   609                                                    const TListType aListType,
       
   610                                                    const TDesC& aFixedText)
       
   611     {
       
   612     //clear last candidates which had been set    
       
   613     iCandidatelist.ResetAndDestroy();
       
   614     
       
   615 	iListManager->ResetStatus();        
       
   616 	
       
   617     iHighlightList.Reset();
       
   618     
       
   619     iFixedText.Zero();
       
   620     iFixedText.Append(aFixedText);
       
   621     
       
   622     iFirstCandidateIndex = 0;
       
   623     iLastCandidateIndex = 0;
       
   624     // create or add new ones
       
   625     for( TInt i=0; i < aCandidates.Count(); i++ )
       
   626         {
       
   627         // CCandidate is s.c. self-containing class
       
   628         CCandidate* candidate = CCandidate::NewL(*aCandidates[i], this);
       
   629         // referring to memory object
       
   630         iCandidatelist.Append(candidate);
       
   631         }
       
   632     
       
   633 	iListType = aListType;
       
   634 
       
   635 	switch ( aListType )
       
   636 		{
       
   637 		case EListNoExpandable:
       
   638 		    {
       
   639 		    ChangeActiveList( iListManager->ListOneRowWithoutIcon() );
       
   640 		    }
       
   641 			break;
       
   642 		case EListNoExpandableWithBubble:
       
   643 		    {
       
   644 		    ChangeActiveList( iListManager->ListOneRowWithoutIconWithBubble() );
       
   645 		    }
       
   646 			break;
       
   647 		case EListExpandable:
       
   648 		case EListExpandableWithoutIcon:
       
   649 		    {
       
   650 		    ChangeActiveList(iListManager->ListOneRowWithIcon());
       
   651 		    }
       
   652 		    break;
       
   653 		case EListExpandableWithBubble:
       
   654 		    {
       
   655 		    ChangeActiveList(iListManager->ListOneRowWithIconWithBubble());
       
   656 		    }
       
   657 		    break;
       
   658 		    
       
   659 		// txin
       
   660 		case EListExpandableRollWithIcon:
       
   661 		    {
       
   662             SetOneRowStartCandIdx(KInvalidCandIndex);
       
   663             SetOriginalFirstCandIdx(KInvalidCandIndex);
       
   664 
       
   665             ChangeActiveList(iListManager->ListOneRowRollWithIcon());
       
   666 		    }
       
   667 	        break;
       
   668 		case EListExpandableRollWithIconWithBubble:
       
   669 		    {
       
   670             SetOneRowStartCandIdx(KInvalidCandIndex);
       
   671             SetOriginalFirstCandIdx(KInvalidCandIndex);
       
   672 
       
   673             ChangeActiveList(iListManager->ListOneRowRollWithIconWithBubble());
       
   674 		    }
       
   675 	        break;
       
   676 	        
       
   677 		case EListExpandableMultiRowWithoutIcon:
       
   678 		    {
       
   679             ChangeActiveList( iListManager->ListExpandableMultiRowWithoutIcon() );
       
   680 		    }
       
   681             break;
       
   682             
       
   683         case EListExpandableMultiRowWithoutIconWithBubble:
       
   684       	    {
       
   685       	    ChangeActiveList(iListManager->ListMultiRowWithoutIconWithBubble());
       
   686       	    }  
       
   687       	    break;
       
   688         	                
       
   689 	    default:
       
   690 	    	__ASSERT_DEBUG( EFalse, 
       
   691 	    			User::Panic( _L("TListType Error::SetCandidatesL()"), 0 ) );
       
   692 	    	break;
       
   693 		}
       
   694     }
       
   695 
       
   696 // -----------------------------------------------------------------------------
       
   697 // CFepCtrlDropdownList::Move
       
   698 // when the control is moved, the function will be called
       
   699 // (other items were commented in a header).
       
   700 // -----------------------------------------------------------------------------
       
   701 //
       
   702 EXPORT_C void CFepCtrlDropdownList::Move(const TPoint& aOffset)
       
   703     {
       
   704     ClearRect(Rect());
       
   705     Invalidate(Rect(),ETrue);    
       
   706     iListManager->Move(aOffset);
       
   707     SetRect(iListManager->ActiveList()->Rect());
       
   708     iListManager->ActiveList()->Draw();
       
   709     Invalidate(iListManager->ActiveList()->Rect());
       
   710     }
       
   711 
       
   712 // -----------------------------------------------------------------------------
       
   713 // CFepCtrlDropdownList::OnDeActivate
       
   714 // when the control is hide, the function will be called
       
   715 // (other items were commented in a header).
       
   716 // -----------------------------------------------------------------------------
       
   717 //
       
   718 EXPORT_C void CFepCtrlDropdownList::OnDeActivate()
       
   719     {
       
   720 	iListManager->ResetStatus();
       
   721     }
       
   722 
       
   723 // ---------------------------------------------------------------------------
       
   724 // Hide or show dropdown list.
       
   725 // ---------------------------------------------------------------------------
       
   726 //    
       
   727 EXPORT_C void CFepCtrlDropdownList::Hide( TBool aFlag )
       
   728     {
       
   729     ClearBubble();
       
   730     CFepUiBaseCtrl::Hide( aFlag );
       
   731     }
       
   732 
       
   733 // -----------------------------------------------------------------------------
       
   734 // CFepCtrlDropdownList::FoldList
       
   735 // fold the drop down list control
       
   736 // (other items were commented in a header).
       
   737 // -----------------------------------------------------------------------------
       
   738 //
       
   739 EXPORT_C void CFepCtrlDropdownList::FoldList()
       
   740     {
       
   741     if ((iListManager->ActiveList() == iListManager->ListMultiRowWithIcon()) 
       
   742     	|| (iListManager->ActiveList() == iListManager->ListMultiRowWithoutIcon()))
       
   743         {
       
   744         ChangeActiveList(iListManager->ListOneRowWithIcon(), iFirstCandidateIndex);            
       
   745         }
       
   746     // added by txin    
       
   747     else if (iListManager->ActiveList() == iListManager->ListMultiRowRollWithIcon())
       
   748         {
       
   749         TInt onerowCandIdx = OneRowStartCandIdx();
       
   750 
       
   751         if (onerowCandIdx != KInvalidCandIndex)
       
   752             {
       
   753             ChangeActiveList(iListManager->ListOneRowRollWithIcon(), onerowCandIdx);
       
   754             return;
       
   755             }
       
   756 
       
   757         ChangeActiveList(iListManager->ListOneRowRollWithIcon(), iFirstCandidateIndex);
       
   758         }
       
   759     else if (iListManager->ActiveList() == iListManager->ListMultiRowRollWithIconWithBubble())
       
   760         {
       
   761         TInt onerowCandIdx = OneRowStartCandIdx();
       
   762 
       
   763         if (onerowCandIdx != KInvalidCandIndex)
       
   764             {
       
   765             ChangeActiveList(iListManager->ListOneRowRollWithIconWithBubble(), onerowCandIdx);
       
   766             return;
       
   767             }
       
   768 
       
   769         ChangeActiveList(iListManager->ListOneRowRollWithIconWithBubble(), iFirstCandidateIndex);
       
   770         }
       
   771     else if(iListManager->ActiveList() == iListManager->ListMultiRowWithIconWithBubble())
       
   772         {
       
   773         ChangeActiveList(iListManager->ListOneRowWithIconWithBubble(), iFirstCandidateIndex);
       
   774         }
       
   775     // end    
       
   776     }
       
   777 
       
   778 // -----------------------------------------------------------------------------
       
   779 // CFepCtrlDropdownList::ResetAndClear
       
   780 // reset and clear and redraw the list
       
   781 // (other items were commented in a header).
       
   782 // -----------------------------------------------------------------------------
       
   783 //        
       
   784 EXPORT_C void CFepCtrlDropdownList::ResetAndClear(const TListType aListType)
       
   785     {
       
   786     //clear last candidates which had been set
       
   787     iCandidatelist.ResetAndDestroy();
       
   788     
       
   789     iFixedText.Zero();
       
   790    
       
   791     iFirstCandidateIndex = 0;
       
   792     iLastCandidateIndex = 0;
       
   793     
       
   794 	switch ( aListType )
       
   795 		{
       
   796 		case EListNoExpandable:
       
   797 	        ChangeActiveList( iListManager->ListOneRowWithoutIcon() );
       
   798 			break;
       
   799 		case EListNoExpandableWithBubble:
       
   800 	        ChangeActiveList( iListManager->ListOneRowWithoutIconWithBubble() );
       
   801 			break;
       
   802 			
       
   803 		case EListExpandable:
       
   804 		case EListExpandableWithoutIcon:
       
   805 			{
       
   806 		    ChangeActiveList(iListManager->ListOneRowWithIcon());
       
   807 		    NotifyClosePage();
       
   808 			}
       
   809 		    break;
       
   810 		case EListExpandableWithBubble:
       
   811 			{
       
   812 		    ChangeActiveList(iListManager->ListOneRowWithIconWithBubble());
       
   813 		    NotifyClosePage();
       
   814 			}
       
   815 		    break;
       
   816 		    
       
   817 		// txin
       
   818 		case EListExpandableRollWithIcon:
       
   819 		    {
       
   820 		    ChangeActiveList(iListManager->ListOneRowRollWithIcon());
       
   821 		    NotifyClosePage();
       
   822 		    }
       
   823 	        break;
       
   824 		// end
       
   825 		case EListExpandableRollWithIconWithBubble:
       
   826 		    {
       
   827 		    ChangeActiveList(iListManager->ListOneRowRollWithIconWithBubble());
       
   828 		    NotifyClosePage();
       
   829 		    }
       
   830 	        break;
       
   831 		case EListExpandableMultiRowWithoutIcon:
       
   832 		    {
       
   833             ChangeActiveList(iListManager->ListExpandableMultiRowWithoutIcon());
       
   834             NotifyClosePage();		    
       
   835 		    }
       
   836 		    break;
       
   837 		    
       
   838 		case EListExpandableMultiRowWithoutIconWithBubble:
       
   839       	    {
       
   840       	    ChangeActiveList(iListManager->ListMultiRowWithoutIconWithBubble());
       
   841       	    NotifyClosePage();
       
   842       	    }  
       
   843       	  break;
       
   844 	    default:
       
   845 	    	__ASSERT_DEBUG( EFalse, 
       
   846 	    			User::Panic( _L("TListType Error::ResetAndClear()"), 0 ) );
       
   847 	    	break;
       
   848 		}
       
   849     }
       
   850 
       
   851 
       
   852 // -----------------------------------------------------------------------------
       
   853 // CFepCtrlDropdownList::HandleEvent
       
   854 // when there is out event coming, the function will be called
       
   855 // (other items were commented in a header).
       
   856 // -----------------------------------------------------------------------------
       
   857 //
       
   858 EXPORT_C void CFepCtrlDropdownList::HandleControlEvent(TInt aEventType, 
       
   859                                                        CFepUiBaseCtrl* aCtrl, 
       
   860                                                        const TDesC& aEventData)
       
   861     {
       
   862     if ( iListEventHandler )
       
   863         {
       
   864         iListEventHandler->HandleListOuterEvent(aEventType, aCtrl, aEventData);        
       
   865         }
       
   866     }
       
   867 
       
   868 // -----------------------------------------------------------------------------
       
   869 // CFepCtrlDropdownList::Draw
       
   870 // draw the list
       
   871 // (other items were commented in a header).
       
   872 // -----------------------------------------------------------------------------
       
   873 //
       
   874 EXPORT_C void CFepCtrlDropdownList::Draw()
       
   875     {   
       
   876 	if(!AbleToDraw())
       
   877         return;
       
   878     
       
   879     if (!iFirstTimeConstruct)
       
   880     	{
       
   881         // if construct is not finished, then no need to draw
       
   882 ///DrawOpaqueMaskBackground();
       
   883         
       
   884         //ActivateBitmapContext();
       
   885         
       
   886   	    iListManager->ActiveList()->Draw();
       
   887   	    Invalidate(iListManager->ActiveList()->Rect());
       
   888     	}
       
   889     }
       
   890 
       
   891 // -----------------------------------------------------------------------------
       
   892 // CFepCtrlDropdownList::SetHighlightCell
       
   893 // set or unset the high light effect for the cell
       
   894 // (other items were commented in a header).
       
   895 // -----------------------------------------------------------------------------
       
   896 //
       
   897 EXPORT_C void CFepCtrlDropdownList::SetHighlightCell(const TInt aCellIndex, 
       
   898                                                      TBool aHighlight, 
       
   899                                                      const TBool aIsDraw)
       
   900     {
       
   901     if (aHighlight)
       
   902         {
       
   903 
       
   904         iHighlightList.Reset();
       
   905 
       
   906         iHighlightList.Append(aCellIndex);
       
   907         
       
   908         if ((iListType == EListExpandableRollWithIcon ||
       
   909             iListType == EListExpandableRollWithIconWithBubble) && 
       
   910             (aCellIndex == GetFirstCandidateIndex()))
       
   911             {
       
   912             SetOneRowStartCandIdx(GetFirstCandidateIndex());
       
   913             }
       
   914         }
       
   915     else
       
   916         {
       
   917         TInt index = iHighlightList.Find(aCellIndex);
       
   918         
       
   919         if ( index != KErrNotFound )
       
   920             {
       
   921             iHighlightList.Remove(index);            
       
   922             }
       
   923         }
       
   924         
       
   925     if( aIsDraw )
       
   926         {
       
   927         iListManager->ActiveList()->SetHighlightCell(aCellIndex, aHighlight, EFalse);
       
   928         
       
   929         Draw();
       
   930         }
       
   931     }
       
   932 
       
   933 
       
   934 // -----------------------------------------------------------------------------
       
   935 // CFepCtrlDropdownList::Rect
       
   936 // get the rect of the list
       
   937 // (other items were commented in a header).
       
   938 // -----------------------------------------------------------------------------
       
   939 //      
       
   940 EXPORT_C const TRect& CFepCtrlDropdownList::Rect()
       
   941     {
       
   942     return iListManager->ActiveList()->Rect();
       
   943     }
       
   944     
       
   945 
       
   946 // -----------------------------------------------------------------------------
       
   947 // CFepCtrlDropdownList::SetEventIdForCandidateSelected
       
   948 // set event id when candidate is selected
       
   949 // (other items were commented in a header).
       
   950 // -----------------------------------------------------------------------------
       
   951 //      
       
   952 EXPORT_C void CFepCtrlDropdownList::SetEventIdForCandidateSelected(TInt aEventId)
       
   953     {
       
   954     iEventIdForCandidateSelected = aEventId;
       
   955     }
       
   956 
       
   957 // -----------------------------------------------------------------------------
       
   958 // CFepCtrlDropdownList::SetEventIdForNextPageCandidate
       
   959 // set event id when need get next page candidate
       
   960 // (other items were commented in a header).
       
   961 // -----------------------------------------------------------------------------
       
   962 //      
       
   963 EXPORT_C void CFepCtrlDropdownList::SetEventIdForNextPageCandidate(TInt aEventId)
       
   964     {
       
   965 	  iEventIdForNextPageCandidate = aEventId;
       
   966     }
       
   967 
       
   968 // -----------------------------------------------------------------------------
       
   969 // CFepCtrlDropdownList::SetEventIdForPreviousPageCandidate
       
   970 // set event id when need get previous page candidate
       
   971 // (other items were commented in a header).
       
   972 // -----------------------------------------------------------------------------
       
   973 //      
       
   974 EXPORT_C void CFepCtrlDropdownList::SetEventIdForPreviousPageCandidate(TInt aEventId)
       
   975     {
       
   976 	  iEventIdForPreviousPageCandidate = aEventId;
       
   977     }
       
   978 
       
   979 // -----------------------------------------------------------------------------
       
   980 // CFepCtrlDropdownList::SetEventIdForCandidateExisted
       
   981 // set event id when need judge if candidate exist
       
   982 // (other items were commented in a header).
       
   983 // -----------------------------------------------------------------------------
       
   984 //      
       
   985 EXPORT_C void CFepCtrlDropdownList::SetEventIdForCandidateExisted(TInt aEventId)
       
   986     {
       
   987     iEventIdForCandidateExisted = aEventId;
       
   988     }
       
   989 
       
   990 // -----------------------------------------------------------------------------
       
   991 // CFepCtrlDropdownList::SetTopLeftPoint
       
   992 // set top left point of the list
       
   993 // (other items were commented in a header).
       
   994 // -----------------------------------------------------------------------------
       
   995 //      
       
   996 EXPORT_C void CFepCtrlDropdownList::SetTopLeftPoint(const TPoint aTopLeftPoint)
       
   997     {
       
   998     SizeChanged(iCellWidth, iCellHeight, iNaviWidth, aTopLeftPoint);
       
   999     }
       
  1000 
       
  1001 // -----------------------------------------------------------------------------
       
  1002 // CFepCtrlDropdownList::SetCellWidth
       
  1003 // set cell width
       
  1004 // (other items were commented in a header).
       
  1005 // -----------------------------------------------------------------------------
       
  1006 //      
       
  1007 EXPORT_C void CFepCtrlDropdownList::SetCellWidth(const TInt aCellWidth)
       
  1008     {
       
  1009     SizeChanged(aCellWidth, iCellHeight, iNaviWidth);
       
  1010     }
       
  1011     
       
  1012 // -----------------------------------------------------------------------------
       
  1013 // CFepCtrlDropdownList::SetCellHeight
       
  1014 // set cell height
       
  1015 // (other items were commented in a header).
       
  1016 // -----------------------------------------------------------------------------
       
  1017 //      
       
  1018 EXPORT_C void CFepCtrlDropdownList::SetCellHeight(const TInt aCellHeight)
       
  1019     {
       
  1020     SizeChanged(iCellWidth, aCellHeight, iNaviWidth);
       
  1021     }
       
  1022     
       
  1023 // -----------------------------------------------------------------------------
       
  1024 // CFepCtrlDropdownList::SetNaviWidth
       
  1025 // set navigation width
       
  1026 // (other items were commented in a header).
       
  1027 // -----------------------------------------------------------------------------
       
  1028 //      
       
  1029 EXPORT_C void CFepCtrlDropdownList::SetNaviWidth(const TInt aNaviWidth)      
       
  1030     {
       
  1031     SizeChanged(iCellWidth, iCellHeight, aNaviWidth);    
       
  1032     }
       
  1033     
       
  1034 // -----------------------------------------------------------------------------
       
  1035 // CFepCtrlDropdownList::SetColNum
       
  1036 // set columns number
       
  1037 // (other items were commented in a header).
       
  1038 // -----------------------------------------------------------------------------
       
  1039 //      
       
  1040 EXPORT_C void CFepCtrlDropdownList::SetColNum(const TInt aColNum)
       
  1041     {
       
  1042     SizeChanged(iCellWidth, iCellHeight, iNaviWidth, iTopLeftPoint, aColNum);
       
  1043     }
       
  1044     
       
  1045 // -----------------------------------------------------------------------------
       
  1046 // CFepCtrlDropdownList::SetRowNum
       
  1047 // Set rows number
       
  1048 // (other items were commented in a header).
       
  1049 // -----------------------------------------------------------------------------
       
  1050 //      
       
  1051 EXPORT_C void CFepCtrlDropdownList::SetRowNum(const TInt aRowNum)
       
  1052     {
       
  1053     SizeChanged(iCellWidth, iCellHeight, iNaviWidth, iTopLeftPoint, iColNum, aRowNum);    
       
  1054     }
       
  1055     
       
  1056 // -----------------------------------------------------------------------------
       
  1057 // CFepCtrlDropdownList::SetBorderColor
       
  1058 // Set border color
       
  1059 // (other items were commented in a header).
       
  1060 // -----------------------------------------------------------------------------
       
  1061 //      
       
  1062 EXPORT_C void CFepCtrlDropdownList::SetBorderColor(TRgb aBorderColor, TBool aReDraw)
       
  1063     {
       
  1064     iBorderColor = aBorderColor;
       
  1065     
       
  1066     if ( aReDraw )
       
  1067         {
       
  1068         Draw();
       
  1069         }
       
  1070     }
       
  1071     
       
  1072 // -----------------------------------------------------------------------------
       
  1073 // CFepCtrlDropdownList::SetBgColor
       
  1074 // Set background color for the whole DDl (drop down list)
       
  1075 // (other items were commented in a header).
       
  1076 // -----------------------------------------------------------------------------
       
  1077 //      
       
  1078 EXPORT_C void CFepCtrlDropdownList::SetBgColor(TRgb aBgColor, TBool aReDraw)
       
  1079     {
       
  1080     iBgColor = aBgColor;
       
  1081     
       
  1082     if ( aReDraw )
       
  1083         {
       
  1084         Draw();
       
  1085         }    
       
  1086     }
       
  1087     
       
  1088 // -----------------------------------------------------------------------------
       
  1089 // CFepCtrlDropdownList::SetNavigationBgColor
       
  1090 // set background color for navigation area
       
  1091 // (other items were commented in a header).
       
  1092 // -----------------------------------------------------------------------------
       
  1093 //      
       
  1094 EXPORT_C void CFepCtrlDropdownList::SetNavigationBgColor(TRgb aNavigationBgColor, TBool aReDraw)
       
  1095     {
       
  1096     iNavigationBgColor = aNavigationBgColor;
       
  1097     
       
  1098     if ( aReDraw )
       
  1099         {
       
  1100         Draw();
       
  1101         }
       
  1102     }
       
  1103     
       
  1104 // -----------------------------------------------------------------------------
       
  1105 // CFepCtrlDropdownList::SetTextColor
       
  1106 // set text color
       
  1107 // (other items were commented in a header).
       
  1108 // -----------------------------------------------------------------------------
       
  1109 //
       
  1110 EXPORT_C void CFepCtrlDropdownList::SetTextColor(TRgb aTextColor, TBool aReDraw)
       
  1111     {
       
  1112     iTextColor = aTextColor;
       
  1113     
       
  1114     if ( aReDraw )
       
  1115         {
       
  1116         Draw();
       
  1117         }
       
  1118     }
       
  1119 
       
  1120 // -----------------------------------------------------------------------------
       
  1121 // CFepCtrlDropdownList::SetSpecialTextColor
       
  1122 // set special text color
       
  1123 // (other items were commented in a header).
       
  1124 // -----------------------------------------------------------------------------
       
  1125 //      
       
  1126 EXPORT_C void CFepCtrlDropdownList::SetSpecialTextColor(TRgb aSpecialTextColor, TBool aReDraw)
       
  1127     {
       
  1128     iSpecialTextColor = aSpecialTextColor;
       
  1129     
       
  1130     if ( aReDraw )
       
  1131         {
       
  1132         Draw();
       
  1133         }    
       
  1134     }
       
  1135 
       
  1136 // -----------------------------------------------------------------------------
       
  1137 // CFepCtrlDropdownList::SetHighLightTextColor
       
  1138 // set text color for highlight
       
  1139 // (other items were commented in a header).
       
  1140 // -----------------------------------------------------------------------------
       
  1141 //      
       
  1142 EXPORT_C void CFepCtrlDropdownList::SetHighLightTextColor(TRgb aHighLightTextColor, TBool aReDraw)
       
  1143     {
       
  1144     iHighLightTextColor = aHighLightTextColor;
       
  1145     
       
  1146     if ( aReDraw )
       
  1147         {
       
  1148         Draw();
       
  1149         }
       
  1150     }
       
  1151 
       
  1152 // -----------------------------------------------------------------------------
       
  1153 // CFepCtrlDropdownList::SetHighLightBgColor
       
  1154 // set background color for highlight
       
  1155 // (other items were commented in a header).
       
  1156 // -----------------------------------------------------------------------------
       
  1157 //      
       
  1158 EXPORT_C void CFepCtrlDropdownList::SetHighLightBgColor(TRgb aHighLightBgColor, TBool aReDraw)
       
  1159     {
       
  1160     iHighLightBgColor = aHighLightBgColor;
       
  1161     
       
  1162     if ( aReDraw )
       
  1163         {
       
  1164         Draw();
       
  1165         }
       
  1166     }
       
  1167 
       
  1168 // -----------------------------------------------------------------------------
       
  1169 // CFepCtrlDropdownList::SetTextAlighment
       
  1170 // set text alignment
       
  1171 // (other items were commented in a header).
       
  1172 // -----------------------------------------------------------------------------
       
  1173 //      
       
  1174 EXPORT_C void CFepCtrlDropdownList::SetTextAlighment(const CGraphicsContext::TTextAlign aAlignment,
       
  1175                                                      TBool aReDraw)
       
  1176     {
       
  1177     iAlignment = aAlignment;
       
  1178     
       
  1179     if ( aReDraw )
       
  1180         {
       
  1181         Draw();
       
  1182         }
       
  1183     }
       
  1184     
       
  1185 // -----------------------------------------------------------------------------
       
  1186 // CFepCtrlDropdownList::SetTextAlighment
       
  1187 // set text alignment
       
  1188 // (other items were commented in a header).
       
  1189 // -----------------------------------------------------------------------------
       
  1190 //      
       
  1191 EXPORT_C void CFepCtrlDropdownList::SetTextMargin(const TInt aTextMargin, TBool aReDraw)
       
  1192     {
       
  1193     iTextMargin = aTextMargin;
       
  1194     
       
  1195     if ( aReDraw )
       
  1196         {
       
  1197         Draw();
       
  1198         }
       
  1199     }
       
  1200 
       
  1201 // -----------------------------------------------------------------------------
       
  1202 // CFepCtrlDropdownList::SetCellColor
       
  1203 // set cell color
       
  1204 // (other items were commented in a header).
       
  1205 // -----------------------------------------------------------------------------
       
  1206 //      
       
  1207 EXPORT_C void CFepCtrlDropdownList::SetSecondaryList(RArray<TInt>& aIndexList, TBool aReDraw)
       
  1208     {
       
  1209     iSecondaryList.Reset();
       
  1210     for (TInt i=0; i < aIndexList.Count(); i++)
       
  1211         {
       
  1212         iSecondaryList.Append(aIndexList[i]);
       
  1213         }
       
  1214     
       
  1215     if ( aReDraw )
       
  1216         {
       
  1217         Draw();
       
  1218         }    
       
  1219     }
       
  1220 
       
  1221 // -----------------------------------------------------------------------------
       
  1222 // CFepCtrlDropdownList::SetFont
       
  1223 // set text font
       
  1224 // (other items were commented in a header).
       
  1225 // -----------------------------------------------------------------------------
       
  1226 //      
       
  1227 EXPORT_C void CFepCtrlDropdownList::SetFont(const CFont* aFont, TBool aReDraw)
       
  1228     {
       
  1229     iFont = aFont;
       
  1230     
       
  1231     if ( aReDraw )
       
  1232         {
       
  1233 		switch ( iListType )
       
  1234 			{
       
  1235 			case EListNoExpandable:
       
  1236 		        ChangeActiveList( iListManager->ListOneRowWithoutIcon() );
       
  1237 				break;
       
  1238 			case EListExpandable:
       
  1239 			case EListExpandableWithoutIcon:
       
  1240 			    ChangeActiveList(iListManager->ListOneRowWithIcon());
       
  1241 			    break;
       
  1242 			// txin
       
  1243 			case EListExpandableRollWithIcon:
       
  1244 		        ChangeActiveList(iListManager->ListOneRowRollWithIcon());
       
  1245 		        break;
       
  1246 			case EListExpandableRollWithIconWithBubble:
       
  1247 			    ChangeActiveList(iListManager->ListOneRowRollWithIconWithBubble());
       
  1248 			    break;
       
  1249 			case EListExpandableMultiRowWithoutIcon:
       
  1250 			    {
       
  1251                 ChangeActiveList( iListManager->ListExpandableMultiRowWithoutIcon() );
       
  1252 			    }
       
  1253                 break;
       
  1254 			case EListExpandableMultiRowWithoutIconWithBubble:
       
  1255 			  	{
       
  1256 			  	ChangeActiveList(iListManager->ListMultiRowWithoutIconWithBubble());
       
  1257 			  	}
       
  1258 			  	break;
       
  1259         	            			    
       
  1260 		    default:
       
  1261 		    	__ASSERT_DEBUG( EFalse, 
       
  1262 		    			User::Panic( _L("TListType Error::SetFont()"), 0 ) );
       
  1263 		    	break;
       
  1264 			}
       
  1265         }     
       
  1266     } 
       
  1267 
       
  1268 // -----------------------------------------------------------------------------
       
  1269 // CFepCtrlDropdownList::SetListEventHandler
       
  1270 // set list event handler
       
  1271 // (other items were commented in a header).
       
  1272 // -----------------------------------------------------------------------------
       
  1273 //      
       
  1274 EXPORT_C void CFepCtrlDropdownList::SetListEventHandler(MListEventHandler* aHandler)
       
  1275     {
       
  1276     iListEventHandler = aHandler;
       
  1277     }
       
  1278                             
       
  1279 // -----------------------------------------------------------------------------
       
  1280 // CFepCtrlDropdownList::CandidateCount
       
  1281 // get candidate count
       
  1282 // (other items were commented in a header).
       
  1283 // -----------------------------------------------------------------------------
       
  1284 //      
       
  1285 EXPORT_C TInt CFepCtrlDropdownList::CandidateCount() const
       
  1286     {
       
  1287     return iCandidatelist.Count(); 
       
  1288     }                              
       
  1289 
       
  1290 // -----------------------------------------------------------------------------
       
  1291 // CFepCtrlDropdownList::GetCellColorList
       
  1292 // get multi color list
       
  1293 // (other items were commented in a header).
       
  1294 // -----------------------------------------------------------------------------
       
  1295 //      
       
  1296 const RArray<TInt>& CFepCtrlDropdownList::GetSecondaryList() const
       
  1297     {
       
  1298     return iSecondaryList; 
       
  1299     }
       
  1300                                               
       
  1301 // -----------------------------------------------------------------------------
       
  1302 // CFepCtrlDropdownList::EnableMultiColor
       
  1303 // enable multi color or not 
       
  1304 // (other items were commented in a header).
       
  1305 // -----------------------------------------------------------------------------
       
  1306 //      
       
  1307 EXPORT_C void CFepCtrlDropdownList::EnableSecondary(TBool aEnable, TBool aReDraw)
       
  1308     {
       
  1309     iEnableSecondary = aEnable;
       
  1310     
       
  1311     if ( aReDraw )
       
  1312         {
       
  1313         Draw();
       
  1314         }    
       
  1315     }
       
  1316                                              
       
  1317 // -----------------------------------------------------------------------------
       
  1318 // CFepCtrlDropdownList::IsEnableSecondary
       
  1319 // get multi color is enable or disable
       
  1320 // (other items were commented in a header).
       
  1321 // -----------------------------------------------------------------------------
       
  1322 //      
       
  1323 EXPORT_C TBool CFepCtrlDropdownList::IsEnableSecondary() const
       
  1324     {
       
  1325     return iEnableSecondary;
       
  1326     }
       
  1327 
       
  1328 // -----------------------------------------------------------------------------
       
  1329 // CFepCtrlDropdownList::DrawMask
       
  1330 // draw mask
       
  1331 // (other items were commented in a header).
       
  1332 // -----------------------------------------------------------------------------
       
  1333 //        
       
  1334 void CFepCtrlDropdownList::DrawMask(TRect aRect)
       
  1335     {
       
  1336     Gc()->Activate( MaskBitmapDevice() );
       
  1337     Gc()->SetBrushStyle( CGraphicsContext::ESolidBrush );
       
  1338     Gc()->SetBrushColor( TRgb(KOpaqueColor) );
       
  1339     Gc()->SetPenSize(PenSize());
       
  1340     Gc()->SetPenColor( TRgb(KOpaqueColor) );
       
  1341     Gc()->DrawRect(aRect);    
       
  1342     }
       
  1343 
       
  1344 // -----------------------------------------------------------------------------
       
  1345 // CFepCtrlDropdownList::ActivateBitmapContext
       
  1346 // active bitmap context
       
  1347 // (other items were commented in a header).
       
  1348 // -----------------------------------------------------------------------------
       
  1349 //      
       
  1350 void CFepCtrlDropdownList::ActivateBitmapContext()
       
  1351     {
       
  1352     Gc()->Activate(BitmapDevice());
       
  1353     } 
       
  1354         
       
  1355 // -----------------------------------------------------------------------------
       
  1356 // CFepCtrlDropdownList::Gc
       
  1357 // return the graphics context
       
  1358 // (other items were commented in a header).
       
  1359 // -----------------------------------------------------------------------------
       
  1360 //      
       
  1361 CFbsBitGc* CFepCtrlDropdownList::Gc()
       
  1362     {
       
  1363     return static_cast<CFbsBitGc*>(BitGc());
       
  1364     }
       
  1365     
       
  1366 // -----------------------------------------------------------------------------
       
  1367 // CFepCtrlDropdownList::GetFirstCandidateIndex
       
  1368 // get FirstCandidateIndex
       
  1369 // (other items were commented in a header).
       
  1370 // -----------------------------------------------------------------------------
       
  1371 //  
       
  1372 TInt CFepCtrlDropdownList::GetFirstCandidateIndex()
       
  1373     {
       
  1374     return iFirstCandidateIndex;
       
  1375     }
       
  1376     
       
  1377 // -----------------------------------------------------------------------------
       
  1378 // CFepCtrlDropdownList::GetLastCandidateIndex
       
  1379 // get LastCandidateIndex
       
  1380 // (other items were commented in a header).
       
  1381 // -----------------------------------------------------------------------------
       
  1382 //  
       
  1383 TInt CFepCtrlDropdownList::GetLastCandidateIndex()
       
  1384     {
       
  1385     return iLastCandidateIndex;
       
  1386     }
       
  1387     
       
  1388 // -----------------------------------------------------------------------------
       
  1389 // CFepCtrlDropdownList::SetFirstCandidateIndex
       
  1390 // set FirstCandidateIndex
       
  1391 // (other items were commented in a header).
       
  1392 // -----------------------------------------------------------------------------
       
  1393 //  
       
  1394 void CFepCtrlDropdownList::SetFirstCandidateIndex(TInt aFirstIndex)
       
  1395     {
       
  1396     iFirstCandidateIndex = aFirstIndex;
       
  1397     }
       
  1398     
       
  1399 // -----------------------------------------------------------------------------
       
  1400 // CFepCtrlDropdownList::SetLastCandidateIndex
       
  1401 // Set LastCandidateIndex
       
  1402 // (other items were commented in a header).
       
  1403 // -----------------------------------------------------------------------------
       
  1404 //  
       
  1405 void CFepCtrlDropdownList::SetLastCandidateIndex(TInt aLastIndex)
       
  1406     {
       
  1407     iLastCandidateIndex = aLastIndex;
       
  1408     }
       
  1409     
       
  1410 // -----------------------------------------------------------------------------
       
  1411 // CFepCtrlDropdownList::GetCandidate
       
  1412 // get candidate
       
  1413 // (other items were commented in a header).
       
  1414 // -----------------------------------------------------------------------------
       
  1415 //      
       
  1416 CCandidate* CFepCtrlDropdownList::GetCandidate(TInt aIndex)
       
  1417     {
       
  1418     if ( ( aIndex >= 0 ) && ( aIndex < iCandidatelist.Count() ) )
       
  1419         {
       
  1420         return iCandidatelist[aIndex];
       
  1421         }
       
  1422         
       
  1423     return NULL;
       
  1424     }
       
  1425     
       
  1426 // -----------------------------------------------------------------------------
       
  1427 // CFepCtrlDropdownList::GetTopLeftPoint
       
  1428 // get Top Left Point
       
  1429 // (other items were commented in a header).
       
  1430 // -----------------------------------------------------------------------------
       
  1431 //  
       
  1432 TPoint CFepCtrlDropdownList::GetTopLeftPoint()
       
  1433     {
       
  1434     return iTopLeftPoint;
       
  1435     }
       
  1436     
       
  1437 // -----------------------------------------------------------------------------
       
  1438 // CFepCtrlDropdownList::GetCellWidth
       
  1439 // get width
       
  1440 // (other items were commented in a header).
       
  1441 // -----------------------------------------------------------------------------
       
  1442 //  
       
  1443 TInt CFepCtrlDropdownList::GetCellWidth()
       
  1444     {
       
  1445     return iCellWidth;
       
  1446     }
       
  1447     
       
  1448 // -----------------------------------------------------------------------------
       
  1449 // CFepCtrlDropdownList::GetCellHeight
       
  1450 // get cell height
       
  1451 // (other items were commented in a header).
       
  1452 // -----------------------------------------------------------------------------
       
  1453 //  
       
  1454 TInt CFepCtrlDropdownList::GetCellHeight()
       
  1455     {
       
  1456     return iCellHeight;
       
  1457     }
       
  1458     
       
  1459 // -----------------------------------------------------------------------------
       
  1460 // CFepCtrlDropdownList::GetNaviWidth
       
  1461 // get navigation width
       
  1462 // (other items were commented in a header).
       
  1463 // -----------------------------------------------------------------------------
       
  1464 //  
       
  1465 TInt CFepCtrlDropdownList::GetNaviWidth()
       
  1466     {
       
  1467     return iNaviWidth;
       
  1468     }
       
  1469     
       
  1470 // -----------------------------------------------------------------------------
       
  1471 // CFepCtrlDropdownList::GetColNum
       
  1472 // get columns number
       
  1473 // (other items were commented in a header).
       
  1474 // -----------------------------------------------------------------------------
       
  1475 //  
       
  1476 TInt CFepCtrlDropdownList::GetColNum()
       
  1477     {
       
  1478     return iColNum;
       
  1479     }
       
  1480     
       
  1481 // -----------------------------------------------------------------------------
       
  1482 // CFepCtrlDropdownList::GetRowNum
       
  1483 // get rows number
       
  1484 // (other items were commented in a header).
       
  1485 // -----------------------------------------------------------------------------
       
  1486 //  
       
  1487 TInt CFepCtrlDropdownList::GetRowNum()
       
  1488     {
       
  1489     return iRowNum;
       
  1490     }
       
  1491     
       
  1492 // -----------------------------------------------------------------------------
       
  1493 // CFepCtrlDropdownList::GetFont
       
  1494 // get text font
       
  1495 // (other items were commented in a header).
       
  1496 // -----------------------------------------------------------------------------
       
  1497 //  
       
  1498 const CFont* CFepCtrlDropdownList::GetFont()
       
  1499     {
       
  1500     return iFont;
       
  1501     }
       
  1502     
       
  1503 // -----------------------------------------------------------------------------
       
  1504 // CFepCtrlDropdownList::GetAlignment
       
  1505 // get alignment
       
  1506 // (other items were commented in a header).
       
  1507 // -----------------------------------------------------------------------------
       
  1508 //  
       
  1509 CGraphicsContext::TTextAlign CFepCtrlDropdownList::GetAlignment()
       
  1510     {
       
  1511     return iAlignment;
       
  1512     }
       
  1513 
       
  1514 // -----------------------------------------------------------------------------
       
  1515 // CFepCtrlDropdownList::GetAlignment
       
  1516 // get alignment
       
  1517 // (other items were commented in a header).
       
  1518 // -----------------------------------------------------------------------------
       
  1519 //  
       
  1520 TInt CFepCtrlDropdownList::GetTextMargin()
       
  1521     {
       
  1522     return iTextMargin;
       
  1523     }
       
  1524 
       
  1525 // -----------------------------------------------------------------------------
       
  1526 // CFepCtrlDropdownList::GetBgColor
       
  1527 // get background color
       
  1528 // (other items were commented in a header).
       
  1529 // -----------------------------------------------------------------------------
       
  1530 //  
       
  1531 TRgb CFepCtrlDropdownList::GetBgColor()
       
  1532     {
       
  1533     return iBgColor;
       
  1534     }
       
  1535     
       
  1536 // -----------------------------------------------------------------------------
       
  1537 // CFepCtrlDropdownList::GetButtonDownBgColor
       
  1538 // get button down color
       
  1539 // (other items were commented in a header).
       
  1540 // -----------------------------------------------------------------------------
       
  1541 //  
       
  1542 TRgb CFepCtrlDropdownList::GetButtonDownBgColor()
       
  1543     {
       
  1544     return iButtonDownBgColor;
       
  1545     }
       
  1546     
       
  1547 // -----------------------------------------------------------------------------
       
  1548 // CFepCtrlDropdownList::GetBorderColor
       
  1549 // get border color
       
  1550 // (other items were commented in a header).
       
  1551 // -----------------------------------------------------------------------------
       
  1552 //      
       
  1553 TRgb CFepCtrlDropdownList::GetBorderColor()
       
  1554     {
       
  1555     return iBorderColor;
       
  1556     }
       
  1557     
       
  1558 // -----------------------------------------------------------------------------
       
  1559 // CFepCtrlDropdownList::GetTextColor
       
  1560 // get text color
       
  1561 // (other items were commented in a header).
       
  1562 // -----------------------------------------------------------------------------
       
  1563 //  
       
  1564 TRgb CFepCtrlDropdownList::GetTextColor()
       
  1565     {
       
  1566     return iTextColor;
       
  1567     }
       
  1568     
       
  1569 // -----------------------------------------------------------------------------
       
  1570 // CFepCtrlDropdownList::GetHighLightBgColor
       
  1571 // get highlight background color
       
  1572 // (other items were commented in a header).
       
  1573 // -----------------------------------------------------------------------------
       
  1574 //
       
  1575 TRgb CFepCtrlDropdownList::GetHighLightBgColor()
       
  1576     {
       
  1577     return iHighLightBgColor;
       
  1578     }
       
  1579     
       
  1580 // -----------------------------------------------------------------------------
       
  1581 // CFepCtrlDropdownList::GetHighLightTextColor
       
  1582 // get highlignt text color
       
  1583 // (other items were commented in a header).
       
  1584 // -----------------------------------------------------------------------------
       
  1585 //  
       
  1586 TRgb CFepCtrlDropdownList::GetHighLightTextColor()
       
  1587     {
       
  1588     return iHighLightTextColor;
       
  1589     }
       
  1590     
       
  1591 // -----------------------------------------------------------------------------
       
  1592 // CFepCtrlDropdownList::GetSpecialTextColor
       
  1593 // get special text color
       
  1594 // (other items were commented in a header).
       
  1595 // -----------------------------------------------------------------------------
       
  1596 //  
       
  1597 TRgb CFepCtrlDropdownList::GetSpecialTextColor()
       
  1598     {
       
  1599     return iSpecialTextColor;
       
  1600     }
       
  1601     
       
  1602 // -----------------------------------------------------------------------------
       
  1603 // CFepCtrlDropdownList::GetFixedText
       
  1604 // get fixed text
       
  1605 // (other items were commented in a header).
       
  1606 // -----------------------------------------------------------------------------
       
  1607 //  
       
  1608 TDesC CFepCtrlDropdownList::GetFixedText()
       
  1609     {
       
  1610     return iFixedText;
       
  1611     }
       
  1612     
       
  1613 // -----------------------------------------------------------------------------
       
  1614 // CFepCtrlDropdownList::GetHighlightList
       
  1615 // get bitmap manager
       
  1616 // (other items were commented in a header).
       
  1617 // -----------------------------------------------------------------------------
       
  1618 //  
       
  1619 const RArray<TInt>& CFepCtrlDropdownList::GetHighlightList() const
       
  1620     {
       
  1621     return iHighlightList;
       
  1622     }
       
  1623 
       
  1624 // -----------------------------------------------------------------------------
       
  1625 // CFepCtrlDropdownList::GetPages
       
  1626 // get page manager
       
  1627 // (other items were commented in a header).
       
  1628 // -----------------------------------------------------------------------------
       
  1629 //  
       
  1630 CPages* CFepCtrlDropdownList::GetPages()
       
  1631     {
       
  1632     return iPages;
       
  1633     }
       
  1634 
       
  1635 // -----------------------------------------------------------------------------
       
  1636 // CFepCtrlDropdownList::GetBitmapDb
       
  1637 // get bitmap manager
       
  1638 // (other items were commented in a header).
       
  1639 // -----------------------------------------------------------------------------
       
  1640 //      
       
  1641 CBitmapDb* CFepCtrlDropdownList::GetBitmapDb()
       
  1642     {
       
  1643     return iBitmapDb;
       
  1644     }
       
  1645 
       
  1646 // -----------------------------------------------------------------------------
       
  1647 // CFepCtrlDropdownList::ReportCandidateSelectEvent
       
  1648 // report candidate selected event
       
  1649 // (other items were commented in a header).
       
  1650 // -----------------------------------------------------------------------------
       
  1651 //      
       
  1652 void CFepCtrlDropdownList::ReportCandidateSelectEventL(const TDesC& aCandidate,
       
  1653                                                       const TInt aSelectedIndex)
       
  1654     {
       
  1655     HBufC* bufc = HBufC::NewL( aCandidate.Length() + 1 );    
       
  1656     TPtr ptr = bufc->Des();
       
  1657     ptr.Copy( aCandidate );
       
  1658     ptr.Append( (TUint16*)&aSelectedIndex, 1 );
       
  1659     ReportEvent(iEventIdForCandidateSelected, *bufc);
       
  1660     delete bufc;
       
  1661     bufc = NULL;
       
  1662     }
       
  1663         
       
  1664 // -----------------------------------------------------------------------------
       
  1665 // CFepCtrlDropdownList::Invalidate
       
  1666 // update the animation
       
  1667 // (other items were commented in a header).
       
  1668 // -----------------------------------------------------------------------------
       
  1669 //      
       
  1670 void CFepCtrlDropdownList::Invalidate(const TRect& aRect, TBool aUpdateAll)
       
  1671     {
       
  1672     RootControl()->UpdateArea(aRect,aUpdateAll);
       
  1673     }    
       
  1674 
       
  1675 // -----------------------------------------------------------------------------
       
  1676 // CFepCtrlDropdownList::ChangeActiveList
       
  1677 // change active list
       
  1678 // (other items were commented in a header).
       
  1679 // -----------------------------------------------------------------------------
       
  1680 //
       
  1681 void CFepCtrlDropdownList::ChangeActiveList(CList* aList, TInt aLastIndex)
       
  1682     {
       
  1683     TRect rect = Rect();       
       
  1684         
       
  1685     CList* beforeList = iListManager->ActiveList();
       
  1686     
       
  1687     if( RootControl()->CtrlCapPointer() == this)
       
  1688         {
       
  1689         SetCapture(EFalse);
       
  1690         }
       
  1691     
       
  1692 	switch ( iListType )
       
  1693 		{
       
  1694 		case EListNoExpandable:
       
  1695 		case EListNoExpandableWithBubble:
       
  1696 	        EnableSecondary(ETrue);
       
  1697 			break;
       
  1698 		case EListExpandable:
       
  1699 		case EListExpandableWithBubble:
       
  1700 		case EListExpandableWithoutIcon:
       
  1701 		// txin
       
  1702 		case EListExpandableRollWithIcon:
       
  1703 		case EListExpandableRollWithIconWithBubble:
       
  1704 		// end
       
  1705 	        EnableSecondary(EFalse);
       
  1706 	        break;
       
  1707 		case EListExpandableMultiRowWithoutIcon:
       
  1708 		case EListExpandableMultiRowWithoutIconWithBubble:	
       
  1709 		    break;
       
  1710 	    default:
       
  1711 	    	__ASSERT_DEBUG( EFalse, 
       
  1712 	    			User::Panic( _L("TListType Error::ChangeActiveList()"), 0 ) );
       
  1713 	    	break;
       
  1714 		}
       
  1715     
       
  1716     iListManager->SetActiveList(aList);
       
  1717     SetRect(iListManager->ActiveList()->Rect());      
       
  1718     
       
  1719     if ( aLastIndex )
       
  1720         {
       
  1721         SetLastCandidateIndex(aLastIndex); 
       
  1722         }
       
  1723     else
       
  1724         {
       
  1725         GetPages()->Reset();
       
  1726         SetFirstCandidateIndex(0);
       
  1727         SetLastCandidateIndex(0);
       
  1728         }
       
  1729         
       
  1730     if(!Hiden() && Ready())
       
  1731         {
       
  1732         TRAP_IGNORE(iListManager->ActiveList()->UpdateListL());
       
  1733         }
       
  1734     
       
  1735 	// If the list is shrink, then redraw
       
  1736     // txin
       
  1737 	if ( ( ( beforeList == iListManager->ListMultiRowWithIcon() )
       
  1738 		&& ( aList != iListManager->ListMultiRowWithIcon() ) ) 
       
  1739 		|| ( ( ( beforeList == iListManager->ListMultiRowWithoutIcon() )
       
  1740 	     && ( aList != iListManager->ListMultiRowWithoutIcon() ) ) ) 
       
  1741 	    || ( ( ( beforeList == iListManager->ListMultiRowRollWithIcon())
       
  1742 	     && ( aList != iListManager->ListMultiRowRollWithIcon() ) ) ) 
       
  1743 	     || ( ( ( beforeList == iListManager->ListExpandableMultiRowWithoutIcon() )
       
  1744 	     && ( aList != iListManager->ListExpandableMultiRowWithoutIcon() ) ) )
       
  1745 	     || ( ( ( beforeList == iListManager->ListMultiRowWithIconWithBubble() ))
       
  1746 	     && (aList != iListManager->ListMultiRowWithIconWithBubble() ) )
       
  1747 	     || ( ( ( beforeList == iListManager->ListMultiRowRollWithIconWithBubble() ))
       
  1748 	     && (aList != iListManager->ListMultiRowRollWithIconWithBubble() ) ) 
       
  1749 	     || ( ( ( beforeList == iListManager->ListMultiRowWithoutIconWithBubble() ))
       
  1750 	     && (aList != iListManager->ListMultiRowWithoutIconWithBubble() ) ))
       
  1751 		{
       
  1752 	    rect.Shrink(TSize(0,-1));
       
  1753 	    RootControl()->ReDrawRect(rect);
       
  1754 	    Invalidate(rect,ETrue);			
       
  1755 		}
       
  1756     // end
       
  1757     }
       
  1758 
       
  1759 // -----------------------------------------------------------------------------
       
  1760 // CFepCtrlDropdownList::GetPenSize
       
  1761 // get pen size
       
  1762 // (other items were commented in a header).
       
  1763 // -----------------------------------------------------------------------------
       
  1764 //
       
  1765 const TSize CFepCtrlDropdownList::GetPenSize()
       
  1766     {
       
  1767     return PenSize();
       
  1768     }
       
  1769 
       
  1770 void CFepCtrlDropdownList::SetCapture(TBool aFlag)
       
  1771     {
       
  1772     CapturePointer(aFlag);
       
  1773     }
       
  1774     
       
  1775 // ---------------------------------------------------------------------------
       
  1776 // CFepCtrlDropdownList::SetActive
       
  1777 // Set active for the button
       
  1778 // (other items were commented in a header).
       
  1779 // ---------------------------------------------------------------------------
       
  1780 //
       
  1781 EXPORT_C void CFepCtrlDropdownList::SetActive(TBool aActiveFlag)
       
  1782     {
       
  1783     if(IsActive() != aActiveFlag)
       
  1784         {
       
  1785         CFepUiBaseCtrl::SetActive(aActiveFlag);    
       
  1786         /*Draw();
       
  1787         UpdateArea(Rect(),EFalse);*/
       
  1788         }
       
  1789     }
       
  1790     
       
  1791 // ---------------------------------------------------------------------------
       
  1792 // CFepCtrlDropdownList::ConstructFromResourceL
       
  1793 // (other items were commented in a header).
       
  1794 // ---------------------------------------------------------------------------
       
  1795 //
       
  1796 EXPORT_C void CFepCtrlDropdownList::ConstructFromResourceL()
       
  1797 	{
       
  1798     if (iResourceId == KInvalidResId)
       
  1799     	{
       
  1800     	User::Leave(KErrArgument);
       
  1801     	}
       
  1802     
       
  1803     // first time construct will not go this way
       
  1804     // only useful for skin change
       
  1805     if (!iFirstTimeConstruct)
       
  1806     	{
       
  1807         TResourceReader reader;
       
  1808         CCoeEnv::Static()->CreateResourceReaderLC(reader, iResourceId);
       
  1809 	    iBitmapDb->ConstructFromResourceL(reader, 
       
  1810 	                                      TSize(iCellWidth, iCellHeight),
       
  1811 	                                      TSize(iNaviWidth, iCellHeight),
       
  1812 	                                      TSize(iNaviWidth, iSpinBtnHeight));
       
  1813 	    CleanupStack::PopAndDestroy(); // reader
       
  1814         SetTextColor(iBitmapDb->TextColor());
       
  1815         SetBorderColor(iBitmapDb->FrameColor());
       
  1816         iListManager->ActiveList()->UpdateListL(AbleToDraw(),EFalse);
       
  1817 	    Draw();
       
  1818     	}
       
  1819     
       
  1820     iFirstTimeConstruct = EFalse;	
       
  1821 	}
       
  1822 	
       
  1823 // ---------------------------------------------------------------------------
       
  1824 // CFepCtrlDropdownList::NotifyGetNextPage
       
  1825 // (other items were commented in a header).
       
  1826 // ---------------------------------------------------------------------------
       
  1827 //
       
  1828 void CFepCtrlDropdownList::NotifyGetNextPage()
       
  1829     {
       
  1830     ReportEvent(iEventIdForNextPageCandidate);
       
  1831     }
       
  1832     
       
  1833 // ---------------------------------------------------------------------------
       
  1834 // CFepCtrlDropdownList::NotifyGetPreviousPage
       
  1835 // (other items were commented in a header).
       
  1836 // ---------------------------------------------------------------------------
       
  1837 //
       
  1838 void CFepCtrlDropdownList::NotifyGetPreviousPage()
       
  1839     {
       
  1840     ReportEvent(iEventIdForPreviousPageCandidate);
       
  1841     } 
       
  1842     
       
  1843 // ---------------------------------------------------------------------------
       
  1844 // CFepCtrlDropdownList::SetFlagCandidateExist
       
  1845 // (other items were commented in a header).
       
  1846 // ---------------------------------------------------------------------------
       
  1847 //
       
  1848 EXPORT_C void CFepCtrlDropdownList::SetFlagCandidateExist(TBool aFlag)
       
  1849     {
       
  1850     iCandidateExisted = aFlag;
       
  1851     }
       
  1852     
       
  1853 // ---------------------------------------------------------------------------
       
  1854 // CFepCtrlDropdownList::NextCandidateExist
       
  1855 // (other items were commented in a header).
       
  1856 // ---------------------------------------------------------------------------
       
  1857 //
       
  1858 TBool CFepCtrlDropdownList::NextCandidateExist()
       
  1859     {
       
  1860     ReportEvent(iEventIdForCandidateExisted);
       
  1861     
       
  1862     return iCandidateExisted;
       
  1863     }
       
  1864     
       
  1865 // -----------------------------------------------------------------------------
       
  1866 // CFepCtrlDropdownList::AutoChangeActiveList
       
  1867 // change active list
       
  1868 // (other items were commented in a header).
       
  1869 // -----------------------------------------------------------------------------
       
  1870 //
       
  1871 void CFepCtrlDropdownList::AutoChangeActiveList( TInt aLastIndex )
       
  1872 	{
       
  1873 	switch ( iListType )
       
  1874 		{
       
  1875 		case EListExpandable:
       
  1876 			if ( iListManager->ActiveList() 
       
  1877 					== iListManager->ListOneRowWithIcon() )
       
  1878 				{
       
  1879 				ChangeActiveList( iListManager->ListMultiRowWithIcon(), aLastIndex );
       
  1880 				BringToTop();
       
  1881 				}
       
  1882 			else
       
  1883 				{
       
  1884 				BringToBack();
       
  1885 				ChangeActiveList( iListManager->ListOneRowWithIcon(), aLastIndex );
       
  1886 				NotifyClosePage();
       
  1887 				}
       
  1888 			break;
       
  1889 		case EListExpandableWithoutIcon:
       
  1890 			if ( iListManager->ActiveList() 
       
  1891 					== iListManager->ListOneRowWithIcon() )
       
  1892 				{
       
  1893 				ChangeActiveList( iListManager->ListMultiRowWithoutIcon(), aLastIndex );
       
  1894 				BringToTop();
       
  1895 				}
       
  1896 			else
       
  1897 				{
       
  1898 				BringToBack();
       
  1899 				ChangeActiveList( iListManager->ListOneRowWithIcon(), aLastIndex );
       
  1900 				}
       
  1901 			break;
       
  1902         // txin
       
  1903 		case EListExpandableRollWithIcon:
       
  1904 		    {
       
  1905 			if (iListManager->ActiveList() == iListManager->ListOneRowRollWithIcon())
       
  1906 				{
       
  1907 				ChangeActiveList(iListManager->ListMultiRowRollWithIcon(), aLastIndex);
       
  1908 				BringToTop();
       
  1909 				}
       
  1910 			else
       
  1911 				{
       
  1912 				BringToBack();
       
  1913 				ChangeActiveList(iListManager->ListOneRowRollWithIcon(), aLastIndex);
       
  1914 				NotifyClosePage();
       
  1915 				}
       
  1916 		    }
       
  1917 		    break;
       
  1918 		case EListExpandableRollWithIconWithBubble:
       
  1919 		    {
       
  1920 			if (iListManager->ActiveList() == iListManager->ListOneRowRollWithIconWithBubble())
       
  1921 				{
       
  1922 				ChangeActiveList(iListManager->ListMultiRowRollWithIconWithBubble(), aLastIndex);
       
  1923 				BringToTop();
       
  1924 				}
       
  1925 			else
       
  1926 				{
       
  1927 				BringToBack();
       
  1928 				ChangeActiveList(iListManager->ListOneRowRollWithIconWithBubble(), aLastIndex);
       
  1929 				NotifyClosePage();
       
  1930 				}
       
  1931 		    }
       
  1932 		    break;
       
  1933 		    
       
  1934 		case EListExpandableWithBubble:
       
  1935 		    {
       
  1936 			if ( iListManager->ActiveList() 
       
  1937 					== iListManager->ListOneRowWithIconWithBubble() )
       
  1938 				{
       
  1939 				ChangeActiveList( iListManager->ListMultiRowWithIconWithBubble(), aLastIndex );
       
  1940 				BringToTop();
       
  1941 				}
       
  1942 			else
       
  1943 				{
       
  1944 				BringToBack();
       
  1945 				ChangeActiveList( iListManager->ListOneRowWithIconWithBubble(), aLastIndex );
       
  1946 				NotifyClosePage();
       
  1947 				}
       
  1948 		    }
       
  1949 		    break;
       
  1950 		case EListExpandableMultiRowWithoutIcon:
       
  1951 		case EListExpandableMultiRowWithoutIconWithBubble:	
       
  1952 			break;              
       
  1953 		case EListNoExpandable:
       
  1954 		case EListNoExpandableWithBubble:
       
  1955 			break;
       
  1956 	    default:
       
  1957 	    	__ASSERT_DEBUG( EFalse, 
       
  1958 	    			User::Panic( _L("TListType Error::AutoChangeActiveList()"), 0 ) );
       
  1959 	    	break;
       
  1960 		}
       
  1961 
       
  1962 	}
       
  1963 
       
  1964 // added by txin in 2007.06.07
       
  1965 EXPORT_C void CFepCtrlDropdownList::SetSpinBtnHeight(const TInt aHeight)
       
  1966     {
       
  1967     // make sure navi next, navi previous plus close, do not beyond row count 
       
  1968     TInt minExpandHeight = 2 * aHeight + GetCellHeight() + 4 * GetCellVerticalMargin();
       
  1969     TInt realExpandHeight = GetCellHeight() * GetRowNum() + 
       
  1970                             (GetRowNum() + 1) * GetCellVerticalMargin();
       
  1971 
       
  1972     if ((aHeight > 0) && (minExpandHeight <= realExpandHeight))
       
  1973         {
       
  1974         iSpinBtnHeight = aHeight;
       
  1975         SizeChanged(iCellWidth, iCellHeight, iNaviWidth);
       
  1976         }
       
  1977     }
       
  1978 
       
  1979 EXPORT_C void CFepCtrlDropdownList::SetCellMargin(const TInt aHorizontalMargin, 
       
  1980                                                   const TInt aVerticalMargin)
       
  1981     {
       
  1982     if (((aHorizontalMargin > 0) && (aHorizontalMargin != iCellHorizontalMargin)) || 
       
  1983         ((aVerticalMargin > 0) && (aVerticalMargin != iCellVerticalMargin)))
       
  1984         {
       
  1985         iCellHorizontalMargin = aHorizontalMargin;
       
  1986         iCellVerticalMargin = aVerticalMargin;
       
  1987 
       
  1988         SizeChanged(iCellWidth, iCellHeight, iNaviWidth); 
       
  1989         }
       
  1990     }
       
  1991     
       
  1992 TInt CFepCtrlDropdownList::GetSpinBtnHeight()
       
  1993     {
       
  1994     return iSpinBtnHeight;
       
  1995     }
       
  1996 
       
  1997 TInt CFepCtrlDropdownList::GetCellHorizontalMargin()
       
  1998     {
       
  1999     return iCellHorizontalMargin;
       
  2000     }
       
  2001 
       
  2002 TInt CFepCtrlDropdownList::GetCellVerticalMargin()
       
  2003     {
       
  2004     return iCellVerticalMargin;
       
  2005     }
       
  2006 
       
  2007 TInt CFepCtrlDropdownList::ListType()
       
  2008     {
       
  2009     return iListType;
       
  2010     }
       
  2011     
       
  2012 TInt CFepCtrlDropdownList::OneRowStartCandIdx()
       
  2013     {
       
  2014     return iOriginalCandIdx;
       
  2015     }
       
  2016     
       
  2017 void CFepCtrlDropdownList::SetOneRowStartCandIdx(TInt aOriginalCandIdx)
       
  2018     {
       
  2019     iOriginalCandIdx = aOriginalCandIdx;
       
  2020     }
       
  2021 
       
  2022 TInt CFepCtrlDropdownList::GetOriginalFirstCandIdx()
       
  2023     {
       
  2024     return iOriginalFirstCandIdx;
       
  2025     }
       
  2026 
       
  2027 void CFepCtrlDropdownList::SetOriginalFirstCandIdx(TInt aOriginalFirstCandIdx)
       
  2028     {
       
  2029     iOriginalFirstCandIdx = aOriginalFirstCandIdx;
       
  2030     }
       
  2031     
       
  2032 EXPORT_C void CFepCtrlDropdownList::SetCandTruncateType(const TCandTruncateType aTruncateType)
       
  2033     {
       
  2034     iCandTruncateType = aTruncateType;
       
  2035     }
       
  2036     
       
  2037 TInt CFepCtrlDropdownList::CandTruncateType()
       
  2038     {
       
  2039     return iCandTruncateType;
       
  2040     }
       
  2041     
       
  2042 CList* CFepCtrlDropdownList::ActiveList()
       
  2043     {
       
  2044     return iListManager->ActiveList();
       
  2045     }
       
  2046 
       
  2047 void CFepCtrlDropdownList::SetUpdateListReDrawFlag(TBool aReDraw)
       
  2048     {
       
  2049     iUpdateListReDraw = aReDraw;
       
  2050     }
       
  2051 
       
  2052 TBool CFepCtrlDropdownList::GetUpdateListRedrawFlag()
       
  2053     {
       
  2054     return iUpdateListReDraw;
       
  2055     }
       
  2056 
       
  2057 EXPORT_C void CFepCtrlDropdownList::SetFuzzyBoundry(TInt aFuzzyBoundry)
       
  2058     {
       
  2059     if (aFuzzyBoundry != iFuzzyBoundry && aFuzzyBoundry >= 0)
       
  2060         {
       
  2061         iFuzzyBoundry = aFuzzyBoundry;
       
  2062         }
       
  2063     }
       
  2064 
       
  2065 TInt CFepCtrlDropdownList::FuzzyBoundry()
       
  2066     {
       
  2067     return iFuzzyBoundry;
       
  2068     }
       
  2069 
       
  2070 EXPORT_C void CFepCtrlDropdownList::SetCandExpandType(const TExpandType aType)
       
  2071     {
       
  2072     if (aType != iCandExpandType)
       
  2073         {
       
  2074         iCandExpandType = aType;
       
  2075         }
       
  2076     }
       
  2077 
       
  2078 TInt CFepCtrlDropdownList::CandExpandType()
       
  2079     {
       
  2080     return iCandExpandType;
       
  2081     }
       
  2082 
       
  2083 void CFepCtrlDropdownList::NotifyClosePage()
       
  2084 	{
       
  2085 	UiLayout()->RootControl()->Draw();
       
  2086 	}
       
  2087 	
       
  2088 EXPORT_C void CFepCtrlDropdownList::SetDropdownListImgID(
       
  2089               TDropdownListDrawInfo aDropdownListDrawInfo)
       
  2090 	{
       
  2091 	iListManager->ListOneRowWithIcon()->SetDropdownListImgID(aDropdownListDrawInfo);
       
  2092 	
       
  2093 	iListManager->ListOneRowWithIconWithBubble()->SetDropdownListImgID(aDropdownListDrawInfo);
       
  2094 													 
       
  2095 	iListManager->ListMultiRowWithIcon()->SetDropdownListImgID(aDropdownListDrawInfo);		
       
  2096 	
       
  2097 	iListManager->ListMultiRowWithIconWithBubble()->SetDropdownListImgID(aDropdownListDrawInfo);	
       
  2098 													 
       
  2099 	iListManager->ListOneRowWithoutIcon()->SetDropdownListImgID(aDropdownListDrawInfo);		
       
  2100 	
       
  2101     iListManager->ListOneRowWithoutIconWithBubble()->SetDropdownListImgID(aDropdownListDrawInfo);			
       
  2102 													 
       
  2103 	iListManager->ListOneRowRollWithIcon()->SetDropdownListImgID(aDropdownListDrawInfo);
       
  2104 			
       
  2105 	iListManager->ListOneRowRollWithIconWithBubble()->SetDropdownListImgID(aDropdownListDrawInfo);		
       
  2106 													 
       
  2107 	iListManager->ListMultiRowRollWithIcon()->SetDropdownListImgID(aDropdownListDrawInfo);
       
  2108 	
       
  2109 	iListManager->ListMultiRowRollWithIconWithBubble()->SetDropdownListImgID(aDropdownListDrawInfo);
       
  2110 	
       
  2111 	iListManager->ListExpandableMultiRowWithoutIcon()->SetDropdownListImgID(aDropdownListDrawInfo);
       
  2112 	iListManager->ListMultiRowWithoutIconWithBubble()->SetDropdownListImgID(aDropdownListDrawInfo);
       
  2113 	}
       
  2114 
       
  2115 CFepUiLayout* CFepCtrlDropdownList::UiLayout()
       
  2116     {
       
  2117     return CFepUiBaseCtrl::UiLayout();
       
  2118     }
       
  2119 
       
  2120 TInt CFepCtrlDropdownList::CandHDirection()
       
  2121     {
       
  2122     return iCandHDirection;
       
  2123     }
       
  2124 
       
  2125 TBool CFepCtrlDropdownList::PageCtrlShown()
       
  2126     {
       
  2127     return iPageCtrlShown;
       
  2128     }
       
  2129     
       
  2130 // -----------------------------------------------------------------------------
       
  2131 // CFepCtrlDropdownList::ShowBubble
       
  2132 // Set show preview bubble on/off
       
  2133 // (other items were commented in a header).
       
  2134 // -----------------------------------------------------------------------------
       
  2135 //
       
  2136 EXPORT_C void CFepCtrlDropdownList::ShowBubble(TBool aFlag)
       
  2137     {  
       
  2138     TBool flag = iBubbleCtrl ? ETrue : EFalse;
       
  2139     iIsShowBubble = aFlag;
       
  2140     if ( flag != aFlag )
       
  2141         {
       
  2142         if(!flag)
       
  2143             {
       
  2144             TRAP_IGNORE(iBubbleCtrl = CBubbleCtrl::NewL(TRect(0,0,0,0),UiLayout(),-0xFFFF));
       
  2145             }
       
  2146         }
       
  2147     }    
       
  2148 
       
  2149 // -----------------------------------------------------------------------------
       
  2150 // CFepCtrlDropdownList::SetBubbleBitmapParam
       
  2151 // Set preview bubble bitmap
       
  2152 // (other items were commented in a header).
       
  2153 // -----------------------------------------------------------------------------
       
  2154 //
       
  2155 EXPORT_C void CFepCtrlDropdownList::SetBubbleBitmapParam(CFbsBitmap* aBmpId,
       
  2156                                                      CFbsBitmap* aMaskBmpId ,
       
  2157                                                      TAknsItemID aBgSkinId )
       
  2158     {
       
  2159     if ( iBubbleCtrl )
       
  2160         {
       
  2161         iBubbleCtrl->SetBitmapParam(aBmpId,aMaskBmpId,aBgSkinId);
       
  2162         }
       
  2163     }
       
  2164 
       
  2165 // -----------------------------------------------------------------------------
       
  2166 // CFepCtrlDropdownList::SetBubbleTextFont
       
  2167 // Set preview bubble text font
       
  2168 // (other items were commented in a header).
       
  2169 // -----------------------------------------------------------------------------
       
  2170 //
       
  2171 EXPORT_C void CFepCtrlDropdownList::SetBubbleTextFont(const CFont* aFont)
       
  2172     {
       
  2173     if ( iBubbleCtrl )
       
  2174         {
       
  2175         iBubbleFont = aFont;    
       
  2176         }
       
  2177     }
       
  2178        
       
  2179 // -----------------------------------------------------------------------------
       
  2180 // CFepCtrlDropdownList::SetTextFormat
       
  2181 // Set preview bubble text format
       
  2182 // (other items were commented in a header).
       
  2183 // -----------------------------------------------------------------------------
       
  2184 //
       
  2185 EXPORT_C void CFepCtrlDropdownList::SetTextFormat(TAknTextLineLayout aTextFormat)
       
  2186     {
       
  2187     if ( iBubbleCtrl )
       
  2188         {
       
  2189         iBubbleCtrl->SetTextFormat(aTextFormat);   
       
  2190         }
       
  2191     }
       
  2192 
       
  2193 // -----------------------------------------------------------------------------
       
  2194 // CFepCtrlDropdownList::SetBubbleSize
       
  2195 // Set preview bubble size
       
  2196 // (other items were commented in a header).
       
  2197 // -----------------------------------------------------------------------------
       
  2198 //
       
  2199 EXPORT_C void CFepCtrlDropdownList::SetFrameDiff(TInt aLeftDiff, TInt aTopDiff,
       
  2200                                              TInt aRightDiff,TInt aBottomDiff)
       
  2201     {
       
  2202     if ( iBubbleCtrl )
       
  2203         {
       
  2204         iBubbleCtrl->SetFrameDiff(aLeftDiff,aTopDiff,aRightDiff,aBottomDiff);    
       
  2205         }        
       
  2206     }    
       
  2207 
       
  2208 // -----------------------------------------------------------------------------
       
  2209 // CFepCtrlDropdownList::SetBubbleSize
       
  2210 // Set preview bubble size
       
  2211 // (other items were commented in a header).
       
  2212 // -----------------------------------------------------------------------------
       
  2213 //
       
  2214 EXPORT_C void CFepCtrlDropdownList::SetBubbleSize(const TSize& aSize)
       
  2215     {
       
  2216     iBubbleSize = aSize;
       
  2217     }
       
  2218 
       
  2219 
       
  2220 // -----------------------------------------------------------------------------
       
  2221 // CFepCtrlDropdownList::DrawBubble
       
  2222 // Show preview bubble
       
  2223 // (other items were commented in a header).
       
  2224 // -----------------------------------------------------------------------------
       
  2225 //
       
  2226 void CFepCtrlDropdownList::DrawBubble(const TRect aRect, const TDesC& aText)
       
  2227     {
       
  2228     if ( iBubbleCtrl && iIsShowBubble && !(iBubbleCtrl->IsShowing()))
       
  2229         {
       
  2230         if(iBubbleFont)
       
  2231             {
       
  2232             iBubbleSize.iWidth = iBubbleFont->TextWidthInPixels(aText) + KPreviewBubbleOffset;
       
  2233             }
       
  2234             
       
  2235         if(iBubbleSize.iWidth < aRect.Width() + KPreviewBubbleOffset )
       
  2236             {
       
  2237             iBubbleSize.iWidth = aRect.Width() + KPreviewBubbleOffset;
       
  2238             }
       
  2239          
       
  2240         
       
  2241         TRect rect = iBubbleCtrl->Rect();
       
  2242         TRect parentWndRect = Rect();       
       
  2243         TInt x1 = aRect.iTl.iX - ( iBubbleSize.iWidth - aRect.Width() ) / 2;
       
  2244         TInt x2 = aRect.iBr.iX + ( iBubbleSize.iWidth - aRect.Width() ) / 2;
       
  2245         
       
  2246         TRect screenRect;
       
  2247         AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::EScreen, screenRect); 
       
  2248         if ( x1 < 0 )
       
  2249             {
       
  2250             rect.iTl.iX = screenRect.iTl.iX;     
       
  2251             rect.iBr.iX = screenRect.iTl.iX + iBubbleSize.iWidth; 
       
  2252             }
       
  2253         else if ( x2 > screenRect.iBr.iX )
       
  2254             {
       
  2255             rect.iTl.iX = screenRect.iBr.iX - iBubbleSize.iWidth;     
       
  2256             rect.iBr.iX = screenRect.iBr.iX;                 
       
  2257             }
       
  2258         else
       
  2259             {
       
  2260             rect.iTl.iX = x1;     
       
  2261             rect.iBr.iX = x2;                 
       
  2262             }
       
  2263         
       
  2264         rect.iTl.iY = iBubbleVerticalMargin + aRect.iTl.iY - 
       
  2265                       iBubbleSize.iHeight;
       
  2266         if ( rect.iTl.iY < 0 )
       
  2267         	{
       
  2268         	rect.iTl.iY = iBubbleVerticalMargin;
       
  2269         	}
       
  2270         
       
  2271         rect.iBr.iY = rect.iTl.iY + iBubbleSize.iHeight;
       
  2272 		    
       
  2273         if((TBidiText::TextDirectionality(aText) == TBidiText:: ERightToLeft) && (aText.Length() > 1))
       
  2274           {
       
  2275        
       
  2276               HBufC* displayStr = aText.Alloc();			 
       
  2277 			  TInt i = 0;
       
  2278 			  TInt charNum = displayStr->Length();
       
  2279 			 
       
  2280 			  while(i < charNum)
       
  2281 				  {
       
  2282 				  displayStr->Des()[i] = aText[(charNum-1)-i];
       
  2283 				  ++i;
       
  2284 				  }
       
  2285 			   TRAP_IGNORE(iBubbleCtrl->SetTextL(*displayStr)); 
       
  2286 			   
       
  2287 			   delete displayStr;
       
  2288         
       
  2289           }
       
  2290        else
       
  2291           {
       
  2292           TRAP_IGNORE(iBubbleCtrl->SetTextL(aText));
       
  2293           }
       
  2294 	          
       
  2295         iBubbleCtrl->Popup(rect);
       
  2296         }
       
  2297     }
       
  2298 
       
  2299 // -----------------------------------------------------------------------------
       
  2300 // CFepCtrlDropdownList::ClearBubble
       
  2301 // Hide preview bubble
       
  2302 // (other items were commented in a header).
       
  2303 // -----------------------------------------------------------------------------
       
  2304 //
       
  2305 void CFepCtrlDropdownList::ClearBubble()
       
  2306     {
       
  2307     if ( iBubbleCtrl && iBubbleCtrl->IsShowing())
       
  2308         {
       
  2309         iBubbleCtrl->Close();
       
  2310         }
       
  2311     }
       
  2312        
       
  2313 // -----------------------------------------------------------------------------
       
  2314 // CFepCtrlDropdownList::ReDrawBubble
       
  2315 // ReDraw preview bubble
       
  2316 // (other items were commented in a header).
       
  2317 // -----------------------------------------------------------------------------
       
  2318 //
       
  2319 void CFepCtrlDropdownList::ReDrawBubble()
       
  2320     {
       
  2321     if(iBubbleCtrl && iBubbleCtrl->IsShowing())
       
  2322         {
       
  2323         iBubbleCtrl->Draw();
       
  2324         }
       
  2325     }
       
  2326 
       
  2327 
       
  2328 // -----------------------------------------------------------------------------
       
  2329 // CFepCtrlDropdownList::ReDrawRect
       
  2330 // ReDraw Dropdown list rect
       
  2331 // (other items were commented in a header).
       
  2332 // -----------------------------------------------------------------------------
       
  2333 //
       
  2334 EXPORT_C void CFepCtrlDropdownList::ReDrawRect(const TRect& /*aRect*/)
       
  2335     {   
       
  2336 	if(!AbleToDraw())
       
  2337         return;
       
  2338     
       
  2339     if (!iFirstTimeConstruct)
       
  2340     	{
       
  2341   	    iListManager->ActiveList()->Draw();
       
  2342     	}
       
  2343     } 
       
  2344 	
       
  2345 // end adding
       
  2346 
       
  2347 // End Of File