CAknListBoxFilterItems Class Reference

class CAknListBoxFilterItems : public CBase

Listbox item filtering. This class is designed to be stored inside a listbox model and the model should call this in its NumberOfItems() and ItemText() implementation. The model must be given to this class and it must have MatchableTextArray() implemented correctly. HandleOfferKeyEvent() should be called from the same offer key event implementation which forwards the keys to listbox and search field

If you have both markable list and find at the same time, you should call ResetFiltering() before executing the command for marked items. This ensures that the ListBox's SelectionIndexes() returns all items instead of only those items that are visible. Selected *items can be found under CAknListBoxFilterItems::SelectionIndexes().

Since
S60 0.9

Inherits from

  • CAknListBoxFilterItems
Public Member Functions
CAknListBoxFilterItems(CEikListBox *, CAknSearchField *, MListBoxModel *, CListBoxView *)
~CAknListBoxFilterItems()
IMPORT_C voidConstructL()
IMPORT_C TPtrCDefaultMatchableItemFromItem(TPtrC)
voidDeferredSendFullKeyEventToFepL(const TKeyEvent &)
IMPORT_C voidDeferredSendKeyEventToFepL(TUint)
IMPORT_C TIntFilteredItemIndex(TInt)
IMPORT_C TIntFilteredNumberOfItems()
IMPORT_C CCoeControl *FindBox()
IMPORT_C voidHandleControlEventL(CCoeControl *, TCoeEvent)
IMPORT_C voidHandleItemArrayChangeL()
IMPORT_C voidHandleOfferkeyEventL()
TInt IdleCallBack(TAny *)
IMPORT_C TIntNonFilteredNumberOfItems()
IMPORT_C voidResetFilteringL()
IMPORT_C CArrayFix< TInt > *SelectionIndexes()
IMPORT_C voidSetListBox(CEikListBox *)
IMPORT_C voidSetModel(MListBoxModel *)
IMPORT_C voidSetObserver(MCoeControlObserver *)
IMPORT_C voidSetParentControl(CCoeControl *)
IMPORT_C voidSetPopup()
IMPORT_C voidSetSearchField(CAknSearchField *)
IMPORT_C voidSetView(CListBoxView *)
IMPORT_C voidUpdateCachedDataL()
IMPORT_C voidUpdateSelectionIndexL(TInt)
IMPORT_C voidUpdateSelectionIndexesL()
IMPORT_C TIntVisibleItemIndex(TInt)
Private Member Functions
voidClearNextChars()
voidFetchSelectionIndexesFromListBoxL()
voidHandleItemAdditionL()
voidHandleItemRemovalL()
voidInstallEmptyTextL()
TBool IsAdaptiveSearch()
TBool IsItemSelected(TInt)
TBool IsItemVisible(const TDesC &, const TDesC &)
TBool IsSeparatorCharacter(TChar)
voidNoCriteriaL(TBool)
voidPushSelectionIndexesToListBoxL()
voidReleaseCriteriaL(const TDesC &)
voidTightenCriteriaL(const TDesC &)
voidUninstallEmptyTextL()
Inherited Functions
CBase::CBase()
CBase::Delete(CBase *)
CBase::Extension_(TUint,TAny *&,TAny *)
CBase::operator new(TUint)
CBase::operator new(TUint,TAny *)
CBase::operator new(TUint,TLeave)
CBase::operator new(TUint,TLeave,TUint)
CBase::operator new(TUint,TUint)
CBase::~CBase()
Private Attributes
TBool iDisableChangesToShownIndexes
HBufC *iEmptyListText
CFindExtension *iExtension
TBool iIsPopup
TUint iKeyValue
CEikListBox *iListBox
TBuf< 256 >iMatchableText
MListBoxModel *iModel
MCoeControlObserver *iObserver
TInt iOldItemCount
HBufC *iOldSearchCriteria
CCoeControl *iParentControl
CAknSearchField *iSearchField
CArrayFix< TInt > *iSelectionIndexes
CArrayFix< TInt > *iShownIndexes
CListBoxView *iView

Constructor & Destructor Documentation

CAknListBoxFilterItems(CEikListBox *, CAknSearchField *, MListBoxModel *, CListBoxView *)

IMPORT_CCAknListBoxFilterItems(CEikListBox *aListBox,
CAknSearchField *aSearchField,
MListBoxModel *aModel,
CListBoxView *aView
)

Base class default constructor.

Parameters

CEikListBox * aListBoxListbox to be filtered,
CAknSearchField * aSearchFieldListbox search field.
MListBoxModel * aModelListbox model,
CListBoxView * aViewA list box view that displays the list items which are currently visible in a list box.

~CAknListBoxFilterItems()

IMPORT_C~CAknListBoxFilterItems()

Destructor. Frees all resources owned by the object prior to its destruction.

Member Functions Documentation

ClearNextChars()

voidClearNextChars()[private]

ConstructL()

IMPORT_C voidConstructL()

This is for setting empty list text.

DefaultMatchableItemFromItem(TPtrC)

IMPORT_C TPtrCDefaultMatchableItemFromItem(TPtrCaText)

For building MdcaPoint() of the model's MatchableTextArray. This method builds the default value for MatchableTextArray.

Parameters

TPtrC aTextPointer descriptor.

DeferredSendFullKeyEventToFepL(const TKeyEvent &)

voidDeferredSendFullKeyEventToFepL(const TKeyEvent &aEvent)
An improved version of DeferredSendKeyEventToFepL. It sends a TKeyEvent rather than just key code. Thus the correct key event can be send to FEP on QWERTY keyboard.
Since
S60 5.0

Parameters

const TKeyEvent & aEventEvent send to FEP.

DeferredSendKeyEventToFepL(TUint)

IMPORT_C voidDeferredSendKeyEventToFepL(TUintaValue)

Sends key events to FEP. This is used to resend key event to FEP if AknFind's HandleOfferKeyEventL() gets the key while search field has no focus. If search field has a focus, the key events go directly to the editor and this is not called.

Parameters

TUint aValueThe character code for an EEventKey.

FetchSelectionIndexesFromListBoxL()

voidFetchSelectionIndexesFromListBoxL()[private]

FilteredItemIndex(TInt)

IMPORT_C TIntFilteredItemIndex(TIntaVisibleItemIndex)const

This is used to fetch the content of a list item after filter has been used.

Parameters

TInt aVisibleItemIndexThe index of visible item.

FilteredNumberOfItems()

IMPORT_C TIntFilteredNumberOfItems()const

This is used to ask how many list items are available after filter has been used. Counts visible list items.

FindBox()

IMPORT_C CCoeControl *FindBox()const

This function just returns pointer to the search field.

HandleControlEventL(CCoeControl *, TCoeEvent)

IMPORT_C voidHandleControlEventL(CCoeControl *aControl,
TCoeEventaEventType
)

Editor sends messages to this object as control events.

Parameters

CCoeControl * aControlThe control that sent the event.
TCoeEvent aEventTypeThe event type.

HandleItemAdditionL()

voidHandleItemAdditionL()[private]

HandleItemArrayChangeL()

IMPORT_C voidHandleItemArrayChangeL()

When you change the list item array you should call this method.

HandleItemRemovalL()

voidHandleItemRemovalL()[private]

HandleOfferkeyEventL()

IMPORT_C voidHandleOfferkeyEventL()

Applications should call this in OfferKeyEventL() which gives keys to listbox and search field.

IdleCallBack(TAny *)

TInt IdleCallBack(TAny *aFilterItems)[static]

This gets called from DeferredSendKeyEventToFepL(). This does the actual sending of a key event. Does not support more than one event at the time.

Parameters

TAny * aFilterItemsPointer to the CAknListBoxFilterItems object.

InstallEmptyTextL()

voidInstallEmptyTextL()[private]

IsAdaptiveSearch()

TBool IsAdaptiveSearch()const [private]

IsItemSelected(TInt)

TBool IsItemSelected(TIntaRealIndex)const [private]

Parameters

TInt aRealIndex

IsItemVisible(const TDesC &, const TDesC &)

TBool IsItemVisible(const TDesC &aMatchableItemString,
const TDesC &aSearchText
)[private]

Parameters

const TDesC & aMatchableItemString
const TDesC & aSearchText

IsSeparatorCharacter(TChar)

TBool IsSeparatorCharacter(TCharc)[private, static]

Parameters

TChar c

NoCriteriaL(TBool)

voidNoCriteriaL(TBoolaUpdateAS = ETrue)[private]

Parameters

TBool aUpdateAS = ETrue

NonFilteredNumberOfItems()

IMPORT_C TIntNonFilteredNumberOfItems()const

Returns number of original list items.

PushSelectionIndexesToListBoxL()

voidPushSelectionIndexesToListBoxL()[private]

ReleaseCriteriaL(const TDesC &)

voidReleaseCriteriaL(const TDesC &aCriteria)[private]

Parameters

const TDesC & aCriteria

ResetFilteringL()

IMPORT_C voidResetFilteringL()

This function is to be called when filter is cleared.

SelectionIndexes()

IMPORT_C CArrayFix< TInt > *SelectionIndexes()

This one gives all indices, not just the ones that are visible.

SetListBox(CEikListBox *)

IMPORT_C voidSetListBox(CEikListBox *aListBox)
Attaches or detaches list used by the filtering.
Since
S60 2.0

Parameters

CEikListBox * aListBoxPointer to listbox or NULL.

SetModel(MListBoxModel *)

IMPORT_C voidSetModel(MListBoxModel *aModel)
Attaches or detaches list model used by the filtering.
Since
S60 2.0

Parameters

MListBoxModel * aModela pointer to list model or NULL.

SetObserver(MCoeControlObserver *)

IMPORT_C voidSetObserver(MCoeControlObserver *aObserver)

Sets the observer.

Parameters

MCoeControlObserver * aObserverPointer to the observer.

SetParentControl(CCoeControl *)

IMPORT_C voidSetParentControl(CCoeControl *aControl)

AknFind uses this to inform us who is the parent control owning the listbox and search field. This control should be window-owning control and it will be used to resize the listbox when changes to the filtering happens.

Parameters

CCoeControl * aControlPointer to the control.

SetPopup()

IMPORT_C voidSetPopup()

AknFind uses this to inform us that we have popup find. Applications shouldn't call this.

SetSearchField(CAknSearchField *)

IMPORT_C voidSetSearchField(CAknSearchField *aSearchField)
Attaches or detaches find pane used by the filtering.
Since
S60 2.0

Parameters

CAknSearchField * aSearchFieldPointer to findbox or NULL.

SetView(CListBoxView *)

IMPORT_C voidSetView(CListBoxView *aView)
Attaches or detaches list view used by the filtering.
Since
S60 2.0

Parameters

CListBoxView * aViewa pointer to list view or NULL.

TightenCriteriaL(const TDesC &)

voidTightenCriteriaL(const TDesC &aCriteria)[private]

Parameters

const TDesC & aCriteria

UninstallEmptyTextL()

voidUninstallEmptyTextL()[private]

UpdateCachedDataL()

IMPORT_C voidUpdateCachedDataL()

This function will update filter items state from the search field and listbox. Also updates selection indexes.

UpdateSelectionIndexL(TInt)

IMPORT_C voidUpdateSelectionIndexL(TIntaVisibleIndex)

This will synchronise the selected index from the listbox. If you use SelectionIndexes(), call this before it. This is heavy operation and goes through all list items.

Parameters

TInt aVisibleIndexIndex to be updated.

UpdateSelectionIndexesL()

IMPORT_C voidUpdateSelectionIndexesL()

This will synchronise the selection indices from the listbox. If you use SelectionIndexes(), call this before it. This is heavy operation and goes through all list items.

VisibleItemIndex(TInt)

IMPORT_C TIntVisibleItemIndex(TIntaOriginalIndex)const

Finds the list item on the screen when the item array index is given.

Parameters

TInt aOriginalIndexItem index.

Member Data Documentation

TBool iDisableChangesToShownIndexes

TBool iDisableChangesToShownIndexes[private]

HBufC * iEmptyListText

HBufC *iEmptyListText[private]

CFindExtension * iExtension

CFindExtension *iExtension[private]

TBool iIsPopup

TBool iIsPopup[private]

TUint iKeyValue

TUint iKeyValue[private]

CEikListBox * iListBox

CEikListBox *iListBox[private]

TBuf< 256 > iMatchableText

TBuf< 256 >iMatchableText[private]

MListBoxModel * iModel

MListBoxModel *iModel[private]

MCoeControlObserver * iObserver

MCoeControlObserver *iObserver[private]

TInt iOldItemCount

TInt iOldItemCount[private]

HBufC * iOldSearchCriteria

HBufC *iOldSearchCriteria[private]

CCoeControl * iParentControl

CCoeControl *iParentControl[private]

CAknSearchField * iSearchField

CAknSearchField *iSearchField[private]

CArrayFix< TInt > * iSelectionIndexes

CArrayFix< TInt > *iSelectionIndexes[private]

CArrayFix< TInt > * iShownIndexes

CArrayFix< TInt > *iShownIndexes[private]

CListBoxView * iView

CListBoxView *iView[private]