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.
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.
|