textinput/peninputcommonctrls/src/peninputdropdownlist/peninputdropdownlist.cpp
changeset 0 eb1f2e154e89
child 5 a47de9135b21
equal deleted inserted replaced
-1:000000000000 0:eb1f2e154e89
       
     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 	    default:
       
   513 	    	__ASSERT_DEBUG( EFalse, 
       
   514 	    			User::Panic( _L("TListType Error::SizeChanged()"), 0 ) );
       
   515 	    	break;
       
   516 		}
       
   517     }
       
   518 
       
   519 // ---------------------------------------------------------------------------
       
   520 // CFepUiBaseCtrl::HandlePointerDownEventL
       
   521 // Handle pointer down event
       
   522 // (other items were commented in a header).
       
   523 // ---------------------------------------------------------------------------
       
   524 //      
       
   525 EXPORT_C CFepUiBaseCtrl* CFepCtrlDropdownList::HandlePointerDownEventL(const TPoint& aPoint)
       
   526     {
       
   527     CFepUiBaseCtrl::HandlePointerDownEventL(aPoint);
       
   528     
       
   529     iListManager->ActiveList()->HandlePointerDownL(aPoint);
       
   530     
       
   531     return this;
       
   532     }
       
   533 
       
   534 // ---------------------------------------------------------------------------
       
   535 // CFepUiBaseCtrl::HandlePointerUpEventL
       
   536 // Handle pointer up event
       
   537 // (other items were commented in a header).
       
   538 // ---------------------------------------------------------------------------
       
   539 //    
       
   540 EXPORT_C CFepUiBaseCtrl*  CFepCtrlDropdownList::HandlePointerUpEventL(const TPoint& aPoint)
       
   541     {
       
   542     CFepUiBaseCtrl::HandlePointerUpEventL(aPoint);
       
   543     
       
   544     iListManager->ActiveList()->HandlePointerUpL(aPoint);
       
   545     
       
   546     return this;
       
   547     }
       
   548 
       
   549 // ---------------------------------------------------------------------------
       
   550 // CFepUiBaseCtrl::HandlePointerMoveEventL
       
   551 // Handle pointer move event
       
   552 // (other items were commented in a header).
       
   553 // ---------------------------------------------------------------------------
       
   554 //
       
   555 EXPORT_C CFepUiBaseCtrl* CFepCtrlDropdownList::HandlePointerMoveEventL(const TPoint& aPoint)
       
   556     {
       
   557     
       
   558     if(!PointerDown())
       
   559         {
       
   560         return NULL;
       
   561         }
       
   562     
       
   563     iListManager->ActiveList()->HandlePointerDragL(aPoint);
       
   564     
       
   565     return this;
       
   566     }
       
   567 
       
   568 EXPORT_C void CFepCtrlDropdownList::HandlePointerLeave(const TPoint& aPoint)
       
   569     {
       
   570     CFepUiBaseCtrl::HandlePointerLeave(aPoint);
       
   571     if(!Hiden())
       
   572         iListManager->ActiveList()->HandlePointerLeave(aPoint);
       
   573     ClearBubble();
       
   574     }
       
   575 
       
   576 // -----------------------------------------------------------------------------
       
   577 // CFepCtrlDropdownList::AddCandidatesL
       
   578 // Add candidate
       
   579 // (other items were commented in a header).
       
   580 // -----------------------------------------------------------------------------
       
   581 //    
       
   582 EXPORT_C void CFepCtrlDropdownList::AddCandidatesL(const RPointerArray<HBufC>& aCandidates,
       
   583                                                    const TListType /*aListType*/)
       
   584     {
       
   585     // add new candidates
       
   586     for (TInt i = iCandidatelist.Count(); i < aCandidates.Count(); i++)
       
   587         {
       
   588         CCandidate* candidate = CCandidate::NewL(*aCandidates[i], this);
       
   589 
       
   590         if (iCandidatelist.Append(candidate) != KErrNone)
       
   591             {
       
   592             delete candidate;
       
   593             }
       
   594         }
       
   595     }
       
   596 
       
   597 // -----------------------------------------------------------------------------
       
   598 // CFepCtrlDropdownList::SetCandidatesL
       
   599 // Set candidate
       
   600 // (other items were commented in a header).
       
   601 // -----------------------------------------------------------------------------
       
   602 //    
       
   603 EXPORT_C void CFepCtrlDropdownList::SetCandidatesL(const RPointerArray<HBufC>& aCandidates, 
       
   604                                                    const TListType aListType,
       
   605                                                    const TDesC& aFixedText)
       
   606     {
       
   607     //clear last candidates which had been set    
       
   608     iCandidatelist.ResetAndDestroy();
       
   609     
       
   610 	iListManager->ResetStatus();        
       
   611 	
       
   612     iHighlightList.Reset();
       
   613     
       
   614     iFixedText.Zero();
       
   615     iFixedText.Append(aFixedText);
       
   616     
       
   617     iFirstCandidateIndex = 0;
       
   618     iLastCandidateIndex = 0;
       
   619     // create or add new ones
       
   620     for( TInt i=0; i < aCandidates.Count(); i++ )
       
   621         {
       
   622         // CCandidate is s.c. self-containing class
       
   623         CCandidate* candidate = CCandidate::NewL(*aCandidates[i], this);
       
   624         // referring to memory object
       
   625         iCandidatelist.Append(candidate);
       
   626         }
       
   627     
       
   628 	iListType = aListType;
       
   629 
       
   630 	switch ( aListType )
       
   631 		{
       
   632 		case EListNoExpandable:
       
   633 		    {
       
   634 		    ChangeActiveList( iListManager->ListOneRowWithoutIcon() );
       
   635 		    }
       
   636 			break;
       
   637 		case EListNoExpandableWithBubble:
       
   638 		    {
       
   639 		    ChangeActiveList( iListManager->ListOneRowWithoutIconWithBubble() );
       
   640 		    }
       
   641 			break;
       
   642 		case EListExpandable:
       
   643 		case EListExpandableWithoutIcon:
       
   644 		    {
       
   645 		    ChangeActiveList(iListManager->ListOneRowWithIcon());
       
   646 		    }
       
   647 		    break;
       
   648 		case EListExpandableWithBubble:
       
   649 		    {
       
   650 		    ChangeActiveList(iListManager->ListOneRowWithIconWithBubble());
       
   651 		    }
       
   652 		    break;
       
   653 		    
       
   654 		// txin
       
   655 		case EListExpandableRollWithIcon:
       
   656 		    {
       
   657             SetOneRowStartCandIdx(KInvalidCandIndex);
       
   658             SetOriginalFirstCandIdx(KInvalidCandIndex);
       
   659 
       
   660             ChangeActiveList(iListManager->ListOneRowRollWithIcon());
       
   661 		    }
       
   662 	        break;
       
   663 		case EListExpandableRollWithIconWithBubble:
       
   664 		    {
       
   665             SetOneRowStartCandIdx(KInvalidCandIndex);
       
   666             SetOriginalFirstCandIdx(KInvalidCandIndex);
       
   667 
       
   668             ChangeActiveList(iListManager->ListOneRowRollWithIconWithBubble());
       
   669 		    }
       
   670 	        break;
       
   671 	        
       
   672 		case EListExpandableMultiRowWithoutIcon:
       
   673 		    {
       
   674             ChangeActiveList( iListManager->ListExpandableMultiRowWithoutIcon() );
       
   675 		    }
       
   676             break;        
       
   677 	    default:
       
   678 	    	__ASSERT_DEBUG( EFalse, 
       
   679 	    			User::Panic( _L("TListType Error::SetCandidatesL()"), 0 ) );
       
   680 	    	break;
       
   681 		}
       
   682     }
       
   683 
       
   684 // -----------------------------------------------------------------------------
       
   685 // CFepCtrlDropdownList::Move
       
   686 // when the control is moved, the function will be called
       
   687 // (other items were commented in a header).
       
   688 // -----------------------------------------------------------------------------
       
   689 //
       
   690 EXPORT_C void CFepCtrlDropdownList::Move(const TPoint& aOffset)
       
   691     {
       
   692     ClearRect(Rect());
       
   693     Invalidate(Rect(),ETrue);    
       
   694     iListManager->Move(aOffset);
       
   695     SetRect(iListManager->ActiveList()->Rect());
       
   696     iListManager->ActiveList()->Draw();
       
   697     Invalidate(iListManager->ActiveList()->Rect());
       
   698     }
       
   699 
       
   700 // -----------------------------------------------------------------------------
       
   701 // CFepCtrlDropdownList::OnDeActivate
       
   702 // when the control is hide, the function will be called
       
   703 // (other items were commented in a header).
       
   704 // -----------------------------------------------------------------------------
       
   705 //
       
   706 EXPORT_C void CFepCtrlDropdownList::OnDeActivate()
       
   707     {
       
   708 	iListManager->ResetStatus();
       
   709     }
       
   710 
       
   711 // ---------------------------------------------------------------------------
       
   712 // Hide or show dropdown list.
       
   713 // ---------------------------------------------------------------------------
       
   714 //    
       
   715 EXPORT_C void CFepCtrlDropdownList::Hide( TBool aFlag )
       
   716     {
       
   717     ClearBubble();
       
   718     CFepUiBaseCtrl::Hide( aFlag );
       
   719     }
       
   720 
       
   721 // -----------------------------------------------------------------------------
       
   722 // CFepCtrlDropdownList::FoldList
       
   723 // fold the drop down list control
       
   724 // (other items were commented in a header).
       
   725 // -----------------------------------------------------------------------------
       
   726 //
       
   727 EXPORT_C void CFepCtrlDropdownList::FoldList()
       
   728     {
       
   729     if ((iListManager->ActiveList() == iListManager->ListMultiRowWithIcon()) 
       
   730     	|| (iListManager->ActiveList() == iListManager->ListMultiRowWithoutIcon()))
       
   731         {
       
   732         ChangeActiveList(iListManager->ListOneRowWithIcon(), iFirstCandidateIndex);            
       
   733         }
       
   734     // added by txin    
       
   735     else if (iListManager->ActiveList() == iListManager->ListMultiRowRollWithIcon())
       
   736         {
       
   737         TInt onerowCandIdx = OneRowStartCandIdx();
       
   738 
       
   739         if (onerowCandIdx != KInvalidCandIndex)
       
   740             {
       
   741             ChangeActiveList(iListManager->ListOneRowRollWithIcon(), onerowCandIdx);
       
   742             return;
       
   743             }
       
   744 
       
   745         ChangeActiveList(iListManager->ListOneRowRollWithIcon(), iFirstCandidateIndex);
       
   746         }
       
   747     else if (iListManager->ActiveList() == iListManager->ListMultiRowRollWithIconWithBubble())
       
   748         {
       
   749         TInt onerowCandIdx = OneRowStartCandIdx();
       
   750 
       
   751         if (onerowCandIdx != KInvalidCandIndex)
       
   752             {
       
   753             ChangeActiveList(iListManager->ListOneRowRollWithIconWithBubble(), onerowCandIdx);
       
   754             return;
       
   755             }
       
   756 
       
   757         ChangeActiveList(iListManager->ListOneRowRollWithIconWithBubble(), iFirstCandidateIndex);
       
   758         }
       
   759     else if(iListManager->ActiveList() == iListManager->ListMultiRowWithIconWithBubble())
       
   760         {
       
   761         ChangeActiveList(iListManager->ListOneRowWithIconWithBubble(), iFirstCandidateIndex);
       
   762         }
       
   763     // end    
       
   764     }
       
   765 
       
   766 // -----------------------------------------------------------------------------
       
   767 // CFepCtrlDropdownList::ResetAndClear
       
   768 // reset and clear and redraw the list
       
   769 // (other items were commented in a header).
       
   770 // -----------------------------------------------------------------------------
       
   771 //        
       
   772 EXPORT_C void CFepCtrlDropdownList::ResetAndClear(const TListType aListType)
       
   773     {
       
   774     //clear last candidates which had been set
       
   775     iCandidatelist.ResetAndDestroy();
       
   776     
       
   777     iFixedText.Zero();
       
   778    
       
   779     iFirstCandidateIndex = 0;
       
   780     iLastCandidateIndex = 0;
       
   781     
       
   782 	switch ( aListType )
       
   783 		{
       
   784 		case EListNoExpandable:
       
   785 	        ChangeActiveList( iListManager->ListOneRowWithoutIcon() );
       
   786 			break;
       
   787 		case EListNoExpandableWithBubble:
       
   788 	        ChangeActiveList( iListManager->ListOneRowWithoutIconWithBubble() );
       
   789 			break;
       
   790 			
       
   791 		case EListExpandable:
       
   792 		case EListExpandableWithoutIcon:
       
   793 			{
       
   794 		    ChangeActiveList(iListManager->ListOneRowWithIcon());
       
   795 		    NotifyClosePage();
       
   796 			}
       
   797 		    break;
       
   798 		case EListExpandableWithBubble:
       
   799 			{
       
   800 		    ChangeActiveList(iListManager->ListOneRowWithIconWithBubble());
       
   801 		    NotifyClosePage();
       
   802 			}
       
   803 		    break;
       
   804 		    
       
   805 		// txin
       
   806 		case EListExpandableRollWithIcon:
       
   807 		    {
       
   808 		    ChangeActiveList(iListManager->ListOneRowRollWithIcon());
       
   809 		    NotifyClosePage();
       
   810 		    }
       
   811 	        break;
       
   812 		// end
       
   813 		case EListExpandableRollWithIconWithBubble:
       
   814 		    {
       
   815 		    ChangeActiveList(iListManager->ListOneRowRollWithIconWithBubble());
       
   816 		    NotifyClosePage();
       
   817 		    }
       
   818 	        break;
       
   819 		case EListExpandableMultiRowWithoutIcon:
       
   820 		    {
       
   821             ChangeActiveList(iListManager->ListExpandableMultiRowWithoutIcon());
       
   822             NotifyClosePage();		    
       
   823 		    }
       
   824 		    break;
       
   825 	    default:
       
   826 	    	__ASSERT_DEBUG( EFalse, 
       
   827 	    			User::Panic( _L("TListType Error::ResetAndClear()"), 0 ) );
       
   828 	    	break;
       
   829 		}
       
   830     }
       
   831 
       
   832 
       
   833 // -----------------------------------------------------------------------------
       
   834 // CFepCtrlDropdownList::HandleEvent
       
   835 // when there is out event coming, the function will be called
       
   836 // (other items were commented in a header).
       
   837 // -----------------------------------------------------------------------------
       
   838 //
       
   839 EXPORT_C void CFepCtrlDropdownList::HandleControlEvent(TInt aEventType, 
       
   840                                                        CFepUiBaseCtrl* aCtrl, 
       
   841                                                        const TDesC& aEventData)
       
   842     {
       
   843     if ( iListEventHandler )
       
   844         {
       
   845         iListEventHandler->HandleListOuterEvent(aEventType, aCtrl, aEventData);        
       
   846         }
       
   847     }
       
   848 
       
   849 // -----------------------------------------------------------------------------
       
   850 // CFepCtrlDropdownList::Draw
       
   851 // draw the list
       
   852 // (other items were commented in a header).
       
   853 // -----------------------------------------------------------------------------
       
   854 //
       
   855 EXPORT_C void CFepCtrlDropdownList::Draw()
       
   856     {   
       
   857 	if(!AbleToDraw())
       
   858         return;
       
   859     
       
   860     if (!iFirstTimeConstruct)
       
   861     	{
       
   862         // if construct is not finished, then no need to draw
       
   863 ///DrawOpaqueMaskBackground();
       
   864         
       
   865         //ActivateBitmapContext();
       
   866         
       
   867   	    iListManager->ActiveList()->Draw();
       
   868   	    Invalidate(iListManager->ActiveList()->Rect());
       
   869     	}
       
   870     }
       
   871 
       
   872 // -----------------------------------------------------------------------------
       
   873 // CFepCtrlDropdownList::SetHighlightCell
       
   874 // set or unset the high light effect for the cell
       
   875 // (other items were commented in a header).
       
   876 // -----------------------------------------------------------------------------
       
   877 //
       
   878 EXPORT_C void CFepCtrlDropdownList::SetHighlightCell(const TInt aCellIndex, 
       
   879                                                      TBool aHighlight, 
       
   880                                                      const TBool aIsDraw)
       
   881     {
       
   882     if (aHighlight)
       
   883         {
       
   884 
       
   885         iHighlightList.Reset();
       
   886 
       
   887         iHighlightList.Append(aCellIndex);
       
   888         
       
   889         if ((iListType == EListExpandableRollWithIcon ||
       
   890             iListType == EListExpandableRollWithIconWithBubble) && 
       
   891             (aCellIndex == GetFirstCandidateIndex()))
       
   892             {
       
   893             SetOneRowStartCandIdx(GetFirstCandidateIndex());
       
   894             }
       
   895         }
       
   896     else
       
   897         {
       
   898         TInt index = iHighlightList.Find(aCellIndex);
       
   899         
       
   900         if ( index != KErrNotFound )
       
   901             {
       
   902             iHighlightList.Remove(index);            
       
   903             }
       
   904         }
       
   905         
       
   906     if( aIsDraw )
       
   907         {
       
   908         iListManager->ActiveList()->SetHighlightCell(aCellIndex, aHighlight, EFalse);
       
   909         
       
   910         Draw();
       
   911         }
       
   912     }
       
   913 
       
   914 
       
   915 // -----------------------------------------------------------------------------
       
   916 // CFepCtrlDropdownList::Rect
       
   917 // get the rect of the list
       
   918 // (other items were commented in a header).
       
   919 // -----------------------------------------------------------------------------
       
   920 //      
       
   921 EXPORT_C const TRect& CFepCtrlDropdownList::Rect()
       
   922     {
       
   923     return iListManager->ActiveList()->Rect();
       
   924     }
       
   925     
       
   926 
       
   927 // -----------------------------------------------------------------------------
       
   928 // CFepCtrlDropdownList::SetEventIdForCandidateSelected
       
   929 // set event id when candidate is selected
       
   930 // (other items were commented in a header).
       
   931 // -----------------------------------------------------------------------------
       
   932 //      
       
   933 EXPORT_C void CFepCtrlDropdownList::SetEventIdForCandidateSelected(TInt aEventId)
       
   934     {
       
   935     iEventIdForCandidateSelected = aEventId;
       
   936     }
       
   937 
       
   938 // -----------------------------------------------------------------------------
       
   939 // CFepCtrlDropdownList::SetEventIdForNextPageCandidate
       
   940 // set event id when need get next page candidate
       
   941 // (other items were commented in a header).
       
   942 // -----------------------------------------------------------------------------
       
   943 //      
       
   944 EXPORT_C void CFepCtrlDropdownList::SetEventIdForNextPageCandidate(TInt aEventId)
       
   945     {
       
   946 	  iEventIdForNextPageCandidate = aEventId;
       
   947     }
       
   948 
       
   949 // -----------------------------------------------------------------------------
       
   950 // CFepCtrlDropdownList::SetEventIdForPreviousPageCandidate
       
   951 // set event id when need get previous page candidate
       
   952 // (other items were commented in a header).
       
   953 // -----------------------------------------------------------------------------
       
   954 //      
       
   955 EXPORT_C void CFepCtrlDropdownList::SetEventIdForPreviousPageCandidate(TInt aEventId)
       
   956     {
       
   957 	  iEventIdForPreviousPageCandidate = aEventId;
       
   958     }
       
   959 
       
   960 // -----------------------------------------------------------------------------
       
   961 // CFepCtrlDropdownList::SetEventIdForCandidateExisted
       
   962 // set event id when need judge if candidate exist
       
   963 // (other items were commented in a header).
       
   964 // -----------------------------------------------------------------------------
       
   965 //      
       
   966 EXPORT_C void CFepCtrlDropdownList::SetEventIdForCandidateExisted(TInt aEventId)
       
   967     {
       
   968     iEventIdForCandidateExisted = aEventId;
       
   969     }
       
   970 
       
   971 // -----------------------------------------------------------------------------
       
   972 // CFepCtrlDropdownList::SetTopLeftPoint
       
   973 // set top left point of the list
       
   974 // (other items were commented in a header).
       
   975 // -----------------------------------------------------------------------------
       
   976 //      
       
   977 EXPORT_C void CFepCtrlDropdownList::SetTopLeftPoint(const TPoint aTopLeftPoint)
       
   978     {
       
   979     SizeChanged(iCellWidth, iCellHeight, iNaviWidth, aTopLeftPoint);
       
   980     }
       
   981 
       
   982 // -----------------------------------------------------------------------------
       
   983 // CFepCtrlDropdownList::SetCellWidth
       
   984 // set cell width
       
   985 // (other items were commented in a header).
       
   986 // -----------------------------------------------------------------------------
       
   987 //      
       
   988 EXPORT_C void CFepCtrlDropdownList::SetCellWidth(const TInt aCellWidth)
       
   989     {
       
   990     SizeChanged(aCellWidth, iCellHeight, iNaviWidth);
       
   991     }
       
   992     
       
   993 // -----------------------------------------------------------------------------
       
   994 // CFepCtrlDropdownList::SetCellHeight
       
   995 // set cell height
       
   996 // (other items were commented in a header).
       
   997 // -----------------------------------------------------------------------------
       
   998 //      
       
   999 EXPORT_C void CFepCtrlDropdownList::SetCellHeight(const TInt aCellHeight)
       
  1000     {
       
  1001     SizeChanged(iCellWidth, aCellHeight, iNaviWidth);
       
  1002     }
       
  1003     
       
  1004 // -----------------------------------------------------------------------------
       
  1005 // CFepCtrlDropdownList::SetNaviWidth
       
  1006 // set navigation width
       
  1007 // (other items were commented in a header).
       
  1008 // -----------------------------------------------------------------------------
       
  1009 //      
       
  1010 EXPORT_C void CFepCtrlDropdownList::SetNaviWidth(const TInt aNaviWidth)      
       
  1011     {
       
  1012     SizeChanged(iCellWidth, iCellHeight, aNaviWidth);    
       
  1013     }
       
  1014     
       
  1015 // -----------------------------------------------------------------------------
       
  1016 // CFepCtrlDropdownList::SetColNum
       
  1017 // set columns number
       
  1018 // (other items were commented in a header).
       
  1019 // -----------------------------------------------------------------------------
       
  1020 //      
       
  1021 EXPORT_C void CFepCtrlDropdownList::SetColNum(const TInt aColNum)
       
  1022     {
       
  1023     SizeChanged(iCellWidth, iCellHeight, iNaviWidth, iTopLeftPoint, aColNum);
       
  1024     }
       
  1025     
       
  1026 // -----------------------------------------------------------------------------
       
  1027 // CFepCtrlDropdownList::SetRowNum
       
  1028 // Set rows number
       
  1029 // (other items were commented in a header).
       
  1030 // -----------------------------------------------------------------------------
       
  1031 //      
       
  1032 EXPORT_C void CFepCtrlDropdownList::SetRowNum(const TInt aRowNum)
       
  1033     {
       
  1034     SizeChanged(iCellWidth, iCellHeight, iNaviWidth, iTopLeftPoint, iColNum, aRowNum);    
       
  1035     }
       
  1036     
       
  1037 // -----------------------------------------------------------------------------
       
  1038 // CFepCtrlDropdownList::SetBorderColor
       
  1039 // Set border color
       
  1040 // (other items were commented in a header).
       
  1041 // -----------------------------------------------------------------------------
       
  1042 //      
       
  1043 EXPORT_C void CFepCtrlDropdownList::SetBorderColor(TRgb aBorderColor, TBool aReDraw)
       
  1044     {
       
  1045     iBorderColor = aBorderColor;
       
  1046     
       
  1047     if ( aReDraw )
       
  1048         {
       
  1049         Draw();
       
  1050         }
       
  1051     }
       
  1052     
       
  1053 // -----------------------------------------------------------------------------
       
  1054 // CFepCtrlDropdownList::SetBgColor
       
  1055 // Set background color for the whole DDl (drop down list)
       
  1056 // (other items were commented in a header).
       
  1057 // -----------------------------------------------------------------------------
       
  1058 //      
       
  1059 EXPORT_C void CFepCtrlDropdownList::SetBgColor(TRgb aBgColor, TBool aReDraw)
       
  1060     {
       
  1061     iBgColor = aBgColor;
       
  1062     
       
  1063     if ( aReDraw )
       
  1064         {
       
  1065         Draw();
       
  1066         }    
       
  1067     }
       
  1068     
       
  1069 // -----------------------------------------------------------------------------
       
  1070 // CFepCtrlDropdownList::SetNavigationBgColor
       
  1071 // set background color for navigation area
       
  1072 // (other items were commented in a header).
       
  1073 // -----------------------------------------------------------------------------
       
  1074 //      
       
  1075 EXPORT_C void CFepCtrlDropdownList::SetNavigationBgColor(TRgb aNavigationBgColor, TBool aReDraw)
       
  1076     {
       
  1077     iNavigationBgColor = aNavigationBgColor;
       
  1078     
       
  1079     if ( aReDraw )
       
  1080         {
       
  1081         Draw();
       
  1082         }
       
  1083     }
       
  1084     
       
  1085 // -----------------------------------------------------------------------------
       
  1086 // CFepCtrlDropdownList::SetTextColor
       
  1087 // set text color
       
  1088 // (other items were commented in a header).
       
  1089 // -----------------------------------------------------------------------------
       
  1090 //
       
  1091 EXPORT_C void CFepCtrlDropdownList::SetTextColor(TRgb aTextColor, TBool aReDraw)
       
  1092     {
       
  1093     iTextColor = aTextColor;
       
  1094     
       
  1095     if ( aReDraw )
       
  1096         {
       
  1097         Draw();
       
  1098         }
       
  1099     }
       
  1100 
       
  1101 // -----------------------------------------------------------------------------
       
  1102 // CFepCtrlDropdownList::SetSpecialTextColor
       
  1103 // set special text color
       
  1104 // (other items were commented in a header).
       
  1105 // -----------------------------------------------------------------------------
       
  1106 //      
       
  1107 EXPORT_C void CFepCtrlDropdownList::SetSpecialTextColor(TRgb aSpecialTextColor, TBool aReDraw)
       
  1108     {
       
  1109     iSpecialTextColor = aSpecialTextColor;
       
  1110     
       
  1111     if ( aReDraw )
       
  1112         {
       
  1113         Draw();
       
  1114         }    
       
  1115     }
       
  1116 
       
  1117 // -----------------------------------------------------------------------------
       
  1118 // CFepCtrlDropdownList::SetHighLightTextColor
       
  1119 // set text color for highlight
       
  1120 // (other items were commented in a header).
       
  1121 // -----------------------------------------------------------------------------
       
  1122 //      
       
  1123 EXPORT_C void CFepCtrlDropdownList::SetHighLightTextColor(TRgb aHighLightTextColor, TBool aReDraw)
       
  1124     {
       
  1125     iHighLightTextColor = aHighLightTextColor;
       
  1126     
       
  1127     if ( aReDraw )
       
  1128         {
       
  1129         Draw();
       
  1130         }
       
  1131     }
       
  1132 
       
  1133 // -----------------------------------------------------------------------------
       
  1134 // CFepCtrlDropdownList::SetHighLightBgColor
       
  1135 // set background color for highlight
       
  1136 // (other items were commented in a header).
       
  1137 // -----------------------------------------------------------------------------
       
  1138 //      
       
  1139 EXPORT_C void CFepCtrlDropdownList::SetHighLightBgColor(TRgb aHighLightBgColor, TBool aReDraw)
       
  1140     {
       
  1141     iHighLightBgColor = aHighLightBgColor;
       
  1142     
       
  1143     if ( aReDraw )
       
  1144         {
       
  1145         Draw();
       
  1146         }
       
  1147     }
       
  1148 
       
  1149 // -----------------------------------------------------------------------------
       
  1150 // CFepCtrlDropdownList::SetTextAlighment
       
  1151 // set text alignment
       
  1152 // (other items were commented in a header).
       
  1153 // -----------------------------------------------------------------------------
       
  1154 //      
       
  1155 EXPORT_C void CFepCtrlDropdownList::SetTextAlighment(const CGraphicsContext::TTextAlign aAlignment,
       
  1156                                                      TBool aReDraw)
       
  1157     {
       
  1158     iAlignment = aAlignment;
       
  1159     
       
  1160     if ( aReDraw )
       
  1161         {
       
  1162         Draw();
       
  1163         }
       
  1164     }
       
  1165     
       
  1166 // -----------------------------------------------------------------------------
       
  1167 // CFepCtrlDropdownList::SetTextAlighment
       
  1168 // set text alignment
       
  1169 // (other items were commented in a header).
       
  1170 // -----------------------------------------------------------------------------
       
  1171 //      
       
  1172 EXPORT_C void CFepCtrlDropdownList::SetTextMargin(const TInt aTextMargin, TBool aReDraw)
       
  1173     {
       
  1174     iTextMargin = aTextMargin;
       
  1175     
       
  1176     if ( aReDraw )
       
  1177         {
       
  1178         Draw();
       
  1179         }
       
  1180     }
       
  1181 
       
  1182 // -----------------------------------------------------------------------------
       
  1183 // CFepCtrlDropdownList::SetCellColor
       
  1184 // set cell color
       
  1185 // (other items were commented in a header).
       
  1186 // -----------------------------------------------------------------------------
       
  1187 //      
       
  1188 EXPORT_C void CFepCtrlDropdownList::SetSecondaryList(RArray<TInt>& aIndexList, TBool aReDraw)
       
  1189     {
       
  1190     iSecondaryList.Reset();
       
  1191     for (TInt i=0; i < aIndexList.Count(); i++)
       
  1192         {
       
  1193         iSecondaryList.Append(aIndexList[i]);
       
  1194         }
       
  1195     
       
  1196     if ( aReDraw )
       
  1197         {
       
  1198         Draw();
       
  1199         }    
       
  1200     }
       
  1201 
       
  1202 // -----------------------------------------------------------------------------
       
  1203 // CFepCtrlDropdownList::SetFont
       
  1204 // set text font
       
  1205 // (other items were commented in a header).
       
  1206 // -----------------------------------------------------------------------------
       
  1207 //      
       
  1208 EXPORT_C void CFepCtrlDropdownList::SetFont(const CFont* aFont, TBool aReDraw)
       
  1209     {
       
  1210     iFont = aFont;
       
  1211     
       
  1212     if ( aReDraw )
       
  1213         {
       
  1214 		switch ( iListType )
       
  1215 			{
       
  1216 			case EListNoExpandable:
       
  1217 		        ChangeActiveList( iListManager->ListOneRowWithoutIcon() );
       
  1218 				break;
       
  1219 			case EListExpandable:
       
  1220 			case EListExpandableWithoutIcon:
       
  1221 			    ChangeActiveList(iListManager->ListOneRowWithIcon());
       
  1222 			    break;
       
  1223 			// txin
       
  1224 			case EListExpandableRollWithIcon:
       
  1225 		        ChangeActiveList(iListManager->ListOneRowRollWithIcon());
       
  1226 		        break;
       
  1227 			case EListExpandableRollWithIconWithBubble:
       
  1228 			    ChangeActiveList(iListManager->ListOneRowRollWithIconWithBubble());
       
  1229 			    break;
       
  1230 			case EListExpandableMultiRowWithoutIcon:
       
  1231 			    {
       
  1232                 ChangeActiveList( iListManager->ListExpandableMultiRowWithoutIcon() );
       
  1233 			    }
       
  1234                 break;			    
       
  1235 		    default:
       
  1236 		    	__ASSERT_DEBUG( EFalse, 
       
  1237 		    			User::Panic( _L("TListType Error::SetFont()"), 0 ) );
       
  1238 		    	break;
       
  1239 			}
       
  1240         }     
       
  1241     } 
       
  1242 
       
  1243 // -----------------------------------------------------------------------------
       
  1244 // CFepCtrlDropdownList::SetListEventHandler
       
  1245 // set list event handler
       
  1246 // (other items were commented in a header).
       
  1247 // -----------------------------------------------------------------------------
       
  1248 //      
       
  1249 EXPORT_C void CFepCtrlDropdownList::SetListEventHandler(MListEventHandler* aHandler)
       
  1250     {
       
  1251     iListEventHandler = aHandler;
       
  1252     }
       
  1253                             
       
  1254 // -----------------------------------------------------------------------------
       
  1255 // CFepCtrlDropdownList::CandidateCount
       
  1256 // get candidate count
       
  1257 // (other items were commented in a header).
       
  1258 // -----------------------------------------------------------------------------
       
  1259 //      
       
  1260 EXPORT_C TInt CFepCtrlDropdownList::CandidateCount() const
       
  1261     {
       
  1262     return iCandidatelist.Count(); 
       
  1263     }                              
       
  1264 
       
  1265 // -----------------------------------------------------------------------------
       
  1266 // CFepCtrlDropdownList::GetCellColorList
       
  1267 // get multi color list
       
  1268 // (other items were commented in a header).
       
  1269 // -----------------------------------------------------------------------------
       
  1270 //      
       
  1271 const RArray<TInt>& CFepCtrlDropdownList::GetSecondaryList() const
       
  1272     {
       
  1273     return iSecondaryList; 
       
  1274     }
       
  1275                                               
       
  1276 // -----------------------------------------------------------------------------
       
  1277 // CFepCtrlDropdownList::EnableMultiColor
       
  1278 // enable multi color or not 
       
  1279 // (other items were commented in a header).
       
  1280 // -----------------------------------------------------------------------------
       
  1281 //      
       
  1282 EXPORT_C void CFepCtrlDropdownList::EnableSecondary(TBool aEnable, TBool aReDraw)
       
  1283     {
       
  1284     iEnableSecondary = aEnable;
       
  1285     
       
  1286     if ( aReDraw )
       
  1287         {
       
  1288         Draw();
       
  1289         }    
       
  1290     }
       
  1291                                              
       
  1292 // -----------------------------------------------------------------------------
       
  1293 // CFepCtrlDropdownList::IsEnableSecondary
       
  1294 // get multi color is enable or disable
       
  1295 // (other items were commented in a header).
       
  1296 // -----------------------------------------------------------------------------
       
  1297 //      
       
  1298 EXPORT_C TBool CFepCtrlDropdownList::IsEnableSecondary() const
       
  1299     {
       
  1300     return iEnableSecondary;
       
  1301     }
       
  1302 
       
  1303 // -----------------------------------------------------------------------------
       
  1304 // CFepCtrlDropdownList::DrawMask
       
  1305 // draw mask
       
  1306 // (other items were commented in a header).
       
  1307 // -----------------------------------------------------------------------------
       
  1308 //        
       
  1309 void CFepCtrlDropdownList::DrawMask(TRect aRect)
       
  1310     {
       
  1311     Gc()->Activate( MaskBitmapDevice() );
       
  1312     Gc()->SetBrushStyle( CGraphicsContext::ESolidBrush );
       
  1313     Gc()->SetBrushColor( TRgb(KOpaqueColor) );
       
  1314     Gc()->SetPenSize(PenSize());
       
  1315     Gc()->SetPenColor( TRgb(KOpaqueColor) );
       
  1316     Gc()->DrawRect(aRect);    
       
  1317     }
       
  1318 
       
  1319 // -----------------------------------------------------------------------------
       
  1320 // CFepCtrlDropdownList::ActivateBitmapContext
       
  1321 // active bitmap context
       
  1322 // (other items were commented in a header).
       
  1323 // -----------------------------------------------------------------------------
       
  1324 //      
       
  1325 void CFepCtrlDropdownList::ActivateBitmapContext()
       
  1326     {
       
  1327     Gc()->Activate(BitmapDevice());
       
  1328     } 
       
  1329         
       
  1330 // -----------------------------------------------------------------------------
       
  1331 // CFepCtrlDropdownList::Gc
       
  1332 // return the graphics context
       
  1333 // (other items were commented in a header).
       
  1334 // -----------------------------------------------------------------------------
       
  1335 //      
       
  1336 CFbsBitGc* CFepCtrlDropdownList::Gc()
       
  1337     {
       
  1338     return static_cast<CFbsBitGc*>(BitGc());
       
  1339     }
       
  1340     
       
  1341 // -----------------------------------------------------------------------------
       
  1342 // CFepCtrlDropdownList::GetFirstCandidateIndex
       
  1343 // get FirstCandidateIndex
       
  1344 // (other items were commented in a header).
       
  1345 // -----------------------------------------------------------------------------
       
  1346 //  
       
  1347 TInt CFepCtrlDropdownList::GetFirstCandidateIndex()
       
  1348     {
       
  1349     return iFirstCandidateIndex;
       
  1350     }
       
  1351     
       
  1352 // -----------------------------------------------------------------------------
       
  1353 // CFepCtrlDropdownList::GetLastCandidateIndex
       
  1354 // get LastCandidateIndex
       
  1355 // (other items were commented in a header).
       
  1356 // -----------------------------------------------------------------------------
       
  1357 //  
       
  1358 TInt CFepCtrlDropdownList::GetLastCandidateIndex()
       
  1359     {
       
  1360     return iLastCandidateIndex;
       
  1361     }
       
  1362     
       
  1363 // -----------------------------------------------------------------------------
       
  1364 // CFepCtrlDropdownList::SetFirstCandidateIndex
       
  1365 // set FirstCandidateIndex
       
  1366 // (other items were commented in a header).
       
  1367 // -----------------------------------------------------------------------------
       
  1368 //  
       
  1369 void CFepCtrlDropdownList::SetFirstCandidateIndex(TInt aFirstIndex)
       
  1370     {
       
  1371     iFirstCandidateIndex = aFirstIndex;
       
  1372     }
       
  1373     
       
  1374 // -----------------------------------------------------------------------------
       
  1375 // CFepCtrlDropdownList::SetLastCandidateIndex
       
  1376 // Set LastCandidateIndex
       
  1377 // (other items were commented in a header).
       
  1378 // -----------------------------------------------------------------------------
       
  1379 //  
       
  1380 void CFepCtrlDropdownList::SetLastCandidateIndex(TInt aLastIndex)
       
  1381     {
       
  1382     iLastCandidateIndex = aLastIndex;
       
  1383     }
       
  1384     
       
  1385 // -----------------------------------------------------------------------------
       
  1386 // CFepCtrlDropdownList::GetCandidate
       
  1387 // get candidate
       
  1388 // (other items were commented in a header).
       
  1389 // -----------------------------------------------------------------------------
       
  1390 //      
       
  1391 CCandidate* CFepCtrlDropdownList::GetCandidate(TInt aIndex)
       
  1392     {
       
  1393     if ( ( aIndex >= 0 ) && ( aIndex < iCandidatelist.Count() ) )
       
  1394         {
       
  1395         return iCandidatelist[aIndex];
       
  1396         }
       
  1397         
       
  1398     return NULL;
       
  1399     }
       
  1400     
       
  1401 // -----------------------------------------------------------------------------
       
  1402 // CFepCtrlDropdownList::GetTopLeftPoint
       
  1403 // get Top Left Point
       
  1404 // (other items were commented in a header).
       
  1405 // -----------------------------------------------------------------------------
       
  1406 //  
       
  1407 TPoint CFepCtrlDropdownList::GetTopLeftPoint()
       
  1408     {
       
  1409     return iTopLeftPoint;
       
  1410     }
       
  1411     
       
  1412 // -----------------------------------------------------------------------------
       
  1413 // CFepCtrlDropdownList::GetCellWidth
       
  1414 // get width
       
  1415 // (other items were commented in a header).
       
  1416 // -----------------------------------------------------------------------------
       
  1417 //  
       
  1418 TInt CFepCtrlDropdownList::GetCellWidth()
       
  1419     {
       
  1420     return iCellWidth;
       
  1421     }
       
  1422     
       
  1423 // -----------------------------------------------------------------------------
       
  1424 // CFepCtrlDropdownList::GetCellHeight
       
  1425 // get cell height
       
  1426 // (other items were commented in a header).
       
  1427 // -----------------------------------------------------------------------------
       
  1428 //  
       
  1429 TInt CFepCtrlDropdownList::GetCellHeight()
       
  1430     {
       
  1431     return iCellHeight;
       
  1432     }
       
  1433     
       
  1434 // -----------------------------------------------------------------------------
       
  1435 // CFepCtrlDropdownList::GetNaviWidth
       
  1436 // get navigation width
       
  1437 // (other items were commented in a header).
       
  1438 // -----------------------------------------------------------------------------
       
  1439 //  
       
  1440 TInt CFepCtrlDropdownList::GetNaviWidth()
       
  1441     {
       
  1442     return iNaviWidth;
       
  1443     }
       
  1444     
       
  1445 // -----------------------------------------------------------------------------
       
  1446 // CFepCtrlDropdownList::GetColNum
       
  1447 // get columns number
       
  1448 // (other items were commented in a header).
       
  1449 // -----------------------------------------------------------------------------
       
  1450 //  
       
  1451 TInt CFepCtrlDropdownList::GetColNum()
       
  1452     {
       
  1453     return iColNum;
       
  1454     }
       
  1455     
       
  1456 // -----------------------------------------------------------------------------
       
  1457 // CFepCtrlDropdownList::GetRowNum
       
  1458 // get rows number
       
  1459 // (other items were commented in a header).
       
  1460 // -----------------------------------------------------------------------------
       
  1461 //  
       
  1462 TInt CFepCtrlDropdownList::GetRowNum()
       
  1463     {
       
  1464     return iRowNum;
       
  1465     }
       
  1466     
       
  1467 // -----------------------------------------------------------------------------
       
  1468 // CFepCtrlDropdownList::GetFont
       
  1469 // get text font
       
  1470 // (other items were commented in a header).
       
  1471 // -----------------------------------------------------------------------------
       
  1472 //  
       
  1473 const CFont* CFepCtrlDropdownList::GetFont()
       
  1474     {
       
  1475     return iFont;
       
  1476     }
       
  1477     
       
  1478 // -----------------------------------------------------------------------------
       
  1479 // CFepCtrlDropdownList::GetAlignment
       
  1480 // get alignment
       
  1481 // (other items were commented in a header).
       
  1482 // -----------------------------------------------------------------------------
       
  1483 //  
       
  1484 CGraphicsContext::TTextAlign CFepCtrlDropdownList::GetAlignment()
       
  1485     {
       
  1486     return iAlignment;
       
  1487     }
       
  1488 
       
  1489 // -----------------------------------------------------------------------------
       
  1490 // CFepCtrlDropdownList::GetAlignment
       
  1491 // get alignment
       
  1492 // (other items were commented in a header).
       
  1493 // -----------------------------------------------------------------------------
       
  1494 //  
       
  1495 TInt CFepCtrlDropdownList::GetTextMargin()
       
  1496     {
       
  1497     return iTextMargin;
       
  1498     }
       
  1499 
       
  1500 // -----------------------------------------------------------------------------
       
  1501 // CFepCtrlDropdownList::GetBgColor
       
  1502 // get background color
       
  1503 // (other items were commented in a header).
       
  1504 // -----------------------------------------------------------------------------
       
  1505 //  
       
  1506 TRgb CFepCtrlDropdownList::GetBgColor()
       
  1507     {
       
  1508     return iBgColor;
       
  1509     }
       
  1510     
       
  1511 // -----------------------------------------------------------------------------
       
  1512 // CFepCtrlDropdownList::GetButtonDownBgColor
       
  1513 // get button down color
       
  1514 // (other items were commented in a header).
       
  1515 // -----------------------------------------------------------------------------
       
  1516 //  
       
  1517 TRgb CFepCtrlDropdownList::GetButtonDownBgColor()
       
  1518     {
       
  1519     return iButtonDownBgColor;
       
  1520     }
       
  1521     
       
  1522 // -----------------------------------------------------------------------------
       
  1523 // CFepCtrlDropdownList::GetBorderColor
       
  1524 // get border color
       
  1525 // (other items were commented in a header).
       
  1526 // -----------------------------------------------------------------------------
       
  1527 //      
       
  1528 TRgb CFepCtrlDropdownList::GetBorderColor()
       
  1529     {
       
  1530     return iBorderColor;
       
  1531     }
       
  1532     
       
  1533 // -----------------------------------------------------------------------------
       
  1534 // CFepCtrlDropdownList::GetTextColor
       
  1535 // get text color
       
  1536 // (other items were commented in a header).
       
  1537 // -----------------------------------------------------------------------------
       
  1538 //  
       
  1539 TRgb CFepCtrlDropdownList::GetTextColor()
       
  1540     {
       
  1541     return iTextColor;
       
  1542     }
       
  1543     
       
  1544 // -----------------------------------------------------------------------------
       
  1545 // CFepCtrlDropdownList::GetHighLightBgColor
       
  1546 // get highlight background color
       
  1547 // (other items were commented in a header).
       
  1548 // -----------------------------------------------------------------------------
       
  1549 //
       
  1550 TRgb CFepCtrlDropdownList::GetHighLightBgColor()
       
  1551     {
       
  1552     return iHighLightBgColor;
       
  1553     }
       
  1554     
       
  1555 // -----------------------------------------------------------------------------
       
  1556 // CFepCtrlDropdownList::GetHighLightTextColor
       
  1557 // get highlignt text color
       
  1558 // (other items were commented in a header).
       
  1559 // -----------------------------------------------------------------------------
       
  1560 //  
       
  1561 TRgb CFepCtrlDropdownList::GetHighLightTextColor()
       
  1562     {
       
  1563     return iHighLightTextColor;
       
  1564     }
       
  1565     
       
  1566 // -----------------------------------------------------------------------------
       
  1567 // CFepCtrlDropdownList::GetSpecialTextColor
       
  1568 // get special text color
       
  1569 // (other items were commented in a header).
       
  1570 // -----------------------------------------------------------------------------
       
  1571 //  
       
  1572 TRgb CFepCtrlDropdownList::GetSpecialTextColor()
       
  1573     {
       
  1574     return iSpecialTextColor;
       
  1575     }
       
  1576     
       
  1577 // -----------------------------------------------------------------------------
       
  1578 // CFepCtrlDropdownList::GetFixedText
       
  1579 // get fixed text
       
  1580 // (other items were commented in a header).
       
  1581 // -----------------------------------------------------------------------------
       
  1582 //  
       
  1583 TDesC CFepCtrlDropdownList::GetFixedText()
       
  1584     {
       
  1585     return iFixedText;
       
  1586     }
       
  1587     
       
  1588 // -----------------------------------------------------------------------------
       
  1589 // CFepCtrlDropdownList::GetHighlightList
       
  1590 // get bitmap manager
       
  1591 // (other items were commented in a header).
       
  1592 // -----------------------------------------------------------------------------
       
  1593 //  
       
  1594 const RArray<TInt>& CFepCtrlDropdownList::GetHighlightList() const
       
  1595     {
       
  1596     return iHighlightList;
       
  1597     }
       
  1598 
       
  1599 // -----------------------------------------------------------------------------
       
  1600 // CFepCtrlDropdownList::GetPages
       
  1601 // get page manager
       
  1602 // (other items were commented in a header).
       
  1603 // -----------------------------------------------------------------------------
       
  1604 //  
       
  1605 CPages* CFepCtrlDropdownList::GetPages()
       
  1606     {
       
  1607     return iPages;
       
  1608     }
       
  1609 
       
  1610 // -----------------------------------------------------------------------------
       
  1611 // CFepCtrlDropdownList::GetBitmapDb
       
  1612 // get bitmap manager
       
  1613 // (other items were commented in a header).
       
  1614 // -----------------------------------------------------------------------------
       
  1615 //      
       
  1616 CBitmapDb* CFepCtrlDropdownList::GetBitmapDb()
       
  1617     {
       
  1618     return iBitmapDb;
       
  1619     }
       
  1620 
       
  1621 // -----------------------------------------------------------------------------
       
  1622 // CFepCtrlDropdownList::ReportCandidateSelectEvent
       
  1623 // report candidate selected event
       
  1624 // (other items were commented in a header).
       
  1625 // -----------------------------------------------------------------------------
       
  1626 //      
       
  1627 void CFepCtrlDropdownList::ReportCandidateSelectEventL(const TDesC& aCandidate,
       
  1628                                                       const TInt aSelectedIndex)
       
  1629     {
       
  1630     HBufC* bufc = HBufC::NewL( aCandidate.Length() + 1 );    
       
  1631     TPtr ptr = bufc->Des();
       
  1632     ptr.Copy( aCandidate );
       
  1633     ptr.Append( (TUint16*)&aSelectedIndex, 1 );
       
  1634     ReportEvent(iEventIdForCandidateSelected, *bufc);
       
  1635     delete bufc;
       
  1636     bufc = NULL;
       
  1637     }
       
  1638         
       
  1639 // -----------------------------------------------------------------------------
       
  1640 // CFepCtrlDropdownList::Invalidate
       
  1641 // update the animation
       
  1642 // (other items were commented in a header).
       
  1643 // -----------------------------------------------------------------------------
       
  1644 //      
       
  1645 void CFepCtrlDropdownList::Invalidate(const TRect& aRect, TBool aUpdateAll)
       
  1646     {
       
  1647     RootControl()->UpdateArea(aRect,aUpdateAll);
       
  1648     }    
       
  1649 
       
  1650 // -----------------------------------------------------------------------------
       
  1651 // CFepCtrlDropdownList::ChangeActiveList
       
  1652 // change active list
       
  1653 // (other items were commented in a header).
       
  1654 // -----------------------------------------------------------------------------
       
  1655 //
       
  1656 void CFepCtrlDropdownList::ChangeActiveList(CList* aList, TInt aLastIndex)
       
  1657     {
       
  1658     TRect rect = Rect();       
       
  1659         
       
  1660     CList* beforeList = iListManager->ActiveList();
       
  1661     
       
  1662     if( RootControl()->CtrlCapPointer() == this)
       
  1663         {
       
  1664         SetCapture(EFalse);
       
  1665         }
       
  1666     
       
  1667 	switch ( iListType )
       
  1668 		{
       
  1669 		case EListNoExpandable:
       
  1670 		case EListNoExpandableWithBubble:
       
  1671 	        EnableSecondary(ETrue);
       
  1672 			break;
       
  1673 		case EListExpandable:
       
  1674 		case EListExpandableWithBubble:
       
  1675 		case EListExpandableWithoutIcon:
       
  1676 		// txin
       
  1677 		case EListExpandableRollWithIcon:
       
  1678 		case EListExpandableRollWithIconWithBubble:
       
  1679 		// end
       
  1680 	        EnableSecondary(EFalse);
       
  1681 	        break;
       
  1682 		case EListExpandableMultiRowWithoutIcon:
       
  1683 		    break;
       
  1684 	    default:
       
  1685 	    	__ASSERT_DEBUG( EFalse, 
       
  1686 	    			User::Panic( _L("TListType Error::ChangeActiveList()"), 0 ) );
       
  1687 	    	break;
       
  1688 		}
       
  1689     
       
  1690     iListManager->SetActiveList(aList);
       
  1691     SetRect(iListManager->ActiveList()->Rect());      
       
  1692     
       
  1693     if ( aLastIndex )
       
  1694         {
       
  1695         SetLastCandidateIndex(aLastIndex); 
       
  1696         }
       
  1697     else
       
  1698         {
       
  1699         GetPages()->Reset();
       
  1700         SetFirstCandidateIndex(0);
       
  1701         SetLastCandidateIndex(0);
       
  1702         }
       
  1703         
       
  1704     if(!Hiden() && Ready())
       
  1705         {
       
  1706         TRAP_IGNORE(iListManager->ActiveList()->UpdateListL());
       
  1707         }
       
  1708     
       
  1709 	// If the list is shrink, then redraw
       
  1710     // txin
       
  1711 	if ( ( ( beforeList == iListManager->ListMultiRowWithIcon() )
       
  1712 		&& ( aList != iListManager->ListMultiRowWithIcon() ) ) 
       
  1713 		|| ( ( ( beforeList == iListManager->ListMultiRowWithoutIcon() )
       
  1714 	     && ( aList != iListManager->ListMultiRowWithoutIcon() ) ) ) 
       
  1715 	    || ( ( ( beforeList == iListManager->ListMultiRowRollWithIcon())
       
  1716 	     && ( aList != iListManager->ListMultiRowRollWithIcon() ) ) ) 
       
  1717 	     || ( ( ( beforeList == iListManager->ListExpandableMultiRowWithoutIcon() )
       
  1718 	     && ( aList != iListManager->ListExpandableMultiRowWithoutIcon() ) ) )
       
  1719 	     || ( ( ( beforeList == iListManager->ListMultiRowWithIconWithBubble() ))
       
  1720 	     && (aList != iListManager->ListMultiRowWithIconWithBubble() ) )
       
  1721 	     || ( ( ( beforeList == iListManager->ListMultiRowRollWithIconWithBubble() ))
       
  1722 	     && (aList != iListManager->ListMultiRowRollWithIconWithBubble() ) ) )
       
  1723 		{
       
  1724 	    rect.Shrink(TSize(0,-1));
       
  1725 	    RootControl()->ReDrawRect(rect);
       
  1726 	    Invalidate(rect,ETrue);			
       
  1727 		}
       
  1728     // end
       
  1729     }
       
  1730 
       
  1731 // -----------------------------------------------------------------------------
       
  1732 // CFepCtrlDropdownList::GetPenSize
       
  1733 // get pen size
       
  1734 // (other items were commented in a header).
       
  1735 // -----------------------------------------------------------------------------
       
  1736 //
       
  1737 const TSize CFepCtrlDropdownList::GetPenSize()
       
  1738     {
       
  1739     return PenSize();
       
  1740     }
       
  1741 
       
  1742 void CFepCtrlDropdownList::SetCapture(TBool aFlag)
       
  1743     {
       
  1744     CapturePointer(aFlag);
       
  1745     }
       
  1746     
       
  1747 // ---------------------------------------------------------------------------
       
  1748 // CFepCtrlDropdownList::SetActive
       
  1749 // Set active for the button
       
  1750 // (other items were commented in a header).
       
  1751 // ---------------------------------------------------------------------------
       
  1752 //
       
  1753 EXPORT_C void CFepCtrlDropdownList::SetActive(TBool aActiveFlag)
       
  1754     {
       
  1755     if(IsActive() != aActiveFlag)
       
  1756         {
       
  1757         CFepUiBaseCtrl::SetActive(aActiveFlag);    
       
  1758         /*Draw();
       
  1759         UpdateArea(Rect(),EFalse);*/
       
  1760         }
       
  1761     }
       
  1762     
       
  1763 // ---------------------------------------------------------------------------
       
  1764 // CFepCtrlDropdownList::ConstructFromResourceL
       
  1765 // (other items were commented in a header).
       
  1766 // ---------------------------------------------------------------------------
       
  1767 //
       
  1768 EXPORT_C void CFepCtrlDropdownList::ConstructFromResourceL()
       
  1769 	{
       
  1770     if (iResourceId == KInvalidResId)
       
  1771     	{
       
  1772     	User::Leave(KErrArgument);
       
  1773     	}
       
  1774     
       
  1775     // first time construct will not go this way
       
  1776     // only useful for skin change
       
  1777     if (!iFirstTimeConstruct)
       
  1778     	{
       
  1779         TResourceReader reader;
       
  1780         CCoeEnv::Static()->CreateResourceReaderLC(reader, iResourceId);
       
  1781 	    iBitmapDb->ConstructFromResourceL(reader, 
       
  1782 	                                      TSize(iCellWidth, iCellHeight),
       
  1783 	                                      TSize(iNaviWidth, iCellHeight),
       
  1784 	                                      TSize(iNaviWidth, iSpinBtnHeight));
       
  1785 	    CleanupStack::PopAndDestroy(); // reader
       
  1786         SetTextColor(iBitmapDb->TextColor());
       
  1787         SetBorderColor(iBitmapDb->FrameColor());
       
  1788         iListManager->ActiveList()->UpdateListL(AbleToDraw(),EFalse);
       
  1789 	    Draw();
       
  1790     	}
       
  1791     
       
  1792     iFirstTimeConstruct = EFalse;	
       
  1793 	}
       
  1794 	
       
  1795 // ---------------------------------------------------------------------------
       
  1796 // CFepCtrlDropdownList::NotifyGetNextPage
       
  1797 // (other items were commented in a header).
       
  1798 // ---------------------------------------------------------------------------
       
  1799 //
       
  1800 void CFepCtrlDropdownList::NotifyGetNextPage()
       
  1801     {
       
  1802     ReportEvent(iEventIdForNextPageCandidate);
       
  1803     }
       
  1804     
       
  1805 // ---------------------------------------------------------------------------
       
  1806 // CFepCtrlDropdownList::NotifyGetPreviousPage
       
  1807 // (other items were commented in a header).
       
  1808 // ---------------------------------------------------------------------------
       
  1809 //
       
  1810 void CFepCtrlDropdownList::NotifyGetPreviousPage()
       
  1811     {
       
  1812     ReportEvent(iEventIdForPreviousPageCandidate);
       
  1813     } 
       
  1814     
       
  1815 // ---------------------------------------------------------------------------
       
  1816 // CFepCtrlDropdownList::SetFlagCandidateExist
       
  1817 // (other items were commented in a header).
       
  1818 // ---------------------------------------------------------------------------
       
  1819 //
       
  1820 EXPORT_C void CFepCtrlDropdownList::SetFlagCandidateExist(TBool aFlag)
       
  1821     {
       
  1822     iCandidateExisted = aFlag;
       
  1823     }
       
  1824     
       
  1825 // ---------------------------------------------------------------------------
       
  1826 // CFepCtrlDropdownList::NextCandidateExist
       
  1827 // (other items were commented in a header).
       
  1828 // ---------------------------------------------------------------------------
       
  1829 //
       
  1830 TBool CFepCtrlDropdownList::NextCandidateExist()
       
  1831     {
       
  1832     ReportEvent(iEventIdForCandidateExisted);
       
  1833     
       
  1834     return iCandidateExisted;
       
  1835     }
       
  1836     
       
  1837 // -----------------------------------------------------------------------------
       
  1838 // CFepCtrlDropdownList::AutoChangeActiveList
       
  1839 // change active list
       
  1840 // (other items were commented in a header).
       
  1841 // -----------------------------------------------------------------------------
       
  1842 //
       
  1843 void CFepCtrlDropdownList::AutoChangeActiveList( TInt aLastIndex )
       
  1844 	{
       
  1845 	switch ( iListType )
       
  1846 		{
       
  1847 		case EListExpandable:
       
  1848 			if ( iListManager->ActiveList() 
       
  1849 					== iListManager->ListOneRowWithIcon() )
       
  1850 				{
       
  1851 				ChangeActiveList( iListManager->ListMultiRowWithIcon(), aLastIndex );
       
  1852 				BringToTop();
       
  1853 				}
       
  1854 			else
       
  1855 				{
       
  1856 				BringToBack();
       
  1857 				ChangeActiveList( iListManager->ListOneRowWithIcon(), aLastIndex );
       
  1858 				NotifyClosePage();
       
  1859 				}
       
  1860 			break;
       
  1861 		case EListExpandableWithoutIcon:
       
  1862 			if ( iListManager->ActiveList() 
       
  1863 					== iListManager->ListOneRowWithIcon() )
       
  1864 				{
       
  1865 				ChangeActiveList( iListManager->ListMultiRowWithoutIcon(), aLastIndex );
       
  1866 				BringToTop();
       
  1867 				}
       
  1868 			else
       
  1869 				{
       
  1870 				BringToBack();
       
  1871 				ChangeActiveList( iListManager->ListOneRowWithIcon(), aLastIndex );
       
  1872 				}
       
  1873 			break;
       
  1874         // txin
       
  1875 		case EListExpandableRollWithIcon:
       
  1876 		    {
       
  1877 			if (iListManager->ActiveList() == iListManager->ListOneRowRollWithIcon())
       
  1878 				{
       
  1879 				ChangeActiveList(iListManager->ListMultiRowRollWithIcon(), aLastIndex);
       
  1880 				BringToTop();
       
  1881 				}
       
  1882 			else
       
  1883 				{
       
  1884 				BringToBack();
       
  1885 				ChangeActiveList(iListManager->ListOneRowRollWithIcon(), aLastIndex);
       
  1886 				NotifyClosePage();
       
  1887 				}
       
  1888 		    }
       
  1889 		    break;
       
  1890 		case EListExpandableRollWithIconWithBubble:
       
  1891 		    {
       
  1892 			if (iListManager->ActiveList() == iListManager->ListOneRowRollWithIconWithBubble())
       
  1893 				{
       
  1894 				ChangeActiveList(iListManager->ListMultiRowRollWithIconWithBubble(), aLastIndex);
       
  1895 				BringToTop();
       
  1896 				}
       
  1897 			else
       
  1898 				{
       
  1899 				BringToBack();
       
  1900 				ChangeActiveList(iListManager->ListOneRowRollWithIconWithBubble(), aLastIndex);
       
  1901 				NotifyClosePage();
       
  1902 				}
       
  1903 		    }
       
  1904 		    break;
       
  1905 		    
       
  1906 		case EListExpandableWithBubble:
       
  1907 		    {
       
  1908 			if ( iListManager->ActiveList() 
       
  1909 					== iListManager->ListOneRowWithIconWithBubble() )
       
  1910 				{
       
  1911 				ChangeActiveList( iListManager->ListMultiRowWithIconWithBubble(), aLastIndex );
       
  1912 				BringToTop();
       
  1913 				}
       
  1914 			else
       
  1915 				{
       
  1916 				BringToBack();
       
  1917 				ChangeActiveList( iListManager->ListOneRowWithIconWithBubble(), aLastIndex );
       
  1918 				NotifyClosePage();
       
  1919 				}
       
  1920 		    }
       
  1921 		    break;
       
  1922         case EListExpandableMultiRowWithoutIcon:
       
  1923             break;              
       
  1924 		case EListNoExpandable:
       
  1925 		case EListNoExpandableWithBubble:
       
  1926 			break;
       
  1927 	    default:
       
  1928 	    	__ASSERT_DEBUG( EFalse, 
       
  1929 	    			User::Panic( _L("TListType Error::AutoChangeActiveList()"), 0 ) );
       
  1930 	    	break;
       
  1931 		}
       
  1932 
       
  1933 	}
       
  1934 
       
  1935 // added by txin in 2007.06.07
       
  1936 EXPORT_C void CFepCtrlDropdownList::SetSpinBtnHeight(const TInt aHeight)
       
  1937     {
       
  1938     // make sure navi next, navi previous plus close, do not beyond row count 
       
  1939     TInt minExpandHeight = 2 * aHeight + GetCellHeight() + 4 * GetCellVerticalMargin();
       
  1940     TInt realExpandHeight = GetCellHeight() * GetRowNum() + 
       
  1941                             (GetRowNum() + 1) * GetCellVerticalMargin();
       
  1942 
       
  1943     if ((aHeight > 0) && (minExpandHeight <= realExpandHeight))
       
  1944         {
       
  1945         iSpinBtnHeight = aHeight;
       
  1946         SizeChanged(iCellWidth, iCellHeight, iNaviWidth);
       
  1947         }
       
  1948     }
       
  1949 
       
  1950 EXPORT_C void CFepCtrlDropdownList::SetCellMargin(const TInt aHorizontalMargin, 
       
  1951                                                   const TInt aVerticalMargin)
       
  1952     {
       
  1953     if (((aHorizontalMargin > 0) && (aHorizontalMargin != iCellHorizontalMargin)) || 
       
  1954         ((aVerticalMargin > 0) && (aVerticalMargin != iCellVerticalMargin)))
       
  1955         {
       
  1956         iCellHorizontalMargin = aHorizontalMargin;
       
  1957         iCellVerticalMargin = aVerticalMargin;
       
  1958 
       
  1959         SizeChanged(iCellWidth, iCellHeight, iNaviWidth); 
       
  1960         }
       
  1961     }
       
  1962     
       
  1963 TInt CFepCtrlDropdownList::GetSpinBtnHeight()
       
  1964     {
       
  1965     return iSpinBtnHeight;
       
  1966     }
       
  1967 
       
  1968 TInt CFepCtrlDropdownList::GetCellHorizontalMargin()
       
  1969     {
       
  1970     return iCellHorizontalMargin;
       
  1971     }
       
  1972 
       
  1973 TInt CFepCtrlDropdownList::GetCellVerticalMargin()
       
  1974     {
       
  1975     return iCellVerticalMargin;
       
  1976     }
       
  1977 
       
  1978 TInt CFepCtrlDropdownList::ListType()
       
  1979     {
       
  1980     return iListType;
       
  1981     }
       
  1982     
       
  1983 TInt CFepCtrlDropdownList::OneRowStartCandIdx()
       
  1984     {
       
  1985     return iOriginalCandIdx;
       
  1986     }
       
  1987     
       
  1988 void CFepCtrlDropdownList::SetOneRowStartCandIdx(TInt aOriginalCandIdx)
       
  1989     {
       
  1990     iOriginalCandIdx = aOriginalCandIdx;
       
  1991     }
       
  1992 
       
  1993 TInt CFepCtrlDropdownList::GetOriginalFirstCandIdx()
       
  1994     {
       
  1995     return iOriginalFirstCandIdx;
       
  1996     }
       
  1997 
       
  1998 void CFepCtrlDropdownList::SetOriginalFirstCandIdx(TInt aOriginalFirstCandIdx)
       
  1999     {
       
  2000     iOriginalFirstCandIdx = aOriginalFirstCandIdx;
       
  2001     }
       
  2002     
       
  2003 EXPORT_C void CFepCtrlDropdownList::SetCandTruncateType(const TCandTruncateType aTruncateType)
       
  2004     {
       
  2005     iCandTruncateType = aTruncateType;
       
  2006     }
       
  2007     
       
  2008 TInt CFepCtrlDropdownList::CandTruncateType()
       
  2009     {
       
  2010     return iCandTruncateType;
       
  2011     }
       
  2012     
       
  2013 CList* CFepCtrlDropdownList::ActiveList()
       
  2014     {
       
  2015     return iListManager->ActiveList();
       
  2016     }
       
  2017 
       
  2018 void CFepCtrlDropdownList::SetUpdateListReDrawFlag(TBool aReDraw)
       
  2019     {
       
  2020     iUpdateListReDraw = aReDraw;
       
  2021     }
       
  2022 
       
  2023 TBool CFepCtrlDropdownList::GetUpdateListRedrawFlag()
       
  2024     {
       
  2025     return iUpdateListReDraw;
       
  2026     }
       
  2027 
       
  2028 EXPORT_C void CFepCtrlDropdownList::SetFuzzyBoundry(TInt aFuzzyBoundry)
       
  2029     {
       
  2030     if (aFuzzyBoundry != iFuzzyBoundry && aFuzzyBoundry >= 0)
       
  2031         {
       
  2032         iFuzzyBoundry = aFuzzyBoundry;
       
  2033         }
       
  2034     }
       
  2035 
       
  2036 TInt CFepCtrlDropdownList::FuzzyBoundry()
       
  2037     {
       
  2038     return iFuzzyBoundry;
       
  2039     }
       
  2040 
       
  2041 EXPORT_C void CFepCtrlDropdownList::SetCandExpandType(const TExpandType aType)
       
  2042     {
       
  2043     if (aType != iCandExpandType)
       
  2044         {
       
  2045         iCandExpandType = aType;
       
  2046         }
       
  2047     }
       
  2048 
       
  2049 TInt CFepCtrlDropdownList::CandExpandType()
       
  2050     {
       
  2051     return iCandExpandType;
       
  2052     }
       
  2053 
       
  2054 void CFepCtrlDropdownList::NotifyClosePage()
       
  2055 	{
       
  2056 	UiLayout()->RootControl()->Draw();
       
  2057 	}
       
  2058 	
       
  2059 EXPORT_C void CFepCtrlDropdownList::SetDropdownListImgID(
       
  2060               TDropdownListDrawInfo aDropdownListDrawInfo)
       
  2061 	{
       
  2062 	iListManager->ListOneRowWithIcon()->SetDropdownListImgID(aDropdownListDrawInfo);
       
  2063 	
       
  2064 	iListManager->ListOneRowWithIconWithBubble()->SetDropdownListImgID(aDropdownListDrawInfo);
       
  2065 													 
       
  2066 	iListManager->ListMultiRowWithIcon()->SetDropdownListImgID(aDropdownListDrawInfo);		
       
  2067 	
       
  2068 	iListManager->ListMultiRowWithIconWithBubble()->SetDropdownListImgID(aDropdownListDrawInfo);	
       
  2069 													 
       
  2070 	iListManager->ListOneRowWithoutIcon()->SetDropdownListImgID(aDropdownListDrawInfo);		
       
  2071 	
       
  2072     iListManager->ListOneRowWithoutIconWithBubble()->SetDropdownListImgID(aDropdownListDrawInfo);			
       
  2073 													 
       
  2074 	iListManager->ListOneRowRollWithIcon()->SetDropdownListImgID(aDropdownListDrawInfo);
       
  2075 			
       
  2076 	iListManager->ListOneRowRollWithIconWithBubble()->SetDropdownListImgID(aDropdownListDrawInfo);		
       
  2077 													 
       
  2078 	iListManager->ListMultiRowRollWithIcon()->SetDropdownListImgID(aDropdownListDrawInfo);
       
  2079 	
       
  2080 	iListManager->ListMultiRowRollWithIconWithBubble()->SetDropdownListImgID(aDropdownListDrawInfo);
       
  2081 	
       
  2082 	iListManager->ListExpandableMultiRowWithoutIcon()->SetDropdownListImgID(aDropdownListDrawInfo);
       
  2083 	}
       
  2084 
       
  2085 CFepUiLayout* CFepCtrlDropdownList::UiLayout()
       
  2086     {
       
  2087     return CFepUiBaseCtrl::UiLayout();
       
  2088     }
       
  2089 
       
  2090 TInt CFepCtrlDropdownList::CandHDirection()
       
  2091     {
       
  2092     return iCandHDirection;
       
  2093     }
       
  2094 
       
  2095 TBool CFepCtrlDropdownList::PageCtrlShown()
       
  2096     {
       
  2097     return iPageCtrlShown;
       
  2098     }
       
  2099     
       
  2100 // -----------------------------------------------------------------------------
       
  2101 // CFepCtrlDropdownList::ShowBubble
       
  2102 // Set show preview bubble on/off
       
  2103 // (other items were commented in a header).
       
  2104 // -----------------------------------------------------------------------------
       
  2105 //
       
  2106 EXPORT_C void CFepCtrlDropdownList::ShowBubble(TBool aFlag)
       
  2107     {  
       
  2108     TBool flag = iBubbleCtrl ? ETrue : EFalse;
       
  2109     iIsShowBubble = aFlag;
       
  2110     if ( flag != aFlag )
       
  2111         {
       
  2112         if(!flag)
       
  2113             {
       
  2114             TRAP_IGNORE(iBubbleCtrl = CBubbleCtrl::NewL(TRect(0,0,0,0),UiLayout(),-0xFFFF));
       
  2115             }
       
  2116         }
       
  2117     }    
       
  2118 
       
  2119 // -----------------------------------------------------------------------------
       
  2120 // CFepCtrlDropdownList::SetBubbleBitmapParam
       
  2121 // Set preview bubble bitmap
       
  2122 // (other items were commented in a header).
       
  2123 // -----------------------------------------------------------------------------
       
  2124 //
       
  2125 EXPORT_C void CFepCtrlDropdownList::SetBubbleBitmapParam(CFbsBitmap* aBmpId,
       
  2126                                                      CFbsBitmap* aMaskBmpId ,
       
  2127                                                      TAknsItemID aBgSkinId )
       
  2128     {
       
  2129     if ( iBubbleCtrl )
       
  2130         {
       
  2131         iBubbleCtrl->SetBitmapParam(aBmpId,aMaskBmpId,aBgSkinId);
       
  2132         }
       
  2133     }
       
  2134 
       
  2135 // -----------------------------------------------------------------------------
       
  2136 // CFepCtrlDropdownList::SetBubbleTextFont
       
  2137 // Set preview bubble text font
       
  2138 // (other items were commented in a header).
       
  2139 // -----------------------------------------------------------------------------
       
  2140 //
       
  2141 EXPORT_C void CFepCtrlDropdownList::SetBubbleTextFont(const CFont* aFont)
       
  2142     {
       
  2143     if ( iBubbleCtrl )
       
  2144         {
       
  2145         iBubbleFont = aFont;    
       
  2146         }
       
  2147     }
       
  2148        
       
  2149 // -----------------------------------------------------------------------------
       
  2150 // CFepCtrlDropdownList::SetTextFormat
       
  2151 // Set preview bubble text format
       
  2152 // (other items were commented in a header).
       
  2153 // -----------------------------------------------------------------------------
       
  2154 //
       
  2155 EXPORT_C void CFepCtrlDropdownList::SetTextFormat(TAknTextLineLayout aTextFormat)
       
  2156     {
       
  2157     if ( iBubbleCtrl )
       
  2158         {
       
  2159         iBubbleCtrl->SetTextFormat(aTextFormat);   
       
  2160         }
       
  2161     }
       
  2162 
       
  2163 // -----------------------------------------------------------------------------
       
  2164 // CFepCtrlDropdownList::SetBubbleSize
       
  2165 // Set preview bubble size
       
  2166 // (other items were commented in a header).
       
  2167 // -----------------------------------------------------------------------------
       
  2168 //
       
  2169 EXPORT_C void CFepCtrlDropdownList::SetFrameDiff(TInt aLeftDiff, TInt aTopDiff,
       
  2170                                              TInt aRightDiff,TInt aBottomDiff)
       
  2171     {
       
  2172     if ( iBubbleCtrl )
       
  2173         {
       
  2174         iBubbleCtrl->SetFrameDiff(aLeftDiff,aTopDiff,aRightDiff,aBottomDiff);    
       
  2175         }        
       
  2176     }    
       
  2177 
       
  2178 // -----------------------------------------------------------------------------
       
  2179 // CFepCtrlDropdownList::SetBubbleSize
       
  2180 // Set preview bubble size
       
  2181 // (other items were commented in a header).
       
  2182 // -----------------------------------------------------------------------------
       
  2183 //
       
  2184 EXPORT_C void CFepCtrlDropdownList::SetBubbleSize(const TSize& aSize)
       
  2185     {
       
  2186     iBubbleSize = aSize;
       
  2187     }
       
  2188 
       
  2189 
       
  2190 // -----------------------------------------------------------------------------
       
  2191 // CFepCtrlDropdownList::DrawBubble
       
  2192 // Show preview bubble
       
  2193 // (other items were commented in a header).
       
  2194 // -----------------------------------------------------------------------------
       
  2195 //
       
  2196 void CFepCtrlDropdownList::DrawBubble(const TRect aRect, const TDesC& aText)
       
  2197     {
       
  2198     if ( iBubbleCtrl && iIsShowBubble && !(iBubbleCtrl->IsShowing()))
       
  2199         {
       
  2200         if(iBubbleFont)
       
  2201             {
       
  2202             iBubbleSize.iWidth = iBubbleFont->TextWidthInPixels(aText) + KPreviewBubbleOffset;
       
  2203             }
       
  2204             
       
  2205         if(iBubbleSize.iWidth < aRect.Width() + KPreviewBubbleOffset )
       
  2206             {
       
  2207             iBubbleSize.iWidth = aRect.Width() + KPreviewBubbleOffset;
       
  2208             }
       
  2209          
       
  2210         
       
  2211         TRect rect = iBubbleCtrl->Rect();
       
  2212         TRect parentWndRect = Rect();       
       
  2213         TInt x1 = aRect.iTl.iX - ( iBubbleSize.iWidth - aRect.Width() ) / 2;
       
  2214         TInt x2 = aRect.iBr.iX + ( iBubbleSize.iWidth - aRect.Width() ) / 2;
       
  2215         
       
  2216         TRect screenRect;
       
  2217         AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::EScreen, screenRect); 
       
  2218         if ( x1 < 0 )
       
  2219             {
       
  2220             rect.iTl.iX = screenRect.iTl.iX;     
       
  2221             rect.iBr.iX = screenRect.iTl.iX + iBubbleSize.iWidth; 
       
  2222             }
       
  2223         else if ( x2 > screenRect.iBr.iX )
       
  2224             {
       
  2225             rect.iTl.iX = screenRect.iBr.iX - iBubbleSize.iWidth;     
       
  2226             rect.iBr.iX = screenRect.iBr.iX;                 
       
  2227             }
       
  2228         else
       
  2229             {
       
  2230             rect.iTl.iX = x1;     
       
  2231             rect.iBr.iX = x2;                 
       
  2232             }
       
  2233         
       
  2234         rect.iTl.iY = iBubbleVerticalMargin + aRect.iTl.iY - 
       
  2235                       iBubbleSize.iHeight;
       
  2236         rect.iBr.iY = iBubbleVerticalMargin + aRect.iTl.iY;
       
  2237 		
       
  2238 		TRAP_IGNORE(iBubbleCtrl->SetTextL(aText));		
       
  2239 	
       
  2240         iBubbleCtrl->Popup(rect);
       
  2241         }
       
  2242     }
       
  2243 
       
  2244 // -----------------------------------------------------------------------------
       
  2245 // CFepCtrlDropdownList::ClearBubble
       
  2246 // Hide preview bubble
       
  2247 // (other items were commented in a header).
       
  2248 // -----------------------------------------------------------------------------
       
  2249 //
       
  2250 void CFepCtrlDropdownList::ClearBubble()
       
  2251     {
       
  2252     if ( iBubbleCtrl && iBubbleCtrl->IsShowing())
       
  2253         {
       
  2254         iBubbleCtrl->Close();
       
  2255         }
       
  2256     }
       
  2257        
       
  2258 // -----------------------------------------------------------------------------
       
  2259 // CFepCtrlDropdownList::ReDrawBubble
       
  2260 // ReDraw preview bubble
       
  2261 // (other items were commented in a header).
       
  2262 // -----------------------------------------------------------------------------
       
  2263 //
       
  2264 void CFepCtrlDropdownList::ReDrawBubble()
       
  2265     {
       
  2266     if(iBubbleCtrl && iBubbleCtrl->IsShowing())
       
  2267         {
       
  2268         iBubbleCtrl->Draw();
       
  2269         }
       
  2270     }
       
  2271 
       
  2272 
       
  2273 // -----------------------------------------------------------------------------
       
  2274 // CFepCtrlDropdownList::ReDrawRect
       
  2275 // ReDraw Dropdown list rect
       
  2276 // (other items were commented in a header).
       
  2277 // -----------------------------------------------------------------------------
       
  2278 //
       
  2279 EXPORT_C void CFepCtrlDropdownList::ReDrawRect(const TRect& /*aRect*/)
       
  2280     {   
       
  2281 	if(!AbleToDraw())
       
  2282         return;
       
  2283     
       
  2284     if (!iFirstTimeConstruct)
       
  2285     	{
       
  2286   	    iListManager->ActiveList()->Draw();
       
  2287     	}
       
  2288     } 
       
  2289 	
       
  2290 // end adding
       
  2291 
       
  2292 // End Of File