epoc32/include/mw/eiklbx.h
author William Roberts <williamr@symbian.org>
Tue, 16 Mar 2010 16:12:26 +0000
branchSymbian2
changeset 2 2fe1408b6811
parent 1 666f914201fb
child 4 837f303aceeb
permissions -rw-r--r--
Final list of Symbian^2 public API header files
     1 /*
     2 * Copyright (c) 1997-2009 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 the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members
     6 * which accompanies this distribution, and is available
     7 * at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
     8 *
     9 * Initial Contributors:
    10 * Nokia Corporation - initial contribution.
    11 *
    12 * Contributors:
    13 *
    14 * Description:  Base class for an on-screen list box control from
    15 *               which one or more items can be selected.
    16 *
    17 */
    18    
    19 #ifndef __EIKLBX_H__
    20 #define __EIKLBX_H__
    21 
    22 //  INCLUDES 
    23 #include <gdi.h>
    24 #include <eikbctrl.h>
    25 #include <eiklbo.h>
    26 #include <eiksbfrm.h>
    27 #include <eiklbm.h>
    28 #include <eiklbv.h>
    29 #include <gulbordr.h>
    30 #include <eiklbed.h>
    31 #include <gulutil.h>
    32 #include <lafpublc.h>
    33 
    34 //  FORWARD DECLARATIONS
    35 enum TKeyCode;
    36 class RIncrMatcherBase;
    37 class CListItemDrawer;
    38 class CEikScrollBarFrame;
    39 class CEikButtonBase;
    40 class CMatchBuffer;
    41 class CListBoxExt;
    42 class CEikListBox;
    43 
    44 //  CLASS DECLARATION
    45 
    46 /**
    47 * Item change observer will be notified when list box items have been added or
    48 * removed or the list box has been reset. Observers can be added and removed by
    49 * using @c CEikListBox methods @c AddItemChangeObserverL() and
    50 * @c RemoveItemChangeObserver().
    51 *
    52 * @since 3.0
    53 */
    54 class MListBoxItemChangeObserver
    55     {
    56     public:
    57         /**
    58          * Notification and handling of a list box item change.
    59          *
    60          * @param aListBox The source list box of this message.
    61          */
    62         virtual void ListBoxItemsChanged(CEikListBox* aListBox) = 0;
    63     };
    64 
    65 
    66 /**
    67 * Item selection (marking) observer is used to let application control item marking
    68 * (in markable lists). Observers can be added and removed by using
    69 * @c CEikListBox methods @c AddSelectionObserverL() and
    70 * @c RemoveSelectionObserver().
    71 *
    72 * @since 3.2
    73 */
    74 class MListBoxSelectionObserver
    75     {
    76     public:
    77         /**
    78          * Notification of entering and leaving marking mode. Marking mode
    79          * is enabled by long pressing shift, ctrl or hash keys (when hash key marking is enabled).
    80          *
    81          * @param aListBox The source list box of this message.
    82          * @param aSelectionModeEnabled ETrue, when entering selection (marking) mode.
    83          */
    84         virtual void SelectionModeChanged(CEikListBox* aListBox, TBool aSelectionModeEnabled) = 0;
    85     };
    86 
    87 
    88 // CLASS DECLARATION
    89     
    90 /**
    91  * Base class for an on-screen list box control from which one or more items 
    92  * can be selected.
    93  *
    94  * @c CEikListBox implements the basics of a list box. It has a scroll bar 
    95  * frame, an item drawer, and a model, and reports events to a list box 
    96  * observer.
    97  * 
    98  * List boxes display a number of items within a scrolling frame; the items 
    99  * in a list box which are visible at one time are represented by a list 
   100  * box view. 
   101  * 
   102  * Writing derived classes: 
   103  * 
   104  * This class may be derived from to provide specialisations of the basic 
   105  * list box behaviour. It is usual when subclassing CEikListBox to also 
   106  * provide specialisations of CListItemDrawer and CListBoxView for 
   107  * representing the data of such a list box effectively
   108  */
   109 class CEikListBox : public CEikBorderedControl, public MEikScrollBarObserver
   110     {
   111 
   112 public:
   113 
   114     friend class CListBoxExt;
   115 
   116 public:
   117 
   118     /**
   119     * Construction flags.
   120     */
   121     enum TFlags
   122         {
   123         
   124         /**
   125          * Construction flag for a list box from which the user can
   126          * select multiple items.
   127          */
   128         EMultipleSelection          = SLafListBox::EMultipleSelection,
   129         
   130         /**
   131          * Construction flag for disabling extended selection. 
   132          * If this is set the user cannot select multiple items by
   133          * using @c SHIFT button.
   134          */
   135         ENoExtendedSelection        = SLafListBox::ENoExtendedSelection,
   136         
   137         /**
   138          * Construction flag that sets the list box to match user’s keystrokes 
   139          * incrementally.
   140          */
   141         EIncrementalMatching        = SLafListBox::EIncrementalMatching,
   142         
   143         /**
   144          * Construction flag for setting the list box as a pop-out list box. 
   145          * Pop-out list boxes handle certain keystrokes and events differently.
   146          */
   147         EPopout                     = SLafListBox::EPopout,
   148 
   149         /**
   150          * Construction flag that enables the indication of pointer press 
   151          * inside the view of the list box.
   152          */
   153         ELeftDownInViewRect         = SLafListBox::ELeftDownInViewRect,
   154         
   155         /**
   156          * Construction flag for enabling @c CEiklist box item double click 
   157          * indication.
   158          */
   159         EItemDoubleClicked          = SLafListBox::EItemDoubleClicked,
   160                 
   161         /**
   162          * Construction flag for removing the ownership of the supplied list box
   163          * model from the @c CEikListBox so that the list box model will not be 
   164          * deleted with the @c CEikListBoxes destruction.
   165          */
   166         EKeepModel                  = SLafListBox::EKeepModel,
   167         
   168         /**
   169          * Construction flag for excluding the scroll bar.
   170          * If the flag is set the scroll bas is drawn ouside the window that 
   171          * describes the scroll bars extent.
   172          */
   173         EScrollBarSizeExcluded      = SLafListBox::EScrollBarSizeExcluded,
   174 
   175         /**
   176          * Construction flag for enabling @c CEikListBox change indication.
   177          */
   178         EStateChanged               = SLafListBox::EStateChanged,
   179 
   180         /**
   181          * Construction flag that indicates that the list box should be created 
   182          * to its own window.
   183          */
   184         ECreateOwnWindow            = SLafListBox::ECreateOwnWindow,
   185 
   186         /**
   187          * Construction flag for disabling key matching.
   188          */
   189         ENoFirstLetterMatching      = SLafListBox::ENoFirstLetterMatching,
   190 
   191         /**
   192          * Construction flag for enabling painting of selected items.
   193          */
   194         EPaintedSelection           = SLafListBox::EPaintedSelection ,
   195 
   196         /**
   197          * Construction flag for enabling loop scrolling in which the list box 
   198          * jumps from the last item to the first item.
   199          */
   200         ELoopScrolling = 0x1000,
   201 
   202         /**
   203          * Construction flag for enabling @c Avkon multiselection list.
   204          */
   205         EEnterMarks = 0x2000,       // Avkon multiselection list
   206 
   207         /**
   208          * Construction flag for enabling Avkon markable list which enables the 
   209          * marking of several items from the list. 
   210          */
   211         EShiftEnterMarks = 0x4000,  // Avkon markable list
   212 
   213         /**
   214          * Construction flag that combines @c EPageAtOnceScrolling and 
   215          * @c EDisableHighlight flags
   216          */
   217         EViewerFlag = 0x8000,       // combined the two flags to fit to WORD.
   218 
   219         /**
   220          * Construction flag for enabling scrolling at a page per time so that 
   221          * the whole list box page is scrolled to the next. 
   222          */
   223         EPageAtOnceScrolling = 0x8000, // Avkon viewers
   224 
   225         /**
   226          * Construction flag for disabling the highlighting of the selected item.
   227          */
   228         EDisableHighlight = 0x8000,  // Avkon viewers       
   229 
   230         /**
   231          * Construction flag for enabling S60 style selection of multiple items 
   232          * from the list box.
   233          */
   234         ES60StyleMultiselection     = SLafListBox::ES60StyleMultiselection,   
   235         
   236         /**
   237          * Construction flag for enabling S60 style markable items.
   238          */
   239         ES60StyleMarkable           = SLafListBox::ES60StyleMarkable
   240         };
   241     enum {KEikMaxMatchingBufferLength = 2};
   242 
   243     /** 
   244      * Indicates who owns the scroll bar.
   245      */ 
   246     enum TScrollBarOwnerShip
   247         {
   248         /**
   249          * Indicates that the scrollbar is not owned by an external class.
   250          */
   251         ENotOwnedExternally=0x0000,
   252         /**
   253          * Indicates that the scrollbar is owned by an external class.
   254          */
   255         EOwnedExternally   =0x0001
   256         };
   257 
   258 protected:
   259 
   260     /**
   261      * Used for indicating the reason why the item lost focus.
   262      */
   263     enum TReasonForFocusLost
   264         { 
   265         /**
   266          * Focus has been lost from the list box to an external control.
   267          */
   268         EFocusLostToExternalControl, 
   269         /**
   270          * Focus has been moved from the list box to an internal editor.
   271          */
   272         EFocusLostToInternalEditor 
   273         };
   274 
   275 public:
   276     /**
   277      * Destructor.
   278      */
   279     IMPORT_C ~CEikListBox();
   280 
   281     /**
   282      * C++ default constructor.
   283      */
   284     IMPORT_C CEikListBox();
   285     /**
   286      * Handles 2nd phase construction.
   287      * 
   288      * Sets list box model and list item drawer. Request another @c ConstructL 
   289      * to handle @c aParent and @c aFlags. 
   290      *
   291      * @param aListBoxModel List box model that is to be used with the list box.
   292      * @param aListItemDrawer List item drawer that is to be used with the 
   293      *        list box.
   294      * @param aParent Host @c CoeControl for the list box.
   295      * @param aFlags Construction flags (@c TFlags) for the list box.
   296      */
   297     IMPORT_C void ConstructL(MListBoxModel* aListBoxModel,
   298                              CListItemDrawer* aListItemDrawer,
   299                              const CCoeControl* aParent,
   300                              TInt aFlags = 0);
   301     
   302     /**
   303      * Handles 2nd phase construction.
   304      *
   305      *
   306      * Sets the border that is to be drawn outside the list box. Request another 
   307      * @c ConstructL to handle list box model, list item drawer, @c aParent 
   308      * and @c aFlags. 
   309      *
   310      * @param aListBoxModel List box model that is to be used with the list box.
   311      * @param aListItemDrawer List item drawer that is to be used with the 
   312      *        list box.
   313      * @param aParent Host @c CoeControl for the list box.
   314      * @param aBorder Border to be drawn outside the list box.
   315      * @param aFlags Construction flags (@c TFlags) for the list box.
   316      */
   317     IMPORT_C void ConstructL(MListBoxModel* aListBoxModel,
   318                              CListItemDrawer* aListItemDrawer,
   319                              const CCoeControl* aParent, 
   320                              TGulBorder aBorder, 
   321                              TInt aFlags = 0);
   322     /**
   323      * Informs the @c CEikListbox of a key press.
   324      *
   325      * @param aKeyEvent Details of the key event that is being handled.
   326      * @param aType Defines what kind of key event is being handled e.g. 
   327      *        @c EEventKeyUp.
   328      * @return @c EKeyWasConsumed if the key was handled by the method.
   329      *         @c EKeyWasNotConsumed if the key was not handled.
   330      */
   331     IMPORT_C virtual TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent,
   332                                                  TEventCode aType);
   333     
   334     /**
   335      * Handling of pointer event within the @c CEikListBox. 
   336      * Used for e.g. selecting an item from the list box.
   337      *
   338      * @param aPointerEvent Details of the pointer event that is being handled.
   339      */
   340     IMPORT_C virtual void HandlePointerEventL(
   341                             const TPointerEvent& aPointerEvent);
   342     
   343     /**
   344      * Creates an own window for the list box or draws the list box to an old 
   345      * window defined by the @c aContainer.
   346      *
   347      * @param aContainer Defines the container where the list box will be drawn.
   348      */
   349     IMPORT_C virtual void SetContainerWindowL(const CCoeControl& aContainer);
   350     
   351     /**
   352      * Checks the minimum size needed for the list box.
   353      *
   354      * @return The two dimensional minimum size for the list box.
   355      */
   356     IMPORT_C virtual TSize MinimumSize();
   357     
   358     /**
   359      * This function sets a flag within the control which indicates 
   360      * whether or not the control is dimmed (greyed out). 
   361      *
   362      * @param aDimmed @c ETrue dimmed. @c EFalse not dimmed.
   363      */
   364     IMPORT_C virtual void SetDimmed(TBool aDimmed);
   365 
   366     /**
   367      * Used for scrolling through the items in the list box. 
   368      *
   369      * @param aScrollBar Scroll bar for the list box.
   370      * @param aEventType Type of the event that occured.
   371      */
   372     IMPORT_C virtual void HandleScrollEventL(CEikScrollBar* aScrollBar, 
   373                                              TEikScrollEvent aEventType);
   374 
   375     // model/view access functions 
   376     /**
   377      * Gets the list box data model.
   378      *
   379      * @return Interface to the list box data model.
   380      */
   381     IMPORT_C MListBoxModel* Model() const;
   382 
   383     /**
   384      * Gets the list box view.
   385      *
   386      * @return Interface to the list box view.
   387      */
   388     IMPORT_C CListBoxView* View() const;
   389 
   390     // functions for accessing top/current/bottom item index
   391     /**
   392      * Gets the index number of the top item.
   393      *
   394      * @return Index number for the top item.
   395      */
   396     IMPORT_C TInt TopItemIndex() const;
   397     
   398     /**
   399      * Sets the selected item to be the top item.
   400      *
   401      * @param aItemIndex Index for the item to be set as the top item.
   402      */
   403     IMPORT_C virtual void SetTopItemIndex(TInt aItemIndex) const;
   404     
   405     /**
   406      * Gets for the bottom items index.
   407      *
   408      * @return Index for the bottom item.
   409      */
   410     IMPORT_C TInt BottomItemIndex() const;
   411     
   412     /**
   413      * Gets the index number of the selected item.
   414      *
   415      * @return Index of the selected item.
   416      */
   417     IMPORT_C TInt CurrentItemIndex() const;   
   418     
   419     /**
   420      * Changes the current item index to the selected item index. Does not
   421      * redraw the list. If the item was not previously visible it is set to the 
   422      * top item in the view.
   423      *
   424      * @param aItemIndex Defines the index of the selected item.
   425      */
   426     IMPORT_C void SetCurrentItemIndex(TInt aItemIndex) const;
   427     
   428     /**
   429      * Changes the current item index to the selected item index and 
   430      * redraws the view.
   431      *
   432      * @param aItemIndex Defines the index of the selected item.
   433      */
   434     IMPORT_C void SetCurrentItemIndexAndDraw(TInt aItemIndex) const;
   435 
   436     // functions for dealing with the selection state
   437     /**
   438      * Gets for list boxes selection indexes.
   439      *
   440      * @return Pointer to the list boxes in array of selection indexes.
   441      */
   442     IMPORT_C const CListBoxView::CSelectionIndexArray* SelectionIndexes() const;
   443     
   444     /**
   445      * Assigns a array of selection indexes for the list box.
   446      *
   447      * @param aArrayOfSelectionIndexes The index array that is to be assigned 
   448      *        to the list Box.
   449      */
   450     IMPORT_C void SetSelectionIndexesL(
   451                 CListBoxView::CSelectionIndexArray* aArrayOfSelectionIndexes);
   452     
   453     /**
   454      * Clears the selection from the view.
   455      */
   456     IMPORT_C void ClearSelection(); 
   457 
   458     // Functions for updating a list box's internal state after its model has
   459     // been updated, all of them will emit item change event to item change
   460     // observers.
   461     /**
   462      * Handles the addition of item to the list box.
   463      */
   464     IMPORT_C void HandleItemAdditionL();
   465     
   466     /**
   467      * Handles the removal of an item from the list box.
   468      */
   469     IMPORT_C void HandleItemRemovalL();
   470 
   471     /**
   472      * Handles the addition of new items to the list box and updates 
   473      * selection indexes array.
   474      *
   475      * NOTE. This algorithm can not handle position of the list highlight
   476      * nor can it update the top item index correctly.
   477      *
   478      * @param aArrayOfNewIndexesAfterAddition Array of new indexes to be added.
   479      */
   480     IMPORT_C void HandleItemAdditionL(
   481                     CArrayFix<TInt> &aArrayOfNewIndexesAfterAddition);
   482     
   483     /**
   484      * Handles the removal of items to the list box and updates 
   485      * selection indexes array.
   486      *
   487      * NOTE. This algorithm cannot handle position of the list highlight
   488      * nor can it update the top item index correctly.
   489      *
   490      * @param aArrayOfOldIndexesBeforeRemoval Array of indexes to be removed.
   491      */
   492     IMPORT_C void HandleItemRemovalL(
   493                     CArrayFix<TInt> &aArrayOfOldIndexesBeforeRemoval);
   494     
   495     /**
   496      * Deletes the item editor
   497      */
   498     IMPORT_C void Reset();
   499 
   500     /**
   501     * Adds an item change observer to the listbox. Duplicates are not checked
   502     * (i.e. adding the same observer multiple times is not prevented).
   503     *
   504     * @since 3.0
   505     * @param aObserver Must be non-NULL.
   506     */
   507     IMPORT_C void AddItemChangeObserverL( MListBoxItemChangeObserver* aObserver );
   508     /**
   509     * Removes an item change observer from the listbox.
   510     *
   511     * @since 3.0
   512     * @param aObserver The observer to be removed.
   513     * @return ETrue if removal ok, EFalse if observer was not removed (not
   514     *         found from the list of observers).
   515     */
   516     IMPORT_C TBool RemoveItemChangeObserver( MListBoxItemChangeObserver* aObserver );
   517 
   518     // functions for accessing the item height
   519     /**
   520      * Sets the height of the item to the selected value.
   521      * 
   522      * @param aHeight New height for the item.
   523      */
   524     IMPORT_C virtual void SetItemHeightL(TInt aHeight);
   525     
   526     /**
   527      * Gets height of the item.
   528      *
   529      * @return Height of the item.
   530      */
   531     IMPORT_C TInt ItemHeight() const;
   532 
   533     // functions for scrollbars
   534     /**
   535      * Creates a scrollbar frame.
   536      *
   537      * @param  aPreAlloc Boolean defining if there should be initial 
   538      *         memory allocations.
   539      * @return The new scroll bar frame.
   540      */
   541     IMPORT_C CEikScrollBarFrame* CreateScrollBarFrameL(TBool aPreAlloc=EFalse);
   542 
   543     /**
   544      * Sets the given scroll bar frame for the list box with the given 
   545      * ownership leve.
   546      *
   547      * @param aScrollBarFrame The new frame that is going to be used.
   548      * @param aOwnerShip Ownership level of the scroll bar frame.
   549      */
   550     IMPORT_C void SetScrollBarFrame(CEikScrollBarFrame* aScrollBarFrame, TScrollBarOwnerShip aOwnerShip);
   551 
   552     /**
   553      * Gets pointer for the scroll bar frame.
   554      *
   555      * @return Pointer to the scroll bar frame.
   556      */
   557     IMPORT_C CEikScrollBarFrame* const ScrollBarFrame();
   558 
   559     /**
   560      * Updates all scroll bars.
   561      */
   562     IMPORT_C virtual void UpdateScrollBarsL();
   563 
   564     // construction support functions
   565     /**
   566      * Gets the size of the rectangle required to display a pop out.
   567      * 
   568      * @param aTargetItemIndex The item from which the popout originates.
   569      * @param aTargetYPos Vertical position of the item from which the popout 
   570      *        originates.
   571      * @param aListBoxRect The list box rectangle.
   572      * @param aMinHeightInNumOfItems The minimum number of items for the popout.
   573      */
   574     IMPORT_C void CalculatePopoutRect( TInt aTargetItemIndex,
   575                                        TInt aTargetYPos,
   576                                        TRect& aListBoxRect,
   577                                        TInt aMinHeightInNumOfItems = 1 );
   578     /**
   579      * Gets the size of the list box in pixels based on the height of 
   580      * the list box in items and the length of the items in characters.
   581      *
   582      * Returns @c TSize element consisting of two elements, the height 
   583      * and the width. Height is the number of items times the height 
   584      * of the font in pixels. Width is the number of characters in a 
   585      * single line times the width of the font in pixels. 
   586      *
   587      * @param aWidthAsNumOfChars Width of list box in characters.
   588      * @param aHeightAsNumOfItems Height of list box in characters.
   589      * @return The size of the list box in pixels as TSize.
   590      */
   591     IMPORT_C TSize CalcSizeInPixels(TInt aWidthAsNumOfChars, 
   592                                     TInt aHeightAsNumOfItems) const;
   593 
   594     /**
   595      * Gets the width of the list box in pixels based on the width of the list 
   596      * box in characters.
   597      *
   598      * Returns the number of characters times the width of a character 
   599      * in pixels. 
   600      *
   601      * @param aNumOfChars The number of characters.
   602      * @return The width of the list box in pixels.
   603      */
   604     IMPORT_C TInt CalcWidthBasedOnNumOfChars(TInt aNumOfChars) const;
   605     
   606     /**
   607      * Gets the height of the list box in pixels based on the width of the 
   608      * list box in characters.
   609      *
   610      * Returns the number of items times the height of the font in pixels.
   611      *
   612      * @param aNumOfItems The number of items.
   613      * @return The height of the list box in pixels.
   614      */
   615     IMPORT_C TInt CalcHeightBasedOnNumOfItems(TInt aNumOfItems) const;
   616     
   617     /**
   618      * Gets the width of the list box in pixels based on the width of the 
   619      * list box text in pixels.
   620      *
   621      * returns the width of the whole list box in pixels, which includes 
   622      * the text width and the width of elements in the list box that have
   623      * an effect on the overall width.
   624      *
   625      * @param aTextWidthInPixels Width of list box text in pixels.
   626      * @return Required width of whole list box in pixels.
   627      */
   628     IMPORT_C TInt CalcWidthBasedOnRequiredItemWidth(
   629                                 TInt aTextWidthInPixels) const;
   630 
   631     // drawing/scrolling functions
   632     /**
   633      * Draws a list box item, first scrolling the list to make it visible 
   634      * if it is not already. 
   635      *
   636      * @c DrawItem() panics if there is no list box view currently set.
   637      * @param aItemIndex Index of the item to reveal.
   638      */
   639     IMPORT_C void DrawItem(TInt aItemIndex) const;
   640 
   641     /**
   642      * Makes an item visible in the list, scrolling it if necessary.
   643      *
   644      * @param aItemIndex Index of the item to reveal.
   645      */
   646     IMPORT_C void ScrollToMakeItemVisible(TInt aItemIndex) const;
   647 
   648     /**
   649     * Redraws list item.
   650     * @param aItemIndex index of item to be redrawn.
   651     * @since 3.2
   652     */
   653     IMPORT_C void RedrawItem( TInt aItemIndex );
   654 
   655     // observer support
   656     /**
   657      * Sets the observer for the list box.
   658      *
   659      * @param aObserver Wanted observer for the list box.
   660      */
   661     IMPORT_C void SetListBoxObserver(MEikListBoxObserver* aObserver);
   662 
   663     
   664     /**
   665      * Gets the size of the vertical gap between items. This space is used 
   666      * by the view to allow a box to be drawn around each item.
   667      *
   668      * @return Size of the vertical gap in pixels.
   669      */
   670     IMPORT_C TInt VerticalInterItemGap() const;
   671 
   672     // popouts only
   673     /**
   674      * Provides a call back mechanism to the button which just launched a 
   675      * popout menu.
   676      *
   677      * @param aButton The button which just launched a popout menu.
   678      */
   679     IMPORT_C void SetLaunchingButton(CEikButtonBase* aButton);
   680 
   681     // Editing support
   682     /**
   683      * Selects an item editor for the list box.
   684      *
   685      * @param aEditor The editor that has been selected for usage.
   686      */
   687     IMPORT_C void SetItemEditor(MEikListBoxEditor* aEditor);
   688     
   689     /**
   690      * Resets the list boxes item editor.
   691      */
   692     IMPORT_C void ResetItemEditor();
   693     /**
   694      * Gets item editor for the current class.
   695      *
   696      * @return The item editor used by the list box class.
   697      */
   698     IMPORT_C MEikListBoxEditor* ItemEditor();
   699     
   700     /**
   701      * Creates an item editor and starts editing the current item.
   702      *
   703      * The editor can edit the current item up to a maximum length of 
   704      * @c aMaxLength characters. Also reports an @c EEventEditingStarted event 
   705      * to any list box observer by default.
   706      *
   707      * The function only creates a new editor if one does not already exist.
   708      *
   709      * @param aMaxLength Maximum length of characters to edit.
   710      */
   711     IMPORT_C virtual void EditItemL(TInt aMaxLength);
   712     
   713     /**
   714      * Stops editing and deletes the item editor. 
   715      *
   716      * The function reports an @c EEventEditingStopped event to any list box 
   717      * observer, and updates the list box model if @c aUpdateModel is @c ETrue.
   718      *
   719      * @param aUpdateModel If @c ETrue the list box model is updated.
   720      */
   721     IMPORT_C void StopEditingL(TBool aUpdateModel);
   722 
   723     // functions needed for Avkon shortcuts, 
   724     // passing information from one list to another
   725 
   726     /**
   727      * No Implementation.
   728      *
   729      * @return Always returns 0.
   730      */
   731     IMPORT_C virtual TInt ShortcutValueForNextList();
   732     
   733     /**
   734      * No Implementation.
   735      *
   736      * @param aValue Not Used.
   737      */
   738     IMPORT_C virtual void SetShortcutValueFromPrevList(TInt aValue);
   739 
   740     // pop-up positioning support
   741     /**
   742      * Gets the position and the size of the list box.
   743      *
   744      * @return A rectangle with the correct position data as 
   745      *         well as size data for the list box.
   746      */
   747     IMPORT_C TRect HighlightRect() const;
   748     
   749     /**
   750      * Checks whether background drawing is suppressed on item level i.e. each
   751 	 *  list item doesn't draw its background.
   752 	 *
   753 	 * @since S60 5.0
   754 	 * @return ETrue if background drawing is suppressed.
   755      */
   756      IMPORT_C TBool BackgroundDrawingSuppressed() const;
   757 
   758 public: // from CCoeControl
   759 
   760     /**
   761      * From @c CCoeControl
   762      *
   763      * Gets the list of logical colours employed in the drawing of the control, 
   764      * paired with an explanation of how they are used. Appends the list to 
   765      * @c aColorUseList.
   766      *
   767      * @param aColorUseList List of logical colours.
   768      */
   769     IMPORT_C virtual void GetColorUseListL(
   770                         CArrayFix<TCoeColorUse>& aColorUseList) const; 
   771                         // not available before Release 005u
   772     
   773     /**
   774      * From @c CCoeControl
   775      *
   776      * Handles a change to the list box’s resources of type @c aType which are 
   777      * shared across the environment, colours or fonts for example.
   778      *
   779      * @param aType The type of resources that have changed.
   780      */
   781     IMPORT_C virtual void HandleResourceChange(TInt aType);         
   782                 // not available before Release 005u
   783     
   784     /**
   785      * From @c CCoeControl
   786      *
   787      * Sets the control as ready to be drawn.
   788      *
   789      * The application should call this function on all controls that are not 
   790      * components in a compound control.
   791      *
   792      * The purpose of this function is that controls are not always ready to 
   793      * be drawn as soon as they have been constructed. For example, it may 
   794      * not be possible to set the control's extent during construction, but 
   795      * its extent should always be set before it is drawn. Similarly, if a 
   796      * control is to be made  invisible, this should be done before it is 
   797      * activated.
   798      * 
   799      * The default implementation sets a flag in the control to indicate it is 
   800      * ready to be drawn. If the control is a compound control, the default 
   801      * implementation also calls @c ActivateL() for all the control's components. 
   802      * To get the control's components it uses @c CountComponentControls() and 
   803      * @c ComponentControl(), which should be implemented by the compound control.
   804      * 
   805      * @c ActivateL() is typically called from the control's @c ConstructL() 
   806      * function.
   807      *
   808      * Notes:
   809      *
   810      * This function can be overridden. This is useful for doing late 
   811      * initialisation of the control, using information that was not available 
   812      * at the time the control was created. For example, a text editor might 
   813      * override @c ActivateL() and use it to enquire whether it is focused: if 
   814      * it is, it makes the cursor and any highlighting visible. At the time when 
   815      * the editor is created, it doesn't know whether or not it has keyboard 
   816      * focus.
   817      *
   818      * If overriding @c ActivateL(), the implementation must include a base 
   819      * call to @c CCoeControl's @c ActivateL(). 
   820      */
   821     IMPORT_C virtual void ActivateL();
   822     
   823     /**
   824      * From @c CCoeControl.
   825      *
   826      * Gets the input capabilities of the control and all its components.
   827      *
   828      * @return The input capabilities of the control.
   829      */
   830     IMPORT_C TCoeInputCapabilities InputCapabilities() const;
   831 
   832 private:
   833     /**
   834     * From CAknControl
   835     */
   836     IMPORT_C void* ExtensionInterface( TUid aInterface );
   837 
   838 protected:
   839     // Shortcuts need access to Incremental matching
   840     // The shortcuts will be used inside OfferkeyEventL().
   841     friend class AknListBoxShortCutsImplementation;
   842     // Avkon layout uses SetVerticalMargin, which is protected.
   843     friend class AknListBoxLayouts;
   844 
   845     /**
   846      * Responds to a change in focus.
   847      *
   848      * This is called whenever the control gains or loses focus, 
   849      * as a result of a call to @c SetFocus(). A typical use of 
   850      * @c FocusChanged() is to change the appearance of the control, 
   851      * for example by drawing a focus rectangle around it.
   852      *
   853      * The default implementation is empty, and should be 
   854      * overridden by the @c CCoeControl-derived class.
   855      *
   856      * @param aDrawNow Contains the value that was passed to it 
   857      *        by @c SetFocus().
   858      */
   859     IMPORT_C virtual void FocusChanged(TDrawNow aDrawNow);
   860     
   861     /**
   862      * Responds to changes to the size and position of the contents 
   863      * of this control.
   864      * 
   865      * For a simple control this might include text or graphics. 
   866      * For a compound control it sets the size and position of the 
   867      * components. It has an empty default implementation and should 
   868      * be implemented by the CCoeControl-derived class.
   869      *
   870      * The function is called whenever @c SetExtent(), @c SetSize(), 
   871      * @c SetRect(), @c SetCornerAndSize(), or @c SetExtentToWholeScreen() 
   872      * are called on the control. Note that the window server does not 
   873      * generate size-changed events: @c SizeChanged() gets called only as 
   874      * a result of calling the functions listed above. Therefore, if a 
   875      * resize of one control affects the size of other controls, it is 
   876      * up to the application to ensure that it handles the re-sizing 
   877      * of all affected controls. 
   878      */
   879     IMPORT_C virtual void SizeChanged();
   880 
   881     /**
   882      * Handles the change in case that the size of the view rectangle
   883      * for the list box changes.
   884      */
   885     IMPORT_C virtual void HandleViewRectSizeChangeL();
   886     
   887     /**
   888      * Gets the number of controls contained in a compound control.
   889      *
   890      * There are two ways to implement a compound control. One way is to
   891      * override this function. The other way is to use the @c CCoeControlArray
   892      * functionality (see the @c InitComponentArrayL method).
   893      *
   894      * @return The number of component controls contained by this control.
   895      */
   896     IMPORT_C virtual TInt CountComponentControls() const;
   897     
   898     /**
   899      * Gets an indexed component of a compound control.
   900      *
   901      * There are two ways to implement a compound control. One way is to 
   902      * override this function. The other way is to use the @c CCoeControlArray 
   903      * functionality (see the @c InitComponentArrayL method).
   904      *
   905      * Note: Within a compound control each component control is identified 
   906      * by an index, where the index depends on the order the controls were 
   907      * added: the first is given an index of 0, the next an index of 1, and
   908      * so on.
   909      *
   910      * @param aIndex The index of the control. 
   911      * @return The component control with an index of aIndex. 
   912      */
   913     IMPORT_C virtual CCoeControl* ComponentControl(TInt aIndex) const;
   914 
   915     // functions that implement first letter and incremental matching
   916     /**
   917      * Creates a buffer for checking how well two strings match up.
   918      */
   919     IMPORT_C void CreateMatchBufferL();  
   920 
   921     /**
   922      * Empties the match buffer .
   923      */
   924     IMPORT_C void ClearMatchBuffer() const;
   925 
   926     /**
   927      * Checks matching for the given character.
   928      *
   929      * @param aCode Character code.
   930      */
   931     IMPORT_C void MatchTypedCharL(TUint aCode);
   932 
   933     /**
   934      * Undoes changes from the match buffer that have been caused 
   935      * by the last match with a character.
   936      */
   937     IMPORT_C void UndoLastChar();
   938     /**
   939      * Checks if the last character matched with the string.
   940      *
   941      * @return @c ETrue if a match was found from the buffer with the character.
   942      */
   943     IMPORT_C TBool LastCharMatched() const;
   944 
   945     // functions needed for supporting scrollbars
   946     /**
   947      * Updates the position of this list box’s scroll bars’ thumbs to reflect 
   948      * the horizontal and vertical position of the list view within the list.
   949      */
   950     IMPORT_C virtual void UpdateScrollBarThumbs() const;
   951     
   952     /**
   953      * Get horizontal scroll granularity in pixels.
   954      * The granularity is the minimum size of a horizontal move of the client 
   955      * area.
   956      *
   957      * @return Grain size for horizontal scrolling in pixels.
   958      */
   959     IMPORT_C virtual TInt HorizScrollGranularityInPixels() const;
   960     
   961     /**
   962      * Gets the number of grains to move horizontally when a nudge button is 
   963      * tapped. 
   964      * For simple list boxes, this value is a fraction of the width of the 
   965      * client area. 
   966      *
   967      * @return Number of grains to move left or right on each nudge
   968      */
   969     IMPORT_C virtual TInt HorizontalNudgeValue() const;
   970     
   971     /**
   972      * Called by various functions of this class to ensure that the top 
   973      * item index is always a sane value. The implementation in @c CEikListBox 
   974      * tries to ensure the minimum amount of white space at the bottom of 
   975      * the list box. Note that this function does not affect the 
   976      * current item index.
   977      */
   978     IMPORT_C virtual void AdjustTopItemIndex() const;
   979 
   980     // navigation support functions
   981     /**
   982      * Simulates an arrow key event. 
   983      * 
   984      * If the list box flags include @c EMultipleSelection, this has the effect 
   985      * of pressing @c SHIFT with the arrow key represented by @c aKeyCode. 
   986      * Calls @c CEikListBox::OfferKeyEventL() with aKeyCode translated into a 
   987      * key event.
   988      *
   989      * @param aKeyCode A key code.
   990      */
   991     IMPORT_C void SimulateArrowKeyEventL(TKeyCode aKeyCode);
   992     
   993     /**
   994      * Handles a left arrow key event.
   995      *
   996      * The method used to handle the event depends on the selection mode, e.g. 
   997      * whether the user has pressed the @c SHIFT or @c CONTROL key. 
   998      *
   999      * @param aSelectionMode Not used
  1000      */
  1001     IMPORT_C virtual void HandleLeftArrowKeyL(CListBoxView::TSelectionMode aSelectionMode);
  1002     
  1003     /**
  1004      * Handles a right arrow key event.
  1005      *
  1006      * The method used to handle the event depends on the selection mode, 
  1007      * e.g. whether the user has pressed the @c SHIFT or @c CONTROL key. 
  1008      *
  1009      * @param aSelectionMode Not used.
  1010      */
  1011     IMPORT_C virtual void HandleRightArrowKeyL(CListBoxView::TSelectionMode aSelectionMode);
  1012 
  1013     // construction support functions
  1014     /**
  1015      * Restores the list box properties shared by all subclasses from a resource
  1016      * reader. This function is not called within @c CEikListBox itself, but is 
  1017      * used by subclasses which support construction from resources.
  1018      *
  1019      * @param aReader A resource reader.
  1020      */
  1021     IMPORT_C void RestoreCommonListBoxPropertiesL(TResourceReader& aReader); 
  1022 
  1023     /**
  1024      * Second-phase constructor.
  1025      *
  1026      * This protected form is overridden non-virtually by the second-phase 
  1027      * constructors of each subclass, and should be invoked by them using 
  1028      * @c CEikListBox::ConstructL().
  1029      *
  1030      * @param aParent The parent control. May be NULL. 
  1031      * @param aFlags Construction flags. 
  1032      */
  1033     IMPORT_C virtual void ConstructL(const CCoeControl* aParent, TInt aFlags = 0);
  1034     
  1035     /**
  1036      * Completes the list box view’s construction.
  1037      *
  1038      * This function is called by @c ConstructL() to complete construction 
  1039      * of the resource view, calling its @c ConstructL() with appropriate 
  1040      * arguments and assigning it to @c iView. Also prepares the view for use.
  1041      */
  1042     IMPORT_C virtual void CreateViewL();
  1043     
  1044     /**
  1045      * Creates the list box view.
  1046      *
  1047      * The function is called by @c ConstructL() to create an instance of 
  1048      * the appropriate list box view class for this list box. The returned 
  1049      * instance is owned by this object, and does not have to have its 
  1050      * second-phase constructor run. This function is called by @c CreateViewL().
  1051      *
  1052      * @return Pointer to a newly constructed list box view for this object.
  1053      */
  1054     IMPORT_C virtual CListBoxView* MakeViewClassInstanceL();
  1055     
  1056     /**
  1057      * Sets the view rectangle from the client rectangle making sure a whole 
  1058      * number of items is displayed.
  1059      * 
  1060      * @param aClientRect  The client rectangle
  1061      */
  1062     IMPORT_C void SetViewRectFromClientRect(const TRect& aClientRect);
  1063     
  1064     /**
  1065      * Calculates the client area.
  1066      *
  1067      * This method is called by various functions of this class to 
  1068      * recalculate the extent of the client area from @c iViewRect. This
  1069      * implementation takes into account any rounding of the viewing 
  1070      * rectangle made to fit a whole number of items.
  1071      *
  1072      * @param aClientRect On return contains a size for the client area 
  1073      *        in pixels.
  1074      */
  1075     IMPORT_C virtual void RestoreClientRectFromViewRect( TRect& aClientRect) const;
  1076 
  1077     /**
  1078      * Rounds down the height of the rectangle (if necessary) so that 
  1079      * only a whole number of items can be displayed inside the list box.
  1080      *
  1081      * @param aRect The rectangle to be modified. 
  1082      * @return The number of pixels reduced. 
  1083      */
  1084     IMPORT_C virtual TInt AdjustRectHeightToWholeNumberOfItems( TRect& aRect) const;
  1085 
  1086     // accessor for Laf members
  1087     /**
  1088      * Gets list box margins.
  1089      *
  1090      * @return The list box margins in pixels.
  1091      */
  1092     IMPORT_C TMargins8 ListBoxMargins() const;
  1093 
  1094     // various accessors for private data members
  1095     /**
  1096      * This function gets the horizontal margin. Use 
  1097      * @c CEikListBox::ListBoxMargins() instead, as this 
  1098      * provides a more accurate value due to the bit shifting involved.
  1099      *
  1100      * @deprecated Use @c CEikListBox::ListBoxMargins()
  1101      * @return The horizontal margin in pixels.
  1102      */
  1103     IMPORT_C TInt HorizontalMargin() const;
  1104     
  1105     /**
  1106      * This function gets the vertical margin. This function 
  1107      * is deprecated, use @c CEikListBox::ListBoxMargins() instead, 
  1108      * this provides a more accurate value due to the bit 
  1109      * shifting involved.
  1110      *
  1111      * @deprecated Use @c CEikListBox::ListBoxMargins()
  1112      * @return The vertical margin in pixels.
  1113      */
  1114     IMPORT_C TInt VerticalMargin() const;
  1115     
  1116     /**
  1117      * Sets the horizontal margin.
  1118      *
  1119      * @param aMargin The required horizontal margin.
  1120      */
  1121     IMPORT_C void SetHorizontalMargin(TInt aMargin);
  1122     
  1123     /**
  1124      * Sets the vertical margin.
  1125      *
  1126      * @param aMargin The required vertical margin.
  1127      */
  1128     IMPORT_C void SetVerticalMargin(TInt aMargin);
  1129     
  1130     /**
  1131      * Gets a pointer to the match buffer. Returns 
  1132      * NULL if the match buffer does not exist.
  1133      *
  1134      * @return Pointer to the match buffer.
  1135      */
  1136     IMPORT_C RIncrMatcherBase* MatchBuffer() const;
  1137     
  1138     /**
  1139      * Gets the view rectangle height adjustment. 
  1140      *
  1141      * These are the adjustments that were made to the 
  1142      * view rectangle when the @c SetViewRectFromClientRect() 
  1143      * function was called.
  1144      *
  1145      * @return Height adjustment.
  1146      */
  1147     IMPORT_C TInt ViewRectHeightAdjustment() const;
  1148     
  1149     /**
  1150      * Gets the background colour.
  1151      *
  1152      * @return The background colour.
  1153      */
  1154     IMPORT_C TRgb BackColor() const;
  1155     
  1156     /**
  1157      * Sets the view rectangle height adjustment. 
  1158      *
  1159      * @param aAdjustment New adjustment.
  1160      */
  1161     IMPORT_C void SetViewRectHeightAdjustment(TInt aAdjustment);
  1162 
  1163     // misc functions
  1164     
  1165     /**
  1166      * Reports a list box event to any observer of this list box. 
  1167      * This function returns immediately if no observer is set.
  1168      *
  1169      * @param aEvent The event to report.
  1170      */
  1171     IMPORT_C virtual void ReportListBoxEventL( MEikListBoxObserver::TListBoxEvent aEvent );
  1172     
  1173     /**
  1174      * Redraws the specified area of this list box into the specified rectangle.
  1175      *
  1176      * @param aRect Rectangle to be redrawn. Specified relative to the 
  1177      *        origin of this control.
  1178      */
  1179     IMPORT_C virtual void Draw(const TRect& aRect) const;
  1180     
  1181     /**
  1182      * Clears the list box margins. The list box is redrawn only if redraws 
  1183      * are enabled for the list box view.
  1184      */
  1185     IMPORT_C void ClearMargins() const;
  1186     
  1187     /**
  1188      * Sets an item as the current item, even if it is not currently 
  1189      * visible. Redraws the list box to reflect the change. This 
  1190      * should not be called from within another Draw function.
  1191      * 
  1192      * @param aItemIndex The index of the list box item to update.
  1193      */
  1194     IMPORT_C virtual void UpdateCurrentItem(TInt aItemIndex) const;
  1195     
  1196     /**
  1197      * Handles drag events.
  1198      *
  1199      * This function is called by @c HandlePointerEventL() to handle pointer 
  1200      * drag events appropriately.
  1201      *
  1202      * @param aPointerPos The position of the @c TPointerEvent for which this 
  1203      *        handler is invoked.
  1204      */
  1205     IMPORT_C virtual void HandleDragEventL(TPoint aPointerPos);
  1206     
  1207     /**
  1208      * Tests whether an item exists.
  1209      *
  1210      * @param aItemIndex Index to test. 
  1211      * @return @c ETrue if the specified item exists, EFalse otherwise.
  1212      */
  1213     IMPORT_C TBool ItemExists(TInt aItemIndex) const;
  1214     
  1215     /**
  1216      * Draws the matcher cursor in the correct location for the current match. 
  1217      * If there is no match buffer, this function returns immediately; 
  1218      * otherwise the cursor is drawn on the current item using 
  1219      * @c CListBoxView::DrawMatcherCursor() after scrolling to make the current 
  1220      * item visible.
  1221      * 
  1222      * A list box control’s matcher cursor is an on-screen cursor which is 
  1223      * drawn to indicate to the user the location of the current text. Whether 
  1224      * the cursor is drawn is dependent on the 
  1225      * @c CListBoxView::TFlags::EHasMatcherCursor flag, which may be set on the 
  1226      * list box’s view.
  1227      *
  1228      * Note, that CListBoxView::DrawMatcherCursor() is not implemented in S60. 
  1229      */
  1230     IMPORT_C void DrawMatcherCursor() const;
  1231 
  1232     /**
  1233      * Gets the vertical gap between elements in the list box. 
  1234      *
  1235      * @return The vertical gap between elements in the list box.
  1236      */
  1237     IMPORT_C static TInt InterItemGap();
  1238 
  1239     /**
  1240      * Updates the view colours in line with the colours in effect for the 
  1241      * Uikon environment. Has no effect if there is no view.
  1242      */
  1243     IMPORT_C void UpdateViewColors();
  1244 
  1245     /**
  1246      * Updates the item drawer colours in line with the colours in effect 
  1247      * for the Uikon environment. Has no effect if there is no item drawer.
  1248      */
  1249     IMPORT_C void UpdateItemDrawerColors();
  1250 
  1251     /**
  1252      * Notifies item change observers about item change. Subclasses must call
  1253      * this method if they have implemented item handling functions (e.g.
  1254      * @c HandleItemAdditionL or @c HandleItemRemovalL).
  1255      *
  1256      * @since S60 3.0
  1257      */
  1258     IMPORT_C void FireItemChange();
  1259 
  1260 
  1261 protected:	// functions which deal with extension
  1262     /**
  1263      * Sets the reason for the list box’s loss of focus.
  1264      *
  1265      * This is required so the list box can determine whether 
  1266      * loss of focus is due to an external control or an internal component.
  1267      *
  1268      * @param aReasonForFocusLost The reason for the loss of focus.
  1269      */
  1270     IMPORT_C void SetReasonForFocusLostL( TReasonForFocusLost aReasonForFocusLost );
  1271 
  1272     /**
  1273      * Gets the reason for the list box’s loss of focus.
  1274      *
  1275      * @return The reason for the loss of focus.
  1276      */
  1277     IMPORT_C TReasonForFocusLost ReasonForFocusLostL();
  1278 
  1279     /**
  1280      * Tests whether the list box match buffer exists.
  1281      *
  1282      * @return @c ETrue if the list box match buffer exists. 
  1283                @c EFalse if the list box match buffer does not exist.
  1284      */
  1285     IMPORT_C TBool IsMatchBuffer() const;
  1286 
  1287     /**
  1288      * Checks for a list box extension. Attempts to create one if not present. 
  1289      *
  1290      * This function leaves if an extension cannot be created.
  1291      */
  1292     void CheckCreateExtensionL();
  1293 
  1294     /**
  1295      * Checks for a list box extension. Creates one if not present. 
  1296      *
  1297      * @return @c ETrue if a list box extension already existed or 
  1298      *         if there was no previous extension and a new extension 
  1299      *         class was created successfully. 
  1300      *         @c EFalse if there was no previous extension and a new one 
  1301      *         could not be constructed.
  1302      */
  1303     TBool CheckCreateExtension();
  1304 
  1305     /**
  1306      * Checks the list box match buffer exists. If a buffer does not 
  1307      * exist, one is created.
  1308      */
  1309     void CheckCreateBufferL();
  1310 
  1311     /**
  1312      * Gets the list box match buffer.
  1313      *
  1314      * @return The list box match buffer.
  1315      */
  1316     CMatchBuffer* Buffer() const;
  1317 
  1318 protected:
  1319     /**
  1320      * Creates a scroll bar frame layout according to @c aLayout.
  1321      *
  1322      * @param aLayout Defines the layout.
  1323      */
  1324     IMPORT_C void CreateScrollBarFrameLayout(TEikScrollBarFrameLayout& aLayout) const;
  1325     
  1326     /**
  1327      * If MiddleSoftKey is either Mark or Unmark, this method sets MSK
  1328      * according to the current item selection state.
  1329      */
  1330     void UpdateMarkUnmarkMSKL() const;
  1331 
  1332 public:
  1333     /**
  1334      * @return Event modifiers for the @c CEikListBox.
  1335      */
  1336     IMPORT_C TInt EventModifiers();
  1337 
  1338     /* 
  1339     * Returns ETrue if list has ES60StyleMultiselection flag. 
  1340     */
  1341     IMPORT_C TBool IsMultiselection();
  1342 
  1343     /**
  1344     * Creates a scrollbar for the listbox. The caller may choose if the scrollbar is requested 
  1345     * remotely via the mop chain from parent control
  1346     *
  1347     * @param	aPreAlloc Is the scrollbar created immediately or when taking in to use
  1348     * @param	aRemote If True, the scrollbar is obtained via mop-chain from 
  1349     *           parent control. If used, the listbox only sets the scrollbar 
  1350     *           values. The scrollbar position and size must set in the parent
  1351     *           control's code.
  1352     *
  1353     * @return	CEikScrollBarFrame*	pointer to scrollbar frame object
  1354     */	
  1355     IMPORT_C CEikScrollBarFrame* CreateScrollBarFrameL(TBool aPreAlloc, TBool aRemote);
  1356 	
  1357     /**
  1358     * Creates a scrollbar for the listbox. The caller may choose if the scrollbar is requested 
  1359     * remotely via the mop chain from parent control
  1360     *
  1361     * @param    aPreAlloc Is the scrollbar created immediately or when taking in to use
  1362     * @param    aRemote If True, the scrollbar is obtained via mop-chain from 
  1363     *           parent control. If used, the listbox only sets the scrollbar 
  1364     *           values. The scrollbar position and size must set in the parent
  1365     *           control's code.
  1366     * @param    aWindowOwning Does the created scrollbar create own window or 
  1367     *           is it compound control. The listbox uses a window owning 
  1368     *           scrollbar by default.
  1369     *
  1370     * @return    CEikScrollBarFrame*    pointer to scrollbar frame object
  1371     */    
  1372     IMPORT_C CEikScrollBarFrame* CreateScrollBarFrameL(TBool aPreAlloc, TBool aRemote, TBool aWindowOwning);
  1373 
  1374     /**
  1375     * By default markable listbox has middle softkey observer, which handles
  1376     * Mark / Unmark functionality. By this method, the caller may disable default
  1377     * observer.
  1378     *
  1379     * @since S60 3.1
  1380     *
  1381     * @param    aEnable If EFalse, disables default middle softkey observer
  1382     *           for markable lists. ETrue enables observer again.
  1383     */    
  1384     IMPORT_C void EnableMSKObserver(TBool aEnable);
  1385     
  1386     /**
  1387     * Called from MSK observer when shift+MSK have been pressed
  1388     *
  1389     * @Since S60 3.1
  1390     */
  1391     void DoShiftMSKMarkingL();
  1392 
  1393     /**
  1394     * This method is only called by CEikButtonGroupContainer when MSK observer
  1395     * is enabled and CEikButtonGroupContainer is deleted.
  1396     *
  1397     * @Since S60 3.1
  1398     */
  1399     void InformMSKButtonGroupDeletion();
  1400     
  1401     /**
  1402     * Adds a selection (item marking) observer to the listbox. Duplicates are not checked
  1403     * (i.e. adding the same observer multiple times is not prevented).
  1404     *
  1405     * @since 3.2
  1406     * @param aObserver Must be non-NULL.
  1407     */
  1408     IMPORT_C void AddSelectionObserverL( MListBoxSelectionObserver* aObserver );
  1409     
  1410     /**
  1411     * Removes a selection (item marking) observer from the listbox.
  1412     *
  1413     * @since 3.2
  1414     * @param aObserver The observer to be removed.
  1415     */
  1416     IMPORT_C void RemoveSelectionObserver( MListBoxSelectionObserver* aObserver );
  1417 
  1418     /**
  1419     * This switches listbox into selection mode. Basicly only changes MSK and
  1420     * informs selection observers about the change.
  1421     *
  1422     * @since 3.2
  1423     * @param aEnable ETrue when entering into selection mode, EFalse when leaving
  1424     */
  1425     void ChangeSelectionMode(TBool aEnable);
  1426 
  1427     /**
  1428     * Sets the number of list items that form one grid line.
  1429 	*
  1430 	* @since S60 5.0
  1431 	* @param aItems Number of items in one grid line.
  1432 	*/
  1433     IMPORT_C void SetItemsInSingleLine(TInt aItems);
  1434 	
  1435     /**
  1436     * Removes pointer event filtering for list items.
  1437     *
  1438     * When there are two pointer up events on the same item at short interval, 
  1439     * listbox will only get the first one and drop the second one. This method forces listbox to handle all pointer up events.
  1440     *
  1441     * @since S60 5.0
  1442     *
  1443     * @param aItemIndexes Array of item indexes to be added.
  1444     **/
  1445     IMPORT_C void SetPointerEventFilterDisabledL( const CArrayFix<TInt>& aItemIndexes );
  1446 
  1447     /**
  1448      * Scrolls the view by the given amount of pixels while keeping the
  1449      * physics parameters up-to-date.
  1450      * This should be called when scrolling the list box view except for
  1451      * when it is done by list dragging (e.g. scrolling with scroll bar).
  1452      *
  1453      * @param  aDeltaPixels  Amount of pixels to scroll the view.
  1454      *
  1455      * @since 5.0
  1456      */
  1457     IMPORT_C void HandlePhysicsScrollEventL( TInt aDeltaPixels );
  1458 
  1459     /**
  1460      * Disables the kinetic scrolling functionality in the list.
  1461      * By default the feature is enabled.
  1462      * 
  1463      * @param  aDisabled  @c ETrue to disable kinetic scrolling,
  1464      *                    @c EFalse otherwise.
  1465      *
  1466      * @since 5.0
  1467      */
  1468     IMPORT_C void DisableScrolling( TBool aDisabled );
  1469     
  1470     /**
  1471      * Checks if the kinetic scrolling is currently enabled in the list.
  1472      *
  1473      * @return @c ETrue if kinetic scrolling is enabled, @c EFalse otherwise.
  1474      *
  1475      * @since 5.0
  1476      */
  1477     IMPORT_C TBool ScrollingDisabled();
  1478     
  1479     /**
  1480      * Suspends transitions effects.
  1481      *
  1482      * @since S60 5.0
  1483      *
  1484      * @param aSuspend ETrue to suspend effects, EFalse to re-enable them.
  1485      */
  1486     IMPORT_C void SuspendEffects( TBool aSuspend );
  1487 
  1488 private:
  1489     IMPORT_C virtual void CEikListBox_Reserved(); // listbox use only
  1490     void HorizontalScroll(TInt aScrollAmountInPixels);
  1491     void DrawItemInView(TInt aItemIndex) const;
  1492     void ClearMargins(CWindowGc& aGc) const;
  1493     TKeyResponse DoOfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType);
  1494     void UpdateScrollBarColors(CEikScrollBar* aScrollBar);
  1495     void UpdateScrollBarsColors();
  1496 
  1497     void HandleItemRemovalWithoutSelectionsL();
  1498 
  1499     /**
  1500      * Scrolls the view by the given amount of pixels.
  1501      *
  1502      * @param  aOffset   Amount of offset in pixels.
  1503      * @param  aDrawNow  Whether or not the view is be drawn.
  1504      *                   If @c EFalse then only the logical state is updated.
  1505      *
  1506      * @internal
  1507      * @since 5.0
  1508      */
  1509     void ScrollView( const TInt aOffset, TBool aDrawNow );
  1510     
  1511     /**
  1512      * Handles pointer events if physics are enabled.
  1513      *
  1514      * @return @c ETrue if the event was consumed by kinetic scrolling.
  1515      *
  1516      * @internal
  1517      * @since 5.0
  1518      */
  1519     TBool HandlePhysicsPointerEventL( const TPointerEvent& aPointerEvent );
  1520     
  1521     /**
  1522      * Selects an item and draws highlight to it.
  1523      * 
  1524      * @param  aItemIndex  Index of the highlighted item. 
  1525      * 
  1526      * @internal
  1527      * @since 5.0
  1528      */
  1529     void UpdateHighlightL( TInt aItemIndex );
  1530     
  1531 protected:
  1532     /** Flags for this list box  */
  1533     TInt iListBoxFlags;
  1534     
  1535     /** This List box's view  */
  1536     CListBoxView* iView;
  1537     
  1538     /** Item drawer for this list box */
  1539     CListItemDrawer* iItemDrawer;
  1540     
  1541     /** Data model for this list box */
  1542     MListBoxModel* iModel;
  1543     
  1544     /** Height of each item in the list */
  1545     TInt iItemHeight;   
  1546     
  1547     /** The scroll bar used by this control */
  1548     CEikScrollBarFrame* iSBFrame;
  1549     
  1550     /** Identifies if the scroll bar is owned by this list */
  1551     TScrollBarOwnerShip iSBFrameOwned;
  1552     
  1553     /** The required height of this list box expressed in 
  1554      * terms of a number of items.
  1555      */
  1556     TInt iRequiredHeightInNumOfItems;
  1557     
  1558     /**
  1559      * Defines which button launched the popout.
  1560      */
  1561     CEikButtonBase* iLaunchingButton; // only used by popouts
  1562     
  1563     /** The button which just launched a popout menu. */
  1564     MEikListBoxObserver* iListBoxObserver;
  1565 
  1566 private:
  1567 
  1568     TRgb iBackColor;
  1569 //  TInt iHorizontalMargin;
  1570 //  TInt iVerticalMargin;
  1571     TMargins8 iMargins ;
  1572     CListBoxExt* iListBoxExt;
  1573     TInt iViewRectHeightAdjustment;
  1574     MEikListBoxEditor* iItemEditor;
  1575     TBool* iLbxDestroyed;
  1576     TBool iLastCharMatched;
  1577     TInt iSpare;
  1578     };
  1579 
  1580 
  1581 
  1582 /**
  1583 * This is a list box that scrolls horizontally, displaying its items 
  1584 * in as many vertical columns as needed. Columns are arranged across 
  1585 * the control from left to right; within columns, items are arranged 
  1586 * from top to bottom. The flow of items or text ‘snakes’ across the 
  1587 * face of the control.
  1588 *
  1589 * This is a flexible control class that makes good use of short, wide 
  1590 * display areas; for instance, subclasses of @c CEikSnakingListBox could 
  1591 * be used for file lists or for a control panel. A standard user 
  1592 * subclass, @c CEikSnakingTextListBox, also exists.
  1593 *
  1594 * @since Symbian 5.0
  1595 */     
  1596 class CEikSnakingListBox : public CEikListBox  
  1597     {
  1598 public:
  1599     /**
  1600      * C++ standard constructor
  1601      */
  1602     IMPORT_C CEikSnakingListBox();
  1603     
  1604     /**
  1605      * Destructor
  1606      */
  1607     IMPORT_C ~CEikSnakingListBox();
  1608     
  1609     /**
  1610      * Creates an instance of the view class.
  1611      *
  1612      * This function is called during construction to create 
  1613      * (but not second-phase construct) an instance of the correct view 
  1614      * class for this list box control. In the case of the snaking list 
  1615      * box, a @c CSnakingListBoxView is returned.
  1616      *
  1617      * This function overrides @c CEikListBox::MakeViewClassInstanceL().
  1618      *
  1619      * @return The view which will be used by the list box being created
  1620      */
  1621     IMPORT_C virtual CListBoxView* MakeViewClassInstanceL();
  1622     
  1623     /**
  1624      * Sets the top item’s index.
  1625      *
  1626      * @param aItemIndex Index of the item to set as the top item.
  1627      */
  1628     IMPORT_C virtual void SetTopItemIndex(TInt aItemIndex) const;
  1629     
  1630     /**
  1631      * Gets the width of this list box’s columns. 
  1632      *
  1633      * @return Width of each column.
  1634      */
  1635     IMPORT_C TInt ColumnWidth() const;
  1636     
  1637     /**
  1638      * Sets the width of all columns in the list box.
  1639      *
  1640      * @param aColumnWidth New column width.
  1641      */
  1642     IMPORT_C void SetColumnWidth(TInt aColumnWidth);
  1643 
  1644 public: //from CCoeControl
  1645     
  1646     /**
  1647      * From @c CCoeControl.
  1648      *
  1649      * Handles pointer events. 
  1650      *
  1651      * @param aPointerEvent The pointer event.
  1652      */
  1653     IMPORT_C void HandlePointerEventL(const TPointerEvent& aPointerEvent);
  1654 
  1655 protected:
  1656     
  1657     /**
  1658      * Handles a change in size of the viewing rectangle.
  1659      *
  1660      * This function is called by framework functions to update the content, 
  1661      * view, and scroll bars of this list box after the viewing rectangle has 
  1662      * changed size. This implementation ensures that the current item is 
  1663      * visible after a resize.
  1664      */
  1665     IMPORT_C virtual void HandleViewRectSizeChangeL();
  1666 
  1667     /**
  1668      * Handles a left arrow key event.
  1669      * 
  1670      * Moves the cursor into the correct column and clears any matcher buffer 
  1671      * that may have been built up.
  1672      *
  1673      * @param aSelectionMode Not used.
  1674      */
  1675     IMPORT_C virtual void HandleLeftArrowKeyL(
  1676                             CListBoxView::TSelectionMode aSelectionMode);
  1677     
  1678     /**
  1679      * Handles a right arrow key event.
  1680      * 
  1681      * Moves the cursor into the correct column and clears any matcher buffer 
  1682      * that may have been built up.
  1683      *
  1684      * @param aSelectionMode Not used.
  1685      */
  1686     IMPORT_C virtual void HandleRightArrowKeyL(
  1687                             CListBoxView::TSelectionMode aSelectionMode);
  1688     
  1689     /**
  1690      * Gets the number of grains to move horizontally when a nudge button 
  1691      * is tapped. 
  1692      *
  1693      * For simple list boxes, this value is a fraction of the width of the
  1694      * client area. 
  1695      *
  1696      * @return Number of grains to move left or right on each nudge.
  1697      */
  1698     IMPORT_C virtual TInt HorizontalNudgeValue() const;
  1699 
  1700     /**
  1701      * Gets the granularity for horizontal scrolls. 
  1702      *
  1703      * The granularity is the minimum size of a horizontal move of the 
  1704      * client area.
  1705      *
  1706      * @return Grain size for horizontal scrolling in pixels.
  1707      */
  1708     IMPORT_C virtual TInt HorizScrollGranularityInPixels() const;
  1709 
  1710     /**
  1711      * Called by various functions of this class to ensure that the top 
  1712      * item index is always a sane value. The implementation in @c CEikListBox 
  1713      * tries to ensure the minimum amount of white space at the bottom of 
  1714      * the list box. Note that this function does not affect the current 
  1715      * item index.
  1716      */
  1717     IMPORT_C virtual void AdjustTopItemIndex() const;
  1718 
  1719     /**
  1720      * Handles drag events.
  1721      *
  1722      * This function is called by @c HandlePointerEventL() to handle 
  1723      * pointer drag events appropriately.
  1724      *
  1725      * @param aPointerPos The position of the @c TPointerEvent for which this 
  1726      *        handler is invoked.
  1727      */
  1728     IMPORT_C virtual void HandleDragEventL(TPoint aPointerPos);
  1729 
  1730     /**
  1731      * Calculates the client area.
  1732      *
  1733      * This method is called by various functions of this class to recalculate 
  1734      * the extent of the client area from @c iViewRect. This implementation 
  1735      * takes into account any rounding of the viewing rectangle made to fit a 
  1736      * whole number of items.
  1737      *
  1738      * @param aClientRect On return contains a size for the client area in 
  1739      *        pixels.
  1740      */
  1741     IMPORT_C virtual void RestoreClientRectFromViewRect(
  1742                                                     TRect& aClientRect) const;
  1743 
  1744     /**
  1745      * Rounds down the height of the rectangle (if necessary) so that only a 
  1746      * whole number of items can be displayed inside the list box.
  1747      *
  1748      * @param aRect The rectangle to be modified. 
  1749      * @return The number of pixels reduced.
  1750      */
  1751     IMPORT_C virtual TInt AdjustRectHeightToWholeNumberOfItems(
  1752                                                         TRect& aRect) const;
  1753 
  1754     /**
  1755      * Move to next or previous item according to the given parameter.
  1756      *
  1757      * @param aPoint Position which defines the moving direction.
  1758      */
  1759     IMPORT_C void MoveToNextOrPreviousItemL(TPoint aPoint);
  1760 
  1761 protected: //from CCoeControl
  1762 
  1763     /**
  1764      * From @c CCoeControl
  1765      *
  1766      * Updates the viewing rectangle of this control appropriately. The function
  1767      * updates the viewing rectangle, and invokes @c HandleViewRectSizeChangeL().
  1768      */
  1769     IMPORT_C virtual void SizeChanged();
  1770     
  1771     /**
  1772      * From @c CCoeControl
  1773      *
  1774      * Gets the list of logical colours employed in the drawing of the control,
  1775      * paired with an explanation of how they are used. Appends the list to 
  1776      * @c aColorUseList.
  1777      *
  1778      * @param aColorUseList List of logical colours.
  1779      */
  1780     IMPORT_C virtual void GetColorUseListL(
  1781                     CArrayFix<TCoeColorUse>& aColorUseList) const; 
  1782                     // not available before Release 005u
  1783     /**
  1784      * From @c CCoeControl.
  1785      *
  1786      * Handles a change to the list box’s resources of type @c aType which are 
  1787      * shared across the environment, colours or fonts for example.
  1788      *
  1789      * @param aType The type of resources that have changed.
  1790      */
  1791     IMPORT_C virtual void HandleResourceChange(TInt aType);         
  1792                     // not available before Release 005u
  1793 
  1794 private: // from CCoeControl
  1795     IMPORT_C void Reserved_1();
  1796     
  1797     IMPORT_C void Reserved_2();
  1798 
  1799 private:
  1800     /**
  1801     * From CAknControl
  1802     */
  1803     IMPORT_C void* ExtensionInterface( TUid aInterface );
  1804 
  1805 private:
  1806     IMPORT_C virtual void CEikListBox_Reserved(); // listbox use only
  1807     };
  1808 
  1809 #endif  // __EIKLBX_H__