class CAknSelectionListDialog : public CAknDialog |
CAknSelectionListDialog is the actual interface to the applications.
Use this class to get a full screen list.
This class only works in whole main pane. Do not try to use this directly for other places.
RESOURCE DIALOG r_res_id_for_a_dialog { flags = EAknDialogSelectionList; buttons = R_AVKON_SOFTKEYS_OPTIONS_BACK; items = { DLG_LINE { type = EAknCtSingleGraphicListBox; id = ESelectionListControl; control = LISTBOX { flags = EAknListBoxSelectionList; }; } // the next dlg line is optional. , DLG_LINE { itemflags = EEikDlgItemNonFocusing; id = EFindControl; type = EAknCtSelectionListFixedFind; } }; }The listbox type can be one of the following (defined in avkon.hrh and aknlists.h):
EAknCtSingleListBox (See CAknSingleStyleListBox) EAknCtSingleNumberListBox (See CAknSingleNumberStyleListBox) EAknCtSingleHeadingListBox (See CAknSingleHeadingStyleListBox) EAknCtSingleGraphicListBox (See CAknSingleGraphicStyleListBox) EAknCtSingleGraphicHeadingListBox (See CAknSingleGraphicHeadingStyleListBox) EAknCtSingleNumberHeadingListBox (See CAknSingleNumberHeadingStyleListBox) EAknCtSingleLargeListBox (See CAknSingleLargeStyleListBox) EAknCtDoubleListBox (See CAknDoubleStyleListBox) EAknCtDoubleNumberListBox (See CAknDoubleNumberStyleListBox) EAknCtDoubleTimeListBox (See CAknDoubleTimeStyleListBox) EAknCtDoubleLargeListBox (See CAknDoubleLargeStyleListBox) EAknCtDoubleGraphicListBox (See CAknDoubleGraphicStyleListBox)The type field while defining find can be one of the following:
EAknCtSelectionListFixedFind EAknCtSelectionListPopupFind EAknCtSelectionListAdaptiveFind
R_AVKON_MENUPANE_SELECTION_LIST R_AVKON_MENUPANE_SELECTION_LIST_WITH_FIND_POPUP
RESOURCE MENU_BAR r_res_id_for_a_menubar { titles = { MENU_TITLE { menu_pane = R_AVKON_MENUPANE_SELECTION_LIST; } }; };C++ Usage:
TInt openedItem = 0; MDesCArray *array = ...; CAknSelectionListDialog *dialog = CAknSelectionListDialog::NewL(openedItem, array, R_RES_ID_FOR_A_MENUBAR); TInt result = dialog->ExecuteLD(R_RES_ID_FOR_A_DIALOG); if (result) { ...use openeditem here... } else { ...canceled... }Alternatively, you can use:
TInt openedItem = 0; MDesCArray *array = ...; CAknSelectionListDialog *dialog = CAknSelectionListDialog::NewL(openedItem, array, R_RES_ID_FOR_A_MENUBAR); dialog->PrepareLC(R_RES_ID_FOR_A_DIALOG); // do some operations here, for example fill icon array TInt result = dialog->RunLD(); if (result) { ... } else { ... }
Often it is also useful to derive from CAknSelectionListDialog and implement OkToExitL() , constructors and the NewL() methods. OkToExitL() implementation helps with providing navigation with other dialogs; OkToExitL() is ideal place to launch new dialogs when a list item is selected. This way when backstepping, the state of the first dialog is preserved...
Public Member Functions | |
---|---|
IMPORT_C void | ConstructL ( TInt ) |
IMPORT_C void | HandlePointerEventL (const TPointerEvent &) |
IMPORT_C CArrayPtr < CGulIcon > * | IconArray () |
IMPORT_C CAknSelectionListDialog * | NewL ( TInt &, MDesCArray *, TInt , MEikCommandObserver *) |
IMPORT_C CAknSelectionListDialog * | NewLC ( TInt &, MDesCArray *, TInt , MEikCommandObserver *) |
IMPORT_C void | SetIconArrayL ( CArrayPtr < CGulIcon > *) |
IMPORT_C void | SetupFind ( TFindType ) |
Protected Member Functions | |
---|---|
CAknSelectionListDialog ( TInt &, MDesCArray *, MEikCommandObserver *) | |
~CAknSelectionListDialog () | |
IMPORT_C CCoeControl * | ComponentControl ( TInt ) |
IMPORT_C TInt | CountComponentControls () |
IMPORT_C SEikControlInfo | CreateCustomControlL ( TInt ) |
IMPORT_C void | Draw (const TRect &) |
TInt | ExitViaIdle ( TAny *) |
IMPORT_C CAknSearchField * | FindBox () |
IMPORT_C void | HandleListBoxEventL ( CEikListBox *, TListBoxEvent) |
IMPORT_C TBool | IsAcceptableListBoxType ( TInt , TBool &) |
IMPORT_C TBool | IsFormattedCellListBox () |
IMPORT_C CEikListBox * | ListBox () |
IMPORT_C TKeyResponse | OfferKeyEventL (const TKeyEvent &, TEventCode ) |
IMPORT_C TBool | OkToExitL ( TInt ) |
IMPORT_C void | PostLayoutDynInitL () |
IMPORT_C void | PreLayoutDynInitL () |
IMPORT_C void | ProcessCommandL ( TInt ) |
IMPORT_C void | SelectionListProcessCommandL ( TInt ) |
IMPORT_C void | SetSizeAndPosition (const TSize &) |
Private Member Functions | |
---|---|
IMPORT_C void | CAknDialog_Reserved () |
IMPORT_C void | CAknSelectionListDialog_Reserved () |
IMPORT_C void | CEikDialog_Reserved_1 () |
IMPORT_C void | CEikDialog_Reserved_2 () |
IMPORT_C void * | ExtensionInterface ( TUid ) |
Public Member Enumerations | |
---|---|
enum | TFindType { ENoFind , EFixedFind , EPopupFind , EAdaptiveFind } |
Inherited Enumerations | |
---|---|
CCoeControl:TZoomType | |
CEikDialog:@115 |
Protected Attributes | |
---|---|
TBool | iEnterKeyPressed |
Private Attributes | |
---|---|
MDesCArray * | iArray |
MEikCommandObserver * | iCmdObserver |
TInt | iDialogResourceId |
CAknSelectionListDialogExtension * | iExtension |
CAknSearchField * | iFindBox |
TFindType | iFindType |
TInt * | iSelectedItem |
TInt | iSpare |
Inherited Attributes | |
---|---|
CAknDialog::iMenuBar | |
CCoeControl::iCoeEnv | |
CCoeControl::iContext | |
CCoeControl::iPosition | |
CCoeControl::iSize | |
CEikBorderedControl::iBorder |
IMPORT_C | CAknSelectionListDialog | ( | TInt & | aIndex, |
MDesCArray * | aArray, | |||
MEikCommandObserver * | aCommand | |||
) | [protected] |
CAknSelectionListDialog() Default constructor.
TInt & aIndex | |
MDesCArray * aArray | |
MEikCommandObserver * aCommand |
IMPORT_C | ~CAknSelectionListDialog | ( | ) | [protected] |
~CAknSelectionListDialog() Destructor.
IMPORT_C void | CAknSelectionListDialog_Reserved | ( | ) | [private, virtual] |
IMPORT_C CCoeControl * | ComponentControl | ( | TInt | aIndex | ) | const [protected, virtual] |
TInt aIndex |
IMPORT_C void | ConstructL | ( | TInt | aMenuTitleResourceId | ) |
ConstructL() Second phase constructor.
TInt aMenuTitleResourceId | Menu items to be shown in options menu. Same as aMenuBarResourceId of NewL(C). |
IMPORT_C SEikControlInfo | CreateCustomControlL | ( | TInt | aControlType | ) | [protected, virtual] |
CreateCustomControlL() creates own list or grid layouts.
Normal implementation of this method is:
SEikControlInfo CreateCustomControlL(TInt aControlType) { CCoeControl *control = NULL; if ( aControlType == EMyCtGridLayout ) { // CMyOddStyleGrid should be derived from CAknFormattedCellListBox or CEikColumnListBox. control = new(ELeave)CMyOddStyleGrid; } SEikControlInfo info = {control,0,0}; return info; }See also IsAcceptableListBoxType() . CreateCustomControlL() and IsAcceptableListBoxType() forms a pair that should be implemented together.
TInt aControlType |
IMPORT_C void | Draw | ( | const TRect & | ) | const [protected, virtual] |
Draw() from CCoeControl
const TRect & |
TInt | ExitViaIdle | ( | TAny * | aSelectionList | ) | [protected, static] |
Callback function to exit dialog after selecting something with tapping it. This prevents dialog to be destroyed before dialog page's handlepointereventl is fully completed.
TAny * aSelectionList | pointer to current CAknSelectionList |
IMPORT_C void * | ExtensionInterface | ( | TUid | aInterface | ) | [private, virtual] |
From CAknControl
TUid aInterface |
IMPORT_C CAknSearchField * | FindBox | ( | ) | const [protected] |
FindBox() accessor to findbox control
IMPORT_C void | HandleListBoxEventL | ( | CEikListBox * | aListBox, |
TListBoxEvent | aEventType | |||
) | [protected] |
HandleListBoxEventL() From MEikListBoxObserver Handles listbox events.
CEikListBox * aListBox | currently ignored |
TListBoxEvent aEventType | type of the listbox event |
IMPORT_C void | HandlePointerEventL | ( | const TPointerEvent & | aPointerEvent | ) | [virtual] |
From CCoeControl . Handles pointer events
const TPointerEvent & aPointerEvent | The pointer event. |
IMPORT_C CArrayPtr < CGulIcon > * | IconArray | ( | ) | const |
Icons, images and thumbnails are in this array.
The list items are tab separated strings with fixed format. Some of the numbers in the list item strings are indexes to this array.
This array can be modified by MDesCArray::MdcaPoint() method or at construction of dialog; after PrepareLC() call.
IMPORT_C TBool | IsAcceptableListBoxType | ( | TInt | aControlType, |
TBool & | aIsFormattedCellList | |||
) | const [protected, virtual] |
IsAcceptableListBoxType() : Detection of list and grid layouts
The CAknSelectionList only works with certain list and grid layouts.
You will get Panic() if you use your own list/grid layouts and you do not have this method implemented!
If you add new list layouts, you should implement this method to publish the type of the layout using this method. This is especially the case where you use CAknSelectionGrid with your own grid layout. (as there are no predefined grid layouts, you need to do this every time you use a selection grid)
EAknCtSingleListBox EAknCtSingleNumberListBox EAknCtSingleHeadingListBox EAknCtSingleGraphicListBox EAknCtSingleGraphicHeadingListBox EAknCtSingleNumberHeadingListBox EAknCtSingleLargeListBox EAknCtDoubleListBox EAknCtDoubleNumberListBox EAknCtDoubleTimeListBox EAknCtDoubleLargeListBox EAknCtDoubleGraphicListBox EAknCtSettingListBox EAknCtSettingNumberListBox
TBool IsAcceptableListBoxType(TInt aControlType, TBool &aIsFormattedCellList) { if (aControlType == EMyCtGridLayout) { // CAknGrid is-a formattedcelllistbox. aIsFormattedCellList = ETrue; return ETrue; } else { return EFalse; } }See also CreateCustomControlL() . IsAcceptableListBoxType() and CreateCustomControlL() forms a pair that should be implemented together.
TInt aControlType | type of the control. Ignored in current default implementation. |
TBool & aIsFormattedCellList | returns whetehr list is a formatted cell listbox or a column listbox. Ignored in current default implementation. In derived implementations this must be set according to dialog's listbox type. |
IMPORT_C TBool | IsFormattedCellListBox | ( | ) | const [protected] |
IsFormattedCellListBox() used to check whether listbox control is a CEikFormattedCellListBox or a CEikColumnListBox . If you derive from IsAcceptableListBoxType() you must take care of the aIsFormattedCellListParameter to make this method to work correctly.
IMPORT_C CEikListBox * | ListBox | ( | ) | const [protected, virtual] |
ListBox() accessor to listbox control
IMPORT_C CAknSelectionListDialog * | NewL | ( | TInt & | aOpenedItem, |
MDesCArray * | aArray, | |||
TInt | aMenuBarResourceId, | |||
MEikCommandObserver * | aCommand = 0 | |||
) | [static] |
CAknSelectionListDialog::NewL()
Static factory constructor. Uses two phase construction and leaves nothing on the CleanupStack .
TInt & aOpenedItem | Variable to be modified when user selects a list item. |
MDesCArray * aArray | Content of list items; A tab-separated string with texts and indexes to icon array |
TInt aMenuBarResourceId | Menu items to be shown in options menu |
MEikCommandObserver * aCommand = 0 | Callback for state changes. EAknCmdOpen command is send by listbox. Options menu commands come here too. |
IMPORT_C CAknSelectionListDialog * | NewLC | ( | TInt & | aOpenedItem, |
MDesCArray * | aArray, | |||
TInt | aMenuBarResourceId, | |||
MEikCommandObserver * | aCommand = 0 | |||
) | [static] |
CAknSelectionListDialog::NewLC()
Static factory constructor. Uses two phase construction and leaves created object in CleanupStack .
TInt & aOpenedItem | Variable to be modified when user selects a list item. |
MDesCArray * aArray | Content of list items; A tab-separated string with texts and indexes to icon array |
TInt aMenuBarResourceId | Menu items to be shown in options menu |
MEikCommandObserver * aCommand = 0 | Callback for state changes. EAknCmdOpen command is send by listbox. Options menu commands come here too. |
IMPORT_C TKeyResponse | OfferKeyEventL | ( | const TKeyEvent & | aKeyEvent, |
TEventCode | aType | |||
) | [protected, virtual] |
const TKeyEvent & aKeyEvent | |
TEventCode aType |
IMPORT_C TBool | OkToExitL | ( | TInt | aButtonId | ) | [protected, virtual] |
OkToExitL() From CAknDialog . This is not called if the Cancel button is activated unless the EEikDialogFlagNotifyEsc flag has been set.
TInt aButtonId | The ID of the button that was activated. |
IMPORT_C void | PostLayoutDynInitL | ( | ) | [protected, virtual] |
PreLayoutDynInitL() From CAknDialog .
IMPORT_C void | PreLayoutDynInitL | ( | ) | [protected, virtual] |
PreLayoutDynInitL() From CAknDialog .
IMPORT_C void | ProcessCommandL | ( | TInt | aCommandId | ) | [protected, virtual] |
ProcessCommandL() From CAknDialog . Processes commands and passes commands to FindBox and ListBox as needed.
TInt aCommandId | id of the command. |
IMPORT_C void | SelectionListProcessCommandL | ( | TInt | aCommand | ) | [protected, virtual] |
SelectionListProcessCommandL() handles selection list and markable list default commands.
For markable lists, this method handles EAknCmdMark, EAknCmdUnmark, EAknMarkAll, EAknUnmarkAll defined in options menu pane R_AVKON_MENUPANE_MARKABLE_LIST.
TInt aCommand |
IMPORT_C void | SetIconArrayL | ( | CArrayPtr < CGulIcon > * | aIcons | ) |
Icons, images and thumbnails are in this array.
The list items are tab separated strings with fixed format. Some of the numbers in the list item strings are indexes to this array.
This array can be modified by MDesCArray::MdcaPoint() method or at construction of dialog; after PrepareLC() call.
IMPORT_C void | SetSizeAndPosition | ( | const TSize & | aSize | ) | [protected, virtual] |
SetSizeAndPosition() From CAknDialog . Sets dialog's size to whole main pane.
const TSize & aSize | ignored |
IMPORT_C void | SetupFind | ( | TFindType | aType | ) |
Provides a way to enable and disable find and find popup on runtime. You still need entry with id EFindControl to resource file for the find, this is only for disabling existing find element.
TFindType aType | type of findbox to be used. |
CAknSelectionListDialog::TFindType Determines what kind of findbox should be used. Note, that a fixed findbox is not available with all list types.
ENoFind |
no findbox should be used |
EFixedFind |
fixed findbox should be used |
EPopupFind |
popup findbox should be used |
EAdaptiveFind |
fixed findbox with adaptive search should be used |
TBool | iEnterKeyPressed | [protected] |
iEnterKeyPressed Set as ETrue if EAknCmdOpen is handled in ProcessCommandL() . This will eventually cause OkToExitL() to be called with EAknSoftkeyOk as aButtonId.
CAknSelectionListDialogExtension * | iExtension | [private] |
Copyright ©2010 Nokia Corporation and/or its subsidiary(-ies).
All rights
reserved. Unless otherwise stated, these materials are provided under the terms of the Eclipse Public License
v1.0.