Symbian Developer Library

SYMBIAN OS V6.1 EDITION FOR C++

[Index] [Glossary] [Previous] [Next]



Location: eiklbx.h
Link against: eikcoctl.lib

Class CEikListBox

CEikListBox

Support

Supported from 6.0

Description

Base class for an on-screen list box control from which one or more items can be selected. CEikListBox implements the basics of a list box — it has a scroll bar frame, an item drawer, and a model, and reports events to a list box observer.

List boxes display a number of items within a scrolling frame; the items in a list box which are visible at one time are represented by a list box view.

Writing derived classes:

This class may be derived from to provide specialisations of the basic list box behaviour. It is usual when subclassing CEikListBox to also provide specialisations of CListItemDrawer and CListBoxView for representing the data of such a list box effectively.

Derivation

CBaseBase class for all classes to be instantiated on the heap
CCoeControlControl base class from which all other controls are derived
CEikBorderedControlA control which is drawn surrounded by a rectangular border
CEikListBoxBase class for an on-screen list box control from which one or more items can be selected
MEikScrollBarObserverThis mixin is implemented by classes wishing to receive notification about scroll events from a scroll bar

Defined in CEikListBox:
AdjustRectHeightToWholeNumberOfItems(), AdjustTopItemIndex(), Anonymous, BackColor(), BottomItemIndex(), Buffer(), CEikListBox(), CalcHeightBasedOnNumOfItems(), CalcSizeInPixels(), CalcWidthBasedOnNumOfChars(), CalcWidthBasedOnRequiredItemWidth(), CalculatePopoutRect(), CheckCreateBufferL(), CheckCreateExtension(), CheckCreateExtensionL(), ClearMargins(), ClearMatchBuffer(), ClearSelection(), ComponentControl(), ConstructL(), CountComponentControls(), CreateMatchBufferL(), CreateScrollBarFrameL(), CreateViewL(), CurrentItemIndex(), Draw(), DrawItem(), DrawMatcherCursor(), ECreateOwnWindow, EIncrementalMatching, EItemDoubleClicked, EKeepModel, ELeftDownInViewRect, EMultipleSelection, ENoExtendedSelection, ENoFirstLetterMatching, EPaintedSelection, EPopout, EScrollBarSizeExcluded, EStateChanged, EditItemL(), FocusChanged(), GetColorUseListL(), HandleDragEventL(), HandleItemAdditionL(), HandleItemRemovalL(), HandleLeftArrowKeyL(), HandlePointerEventL(), HandleResourceChange(), HandleRightArrowKeyL(), HandleScrollEventL(), HandleViewRectSizeChangeL(), HorizScrollGranularityInPixels(), HorizontalMargin(), HorizontalNudgeValue(), InputCapabilities(), InterItemGap(), IsMatchBuffer(), ItemEditor(), ItemExists(), ItemHeight(), KEikListBoxInterItemGap, KEikMaxMatchingBufferLength, ListBoxMargins(), MakeViewClassInstanceL(), MatchBuffer(), MatchTypedCharL(), MinimumSize(), Model(), OfferKeyEventL(), ReasonForFocusLostL(), ReportListBoxEventL(), Reset(), ResetItemEditor(), RestoreClientRectFromViewRect(), RestoreCommonListBoxPropertiesL(), ScrollBarFrame(), ScrollToMakeItemVisible(), SelectionIndexes(), SetContainerWindowL(), SetCurrentItemIndex(), SetCurrentItemIndexAndDraw(), SetDimmed(), SetHorizontalMargin(), SetItemEditor(), SetItemHeightL(), SetLaunchingButton(), SetListBoxObserver(), SetReasonForFocusLostL(), SetSelectionIndexesL(), SetTopItemIndex(), SetVerticalMargin(), SetViewRectFromClientRect(), SimulateArrowKeyEventL(), SizeChanged(), StopEditingL(), TFlags, TopItemIndex(), UndoLastChar(), UpdateCurrentItem(), UpdateItemDrawerColors(), UpdateScrollBarThumbs(), UpdateScrollBarsL(), UpdateViewColors(), VerticalInterItemGap(), VerticalMargin(), View(), ViewRectHeightAdjustment(), iItemDrawer, iItemHeight, iLaunchingButton, iListBoxFlags, iListBoxObserver, iModel, iRequiredHeightInNumOfItems, iSBFrame, iView, ~CEikListBox()

Inherited from CBase:
operator new()

Inherited from CCoeControl:
ActivateGc(), ActivateL(), BackedUpWindow(), CapturesPointer(), ClaimPointerGrab(), CloseWindow(), ConstructFromResourceL(), ControlContext(), ControlEnv(), CopyControlContextFrom(), CreateBackedUpWindowL(), CreateWindowL(), DeactivateGc(), DrawDeferred(), DrawNow(), DrawableWindow(), EnableDragEvents(), GetColor(), GetHelpContext(), GrabbingComponent(), HandleComponentControlsResourceChange(), HandlePointerBufferReadyL(), HandleRedrawEvent(), IgnoreEventsUntilNextPointerUp(), Index(), IsActivated(), IsBackedUp(), IsBeingDestroyed(), IsBlank(), IsDimmed(), IsFocused(), IsNonFocusing(), IsReadyToDraw(), IsVisible(), MakeVisible(), Observer(), OverrideColorL(), OwnsWindow(), Position(), PositionChanged(), PositionRelativeToScreen(), PrepareForFocusGainL(), PrepareForFocusLossL(), Rect(), RecursivelyMergedInputCapabilities(), ReportEventL(), ResetGc(), SetAllowStrayPointers(), SetBlank(), SetCanDrawOutsideRect(), SetComponentsToInheritVisibility(), SetContainerWindow(), SetControlContext(), SetCornerAndSize(), SetCornerAndSizeL(), SetExtent(), SetExtentL(), SetExtentToWholeScreen(), SetExtentToWholeScreenL(), SetFocus(), SetFocusing(), SetGloballyCapturing(), SetNeighbor(), SetNonFocusing(), SetObserver(), SetPointerCapture(), SetPosition(), SetRect(), SetRectL(), SetSize(), SetSizeL(), SetSizeWithoutNotification(), SetSizeWithoutNotificationL(), Size(), SizeChangedL(), SystemGc(), Window()

Inherited from CEikBorderedControl:
Border(), HasBorder(), SetAdjacent(), SetBorder(), iBorder

Inherited from MEikScrollBarObserver:
EEikScrollBottom, EEikScrollDown, EEikScrollEnd, EEikScrollHome, EEikScrollLeft, EEikScrollPageDown, EEikScrollPageLeft, EEikScrollPageRight, EEikScrollPageUp, EEikScrollRight, EEikScrollThumbDragHoriz, EEikScrollThumbDragVert, EEikScrollThumbReleaseHoriz, EEikScrollThumbReleaseVert, EEikScrollTop, EEikScrollUp, TEikScrollEvent

See also:


Construction and destruction


CEikListBox()

CEikListBox();

Description

Default constructor.

This function allocates memory for a list box, and initialises its stack-based members.


ConstructL()

protected: void ConstructL(const CCoeControl* aParent,TInt aFlags = 0);

Description

Protected second-phase constructor.

This protected form is overridden non-virtually by the second-phase constructors of each subclass, and should be invoked by them using CEikListBox::ConstructL().

Parameters

const CCoeControl* aParent

The parent control. May be NULL.

TInt aFlags = 0

An ORed combination of TFlags (below).


ConstructL()

void ConstructL(MListBoxModel* aListBoxModel,CListItemDrawer* aListItemDrawer,const CCoeControl* aParent,TInt aFlags = 0);

Description

Second-phase construction of a list box.

These functions complete construction of this list box, initialising its heap-stored members with the information provided by the arguments. The functions invoke ConstructL(CCoeControl*, TInt).

Parameters

MListBoxModel* aListBoxModel

The list box model representing the data to be displayed. May be NULL.

CListItemDrawer* aListItemDrawer

A drawer for list items.

const CCoeControl* aParent

The parent control. May be NULL.

TInt aFlags = 0

An ORed combination of TFlags (below).


ConstructL()

void ConstructL(MListBoxModel* aListBoxModel,CListItemDrawer* aListItemDrawer,const CCoeControl* aParent,TGulBorder aBorder,TInt aFlags = 0);

Description

Second-phase construction of a list box with a border.

These functions complete construction of this list box, initialising its heap-stored members with the information provided by the arguments. The functions invoke ConstructL(CCoeControl*, TInt).

The protected form is overridden non-virtually by the second-phase constructors of each subclass, and should be invoked by them using CEikListBox::ConstructL().

Parameters

MListBoxModel* aListBoxModel

The list box model representing the data to be displayed. May be NULL.

CListItemDrawer* aListItemDrawer

A drawer for list items.

const CCoeControl* aParent

The parent control. May be NULL.

TGulBorder aBorder

A specified border style.

TInt aFlags = 0

An ORed combination of TFlags (below).


~CEikListBox()

~CEikListBox();

Description

Destructor. This frees any resources owned by this list box. If EKeepModel was not specified, the list box model will also be freed.

[Top]


Construction support

Description

The following virtual functions are invoked by the constructors of CEikListBox to build its fields and ready it for being used.


CalcHeightBasedOnNumOfItems()

TInt CalcHeightBasedOnNumOfItems(TInt aNumOfItems) const;

Description

Gets the height of the list box based on the number of list box items. The height returned includes the list box margins, border and if present, the scroll bar frame.

Parameters

TInt aNumOfItems

The number of list box items.

Return value

TInt

The height of the list box in pixels.


CalcSizeInPixels()

TSize CalcSizeInPixels(TInt aWidthAsNumOfChars, TInt aHeightAsNumOfItems) const;

Description

Gets the size of the list box in pixels based on the height of the list box in items.

Parameters

TInt aWidthAsNumOfChars

Width of list box in characters.

TInt aHeightAsNumOfItems

Height of list box in characters.

Return value

TSize

A two dimensional size as a width and a height value in pixels.


CalcWidthBasedOnNumOfChars()

TInt CalcWidthBasedOnNumOfChars(TInt aNumOfChars) const;

Description

Gets the width of the list box in pixels based on the width of the list box in characters.

Parameters

TInt aNumOfChars

Width of list box in characters.

Return value

TInt

Width of list box in pixels.


CalcWidthBasedOnRequiredItemWidth()

TInt CalcWidthBasedOnRequiredItemWidth(TInt aTextWidthInPixels) const;

Description

Gets the width of the list box in pixels based on the width of the list box text in pixels.

Parameters

TInt aTextWidthInPixels

Width of list box text in pixels.

Return value

TInt

Required width of whole list box in pixels.


CalculatePopoutRect()

void CalculatePopoutRect(TInt aTargetItemIndex, TInt aTargetYPos, TRect& aListBoxRect, TInt aMinHeightInNumOfItems = 1);

Description

Gets the size of the rectangle required to display a pop out.

Parameters

TInt aTargetItemIndex

The item from which the popout originates.

TInt aTargetYPos

Vertical position of the item from which the popout originates.

TRect& aListBoxRect

The list box rectangle.

TInt aMinHeightInNumOfItems = 1

The minimum number of items for the popout.


MakeViewClassInstanceL()

protected: virtual CListBoxView* MakeViewClassInstanceL();

Description

Creates the list box view.

The function is called by ConstructL() to create an instance of the appropriate list box view class for this list box. The returned instance is owned by this object, and does not have to have its second-phase constructor run. This function is called by CreateViewL().

Return value

CListBoxView*

Pointer to a newly constructed list box view for this object.


CreateViewL()

protected: virtual void CreateViewL();

Description

Completes the list box view’s construction.

This function is called by ConstructL() to complete construction of the resource view, calling its ConstructL() with appropriate arguments and assigning it to iView. Also prepares the view for use.


RestoreCommonListBoxPropertiesL()

protected: void RestoreCommonListBoxPropertiesL(TResourceReader& aReader);

Description

Restores the list box properties shared by all subclasses from a resource reader. This function is not called within CEikListBox itself, but is used by subclasses which support construction from resources.

Parameters

TResourceReader& aReader

A resource reader.

See also:


SetContainerWindowL()

virtual void SetContainerWindowL(const CCoeControl& aContainer);

Description

Sets this list box’s container. This enables drag events and pointer grab.

If the ECreateOwnWindow or EPopout flags have been set, a window is first created for this control and this control becomes a window-owning control. Pop-out list boxes’ windows have backup set on them.

Parameters

const CCoeControl& aContainer

A compound control to set as this list box’s container.

See also:


SetLaunchingButton()

void SetLaunchingButton(CEikButtonBase* aButton);

Description

Provides a call back mechanism to the button which just launched a popout menu.

Parameters

CEikButtonBase* aButton

The button which just launched a popout menu.

[Top]


Model and view access


Model()

MListBoxModel* Model() const;

Description

Gets a pointer to the list box model.

Return value

MListBoxModel*

The list box model used by this list box.


View()

CListBoxView* View() const;

Description

Gets a pointer to the list box view.

Return value

CListBoxView*

The list box view used by this list box.

[Top]


Top, bottom and current item

Description

These functions access the view of this list box (see CListBoxView). The list box view must be instantiated before any of these functions are called.


TopItemIndex()

TInt TopItemIndex() const;

Description

Gets the index number of the item at the top of the view.

Return value

TInt

Index number of the item at the top of the view.


SetTopItemIndex()

virtual void SetTopItemIndex(TInt aItemIndex) const;

Description

Sets which item is displayed at the top of the view. The view updates the scroll bar thumb to reflect this.

Parameters

TInt aItemIndex

Index of the item to display at the top.


BottomItemIndex()

TInt BottomItemIndex() const;

Description

Gets the index number of the item at the bottom of the view.

Return value

TInt

Index number of the item displayed at the bottom of the view.


CurrentItemIndex()

TInt CurrentItemIndex() const;

Description

Gets the index number of the current item in the view.

Return value

TInt

Index number of the current item.


SetCurrentItemIndex()

void SetCurrentItemIndex(TInt aItemIndex) const;

Description

Sets the current item, but does not redraw the list.

If the item was not previouly visible it is set to the top item in the view.

Parameters

TInt aItemIndex

Index of the item to make current.


SetCurrentItemIndexAndDraw()

void SetCurrentItemIndexAndDraw(TInt aItemIndex) const;

Description

Sets the current item and redraws the list. The list box view is scrolled so that the new current item is visible.

If the item was not previouly visible it is set to the top item in the view.

Parameters

TInt aItemIndex

Index of the item to make current.


AdjustTopItemIndex()

virtual void AdjustTopItemIndex() const;

Description

Called by various functions of this class to ensure that the top item index is always a sane value. The implementation in CEikListBox tries to ensure the minimum amount of white space at the bottom of the list box. Note that this function does not affect the current item index.

See also:

[Top]


Selection state

Description

List boxes can have a number of items checked, or marked as selected.


SelectionIndexes()

const CListBoxView::CSelectionIndexArray* SelectionIndexes() const;

Description

Gets the items which are currently selected.

Return value

CListBoxView::CSelectionIndexArray*

The items which are currently selected.


SetSelectionIndexesL()

void SetSelectionIndexesL(CListBoxView::CSelectionIndexArray* aArrayOfSelectionIndexes);

Description

Sets a new list of items as selected.

Parameters

CListBoxView::CSelectionIndexArray* aArrayOfSelectionIndexes

New list of selected items.


ClearSelection()

void ClearSelection();

Description

Clears the selection.

[Top]


Model update handling

Description

List box objects need to be informed when data is added to or removed from their models. These functions may be used to update a list box’s internal state in response to changing data.


HandleItemAdditionL()

void HandleItemAdditionL();

Description

Handles the addition of an item to the model.

This method should be called after one or more items have been added to the model. Unlike HandleItemRemoval(), below, this function redraws the list box and leaves the selection in a sensible state.

See also:


HandleItemRemovalL()

void HandleItemRemovalL();

Description

Handles the removal of an item from the model.

This method should be called after one or more items have been removed from the model. It is then up to the application to make sure that the current item index is set to an appropriate value and to redraw the list box.


Reset()

void Reset();

Description

Resets the selection indices, top and current item indices, the selection, and the horizontal scroll offset of this list box. This function does not redraw the list box.

[Top]


Item height


SetItemHeightL()

virtual void SetItemHeightL(TInt aHeight);

Description

Sets the item height.

Parameters

TInt aHeight

New height for all items, in pixels.


ItemHeight()

TInt ItemHeight() const;

Description

Gets the item height in pixels.

Return value

TInt

Height in pixels of each item in the list.

[Top]


Scroll bars


UpdateScrollBarThumbs()

protected: void UpdateScrollBarThumbs() const;

Description

Updates the position of this list box’s scroll bars’ thumbs to reflect the horizontal and vertical position of the list view within the list.


UpdateScrollBarsL()

void UpdateScrollBarsL();

Description

Updates the size, span and thumb position of this list box’s scroll bars.


HorizScrollGranularityInPixels()

virtual TInt HorizScrollGranularityInPixels() const;

Description

Gets the granularity for horizontal scrolls.

The granularity is the minimum size of a horizontal move of the client area.

Return value

TInt

Grain size for horizontal scrolling in pixels.


HorizontalNudgeValue()

virtual TInt HorizontalNudgeValue() const;

Description

Gets the number of grains to move horizontally when a nudge button is tapped.

For simple list boxes, this value is a fraction of the width of the client area.

Return value

TInt

Number of grains to move left or right on each nudge.

See also:

[Top]


Drawing and scrolling


Draw()

virtual void Draw(const TRect& aRect) const;

Description

Redraws the specified area of this list box into the specified rectangle.

Parameters

const TRect& aRect

Rectangle to be redrawn, specified relative to the origin of this control.


DrawItem()

void DrawItem(TInt aItemIndex) const;

Description

Draws a list box item, first scrolling the list to make it visible if it is not already. DrawItem() panics if there is no list box view currently set.

Parameters

TInt aItemIndex

Index of the item to reveal.


ScrollToMakeItemVisible()

void ScrollToMakeItemVisible(TInt aItemIndex) const;

Description

Makes an item visible in the list, scrolling it if necessary.

Parameters

TInt aItemIndex

Index of the item to reveal.


DrawMatcherCursor()

void DrawMatcherCursor() const;

Description

Draws the matcher cursor in the correct location for the current match. If there is no match buffer, this function returns immediately; otherwise the cursor is drawn on the current item using CListBoxView::DrawMatcherCursor() after scrolling to make the current item visible.

A list box control’s matcher cursor is an on-screen cursor which is drawn to indicate to the user the location of the current text. Whether the cursor is drawn is dependent on the CListBoxView::TFlags::EHasMatcherCursor flag, which may be set on the list box’s view.

[Top]


Observer support

Description

Uikon list boxes support observation of list box events using the interface defined by MEikListBoxObserver.


SetListBoxObserver()

void SetListBoxObserver(MEikListBoxObserver* aObserver);

Description

Sets the list box observer. This observer receives future list box events from this list box.

Parameters

MEikListBoxObserver* aObserver

The list box observer to report to.


ReportListBoxEventL()

virtual void ReportListBoxEventL(MEikListBoxObserver::TListBoxEvent aEvent);

Description

Reports a list box event to any observer of this list box. This function returns immediately if no observer is set.

Parameters

MEikListBoxObserver::TListBoxEvent aEvent

The event to report.

[Top]


Resize considerations


AdjustRectHeightToWholeNumberOfItems()

virtual TInt AdjustRectHeightToWholeNumberOfItems(TRect& aRect) const;

Description

Rounds down the height of the rectangle (if necessary) so that only a whole number of items can be displayed inside the list box.

Parameters

TRect& aRect

The rectangle to be modified.

Return value

TInt

The number of pixels reduced.


SizeChanged()

virtual void SizeChanged();

Description

Updates the viewing rectangle of this control appropriately. The function updates the viewing rectangle, and invokes HandleViewRectSizeChangeL().


HandleViewRectSizeChangeL()

virtual void HandleViewRectSizeChangeL();

Description

Handles a change in size of the viewing rectangle.

This function is called by framework functions to update the content, view, and scroll bars of this list box after the viewing rectangle has changed size. This implementation ensures that the current item is visible after a resize.


RestoreClientRectFromViewRect()

virtual void RestoreClientRectFromViewRect(TRect& aClientRect) const;

Description

Calculates the client area.

This method is called by various functions of this class to recalculate the extent of the client area from iViewRect. This implementation takes into account any rounding of the viewing rectangle made to fit a whole number of items.

Parameters

TRect& aClientRect

On return contains a size for the client area in pixels.

[Top]


Component controls


CountComponentControls()

virtual TInt CountComponentControls() const;

Description

Gets a count of the component controls of this list box control. This information is used for DrawNow().

Return value

TInt

The number of component controls.


ComponentControl()

virtual CCoeControl* ComponentControl(TInt aIndex) const;

Description

Gets a pointer to the specified component control. This is used for DrawNow().

Parameters

TInt aIndex

Index of the component control to look up.

Return value

CCoeControl*

The control at aIndex.

[Top]


Miscellaneous functions


VerticalInterItemGap()

TInt VerticalInterItemGap() const;

Description

Gets the size of the vertical gap between items. This space is used by the view to allow a box to be drawn around each item.

Return value

TInt

Size of the vertical gap, in pixels.


FocusChanged()

protected: virtual void FocusChanged(TDrawNow aDrawNow);

Description

Handles focus changes.

The function emphasises or de-emphasises the view as needed, and shows or hides the matcher cursor.

Parameters

TDrawNow aDrawNow

If EDrawNow, a redraw is performed immediately.

See also:


ItemExists()

TBool ItemExists(TInt aItemIndex) const;

Description

Tests whether an item exists.

Parameters

TInt aItemIndex

Index to test.

Return value

TBool

ETrue if the specified item exists, EFalse otherwise.

[Top]


Input event handling

Description

OfferKeyEventL(), HandlePointerEventL() and HandleScrollEventL() are implementations of interfaces defined elsewhere. They are documented here for the sake of completeness.


OfferKeyEventL()

virtual TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType);

Description

Handles key events.

Parameters

const TKeyEvent& aKeyEvent

The key event.

TEventCode aType

The type of key event.

Return value

TKeyResponse

Response to the key event, depending on whether the key was consumed.

See also:


HandlePointerEventL()

virtual void HandlePointerEventL(const TPointerEvent& aPointerEvent);

Description

Handles pointer events.

Parameters

const TPointerEvent& aPointerEvent

The pointer event.

See also:


HandleDragEventL()

virtual void HandleDragEventL(TPoint aPointerPos);

Description

Handles drag events.

This function is called by HandlePointerEventL() to handle pointer drag events appropriately.

Parameters

TPoint aPointerPos

The position of the TPointerEvent for which this handler is invoked.


HandleScrollEventL()

virtual void HandleScrollEventL(CEikScrollBar* aScrollBar,TEikScrollEvent aEventType);

Description

Handles scroll bar events. These are passed by this list box’s scroll bars.

Parameters

CEikScrollBar* aScrollBar

The scroll bar on which the event occurred.

TEikScrollEvent aEventType

The type of event.

[Top]


Other member functions


MinimumSize()

virtual TSize MinimumSize();

Description

Gets the smallest area in which this list box can be completely displayed.

Return value

TSize

The smallest area in which this list box can be displayed completely.


SetDimmed()

virtual void SetDimmed(TBool aDimmed);

Description

Sets the list box dim state.

Parameters

TBool aDimmed

ETrue to dim the list box, EFalse to undim.


CreateScrollBarFrameL()

CEikScrollBarFrame* CreateScrollBarFrameL(TBool aPreAlloc=EFalse);

Description

Creates a scroll bar frame.

If aPreAlloc is ETrue, any scroll bars that the scroll bar frame may need are pre-allocated.

Parameters

TBool aPreAlloc=EFalse

EFalse to not pre-allocate scroll bars. ETrue to pre-allocate.

Return value

CEikScrollBarFrame*

Newly created scroll bar frame.


EditItemL()

void EditItemL(TInt aMaxLength);

Description

Creates an item editor and starts editing the current item

The editor can edit the current item up to a maximum length of aMaxLength characters. Also reports an EEventEditingStarted event to any list box observer by default.

The function only creates a new editor if one does not already exist.

Parameters

TInt aMaxLength

Maximum length of characters to edit.


GetColorUseListL()

void GetColorUseListL(CArrayFix<TCoeColorUse>& aColorUseList) const;

Description

Gets the list of logical colours employed in the drawing of the control, paired with an explanation of how they are used. Appends the list to aColorUseList.

Parameters

CArrayFix<TCoeColorUse>& aColorUseList

List of logical colours.


HandleLeftArrowKeyL()

virtual void HandleLeftArrowKeyL(CListBoxView::TSelectionMode aSelectionMode);

Description

Handles a left arrow key event.

The method used to handle the event depends on the selection mode, e.g. whether the user has pressed the SHIFT or CONTROL key.

Parameters

CListBoxView::TSelectionMode aSelectionMode

Not used.


HandleResourceChange()

void HandleResourceChange(TInt aType);

Description

Handles a change to the list box’s resources of type aType which are shared across the environment, colours or fonts for example.

Parameters

TInt aType

The type of resources that have changed.


HandleRightArrowKeyL()

virtual void HandleRightArrowKeyL(CListBoxView::TSelectionMode aSelectionMode);

Description

Handles a right arrow key event.

The method used to handle the event depends on the selection mode, e.g. whether the user has pressed the SHIFT or CONTROL key.

Parameters

CListBoxView::TSelectionMode aSelectionMode

Not used.


InputCapabilities()

TCoeInputCapabilities InputCapabilities() const;

Description

Gets the list box’s input capabilities as set through the list box flags.

Return value

TCoeInputCapabilities

List box input capabilities.


ItemEditor()

MEikListBoxEditor* ItemEditor();

Description

Gets a pointer to the item editor. Does not imply transfer of ownership.

Return value

MEikListBoxEditor*

Pointer to the item editor.


ResetItemEditor()

void ResetItemEditor();

Description

Deletes and NULLs the item editor.


ScrollBarFrame()

CEikScrollBarFrame* const ScrollBarFrame();

Description

Gets a pointer to the scroll bar frame.

Return value

CEikScrollBarFrame

Pointer to the scroll bar frame.


SetItemEditor()

void SetItemEditor(MEikListBoxEditor* aEditor);

Description

Sets the item editor. Ownership of the item editor is transferred to this class.

Parameters

MEikListBoxEditor* aEditor

The item editor.


StopEditingL()

void StopEditingL( TBool aUpdateModel );

Description

Stops editing and deletes the item editor.

The function reports an EEventEditingStopped event to any list box observer, and updates the list box model if aUpdateModel is ETrue.

Parameters

TBool aUpdateModel

If ETrue the list box model is updated.

[Top]


Protected member functions


BackColor()

TRgb BackColor() const;

Description

Gets the background colour.

Return value

TRgb

The background colour.


Buffer()

CMatchBuffer* Buffer() const;

Description

Gets the list box match buffer.

Return value

CMatchBuffer*

The list box match buffer.


CheckCreateBufferL()

void CheckCreateBufferL();

Description

Checks the list box match buffer exists. If a buffer does not exist, one is created.


CheckCreateExtension()

TBool CheckCreateExtension();

Description

Checks for a list box extension, creates one if not present.

Return value

TBool

ETrue if a list box extension already existed or if there was no previous extension and a new extension class was created successfully. EFalse if there was no previous extension and a new one could not be constructed.


CheckCreateExtensionL()

void CheckCreateExtensionL();

Description

Checks for a list box extension, attempts to create one if not present.

This function leaves automatically if an extension cannot be created.


SetReasonForFocusLostL()

void SetReasonForFocusLostL(TReasonForFocusLost aReasonForFocusLost);

Description

Sets the reason for the list box’s loss of focus.

This is required so the list box can determine whether loss of focus is due to an external control or an internal component.

Return value

TReasonForFocusLost aReasonForFocusLost

The reason for the loss of focus.


ReasonForFocusLostL()

TReasonForFocusLost ReasonForFocusLostL();

Description

Gets the reason for the list box’s loss of focus.

Return value

TReasonForFocusLost

The reason for the loss of focus.


ClearMargins()

void ClearMargins() const;

Description

Clears the list box margins. The list box is redrawn only if redraws are enabled for the list box view.


ClearMatchBuffer()

void ClearMatchBuffer() const;

Description

Clears the match buffer.


CreateMatchBufferL()

void CreateMatchBufferL();

Description

Creates a match buffer.

This is a utility function called from RestoreL() of subclasses such as CEikTextListBox.


HorizontalMargin()

TInt HorizontalMargin() const;

Description

Deprecated.

This function gets the horizontal margin. Use CEikListBox::ListBoxMargins() instead, as this provides a more accurate value due to the bit shifting involved.

Return value

TInt

The horizontal margin in pixels.


InterItemGap()

TInt InterItemGap();

Description

Gets the vertical gap between elements in the list box.

Return value

TInt

The vertical gap between elements in the list box.

See also:


IsMatchBuffer()

TBool IsMatchBuffer() const;

Description

Tests whether the list box match buffer exists.

Return value

TBool

ETrue if the list box match buffer exists. EFalse if the list box match buffer does not exist.


MatchBuffer()

RIncrMatcherBase* MatchBuffer() const;

Description

Gets a pointer to the match buffer. Returns NULL if the match buffer does not exist.

Return value

RIncrMatcherBase*

Pointer to the match buffer.


MatchTypedCharL()

void MatchTypedCharL(TUint aCode);

Description

Searches the match buffer for a match to a typed character. Displays the item corresponding to the typed character if a match is found. No effect if no match is found.

Parameters

TUint aCode

The ID of the character to match.


SetHorizontalMargin()

void SetHorizontalMargin(TInt aMargin);

Description

Sets the horizontal margin..

Parameters

TInt aMargin

The required horizontal margin.


SetVerticalMargin()

void SetVerticalMargin(TInt aMargin);

Description

Sets the vertical margin to aMargin.

Parameters

TInt aMargin

The required vertical margin.


SetViewRectFromClientRect()

void SetViewRectFromClientRect(const TRect& aClientRect);

Description

Sets the view rectangle from the client rectangle making sure a whole number of items is displayed.

Parameters

const TRect& aClientRect

The client rectangle.


SimulateArrowKeyEventL()

void SimulateArrowKeyEventL(TKeyCode aKeyCode);

Description

Simulates an arrow key event.

If the list box flags include EMultipleSelection, this has the effect of pressing SHIFT with the arrow key represented by aKeyCode. Calls CEikListBox::OfferKeyEventL() with aKeyCode translated into a key event.

Parameters

TKeyCode aKeyCode

A key code.


UndoLastChar()

void UndoLastChar();

Description

Removes one character from the matcher buffer, then finds the first item which matches the new buffer, if any. Redraws the list box to reflect the change. This should not be called from within another Draw() function.


UpdateCurrentItem()

void UpdateCurrentItem(TInt aItemIndex) const;

Description

Sets an item as the current item, even if it is not currently visible. Redraws the list box to reflect the change. This should not be called from within another Draw function.

Parameters

TInt aItemIndex

The index of the list box item to update.


UpdateItemDrawerColors()

void UpdateItemDrawerColors();

Description

Updates the item drawer colours in line with the colours in effect for the Uikon environment. Has no effect if there is no item drawer.


UpdateViewColors()

void UpdateViewColors();

Description

Updates the view colours in line with the colours in effect for the Uikon environment. Has no effect if there is no view.


VerticalMargin()

TInt VerticalMargin() const;

Description

Deprecated.

This function gets the vertical margin. This function is deprecated, use CEikListBox::ListBoxMargins() instead, this provides a more accurate value due to the bit shifting involved.

Return value

TInt

The vertical margin in pixels.


ListBoxMargins()

TMargins8 ListBoxMargins() const

Description

Gets list box margins.

Return value

TMargins8

The list box margins in pixels.


ViewRectHeightAdjustment()

TInt ViewRectHeightAdjustment() const;

Description

Gets the view rectangle height adjustment.

These are the adjustments that were made to the view rectangle when the SetViewRectFromClientRect() function was called.

Return value

TInt

Height adjustment.

[Top]


Nested types


Enum TFlags

TFlags

Description

Construction flags.

The aFlags argument of CEikListBox::ConstructL() is formed from an ORed combination of the following flag values:

EMultipleSelection

User can select more than one item from this list box.

ENoExtendedSelection

If set, extended selection using SHIFT is not possible.

EIncrementalMatching

List box matches user’s keystrokes incrementally.

EPopout

List box is a pop-out list box. Pop-out list boxes handle certain keystrokes and events differently.

ELeftDownInViewRect

If set, indicates the pointer being pressed inside the view rectangle of the list box.

EItemDoubleClicked

If set, indicates the CEikListBox item was double clicked.

EKeepModel

If set, the CEikListBox does not take ownership of the supplied list box model, and will not delete it upon its destruction.

EScrollBarSizeExcluded

If set, the scroll bar is drawn outside the window describing the extent of the scroll box.

EStateChanged

If set, indicates the CEikListBox has changed.

ECreateOwnWindow

The list box should create its own window.

ENoFirstLetterMatching

List box does not permit any key press matching.

EPaintedSelection

If set, selected items are painted.

[Top]


Member enumerations


Enum Anonymous

Description

Miscellaneous constants.

KEikMaxMatchingBufferLength

Maximum length of incremental match buffer (=22).

KEikListBoxInterItemGap

The vertical gap between list box items.

KEikListBoxInterItemGap

Vertical gap between list box items.

[Top]


Protected data members

Description

The following data members are declared as protected:, and may be accessed from subclasses of CEikListBox.


iItemDrawer

CListItemDrawer* iItemDrawer

Description

The drawer used by iView.


iItemHeight

TInt iItemHeight

Description

Height of each item in the list.


iLaunchingButton

CEikButtonBase* iLaunchingButton

Description

The button which just launched a popout menu.


iListBoxFlags

TInt iListBoxFlags

Description

Flags for this list box (see TFlags)


iListBoxObserver

MEikListBoxObserver* iListBoxObserver

Description

A list box observer to report list box events to.


iModel

MListBoxModel* iModel

Description

The data model for this list box.


iRequiredHeightInNumOfItems

TInt iRequiredHeightInNumOfItems

Description

The required height of this list box expressed in terms of a number of items. This field is used only by subclasses and by CEikListBox::MinimumSize().


iSBFrame

CEikScrollBarFrame* iSBFrame

Description

The scroll bar frame used by this control.


iView

CListBoxView* iView

Description

This list box’s view.