API published in: S60 1st Ed
Link against: avkon.lib eikctl.lib eikcoctl.lib
Required Capabilities
None
#include <eiklbv.h>
Inherited by CAknGridView, CColumnListBoxView, CFormattedCellListBoxView, and CSnakingListBoxView.
A list box view displays the list items which are currently visible in a list box. List box views draw each of the items for display using methods defined in their associated list box drawer.
Together with its list item drawer, a CListBoxView
encapsulates the on-screen appearance of data in a list box.
List box views also encapsulate item selection, the current item, and the fundamentals of how the selection and the current
item are updated according to user input. Input events themselves are handled by CEikListBox
, which calls member functions of CListBoxView
appropriately.
This class is sufficient for plain list box views, and may be derived from in order to provide more complex list views. TechView
supplies and uses the classes CHierarchicalListBoxView
and CSnakingListBoxView
, which provide two kinds of indented list views.
Public Types |
|
typedef CArrayFix< TInt > | CSelectionIndexArray |
The items which are selected within a list box list. |
|
enum | TCursorMovement { ECursorNextItem, ECursorPreviousItem, ECursorNextColumn, ECursorPreviousColumn, ECursorPreviousPage, ECursorNextPage, ECursorFirstItem, ECursorLastItem, ECursorNextScreen, ECursorPrevScreen } |
Cursor movement flags. More... |
|
enum | TFlags { EAnchorExists = 0x0001, EEmphasized = 0x0002, EDimmed = 0x0004, EHasMatcherCursor = 0x0008, EDisableRedraw = 0x0010, EPaintedSelection = 0x0020, EMarkSelection = 0x0040, EUnmarkSelection = 0x0080, EItemCountModified = 0x0100 } |
List box view flags. More... |
|
enum | TSelectionMode { ENoSelection, ESingleSelection, EContiguousSelection, EDisjointSelection, EDisjointMarkSelection, EPenMultiselection, EChangeMarkMode } |
Modes for modifying the selection. More... |
|
Public Member Functions |
|
IMPORT_C | ~CListBoxView () |
Destructor. |
|
IMPORT_C | CListBoxView () |
C++ default constructor. |
|
virtual IMPORT_C void | ConstructL (MListBoxModel *aListBoxModel, CListItemDrawer *aItemDrawer, CWsScreenDevice *aScreen, RWindowGroup *aGroupWin, RWindow *aWsWindow, const TRect &aDisplayArea, TInt aItemHeight) |
By default Symbian 2nd phase constructor is private. |
|
IMPORT_C TRect | ViewRect () const |
Gets the list box’s view rectangle. |
|
IMPORT_C void | SetViewRect (const TRect &aRect) |
Sets the area within the list window in which the view can draw itself. |
|
virtual IMPORT_C TInt | CurrentItemIndex () const |
Gets the current item’s index. |
|
IMPORT_C void | SetCurrentItemIndex (TInt aItemIndex) |
Set the index of the current item. |
|
IMPORT_C TInt | TopItemIndex () const |
Gets the index of the item at the top of the view. |
|
virtual IMPORT_C void | SetTopItemIndex (TInt aItemIndex) |
Sets the item at the top of the view by its index in the list of all items. |
|
IMPORT_C TInt | BottomItemIndex () const |
Gets the index of the item at the bottom of this view. |
|
virtual IMPORT_C void | CalcBottomItemIndex () |
Recalculates the index of the bottom item in the list by using the top item index and the size of the display. |
|
virtual IMPORT_C void | SetItemHeight (TInt aItemHeight) |
Sets the item height. |
|
IMPORT_C void | SetMatcherCursorColor (TRgb aColor) |
Sets the match cursor’s colour. |
|
IMPORT_C void | SetMatcherCursorPos (TInt aPosWithinCurrentItem) |
Sets the match cursor's position. |
|
IMPORT_C TInt | MatcherCursorPos () const |
Gets the match cursor’s position. |
|
virtual IMPORT_C void | DrawMatcherCursor () |
Draws the match cursor in its current screen position if the matcher cursor flag has been set. |
|
IMPORT_C void | HideMatcherCursor () |
Hides the matcher cursor. |
|
IMPORT_C void | SetMatcherCursor (TBool aMatcherCursor) |
Sets whether the matcher cursor flag to specify whether the match cursor is drawn. |
|
IMPORT_C void | SetEmphasized (TBool aEmphasized) |
Sets whether or not items are drawn as emphasised. |
|
IMPORT_C void | SetDimmed (TBool aDimmed) |
Sets whether items will be drawn dimmed. |
|
IMPORT_C void | SetDisableRedraw (TBool aDisableRedraw) |
Disables or enables redraws. |
|
IMPORT_C TBool | RedrawDisabled () const |
Tests whether redraw is disabled. |
|
IMPORT_C void | SetPaintedSelection (TBool aPaintedSelection) |
Sets the painted selection flag. |
|
IMPORT_C const CSelectionIndexArray * | SelectionIndexes () const |
Gets a pointer to the selection list of this view. |
|
IMPORT_C void | GetSelectionIndexesL (CSelectionIndexArray *aSelectionArray) const |
Gets a copy of the array of currently selected items. |
|
IMPORT_C void | SetSelectionIndexesL (const CSelectionIndexArray *aSelectionIndexes) |
Sets the currently selected items of this view from a selection index array. |
|
IMPORT_C void | ClearSelection () |
Resets the selection state so that there is nothing selected. |
|
virtual IMPORT_C void | UpdateSelectionL (TSelectionMode aSelectionMode) |
Updates item selection. |
|
IMPORT_C void | ToggleItemL (TInt aItemIndex) |
Toggles the selection of an item. |
|
IMPORT_C void | SelectItemL (TInt aItemIndex) |
Selects an item by index. |
|
IMPORT_C void | DeselectItem (TInt aItemIndex) |
Deselects an item by index. |
|
IMPORT_C void | SetAnchor (TInt aItemIndex) |
Sets the anchor to the specified item. |
|
IMPORT_C void | ClearSelectionAnchorAndActiveIndex () |
Resets the anchor index, the active end and the EAnchorExists flag. |
|
virtual IMPORT_C TBool | ScrollToMakeItemVisible (TInt aItemIndex) |
Scrolls vertically to make a particular item visible. |
|
virtual IMPORT_C void | VScrollTo (TInt aNewTopItemIndex) |
Sets the index of the item to be the top item. |
|
virtual IMPORT_C void | VScrollTo (TInt aNewTopItemIndex, TRect &aMinRedrawRect) |
Sets the index of the item to be the top item. |
|
virtual IMPORT_C void | HScroll (TInt aHScrollAmount) |
Scrolls horizontally by the specified number of pixels. |
|
IMPORT_C TInt | HScrollOffset () const |
Gets the offset of the visible portion of the data from the left margin in pixels. |
|
IMPORT_C void | SetHScrollOffset (TInt aHorizontalOffset) |
Sets the horizontal scroll offset in pixels. |
|
IMPORT_C TInt | DataWidth () const |
Gets the width of the widest item in the list in pixels. |
|
virtual IMPORT_C void | CalcDataWidth () |
Recalculates the data width of this list box view from the item width of its list item drawer. |
|
virtual IMPORT_C TInt | VisibleWidth (const TRect &aRect) const |
Gets the visible width of the specified rectangle in pixels. |
|
virtual IMPORT_C TInt | CalcNewTopItemIndexSoItemIsVisible (TInt aItemIndex) const |
Calculates which item should be selected in order to make a particular item visible. |
|
virtual IMPORT_C void | Draw (const TRect *aClipRect=NULL) const |
Draws every visible item into the specified rectangle. |
|
virtual IMPORT_C void | DrawItem (TInt aItemIndex) const |
Draws the specified item via CListBoxDrawer::DrawItem() if it is visible. |
|
IMPORT_C void | SetListEmptyTextL (const TDesC &aText) |
Sets list box backroung text. |
|
const TDesC * | EmptyListText () const |
Gets an empty list box text. |
|
IMPORT_C TBool | ItemIsSelected (TInt aItemIndex) const |
Tests whether an item is selected. |
|
IMPORT_C TBool | ItemIsVisible (TInt aItemIndex) const |
Tests whether an item is visible. |
|
virtual IMPORT_C TPoint | ItemPos (TInt aItemIndex) const |
Gets the on-screen position of an item. |
|
virtual IMPORT_C TSize | ItemSize (TInt aItemIndex=0) const |
Gets the on-screen size of an item. |
|
IMPORT_C void | SetTextColor (TRgb aColor) |
Sets the colour in which to display text. |
|
IMPORT_C void | SetBackColor (TRgb aColor) |
Sets the background colour. |
|
IMPORT_C TRgb | TextColor () const |
Gets the colour in which text is to be displayed. |
|
IMPORT_C TRgb | BackColor () const |
Gets the background colour for this view. |
|
virtual IMPORT_C void | MoveCursorL (TCursorMovement aCursorMovement, TSelectionMode aSelectionMode) |
Moves the current item cursor in the specified direction. |
|
virtual IMPORT_C void | VerticalMoveToItemL (TInt aTargetItemIndex, TSelectionMode aSelectionMode) |
Moves to the specified item, sets it as the current item and scrolls the display to make the item visible. |
|
virtual IMPORT_C TBool | XYPosToItemIndex (TPoint aPosition, TInt &aItemIndex) const |
Converts a pixel position into an item index. |
|
virtual IMPORT_C TInt | NumberOfItemsThatFitInRect (const TRect &aRect) const |
Gets the number of items that will fit into a given rectangle. |
|
void | SetVisibilityObserver (MListVisibilityObserver *aObserver) |
Sets the visibility observer. |
|
IMPORT_C TBool | IsVisible () const |
Tests if this view is visible. |
|
CListItemDrawer * | ItemDrawer () const |
Gets the object used by this list box view to draw its items. |
|
virtual IMPORT_C void | DrawEmptyList (const TRect &aClientRect) const |
Not implemented. |
|
void | DisableVerticalLineDrawing (TBool aDisable) |
Disables vertical line drawing. |
|
IMPORT_C void | DeselectRangeL (TInt aItemIndex1, TInt aItemIndex2) |
Deselects range between given indexes. |
|
Protected Member Functions |
|
TInt | Flags () const |
Gets this view’s flags. |
|
void | SetFlags (TInt aMask) |
Sets this view’s flags according to a bitmask. |
|
void | ClearFlags (TInt aMask) |
Clears this view’s flags according to a bitmask. |
|
IMPORT_C void | SelectRangeL (TInt aItemIndex1, TInt aItemIndex2) |
Selects items between given indexes. |
|
Protected Attributes |
|
TInt | iFlags |
The flags for this list box. |
|
CListItemDrawer * | iItemDrawer |
This view’s item drawer. |
|
MListBoxModel * | iModel |
This view’s model. |
|
TInt | iDataWidth |
Width (in pixels) of the longest item in the model. |
|
TInt | iTopItemIndex |
Index of the item at the top of the view. |
|
TInt | iBottomItemIndex |
Index of the item at the bottom of the view. |
|
TInt | iHScrollOffset |
Pixel offset of the visible portion of the data from the left margin. |
|
TInt | iCurrentItemIndex |
Index of the current item. |
|
TInt | iItemHeight |
Height of each item in the list in pixels. |
|
RWindow * | iWin |
This list box view’s window. |
|
RWindowGroup * | iGroupWin |
The window group of this view. |
|
CWindowGc * | iGc |
Graphics context for the control. |
|
TRect | iViewRect |
Graphics context for the control. |
|
HBufC * | iListEmptyText |
The empty list text. |
|
TBool | iDisableVerticalLineDrawing |
Indicates whether vertical line drawing is disabled. |
|
Friends |
|
class | CEikListBox |
List box base class. |
|
The items which are selected within a list box list. |
|
Cursor movement flags.
These describe the cursor movements recognised by
|
|
|
Modes for modifying the selection. Changing the current item of a list box view may also affect which items are selected. The selection mode of such an action describes how (or if) the selection is altered by the action.
Each function of Note that the behaviour of list box views may vary with the target phone due to the wide range of possible input devices. The following description assumes a phone with a pointer and a keyboard.
|
|
Destructor. |
|
C++ default constructor.
Allocates an area of memory for a |
|
Gets the background colour for this view.
|
|
Gets the index of the item at the bottom of this view.
|
|
Recalculates the index of the bottom item in the list by using the top item index and the size of the display. This function is called by the owning list box control when either the size of the list box or the number of items in its model changes. Reimplemented in CAknGridView, CAknColumnListBoxView, CColumnListBoxView, CFormattedCellListBoxView, and CSnakingListBoxView. |
|
Recalculates the data width of this list box view from the item width of its list item drawer.
This method is called directly by Reimplemented in CAknGridView, and CSnakingListBoxView. |
|
Calculates which item should be selected in order to make a particular item visible.
Calling
Reimplemented in CAknGridView, and CSnakingListBoxView. |
|
Clears this view’s flags according to a bitmask.
These flags are defined by the nested enum
|
|
Resets the selection state so that there is nothing selected.
|
|
Resets the anchor index, the active end and the |
|
By default Symbian 2nd phase constructor is private.
This function completes the initialisation of a default-constructed list box view. The item drawer’s graphics context is created
on
|
|
Gets the current item’s index.
Reimplemented in CAknGridView. |
|
Gets the width of the widest item in the list in pixels.
|
|
Deselects an item by index.
|
|
Deselects range between given indexes.
|
|
Disables vertical line drawing.
|
|
Draws every visible item into the specified rectangle.
As implemented in
Reimplemented in CAknGMSStyleGridView, CAknGridView, CSingleHeadingStyleView, CColumnListBoxView, CFormattedCellListBoxView, CSnakingListBoxView, and CSettingsListBoxView. |
|
Not implemented.
Reimplemented in CAknColumnListBoxView, CAknSetStyleListBoxView, CSingleHeadingStyleView, and CFormattedCellListBoxView. |
|
Draws the specified item via
Reimplemented in CAknGridView, and CSettingsListBoxView. |
|
Draws the match cursor in its current screen position if the matcher cursor flag has been set. This is deprecated and broken and should not be used. Reimplemented in CAknGridView. |
|
Gets an empty list box text.
|
|
Gets this view’s flags.
These flags are defined by the nested enum
|
|
Gets a copy of the array of currently selected items.
|
|
Hides the matcher cursor. |
|
Scrolls horizontally by the specified number of pixels.
Reimplemented in CSnakingListBoxView. |
|
Gets the offset of the visible portion of the data from the left margin in pixels.
|
|
Tests if this view is visible.
|
|
Gets the object used by this list box view to draw its items.
Reimplemented in CSettingsListBoxView. |
|
Tests whether an item is selected.
|
|
Tests whether an item is visible.
|
|
Gets the on-screen position of an item.
Reimplemented in CAknGridView, and CSnakingListBoxView. |
|
Gets the on-screen size of an item.
As implemented in
Reimplemented in CAknGridView, and CSnakingListBoxView. |
|
Gets the match cursor’s position.
|
|
Moves the current item cursor in the specified direction.
This function is called by
|
|
Gets the number of items that will fit into a given rectangle.
Reimplemented in CSnakingListBoxView. |
|
Tests whether redraw is disabled.
|
|
Scrolls vertically to make a particular item visible.
Reimplemented in CAknGridView, and CSnakingListBoxView. |
|
Gets a pointer to the selection list of this view.
|
|
Selects an item by index. This function leaves if memory could not be allocated for an extra item in the array of selected items.
|
|
Selects items between given indexes.
|
|
Sets the anchor to the specified item.
|
|
Sets the background colour.
|
|
Set the index of the current item. This function changes the current item, but does not redraw the list view or update the selection.
|
|
Sets whether items will be drawn dimmed. The function sets or resets the dim flag.
|
|
Disables or enables redraws.
If this flag is set to
|
|
Sets whether or not items are drawn as emphasised. The function sets or resets the emphasised flag.
|
|
Sets this view’s flags according to a bitmask.
These flags are defined by the nested enum
|
|
Sets the horizontal scroll offset in pixels.
|
|
Sets the item height.
Reimplemented in CAknGridView, and CSnakingListBoxView. |
|
Sets list box backroung text. This text is visible if the list box has no items.
|
|
Sets whether the matcher cursor flag to specify whether the match cursor is drawn.
|
|
Sets the match cursor’s colour.
|
|
Sets the match cursor's position.
|
|
Sets the painted selection flag.
|
|
Sets the currently selected items of this view from a selection index array.
|
|
Sets the colour in which to display text.
|
|
Sets the item at the top of the view by its index in the list of all items.
This function also invokes
Reimplemented in CAknGridView, and CSnakingListBoxView. |
|
Sets the area within the list window in which the view can draw itself.
|
|
Sets the visibility observer.
|
|
Gets the colour in which text is to be displayed.
|
|
Toggles the selection of an item.
|
|
Gets the index of the item at the top of the view.
|
|
Updates item selection.
|
|
Moves to the specified item, sets it as the current item and scrolls the display to make the item visible.
|
|
Gets the list box’s view rectangle.
|
|
Gets the visible width of the specified rectangle in pixels.
This function is called by
Reimplemented in CAknGridView, and CSnakingListBoxView. |
|
Sets the index of the item to be the top item.
This two argument version returns the area which needs redrawing via
|
|
Sets the index of the item to be the top item.
|
|
Converts a pixel position into an item index.
The function returns
Reimplemented in CAknGridView, and CSnakingListBoxView. |
|
List box base class.
To access |
|
Index of the item at the bottom of the view. This is not necessarily the item at the end of the list. |
|
Index of the current item. |
|
Width (in pixels) of the longest item in the model. |
|
Indicates whether vertical line drawing is disabled. |
|
The flags for this list box.
These flags are defined by the nested enum |
|
Graphics context for the control. |
|
The window group of this view. |
|
Pixel offset of the visible portion of the data from the left margin. |
|
This view’s item drawer. Not owned. |
|
Height of each item in the list in pixels. |
|
The empty list text. |
|
This view’s model. Not owned. |
|
Index of the item at the top of the view. This is not necessarily the item at the start of the list. |
|
Graphics context for the control. |
|
This list box view’s window. |