textinput/peninputarc/inc/peninputlayoutcontrolinc/peninputlayoutaknchoicelist.h
changeset 0 eb1f2e154e89
equal deleted inserted replaced
-1:000000000000 0:eb1f2e154e89
       
     1 /*
       
     2 * Copyright (c) 2005-2006 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:  header file of choice list window for avkon version
       
    15 *
       
    16 */
       
    17 
       
    18 #ifndef C_AKN_FEPLAYOUTCHOICELIST_H
       
    19 #define C_AKN_FEPLAYOUTCHOICELIST_H
       
    20 
       
    21 #include "peninputlayoutchoicelist.h"
       
    22 #include <eikclb.h>
       
    23 #include <aknlists.h>
       
    24 class CAknSingleStyleListBox;
       
    25 class CAknsFrameBackgroundControlContext;
       
    26 
       
    27 /**
       
    28  *  class CFepLayoutAknChoiceList
       
    29  *
       
    30  *  Popup choick list control. This class could be used directly by user.
       
    31  *
       
    32  *  @lib feplayoutcontrol.lib
       
    33  *  @since S60 V4.0
       
    34  */
       
    35 class CFepLayoutAknChoiceList : public CFepLayoutChoiceList
       
    36     {
       
    37 public:
       
    38     /**
       
    39      * Factory function.        
       
    40      *
       
    41      * @since S60 V4.0        
       
    42      * @param aUiLayout Ui layout who contains this control.Ownership not transferred
       
    43      * @param aControlId control Id
       
    44      * @return An instance of CFepLayoutChoiceList class        
       
    45      */                               
       
    46     IMPORT_C static CFepLayoutAknChoiceList* NewL(CFepUiLayout* aUiLayout,
       
    47                                          TInt aControlId,CCoeControl* aParent);
       
    48 
       
    49     //IMPORT_C static CFepLayoutAknChoiceList* NewL(CFepUiLayout* aUiLayout,
       
    50       //                                     TInt aControlId,CAknChoiceListPopup* aList);
       
    51 
       
    52     /**
       
    53      * Destructor.        
       
    54      *
       
    55      * @since S60 V4.0        
       
    56      */                  
       
    57     //IMPORT_C  ~CFepLayoutAknChoiceList();
       
    58     
       
    59 
       
    60     /**
       
    61      * Set choice list items.
       
    62      *
       
    63      * @since S60 V4.0        
       
    64      * @param aItemList Item list array. The function copies them internally.
       
    65      * @return None        
       
    66      */                                 
       
    67     IMPORT_C void SetItemsL(const RPointerArray<CFepLayoutChoiceList::SItem>& aItemList);
       
    68 
       
    69     /**
       
    70      * Append a choice list item.
       
    71      *
       
    72      * @since S60 V4.0        
       
    73      * @param aItem Item to add.
       
    74      * @return None        
       
    75      */                                 
       
    76     IMPORT_C void AddItemL(const CFepLayoutChoiceList::SItem& aItem);
       
    77 
       
    78     /**
       
    79      * Insert a choice list item at specified postion.
       
    80      *
       
    81      * @since S60 V4.0        
       
    82      * @param aPostion The position is to be inserted.
       
    83      * @param aItem Item to insert.
       
    84      * @return None        
       
    85      */                                 
       
    86     IMPORT_C void InsertItemL(TInt aPostion, const CFepLayoutChoiceList::SItem& aItem);
       
    87 
       
    88     /**
       
    89      * Remove a choice list item by command
       
    90      * Only the first found item is removed.
       
    91      *
       
    92      * @since S60 V4.0        
       
    93      * @param aCommand Item command.
       
    94      * @return None        
       
    95      */                                 
       
    96     IMPORT_C void RemoveItemByCommand(TInt aCommand);
       
    97 
       
    98     /**
       
    99      * Remove a choice list item by index
       
   100      *
       
   101      * @since S60 V4.0        
       
   102      * @param aIndex Item index
       
   103      * @return None        
       
   104      */                                 
       
   105     IMPORT_C void RemoveItemByIndex(TInt aIndex);
       
   106 
       
   107     /**
       
   108      * Clear all choice list items
       
   109      *
       
   110      * @since S60 V4.0        
       
   111      * @return None        
       
   112      */                                 
       
   113     IMPORT_C void ClearItemsL();
       
   114     
       
   115     /**
       
   116      * Clear all choice list items
       
   117      *
       
   118      * @since S60 V4.0        
       
   119      * @return None        
       
   120      */                                 
       
   121     IMPORT_C TInt ItemsCount();
       
   122     
       
   123     /**
       
   124      * Retrieve a choice list item by index
       
   125      *
       
   126      * @since S60 V4.0        
       
   127      * @param aIndex Item index
       
   128      * @return choice list item pointer of specified index
       
   129      */                                 
       
   130     //const CFepLayoutChoiceList::SItem* ItemByIndex(TInt aIndex);
       
   131 
       
   132     /**
       
   133      * Retrieve a choice list item by item's command
       
   134      * Only first found item is returned.
       
   135      *
       
   136      * @since S60 V4.0        
       
   137      * @param aCommand Item command
       
   138      * @return choice list item pointer. NULL if not found.
       
   139      */                                 
       
   140     //const CFepLayoutChoiceList::SItem*  ItemByCommand(TInt aCommand);
       
   141 
       
   142     IMPORT_C CEikColumnListBox* ListBox();
       
   143     
       
   144     IMPORT_C CEikFormattedCellListBox* FormatedCellListBox();
       
   145     
       
   146     
       
   147     IMPORT_C void SetItemRect(const TRect& aItemRect, const TRect& aFocusRect);     
       
   148 
       
   149     //from CFepUiBaseCtrl
       
   150     IMPORT_C void SetRect(const TRect& aRect);    
       
   151     
       
   152     IMPORT_C ~CFepLayoutAknChoiceList();
       
   153 protected:
       
   154 
       
   155    /**
       
   156      * Constructor.        
       
   157      *
       
   158      * @since S60 V4.0        
       
   159      * @param aUiLayout Ui layout who contains this control.Ownership not transferred
       
   160      * @param aControlId control Id
       
   161      */                  
       
   162     IMPORT_C CFepLayoutAknChoiceList(CFepUiLayout* aUiLayout, 
       
   163                                   TInt aControlId,CCoeControl* aParent);
       
   164         
       
   165     IMPORT_C void ConstructL(); 
       
   166     /**
       
   167      * Get item whose region contains the point.
       
   168      *
       
   169      * @since S60 V4.0
       
   170      * @param aPoint The point position the layout
       
   171      * @return The index of choice item. -1 if no item contains
       
   172      *         the point
       
   173      */                                        
       
   174      //IMPORT_C TInt HitTest(const TPoint& aPoint);
       
   175 
       
   176     /**
       
   177      * Handle pointer down event
       
   178      *
       
   179      * @since S60 V4.0
       
   180      * @param aPoint The point position relative the layout
       
   181      * @return The control which handles the event.
       
   182      */                                        
       
   183     IMPORT_C virtual CFepUiBaseCtrl* HandlePointerDownEventL(const TPoint& aPoint);
       
   184     
       
   185     /**
       
   186      * Handle pointer move event
       
   187      *
       
   188      * @since S60 V4.0
       
   189      * @param aPoint The point position relative the layout
       
   190      * @return The control which handles the event.     
       
   191      */                  
       
   192     IMPORT_C virtual CFepUiBaseCtrl* HandlePointerMoveEventL(const TPoint& aPoint);
       
   193     
       
   194     /**
       
   195      * Handle pointer up event
       
   196      *
       
   197      * @since S60 V4.0
       
   198      * @param aPoint The point position relative the layout
       
   199      * @return The control which handles the event.     
       
   200      */                  
       
   201     IMPORT_C virtual CFepUiBaseCtrl* HandlePointerUpEventL(const TPoint& aPoint);
       
   202     
       
   203 private:
       
   204     /**
       
   205      * Draw a choice list item by index.
       
   206      *
       
   207      * @since S60 V4.0
       
   208      * @param aIndex The index of item to draw.
       
   209      * @param aErase ETrue, draw background 
       
   210                      EFalse, don't draw background
       
   211      * @return None.     
       
   212      */                  
       
   213 //    void DrawItem(TInt aIndex, TBool aErase);
       
   214 
       
   215     /**
       
   216      * Draw a choice list item.
       
   217      *
       
   218      * @since S60 V4.0
       
   219      * @param aRect The position of the item.
       
   220      * @param aItem The item to draw.
       
   221      * @param aFocus Whether the item is focused or not
       
   222      * @param aErase ETrue, draw background 
       
   223                      EFalse, don't draw background
       
   224      * @return None.     
       
   225      */                  
       
   226   //  void DrawItem(const TRect& aRect, const CFepLayoutChoiceList::SItem& aItem, 
       
   227     //              TBool aErase, TBool aFocus);
       
   228 
       
   229     /**
       
   230      * Draw choice list background
       
   231      *
       
   232      * @since S60 V4.0
       
   233      * @param aRect The area to draw
       
   234      * @param aDrawBorder ETrue, draw border 
       
   235                           EFalse, don't draw border
       
   236      * @return None.     
       
   237      */                  
       
   238     //void DrawChoiceListBackground(const TRect& aRect);//, TBool aDrawBorder = ETrue);
       
   239 
       
   240     /**
       
   241      * Report event to observer
       
   242      *
       
   243      * @since S60 V4.0
       
   244      * @param aEvent Event to report
       
   245      * @return None.      
       
   246      */                  
       
   247    // void ReportChoiceEvent(CFepLayoutChoiceList::SEvent& aEvent);
       
   248 
       
   249     /**
       
   250      * Choice list draw function
       
   251      *
       
   252      * @since S60 V4.0
       
   253      * @return None.     
       
   254      */
       
   255     IMPORT_C void Draw();
       
   256 
       
   257     /**
       
   258      * Prepare display.
       
   259      *
       
   260      * @since S60 V4.0
       
   261      * @return None.     
       
   262      */
       
   263     IMPORT_C void OnDisplay(const TPoint& aOffset);
       
   264     
       
   265     IMPORT_C TBool ScrollbarVisible();
       
   266     /**
       
   267      * Calculate rect based on item count.
       
   268      *
       
   269      * @since S60 V4.0
       
   270      * @return None.     
       
   271      */
       
   272     IMPORT_C void ReCalcLayout();
       
   273     
       
   274     IMPORT_C TInt MinItemWidthInPixels();
       
   275 private:
       
   276     /**
       
   277      * Adjust the txt which is appended to column list.
       
   278      * As we use column list there, we need insert "\t" to the txt in order to
       
   279      * display the txt.          
       
   280      *
       
   281      * @since S60 V5.0
       
   282      * @param aTxt The text to be added.
       
   283      * @return The txt after insert "\t" to the header.     
       
   284      */
       
   285     const TDesC& AdjustColumnText(const TDesC& aTxt);
       
   286     
       
   287     void UpdateControlContext();
       
   288     void UpdateTextColors();
       
   289     void RemoveItemByIndexL(TInt aIndex);
       
   290 private:
       
   291 
       
   292     //CAknChoiceListPopup* iListBoxCtrl;
       
   293     //CAknSingleStyleListBox* iListBox; 
       
   294     CAknSinglePopupMenuStyleListBox* iListBox;
       
   295     CCoeControl* iParent;  
       
   296     //There must be a seperate scrollbar control to handle scroll bar pointer event.
       
   297     //because pointer event is sent to RWindow directly.
       
   298     CFepUiBaseCtrl* iScrollbarCtrl;
       
   299     
       
   300     TBool iScrollbarCaptured;
       
   301     
       
   302     //buffer used to insert '\t' to the colum list box
       
   303     HBufC* iTxtTransferBuf;
       
   304     
       
   305     CAknsFrameBackgroundControlContext* iBgContext;        
       
   306     };
       
   307 #endif //C_AKN_FEPLAYOUTCHOICELIST_H
       
   308 //End Of File