classicui_pub/lists_api/inc/EIKLBV.H
branchRCL_3
changeset 56 d48ab3b357f1
child 72 a5e7a4f63858
equal deleted inserted replaced
55:aecbbf00d063 56:d48ab3b357f1
       
     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 "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:
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #if !defined(__EIKLBV_H__)
       
    21 #define __EIKLBV_H__
       
    22 
       
    23 #if !defined(__E32BASE_H__)
       
    24 #include <e32base.h>
       
    25 #endif
       
    26 
       
    27 #if !defined(__GDI_H__)
       
    28 #include <gdi.h>
       
    29 #endif
       
    30 
       
    31 class CListItemDrawer;
       
    32 class MListBoxModel;
       
    33 class CWindowGc;
       
    34 class RWindowGroup;
       
    35 class CWsScreenDevice;
       
    36 class CWindowGc;
       
    37 class RWindow;
       
    38 class CListBoxViewExtension;
       
    39 class CEikListBox;
       
    40 
       
    41 //
       
    42 // class MListVisibiltyObserver
       
    43 //
       
    44 
       
    45 class MListVisibilityObserver 
       
    46 	{
       
    47 public:
       
    48 	virtual TBool IsVisible() const = 0;
       
    49 	};
       
    50 
       
    51 /**
       
    52  * List box view.
       
    53  *
       
    54  * A list box view displays the list items which are currently visible in 
       
    55  * a list box. List box views draw each of the items for display using 
       
    56  * methods defined in their associated list box drawer. 
       
    57  *
       
    58  * Together with its list item drawer, a @c CListBoxView encapsulates the 
       
    59  * on-screen appearance of data in a list box.
       
    60  *
       
    61  * List box views also encapsulate item selection, the current item, and the 
       
    62  * fundamentals of how the selection and the current item are updated according
       
    63  * to user input. Input events themselves are handled by @c CEikListBox, 
       
    64  * which calls member functions of @c CListBoxView appropriately.
       
    65  *
       
    66  * This class is sufficient for plain list box views, and may be derived from 
       
    67  * in order to provide more complex list views. @c TechView supplies and uses 
       
    68  * the classes @c CHierarchicalListBoxView and @c CSnakingListBoxView, which 
       
    69  * provide two kinds of indented list views.
       
    70  */
       
    71 class CListBoxView : public CBase
       
    72 	{
       
    73 public:
       
    74 
       
    75     /**
       
    76      * Cursor movement flags. These describe the cursor movements recognised by
       
    77      * @c MoveCursorL().
       
    78      */
       
    79     enum TCursorMovement 
       
    80 		{
       
    81         /** Cursors movement to next item. */
       
    82         ECursorNextItem,  	
       
    83 
       
    84         /** Cursors movement to previous item. */
       
    85         ECursorPreviousItem,
       
    86 
       
    87         /** Cursors movement to next column. */
       
    88         ECursorNextColumn,  
       
    89 
       
    90         /** Cursors movement to previous column. */
       
    91         ECursorPreviousColumn,  
       
    92 
       
    93         /** Cursors movement to previous page. */
       
    94         ECursorPreviousPage, 
       
    95 
       
    96         /** Cursors movement to next page. */
       
    97         ECursorNextPage,
       
    98 
       
    99         /** Cursors movement to the first item. */
       
   100         ECursorFirstItem,
       
   101 
       
   102         /** Cursors movement to the last item. */
       
   103         ECursorLastItem,
       
   104 
       
   105         /** Cursors movement to the next screen. */
       
   106         ECursorNextScreen,
       
   107 
       
   108         /** Cursors movement to the previous screen. */
       
   109         ECursorPrevScreen
       
   110         };  
       
   111 
       
   112     /**
       
   113      * List box view flags.
       
   114      *
       
   115      * These flags may be combined with a logical OR to get a combination of 
       
   116      * effects.
       
   117      */
       
   118 	enum TFlags
       
   119 		{
       
   120         /** A selection anchor exists. */
       
   121 		EAnchorExists   = 0x0001,
       
   122 
       
   123         /** The view is emphasised. */
       
   124 		EEmphasized     = 0x0002,
       
   125 
       
   126         /** The view is dimmed. */
       
   127 		EDimmed         = 0x0004,
       
   128 
       
   129         /** List box view has a cursor for incremental matching. */
       
   130 		EHasMatcherCursor = 0x0008,
       
   131 
       
   132         /** Redraw is disabled. */
       
   133 		EDisableRedraw  = 0x0010,
       
   134 
       
   135         /** If set, selected items are painted. */
       
   136 		EPaintedSelection = 0x0020,
       
   137 
       
   138         /** Item marking enabled. */
       
   139 		EMarkSelection  = 0x0040,
       
   140 
       
   141         /** Item unmarking enabled. */
       
   142 		EUnmarkSelection = 0x0080,
       
   143 
       
   144         /** Item count changes enabled. */
       
   145 		EItemCountModified = 0x0100,
       
   146 
       
   147         /** Vertical offset has changed. */
       
   148 		EOffsetChanged = 0x0200,
       
   149 		};
       
   150 		
       
   151     /**
       
   152      * Modes for modifying the selection.
       
   153      *
       
   154      * Changing the current item of a list box view may also affect which items
       
   155      * are selected. The selection mode of such an action describes how (or if)
       
   156      * the selection is altered by the action.
       
   157      *
       
   158      * Each function of @c CListBoxView which affects the current item is 
       
   159      * passed an appropriate selection mode by the calling input handler method
       
   160      * of @c CEikListBox. The mode is varied according to the keyboard 
       
   161      * modifiers held down by the user, or whether a pointer action was a tap 
       
   162      * or a sweep.
       
   163      *
       
   164      * Note that the behaviour of list box views may vary with the target 
       
   165      * phone due to the wide range of possible input devices. 
       
   166      * The following description assumes a phone with a pointer and a keyboard.
       
   167      */
       
   168     enum TSelectionMode 
       
   169         {
       
   170         /** 
       
   171          * The selection is not changed by actions while this is in effect, 
       
   172          * holding CTRL while pressing cursor up or down for example.
       
   173          */
       
   174         ENoSelection,
       
   175     
       
   176         /** 
       
   177          * Only a single item in the list is allowed to be selected by an 
       
   178          * action; when selecting individual items with the pointer, or 
       
   179          * moving using the cursor keys without any modifiers for example.
       
   180          */
       
   181         ESingleSelection,
       
   182 
       
   183         /** 
       
   184          * A single continuous run of items can be added to the selection array
       
   185          * by an action, when keyboard-selecting with the shift key held down, 
       
   186          * or when sweeping a selection with the pointer for example.
       
   187          */
       
   188         EContiguousSelection,
       
   189 
       
   190         /** 
       
   191          * Any single item in the list may be added to the selection by an 
       
   192          * action, when selecting or drag-selecting with the pointer when the
       
   193          * @c CTRL key is held down for example.
       
   194          */
       
   195         EDisjointSelection,
       
   196 
       
   197         /** 
       
   198          * Any single item in the list may be removed from the selection by an 
       
   199          * action, when unselecting for example.
       
   200          */
       
   201         EDisjointMarkSelection,
       
   202 
       
   203         /** 
       
   204          * Multiple items can be added to the selection array by an action, 
       
   205          * when selecting with the edit key for example.
       
   206          */
       
   207         EPenMultiselection,
       
   208 
       
   209         /** 
       
   210          * Mark mode is changed to @c EUnmarkSelection if item is marked or 
       
   211          * @c EMarkSelection if item is not marked by an action, when selecting
       
   212          * or unselecting item for example.
       
   213          */
       
   214         EChangeMarkMode
       
   215         };
       
   216 
       
   217     /** The items which are selected within a list box list. */
       
   218 	typedef CArrayFix<TInt> CSelectionIndexArray;
       
   219 
       
   220 public:
       
   221 
       
   222     /**
       
   223      * Destructor.
       
   224      */
       
   225 	IMPORT_C ~CListBoxView();
       
   226 
       
   227     /**
       
   228      * C++ default constructor.
       
   229      *
       
   230      * Allocates an area of memory for a @c CListBoxView, and begins its 
       
   231      * initialisation.
       
   232      */
       
   233     IMPORT_C CListBoxView();
       
   234 
       
   235     /**
       
   236      * By default Symbian 2nd phase constructor is private. 
       
   237      *
       
   238      * This function completes the initialisation of a default-constructed list
       
   239      * box view. The item drawer’s graphics context is created on @c aScreen, 
       
   240      * and the list item drawer’s graphics context is set to this. See 
       
   241      * @c CListItemDrawer::SetGc().
       
   242      * 
       
   243      * @param aListBoxModel The list box model to use. 
       
   244      * @param aItemDrawer A default-constructed item drawer. 
       
   245      * @param aScreen Screen on which to display. 
       
   246      * @param aGroupWin This list box view’s window group. 
       
   247      * @param aWsWindow Window for this view. 
       
   248      * @param aDisplayArea The viewing rectangle this list box view is to use.
       
   249      * @param aItemHeight Height of a single list item. 
       
   250      */
       
   251     IMPORT_C virtual void ConstructL(MListBoxModel* aListBoxModel, 
       
   252                                      CListItemDrawer* aItemDrawer, 
       
   253                                      CWsScreenDevice* aScreen, 
       
   254                                      RWindowGroup* aGroupWin, 
       
   255                                      RWindow* aWsWindow, 
       
   256                                      const TRect& aDisplayArea, 
       
   257                                      TInt aItemHeight);
       
   258 
       
   259     // functions for accessing the view rect (the area of the host window in 
       
   260     // which the items are drawn)
       
   261     /**
       
   262      * Gets the list box’s view rectangle.
       
   263      *
       
   264      * @return This list box’s view rectangle.
       
   265      */
       
   266     IMPORT_C TRect ViewRect() const;
       
   267 
       
   268     /**
       
   269      * Sets the area within the list window in which the view can draw itself.
       
   270      * 
       
   271      * @param aRect New view rectangle.
       
   272      */
       
   273 	IMPORT_C void SetViewRect(const TRect& aRect);  
       
   274 
       
   275 	// misc. access functions for the main attributes 
       
   276     /**
       
   277      * Gets the current item’s index.
       
   278      *
       
   279      * @return Index number of the current item.
       
   280      */
       
   281 	IMPORT_C virtual TInt CurrentItemIndex() const;	
       
   282 
       
   283     /**
       
   284      * Set the index of the current item. This function changes the current 
       
   285      * item, but does not redraw the list view or update the selection.
       
   286      *
       
   287      * @param aItemIndex Which item to make current.
       
   288      * @panic EEikPanicListBoxInvalidCurrentItemIndexSpecified Panics if the 
       
   289      *        given index is not valid. 
       
   290      */
       
   291 	IMPORT_C void SetCurrentItemIndex(TInt aItemIndex); 
       
   292 
       
   293     /**
       
   294      * Gets the index of the item at the top of the view.
       
   295      *
       
   296      * @return The item currently displayed at the top of this list box view.
       
   297      */
       
   298 	IMPORT_C TInt TopItemIndex() const;		
       
   299 
       
   300     /**
       
   301      * Sets the item at the top of the view by its index in the list of all 
       
   302      * items. This function also invokes @c CalcBottomItemIndex().
       
   303      *
       
   304      * @param aItemIndex Index of the item to start the view at.
       
   305      * @panic EEikPanicListBoxInvalidTopItemIndexSpecified Panics if the given
       
   306      *        index is not valid. 
       
   307      */
       
   308 	IMPORT_C virtual void SetTopItemIndex(TInt aItemIndex);
       
   309 
       
   310     /**
       
   311      * Gets the index of the item at the bottom of this view.
       
   312      *
       
   313      * @return Index of the item at the bottom of this view.
       
   314      */
       
   315 	IMPORT_C TInt BottomItemIndex() const;
       
   316 
       
   317     /**
       
   318      * Recalculates the index of the bottom item in the list by using the top 
       
   319      * item index and the size of the display.
       
   320      *
       
   321      * This function is called by the owning list box control when either the 
       
   322      * size of the list box or the number of items in its model changes.
       
   323      */
       
   324 	IMPORT_C virtual void CalcBottomItemIndex();
       
   325 
       
   326     /**
       
   327      * Sets the item height.
       
   328      *
       
   329      * @param aItemHeight New item height.
       
   330      */
       
   331 	IMPORT_C virtual void SetItemHeight(TInt aItemHeight);
       
   332 
       
   333 	// functions that support incremental matching 
       
   334     /**
       
   335      * Sets the match cursor’s colour.
       
   336      *
       
   337      * @deprecated
       
   338      * @param aColor Colour in which to display the incremental match cursor.
       
   339      */
       
   340 	IMPORT_C void SetMatcherCursorColor(TRgb aColor);
       
   341 
       
   342     /**
       
   343      * Sets the match cursor's position.
       
   344      *
       
   345      * @deprecated
       
   346      * @param aPosWithinCurrentItem Character position for the match cursor 
       
   347      *        within the current item’s string.
       
   348      */
       
   349 	IMPORT_C void SetMatcherCursorPos(TInt aPosWithinCurrentItem);
       
   350 
       
   351     /**
       
   352      * Gets the match cursor’s position.
       
   353      *
       
   354      * @deprecated
       
   355      * @return Character position of the match cursor within the current
       
   356      *         item’s string.
       
   357      */
       
   358 	IMPORT_C TInt MatcherCursorPos() const;
       
   359 
       
   360     /**
       
   361      * Draws the match cursor in its current screen position if the matcher 
       
   362      * cursor flag has been set.
       
   363      * 
       
   364      * This is deprecated and broken and should not be used.
       
   365      *
       
   366      * @deprecated
       
   367      */
       
   368 	IMPORT_C virtual void DrawMatcherCursor();
       
   369 
       
   370     /**
       
   371      * Hides the matcher cursor.
       
   372      *
       
   373      * @deprecated
       
   374      */
       
   375 	IMPORT_C void HideMatcherCursor();
       
   376 
       
   377     /**
       
   378      * Sets whether the matcher cursor flag to specify whether the match 
       
   379      * cursor is drawn.
       
   380      *
       
   381      * @deprecated
       
   382      * @param aMatcherCursor If @c ETrue, the view will draw match cursor. 
       
   383      */
       
   384 	IMPORT_C void SetMatcherCursor(TBool aMatcherCursor);
       
   385 
       
   386     /**
       
   387      * Sets whether or not items are drawn as emphasised. 
       
   388      *
       
   389      * The function sets or resets the emphasised flag.
       
   390      *
       
   391      * @param aEmphasized If @c ETrue, this view will draw items emphasised. 
       
   392      *        If @c EFalse will not draw items emphasised.
       
   393      */
       
   394 	IMPORT_C void SetEmphasized(TBool aEmphasized);
       
   395 
       
   396     /**
       
   397      * Sets whether items will be drawn dimmed. 
       
   398      *
       
   399      * The function sets or resets the dim flag.
       
   400      *
       
   401      * @param aDimmed If @c ETrue, this view will draw items dimmed. 
       
   402      *        If @c EFalse this view will not draw items dimmed.
       
   403      */
       
   404 	IMPORT_C void SetDimmed(TBool aDimmed);
       
   405 
       
   406     /**
       
   407      * Disables or enables redraws.
       
   408      *
       
   409      * If this flag is set to @c ETrue, all member functions which draw items 
       
   410      * will return immediately without drawing anything. Functions which update
       
   411      * the internal state of the list box will still work, but nothing will be 
       
   412      * drawn or updated on the screen.
       
   413      *
       
   414      * @param aDisableRedraw Disables redraw if @c ETrue.
       
   415      */
       
   416 	IMPORT_C void SetDisableRedraw(TBool aDisableRedraw);
       
   417 
       
   418     /**
       
   419      * Tests whether redraw is disabled.
       
   420      *
       
   421      * @return ETrue if redraw is disabled.
       
   422      */
       
   423 	IMPORT_C TBool RedrawDisabled() const;
       
   424 
       
   425     /**
       
   426      * Sets the painted selection flag.
       
   427      *
       
   428      * @deprecated
       
   429      * @param aPaintedSelection If @c ETrue the painted selection flag is set 
       
   430      *        on. If @c EFalse the selection flag is set off. If NULL the 
       
   431      *        painted selection flag is cleared.
       
   432      */
       
   433 	IMPORT_C void SetPaintedSelection( TBool aPaintedSelection );
       
   434 
       
   435 	// functions that support selection
       
   436     /**
       
   437      * Gets a pointer to the selection list of this view.
       
   438      * 
       
   439      * @return Pointer to an array describing the items 
       
   440      *         in the list which are currently selected. The object pointed 
       
   441      *         at is owned by the @c CListBoxView.
       
   442      */
       
   443     IMPORT_C const CSelectionIndexArray* SelectionIndexes() const;
       
   444 
       
   445     /**
       
   446      * Gets a copy of the array of currently selected items. 
       
   447      * 
       
   448      * @param[in,out] aSelectionArray An instantiated @c CSelectionIndexArray.
       
   449      *                On return, contains a copy of selection indexes. 
       
   450      * @panic EEikPanicListBoxInvalidSelIndexArraySpecified Panics if the given
       
   451      *        selection index array is not valid.
       
   452      * @panic EEikPanicListBoxNoSelIndexArray Panics if selection indexes have 
       
   453      *        not been defined for this class. 
       
   454      */
       
   455 	IMPORT_C void GetSelectionIndexesL(
       
   456                                 CSelectionIndexArray* aSelectionArray) const;
       
   457 	
       
   458     /**
       
   459      * Sets the currently selected items of this view from a selection index 
       
   460      * array.
       
   461      * 
       
   462      * @param aSelectionIndexes Items to select.
       
   463      * @panic EEikPanicListBoxInvalidSelIndexArraySpecified Panics if the given
       
   464      *        selection index array is not valid.
       
   465      */
       
   466     IMPORT_C void SetSelectionIndexesL(const CSelectionIndexArray* 
       
   467                                        aSelectionIndexes);
       
   468 	
       
   469     /**
       
   470      * Resets the selection state so that there is nothing selected.
       
   471      *
       
   472      * @panic EEikPanicListBoxNoSelIndexArray Panics if selection indexes have 
       
   473      *        not been defined for this class. 
       
   474      */
       
   475     IMPORT_C void ClearSelection(); 		
       
   476 	
       
   477     // select/highlight items without moving the cursor
       
   478     /**
       
   479      * Updates item selection.
       
   480      *
       
   481      * @param aSelectionMode The selection mode. 
       
   482      */
       
   483     IMPORT_C virtual void UpdateSelectionL(TSelectionMode aSelectionMode);  
       
   484     	
       
   485     /**
       
   486      * Toggles the selection of an item.
       
   487      *
       
   488      * @param aItemIndex Item to toggle.
       
   489      * @panic EEikPanicListBoxNoSelIndexArray Panics if selection indexes have 
       
   490      *        not been defined for this class. 
       
   491      */
       
   492     IMPORT_C void ToggleItemL(TInt aItemIndex);
       
   493 	
       
   494     /**
       
   495      * Selects an item by index. 
       
   496      *
       
   497      * This function leaves if memory could not be allocated for an extra item
       
   498      * in the array of selected items.
       
   499      *
       
   500      * @param aItemIndex Item to select.
       
   501      * @panic EEikPanicListBoxNoSelIndexArray Panics if selection indexes have 
       
   502      *        not been defined for this class. 
       
   503      */
       
   504     IMPORT_C void SelectItemL(TInt aItemIndex);
       
   505 	
       
   506     /**
       
   507      * Deselects an item by index.
       
   508      *
       
   509      * @param aItemIndex Item to deselect.
       
   510      * @panic EEikPanicListBoxNoSelIndexArray Panics if selection indexes have 
       
   511      *        not been defined for this class. 
       
   512      */
       
   513     IMPORT_C void DeselectItem(TInt aItemIndex);
       
   514 	
       
   515     /**
       
   516      * Sets the anchor to the specified item.
       
   517      *
       
   518      * @param aItemIndex The index of the item at which the anchor is set.
       
   519      */
       
   520     IMPORT_C void SetAnchor(TInt aItemIndex);
       
   521 	
       
   522     /**
       
   523      * Resets the anchor index, the active end and the  @c EAnchorExists flag.
       
   524      */
       
   525     IMPORT_C void ClearSelectionAnchorAndActiveIndex();
       
   526 
       
   527 	// functions that support scrolling
       
   528     /**
       
   529      * Scrolls vertically to make a particular item visible. 
       
   530      * 
       
   531      * @param aItemIndex The item to make visible.
       
   532      * @return @c ETrue if any scrolling was done, @c EFalse if no 
       
   533      *         scrolling was necessary.
       
   534      */
       
   535 	IMPORT_C virtual TBool ScrollToMakeItemVisible(TInt aItemIndex);
       
   536     
       
   537     /**
       
   538      * Sets the index of the item to be the top item.
       
   539      *
       
   540      * @param aNewTopItemIndex The item to scroll to.
       
   541      */
       
   542 	IMPORT_C virtual void VScrollTo(TInt aNewTopItemIndex);
       
   543 
       
   544     /**
       
   545      * Sets the index of the item to be the top item.
       
   546      *
       
   547      * This two argument version returns the area which needs redrawing via 
       
   548      * @c aMinRedrawRect&. This function does not perform the redraw.
       
   549      *
       
   550      * @param aNewTopItemIndex The distance by which to scroll. 
       
   551      * @param aMinRedrawRect On return, the minimum rectangle to redraw.
       
   552      */
       
   553     IMPORT_C virtual void VScrollTo(TInt aNewTopItemIndex, 
       
   554                                     TRect& aMinRedrawRect);
       
   555 	
       
   556     /**
       
   557      * Scrolls horizontally by the specified number of pixels.
       
   558      *
       
   559      * @param aHScrollAmount The distance to scroll by in pixels. A negative 
       
   560      *        value scrolls to the left, a positive value scrolls to the right.
       
   561      */
       
   562     IMPORT_C virtual void HScroll(TInt aHScrollAmount);
       
   563 	
       
   564     /**
       
   565      * Gets the offset of the visible portion of the data from the left margin
       
   566      * in pixels.
       
   567      *
       
   568      * @return The horizontal scroll offset in pixels.
       
   569      */
       
   570     IMPORT_C TInt HScrollOffset() const;
       
   571 
       
   572     /**
       
   573      * Sets the horizontal scroll offset in pixels.
       
   574      *
       
   575      * @param aHorizontalOffset New value for the horizontal scroll offset, in 
       
   576      *        pixels.
       
   577      */
       
   578 	IMPORT_C void SetHScrollOffset(TInt aHorizontalOffset);
       
   579 
       
   580     /**
       
   581      * Gets the width of the widest item in the list in pixels.
       
   582      *
       
   583      * @return Data width in pixels.
       
   584      */
       
   585 	IMPORT_C TInt DataWidth() const;
       
   586 
       
   587     /**
       
   588      * Recalculates the data width of this list box view from the item width 
       
   589      * of its list item drawer. This method is called directly by 
       
   590      * @c CEikListBox when the list box’s size changes or when data is added.
       
   591      */
       
   592 	IMPORT_C virtual void CalcDataWidth();
       
   593 
       
   594     /**
       
   595      * Gets the visible width of the specified rectangle in pixels. This 
       
   596      * function is called by @c CListBoxView itself on its own viewing 
       
   597      * rectangle.
       
   598      *
       
   599      * @param aRect The rectangle to get the visible width for.
       
   600      * @return Visible width of @c aRect.
       
   601      */
       
   602 	IMPORT_C virtual TInt VisibleWidth(const TRect& aRect) const;
       
   603 
       
   604     /**
       
   605      * Calculates which item should be selected in order to make a 
       
   606      * particular item visible. Calling 
       
   607      * @c VScrollTo(CalcNewTopItemIndexSoItemIsVisible(idx)), for example, 
       
   608      * would make the item whose index is @c idx visible.
       
   609      *
       
   610      * @param aItemIndex The index of the new top item.
       
   611      * @return The item to be selected. 
       
   612      */
       
   613     IMPORT_C virtual TInt CalcNewTopItemIndexSoItemIsVisible(
       
   614                                                         TInt aItemIndex) const;
       
   615 
       
   616 	// functions that support drawing
       
   617     /**
       
   618      * Draws every visible item into the specified rectangle. 
       
   619      *
       
   620      * As implemented in @c CListBoxView, this function's argument is ignored 
       
   621      * and the internal viewing rectangle is used. See @c SetViewRect().
       
   622      *
       
   623      * @param aClipRect The rectangle to draw into, this is ignored. Default 
       
   624      *        value is NULL.
       
   625      * @panic EEikPanicListBoxNoModel Panics if the list box model for this 
       
   626      *        class has not been defined. 
       
   627      */
       
   628 	IMPORT_C virtual void Draw(const TRect* aClipRect = NULL) const;
       
   629 
       
   630     /**
       
   631      * Draws the specified item via @c CListBoxDrawer::DrawItem() if it is 
       
   632      * visible.
       
   633      *
       
   634      * @param aItemIndex Index number of the item to draw.
       
   635      */
       
   636 	IMPORT_C virtual void DrawItem(TInt aItemIndex) const;
       
   637 
       
   638     /**
       
   639      * Sets list box backroung text. This text is visible if the list box 
       
   640      * has no items.
       
   641      *
       
   642      * @param aText The text for the empty list box background.
       
   643      */
       
   644 	IMPORT_C void SetListEmptyTextL(const TDesC& aText);
       
   645 
       
   646     /**
       
   647      * Gets an empty list box text. 
       
   648      * 
       
   649      * @return Pointer the empty list box text. 
       
   650      */
       
   651 	inline const TDesC* EmptyListText() const;
       
   652 
       
   653     /**
       
   654      * Tests whether an item is selected.
       
   655      *
       
   656      * @param aItemIndex Index of item to test.
       
   657      * @return @c ETrue if the item is selected.
       
   658      */    
       
   659     IMPORT_C TBool ItemIsSelected(TInt aItemIndex) const; 
       
   660 
       
   661     /**
       
   662      * Tests whether an item is visible.
       
   663      *
       
   664      * @param aItemIndex Index of item to be tested.
       
   665      * @return @c ETrue if the item is visible.
       
   666      */
       
   667 	IMPORT_C TBool ItemIsVisible(TInt aItemIndex) const;
       
   668 
       
   669     /**
       
   670      * Gets the on-screen position of an item.
       
   671      * 
       
   672      * @param aItemIndex Index of an item.
       
   673      * @return Position of the item.
       
   674      */
       
   675 	IMPORT_C virtual TPoint ItemPos(TInt aItemIndex) const;
       
   676 
       
   677     /**
       
   678      * Gets the on-screen size of an item. 
       
   679      * 
       
   680      * As implemented in @c CListBoxView, all items report the same size. 
       
   681      * The size returned may be larger than the width of the list box view, but
       
   682      * will not be smaller.
       
   683      *
       
   684      * @param aItemIndex Index of an item. Default value is 0.
       
   685      * @return Size of the item.
       
   686      */
       
   687 	IMPORT_C virtual TSize ItemSize(TInt aItemIndex=0) const;
       
   688 
       
   689     /**
       
   690      * Sets the colour in which to display text.
       
   691      *
       
   692      * @param aColor Colour in which to display text.
       
   693      */
       
   694 	IMPORT_C void SetTextColor(TRgb aColor);
       
   695 
       
   696     /**
       
   697      * Sets the background colour.
       
   698      *
       
   699      * @param aColor The background colour.
       
   700      */
       
   701 	IMPORT_C void SetBackColor(TRgb aColor);
       
   702 	
       
   703     /**
       
   704      * Gets the colour in which text is to be displayed.
       
   705      *
       
   706      * @return Current text colour.
       
   707      */
       
   708     IMPORT_C TRgb TextColor() const;
       
   709 
       
   710     /**
       
   711      * Gets the background colour for this view.
       
   712      * 
       
   713      * @return The background colour.
       
   714      */
       
   715 	IMPORT_C TRgb BackColor() const;
       
   716 
       
   717     /**
       
   718      * Moves the current item cursor in the specified direction. This function 
       
   719      * is called by @c CEikListBox in response to user input.
       
   720      *
       
   721      * @param aCursorMovement The cursor movement to apply. 
       
   722      * @param aSelectionMode The selection mode of the calling list box.
       
   723      */
       
   724 	IMPORT_C virtual void MoveCursorL(TCursorMovement aCursorMovement, 
       
   725                                       TSelectionMode aSelectionMode);
       
   726 	
       
   727     /**
       
   728      * Moves to the specified item, sets it as the current item and scrolls the
       
   729      * display to make the item visible.
       
   730      *
       
   731      * @param aTargetItemIndex The index of the item to which to move.
       
   732      * @param aSelectionMode The selection mode. 
       
   733      */
       
   734     IMPORT_C virtual void VerticalMoveToItemL(TInt aTargetItemIndex, 
       
   735                                               TSelectionMode aSelectionMode);
       
   736 	
       
   737     /**
       
   738      * Converts a pixel position into an item index.
       
   739      *
       
   740      * The function returns @c ETrue and sets @c aItemIndex to the index of the
       
   741      * item whose bounding box contains @c aPosition. Returns @c EFalse if no 
       
   742      * such item exists.
       
   743      *
       
   744      * @param aPosition A position relative to the origin of the list box 
       
   745      *                  control.
       
   746      * @param aItemIndex Is set to the item at that position. 
       
   747      * @return @c ETrue if there was an item at @c aPosition.
       
   748      */
       
   749     IMPORT_C virtual TBool XYPosToItemIndex(TPoint aPosition, 
       
   750                                             TInt& aItemIndex) const;   
       
   751     
       
   752     /**
       
   753      * Gets the number of items that will fit into a given rectangle.
       
   754      *
       
   755      * @param aRect The rectangle.
       
   756      * @return The number of items that will fit into the given rectangle.
       
   757      */
       
   758     IMPORT_C virtual TInt NumberOfItemsThatFitInRect(const TRect& aRect) const;
       
   759 
       
   760     /**
       
   761      * Sets the visibility observer.
       
   762      *
       
   763      * @param aObserver New visibility observer for this control.
       
   764      */
       
   765     void SetVisibilityObserver(MListVisibilityObserver* aObserver);
       
   766 
       
   767     /**
       
   768      * Tests if this view is visible.
       
   769      *
       
   770      * @return @c ETrue if this view is visible. @c EFalse if this view 
       
   771      *         is not visible or does not exist.
       
   772      */
       
   773 	IMPORT_C TBool IsVisible() const;
       
   774 
       
   775     /**
       
   776      * Gets the object used by this list box view to draw its items.
       
   777      *
       
   778      * @return Pointer to the list box item drawer. 
       
   779      */
       
   780 	inline CListItemDrawer* ItemDrawer() const;
       
   781 
       
   782     /**
       
   783      * Not implemented.
       
   784      * 
       
   785      * @param aClientRect Not used.
       
   786      */
       
   787 	IMPORT_C virtual void DrawEmptyList(const TRect &aClientRect) const;
       
   788 
       
   789     // disables vertical line drawing, useful only for certain 
       
   790     //custom list boxes
       
   791     /**
       
   792      * Disables vertical line drawing.
       
   793      *
       
   794      * @param aDisable @c ETrue if disabled.
       
   795      */
       
   796     void DisableVerticalLineDrawing( TBool aDisable );
       
   797 
       
   798     /** 
       
   799     * Deselects range between given indexes.
       
   800     *
       
   801     * @deprecated
       
   802     * @param aItemIndex1 First index of selectable range.
       
   803     * @param aItemIndex2 Second index of selectable range.
       
   804     */
       
   805     IMPORT_C void DeselectRangeL(TInt aItemIndex1, TInt aItemIndex2);
       
   806 
       
   807     /**
       
   808      * Sets the offset for view.
       
   809      *
       
   810      * @internal
       
   811      * @param aOffset Offset in pixels.
       
   812      */
       
   813     IMPORT_C void SetItemOffsetInPixels(TInt aOffset);
       
   814     
       
   815     /**
       
   816      * Gets view offset.
       
   817      *
       
   818      * @internal
       
   819      * @return View's offset.
       
   820      */
       
   821     IMPORT_C TInt ItemOffsetInPixels() const;
       
   822     
       
   823     /**
       
   824      * Sets scrolling state.
       
   825 	 *
       
   826 	 * @internal
       
   827      */
       
   828     void SetScrolling( TBool aIsScrolling );
       
   829 	 
       
   830 	/**
       
   831 	 * Returns item's height. All items have the same height.
       
   832 	 *
       
   833 	 * @internal
       
   834 	 * @return Item height.
       
   835 	 */ 
       
   836     TInt ItemHeight() const { return iItemHeight; }
       
   837     
       
   838     /**
       
   839      * Tests whether an item is partially visible.
       
   840      * Note that this returns @c EFalse also when item is fully visible,
       
   841      * i.e. the whole item area is inside the list view rectangle.
       
   842      *
       
   843      * @param  aItemIndex  Index of item to be tested.
       
   844      *
       
   845      * @return @c ETrue if the item is partially visible,
       
   846      *         @c EFalse if it's not visible or fully visible.
       
   847      */
       
   848     IMPORT_C TBool ItemIsPartiallyVisible( TInt aItemIndex ) const;
       
   849     
       
   850     /**
       
   851      * Resets the selection state so that there is nothing selected.
       
   852      *
       
   853      * @param  aDrawItems  Whether or not to draw the items which are
       
   854      *                     deselected.
       
   855      *
       
   856      * @panic  EEikPanicListBoxNoSelIndexArray  Panics if selection indexes
       
   857      *                                          have not been defined for
       
   858      *                                          this class. 
       
   859      */
       
   860     void ClearSelection( TBool aDrawItems );
       
   861     
       
   862     /**
       
   863      * Sets all items selected.
       
   864      *
       
   865      * @param  aDrawItems  Whether or not to draw the items which are
       
   866      *                     selected.
       
   867      *
       
   868      * @panic EEikPanicListBoxNoSelIndexArray Panics if selection indexes have 
       
   869      *        not been defined for this class. 
       
   870      *        
       
   871      * @panic EEikPanicListBoxNoModel Panics if listbox model not existing.
       
   872      * 
       
   873      */
       
   874     void SelectAllL( TBool aDrawItems );
       
   875 
       
   876 protected:
       
   877 
       
   878 	// functions for accessing the flags
       
   879     /**
       
   880      * Gets this view’s flags.
       
   881      *
       
   882      * These flags are defined by the nested enum @c TFlags (below).
       
   883      *
       
   884      * @return List box's flags. 
       
   885      */
       
   886 	inline TInt Flags() const;
       
   887 
       
   888     /**
       
   889      * Sets this view’s flags according to a bitmask.
       
   890      *
       
   891      * These flags are defined by the nested enum @c TFlags (below).
       
   892      *
       
   893      * @param aMask Sets new flags for the list box.
       
   894      */
       
   895 	inline void SetFlags(TInt aMask);
       
   896 
       
   897     /**
       
   898      * Clears this view’s flags according to a bitmask.
       
   899      *
       
   900      * These flags are defined by the nested enum @c TFlags (below).
       
   901      *
       
   902      * @param aMask Flags to be removed. 
       
   903      */
       
   904 	inline void ClearFlags(TInt aMask);
       
   905 
       
   906     /**
       
   907      * List box base class.
       
   908      * To access @c SetFlags()/ClearFlags().
       
   909      */
       
   910     friend class CEikListBox; 
       
   911 
       
   912 	// misc. functions
       
   913     /**
       
   914      * Selects items between given indexes.
       
   915      * 
       
   916      * @deprecated
       
   917      * @param aItemIndex1 First index of selectable range.
       
   918      * @param aItemIndex2 Second index of selectable range.
       
   919      */
       
   920 	IMPORT_C void SelectRangeL(TInt aItemIndex1, TInt aItemIndex2);
       
   921 
       
   922 private:
       
   923     /**
       
   924      * Set item index directly. 
       
   925      * For CEikListBox.
       
   926      * @param aItemIndex New item index.
       
   927      */
       
   928     void SetItemIndex( TInt aItemIndex );
       
   929  
       
   930 protected:
       
   931 
       
   932     /**
       
   933      * The flags for this list box. These flags are defined by the nested enum
       
   934      * @c TFlags (below).
       
   935      */
       
   936 	TInt iFlags;   	
       
   937 
       
   938     /**
       
   939      * This view’s item drawer.
       
   940      * Not owned.
       
   941      */
       
   942 	CListItemDrawer* iItemDrawer;
       
   943 
       
   944     /**
       
   945      * This view’s model.
       
   946      * Not owned.
       
   947      */
       
   948 	MListBoxModel* iModel;
       
   949 
       
   950     /**
       
   951      * Width (in pixels) of the longest item in the model.
       
   952      */
       
   953 	TInt iDataWidth;			
       
   954     
       
   955     /**
       
   956      * Index of the item at the top of the view. This is not necessarily the 
       
   957      * item at the start of the list.
       
   958      */
       
   959     TInt iTopItemIndex;
       
   960 	
       
   961     /**
       
   962      * Index of the item at the bottom of the view. This is not necessarily the
       
   963      * item at the end of the list.
       
   964      */
       
   965     TInt iBottomItemIndex;
       
   966 	
       
   967     /**
       
   968      * Pixel offset of the visible portion of the data from the left margin.
       
   969      */
       
   970     TInt iHScrollOffset; 
       
   971 	
       
   972     /**
       
   973      * Index of the current item.
       
   974      */
       
   975     TInt iCurrentItemIndex;
       
   976 	
       
   977     /**
       
   978      * Height of each item in the list in pixels.
       
   979      */
       
   980     TInt iItemHeight;
       
   981 	
       
   982     /**
       
   983      * This list box view’s window.
       
   984      */
       
   985     RWindow* iWin;
       
   986 	
       
   987     /**
       
   988      * The window group of this view.
       
   989      */
       
   990     RWindowGroup* iGroupWin;
       
   991 	
       
   992     /**
       
   993      * Graphics context for the control.
       
   994      */
       
   995     CWindowGc* iGc;
       
   996 	
       
   997     /**
       
   998      * Graphics context for the control.
       
   999      */
       
  1000     TRect iViewRect;
       
  1001 
       
  1002     /**
       
  1003      * The empty list text.
       
  1004      */
       
  1005 	HBufC *iListEmptyText;
       
  1006     
       
  1007     /**
       
  1008      * Indicates whether vertical line drawing is disabled.
       
  1009      */
       
  1010     TBool iDisableVerticalLineDrawing /*TInt iSpare*/;
       
  1011 
       
  1012 private:
       
  1013 	TInt iMatcherCursorPos;
       
  1014 	TRgb iMatcherCursorColor; 
       
  1015 	TRgb iBackColor;
       
  1016 	TRgb iTextColor;
       
  1017 	TInt iAnchorIndex;  
       
  1018 	TInt iActiveEndIndex;
       
  1019 	CSelectionIndexArray* iSelectionIndexes;
       
  1020 	MListVisibilityObserver* iVisibilityObserver;
       
  1021 protected:
       
  1022     /**
       
  1023      * Current vertical offset of the view in pixels.
       
  1024      */
       
  1025     TInt iVerticalOffset;
       
  1026 
       
  1027 	CListBoxViewExtension* iExtension;
       
  1028     TInt iSpare[4];
       
  1029 	};
       
  1030 
       
  1031 NONSHARABLE_CLASS( CListBoxViewExtension ) : public CBase
       
  1032     {
       
  1033     public:
       
  1034         static CListBoxViewExtension* NewL();
       
  1035         
       
  1036         ~CListBoxViewExtension();
       
  1037         
       
  1038     private:
       
  1039         void ConstructL();
       
  1040         
       
  1041     public:
       
  1042 	CEikListBox* iListBox;
       
  1043 	TBool iScrolling;
       
  1044 	TBool iScrollingDisabled;
       
  1045     };
       
  1046 
       
  1047 
       
  1048 /**
       
  1049  * Return text currently in the empty list text
       
  1050  */
       
  1051 inline const TDesC* CListBoxView::EmptyListText() const
       
  1052 	{ return(iListEmptyText); }
       
  1053 
       
  1054 
       
  1055 class CSnakingListBoxView : public CListBoxView
       
  1056 	{
       
  1057 public:
       
  1058 	IMPORT_C ~CSnakingListBoxView();
       
  1059 	IMPORT_C CSnakingListBoxView();
       
  1060 	inline TInt ColumnWidth() const;
       
  1061 	IMPORT_C void SetColumnWidth(TInt aColumnWidth);
       
  1062 	IMPORT_C virtual void MoveCursorL(TCursorMovement aCursorMovement, TSelectionMode aSelectionMode);
       
  1063 	IMPORT_C virtual void SetTopItemIndex(TInt aItemIndex);
       
  1064 	IMPORT_C virtual void SetItemHeight(TInt aItemHeight);
       
  1065 	IMPORT_C virtual TBool XYPosToItemIndex(TPoint aPosition, TInt& aItemIndex) const;
       
  1066 	IMPORT_C virtual TInt NumberOfItemsThatFitInRect(const TRect& aRect) const;
       
  1067 	IMPORT_C virtual void HScroll(TInt aHScrollAmount);
       
  1068 	IMPORT_C virtual void CalcDataWidth();
       
  1069 	IMPORT_C virtual void CalcBottomItemIndex();
       
  1070 	IMPORT_C virtual void Draw(const TRect* aClipRect = NULL) const;
       
  1071 	IMPORT_C virtual TInt VisibleWidth(const TRect& aRect) const;
       
  1072 	IMPORT_C virtual TBool ScrollToMakeItemVisible(TInt aItemIndex);
       
  1073 	IMPORT_C virtual TInt CalculateHScrollOffsetSoItemIsVisible(TInt aItemIndex);
       
  1074 	IMPORT_C virtual TInt CalcNewTopItemIndexSoItemIsVisible(TInt aItemIndex) const;
       
  1075 	IMPORT_C virtual TPoint ItemPos(TInt aItemIndex) const;
       
  1076 	IMPORT_C virtual TSize ItemSize(TInt aItemIndex=0) const;
       
  1077 	IMPORT_C void CalcRowAndColIndexesFromItemIndex(TInt aItemIndex, TInt& aRowIndex, TInt& aColIndex) const;
       
  1078 	IMPORT_C void CalcItemIndexFromRowAndColIndexes(TInt& aItemIndex, TInt aRowIndex, TInt aColIndex) const;
       
  1079 	IMPORT_C virtual TInt NumberOfItemsPerColumn() const;
       
  1080 protected:
       
  1081 	IMPORT_C virtual void DrawItemRange(TInt aStartItemIndex, TInt aEndItemIndex) const;
       
  1082 	IMPORT_C void DrawColumnRange(TInt aStartColIndex, TInt aEndColIndex) const;
       
  1083 	IMPORT_C void MoveToPreviousColumnL(TSelectionMode aSelectionMode);
       
  1084 	IMPORT_C void MoveToNextColumnL(TSelectionMode aSelectionMode);
       
  1085 	IMPORT_C void ClearUnusedItemSpace(TInt aStartItemIndex, TInt aEndItemIndex) const;
       
  1086 	IMPORT_C void UpdateHScrollOffsetBasedOnTopItemIndex();
       
  1087 private: // overridden from CListBoxView
       
  1088 	IMPORT_C virtual TAny* Reserved_1();
       
  1089 protected:
       
  1090 	TInt iColumnWidth;
       
  1091 	};
       
  1092 
       
  1093 
       
  1094 
       
  1095 inline TInt CListBoxView::Flags() const
       
  1096 	{ return iFlags; }
       
  1097 
       
  1098 inline void CListBoxView::SetFlags(TInt aMask)
       
  1099 	{ iFlags|=aMask; }
       
  1100  
       
  1101 inline void CListBoxView::ClearFlags(TInt aMask)
       
  1102 	{ iFlags&=(~aMask); }
       
  1103 
       
  1104 inline CListItemDrawer* CListBoxView::ItemDrawer() const
       
  1105 	{ return iItemDrawer; }
       
  1106 
       
  1107 inline TInt CSnakingListBoxView::ColumnWidth() const
       
  1108 	{ return iColumnWidth; }
       
  1109 
       
  1110 
       
  1111 #endif  // __EIKLBV_H__