williamr@2: /* williamr@2: * Copyright (c) 2002-2006 Nokia Corporation and/or its subsidiary(-ies). williamr@2: * All rights reserved. williamr@2: * This component and the accompanying materials are made available williamr@2: * under the terms of the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members williamr@2: * which accompanies this distribution, and is available williamr@2: * at the URL "http://www.symbianfoundation.org/legal/licencesv10.html". williamr@2: * williamr@2: * Initial Contributors: williamr@2: * Nokia Corporation - initial contribution. williamr@2: * williamr@2: * Contributors: williamr@2: * williamr@2: * Description: Dialogs for selection service implementation. williamr@2: * williamr@2: */ williamr@2: williamr@2: williamr@2: #ifndef __AKNSELECTIONLIST_H__ williamr@2: #define __AKNSELECTIONLIST_H__ williamr@2: williamr@2: #include williamr@2: #include williamr@2: #include williamr@2: #include williamr@2: #include williamr@2: williamr@2: class CAknSelectionListDialogExtension; williamr@2: class CAknMarkableListDialogExtension; williamr@2: williamr@2: /** CAknSelectionListDialog is the actual interface to the applications. williamr@2: * williamr@2: * Use this class to get a full screen list. williamr@2: * williamr@2: * This class only works in whole main pane. Do not try to use williamr@2: * this directly for other places. williamr@2: * williamr@2: * @lib Avkon.lib williamr@2: * @since S60 v1.0 williamr@2: * williamr@2: * resource definition for this class: williamr@2: * @code williamr@2: * RESOURCE DIALOG r_res_id_for_a_dialog williamr@2: * { williamr@2: * flags = EAknDialogSelectionList; williamr@2: * buttons = R_AVKON_SOFTKEYS_OPTIONS_BACK; williamr@2: * items = williamr@2: * { williamr@2: * DLG_LINE williamr@2: * { williamr@2: * type = EAknCtSingleGraphicListBox; williamr@2: * id = ESelectionListControl; williamr@2: * control = LISTBOX williamr@2: * { williamr@2: * flags = EAknListBoxSelectionList; williamr@2: * }; williamr@2: * } williamr@2: * // the next dlg line is optional. williamr@2: * , williamr@2: * DLG_LINE williamr@2: * { williamr@2: * itemflags = EEikDlgItemNonFocusing; williamr@2: * id = EFindControl; williamr@2: * type = EAknCtSelectionListFixedFind; williamr@2: * } williamr@2: * }; williamr@2: * } williamr@2: * @endcode williamr@2: * The listbox type can be one of the following (defined in avkon.hrh and aknlists.h): williamr@2: @verbatim williamr@2: EAknCtSingleListBox (See CAknSingleStyleListBox) williamr@2: EAknCtSingleNumberListBox (See CAknSingleNumberStyleListBox) williamr@2: EAknCtSingleHeadingListBox (See CAknSingleHeadingStyleListBox) williamr@2: EAknCtSingleGraphicListBox (See CAknSingleGraphicStyleListBox) williamr@2: EAknCtSingleGraphicHeadingListBox (See CAknSingleGraphicHeadingStyleListBox) williamr@2: EAknCtSingleNumberHeadingListBox (See CAknSingleNumberHeadingStyleListBox) williamr@2: EAknCtSingleLargeListBox (See CAknSingleLargeStyleListBox) williamr@2: EAknCtDoubleListBox (See CAknDoubleStyleListBox) williamr@2: EAknCtDoubleNumberListBox (See CAknDoubleNumberStyleListBox) williamr@2: EAknCtDoubleTimeListBox (See CAknDoubleTimeStyleListBox) williamr@2: EAknCtDoubleLargeListBox (See CAknDoubleLargeStyleListBox) williamr@2: EAknCtDoubleGraphicListBox (See CAknDoubleGraphicStyleListBox) williamr@2: @endverbatim williamr@2: * The type field while defining find can be one of the following: williamr@2: @verbatim williamr@2: EAknCtSelectionListFixedFind williamr@2: EAknCtSelectionListPopupFind williamr@2: EAknCtSelectionListAdaptiveFind williamr@2: @endverbatim williamr@2: * williamr@2: * The menubar you give for selection list dialog should have williamr@2: * one of the following as one of its menu panes (defined in avkon.hrh): williamr@2: @verbatim williamr@2: R_AVKON_MENUPANE_SELECTION_LIST williamr@2: R_AVKON_MENUPANE_SELECTION_LIST_WITH_FIND_POPUP williamr@2: @endverbatim williamr@2: * @code williamr@2: * RESOURCE MENU_BAR r_res_id_for_a_menubar williamr@2: * { williamr@2: * titles = williamr@2: * { williamr@2: * MENU_TITLE { menu_pane = R_AVKON_MENUPANE_SELECTION_LIST; } williamr@2: * }; williamr@2: * }; williamr@2: * @endcode williamr@2: * C++ Usage: williamr@2: * @code williamr@2: * TInt openedItem = 0; williamr@2: * MDesCArray *array = ...; williamr@2: * CAknSelectionListDialog *dialog = CAknSelectionListDialog::NewL(openedItem, array, R_RES_ID_FOR_A_MENUBAR); williamr@2: * TInt result = dialog->ExecuteLD(R_RES_ID_FOR_A_DIALOG); williamr@2: * if (result) williamr@2: * { williamr@2: * ...use openeditem here... williamr@2: * } williamr@2: * else williamr@2: * { williamr@2: * ...canceled... williamr@2: * } williamr@2: * williamr@2: * @endcode williamr@2: * Alternatively, you can use: williamr@2: * @code williamr@2: * TInt openedItem = 0; williamr@2: * MDesCArray *array = ...; williamr@2: * CAknSelectionListDialog *dialog = CAknSelectionListDialog::NewL(openedItem, array, R_RES_ID_FOR_A_MENUBAR); williamr@2: * dialog->PrepareLC(R_RES_ID_FOR_A_DIALOG); williamr@2: * // do some operations here, for example fill icon array williamr@2: * TInt result = dialog->RunLD(); williamr@2: * if (result) williamr@2: * { williamr@2: * ... williamr@2: * } williamr@2: * else williamr@2: * { williamr@2: * ... williamr@2: * } williamr@2: * @endcode williamr@2: * williamr@2: * Often it is also useful to derive from CAknSelectionListDialog and implement OkToExitL(), constructors and the NewL() methods. williamr@2: * OkToExitL() implementation helps with providing navigation with other dialogs; OkToExitL() is ideal place to launch williamr@2: * new dialogs when a list item is selected. This way when backstepping, the state of the first dialog is preserved... williamr@2: * williamr@2: * williamr@2: */ williamr@2: class CAknSelectionListDialog : public CAknDialog, public MEikListBoxObserver williamr@2: { williamr@2: public: williamr@2: /** CAknSelectionListDialog::NewL() williamr@2: * williamr@2: * Static factory constructor. Uses two phase construction and leaves nothing on the CleanupStack. williamr@2: * williamr@2: * @param aOpenedItem Variable to be modified when user selects a list item. williamr@2: * @param aArray Content of list items; A tab-separated string with texts and indexes to icon array williamr@2: * @param aMenuBarResourceId Menu items to be shown in options menu williamr@2: * @param aCommand Callback for state changes. EAknCmdOpen command is send by listbox. Options menu commands come here too. williamr@2: * @return A pointer to created object williamr@2: */ williamr@2: IMPORT_C static CAknSelectionListDialog *NewL( TInt &aOpenedItem, MDesCArray *aArray, TInt aMenuBarResourceId, MEikCommandObserver *aCommand = 0 ); williamr@2: williamr@2: /** CAknSelectionListDialog::NewLC() williamr@2: * williamr@2: * Static factory constructor. Uses two phase construction and leaves created object in CleanupStack. williamr@2: * williamr@2: * @param aOpenedItem Variable to be modified when user selects a list item. williamr@2: * @param aArray Content of list items; A tab-separated string with texts and indexes to icon array williamr@2: * @param aMenuBarResourceId Menu items to be shown in options menu williamr@2: * @param aCommand Callback for state changes. EAknCmdOpen command is send by listbox. Options menu commands come here too. williamr@2: * @return A pointer to created object williamr@2: */ williamr@2: IMPORT_C static CAknSelectionListDialog *NewLC( TInt &aOpenedItem, MDesCArray *aArray, TInt aMenuBarResourceId, MEikCommandObserver *aCommand = 0 ); williamr@2: williamr@2: /** ConstructL() williamr@2: * Second phase constructor. williamr@2: * williamr@2: * @param aMenuTitleResourceId Menu items to be shown in options menu. Same as aMenuBarResourceId of NewL(C). williamr@2: */ williamr@2: IMPORT_C void ConstructL(TInt aMenuTitleResourceId); williamr@2: williamr@2: public: williamr@2: /** CAknSelectionListDialog::TFindType williamr@2: * Determines what kind of findbox should be used. Note, that a fixed findbox is not williamr@2: * available with all list types. williamr@2: */ williamr@2: enum TFindType williamr@2: { williamr@2: /** no findbox should be used */ williamr@2: ENoFind, williamr@2: /** fixed findbox should be used */ williamr@2: EFixedFind, williamr@2: /** popup findbox should be used */ williamr@2: EPopupFind, williamr@2: /** fixed findbox with adaptive search should be used */ williamr@2: EAdaptiveFind williamr@2: }; williamr@2: williamr@2: /** SetupFind() williamr@2: * williamr@2: * Provides a way to enable and disable find and find popup on runtime. williamr@2: * You still need entry with id EFindControl to resource file for the find, this is only for disabling williamr@2: * existing find element. williamr@2: * williamr@2: * @param aType type of findbox to be used. williamr@2: */ williamr@2: IMPORT_C void SetupFind(TFindType aType); williamr@2: williamr@2: /** IconArray() williamr@2: * williamr@2: * Icons, images and thumbnails are in this array. williamr@2: * williamr@2: * The list items are tab separated strings with fixed format. Some of the numbers williamr@2: * in the list item strings are indexes to this array. williamr@2: * williamr@2: * This array can be modified by MDesCArray::MdcaPoint() method or at construction of williamr@2: * dialog; after PrepareLC() call. williamr@2: * williamr@2: * @return pointer to iconarray of the list williamr@2: */ williamr@2: IMPORT_C CArrayPtr* IconArray() const; williamr@2: williamr@2: /** SetIconArrayL() williamr@2: * williamr@2: * Icons, images and thumbnails are in this array. williamr@2: * williamr@2: * The list items are tab separated strings with fixed format. Some of the numbers williamr@2: * in the list item strings are indexes to this array. williamr@2: * williamr@2: * This array can be modified by MDesCArray::MdcaPoint() method or at construction of williamr@2: * dialog; after PrepareLC() call. williamr@2: * williamr@2: * @param aIcons a array containing icons. williamr@2: */ williamr@2: IMPORT_C void SetIconArrayL(CArrayPtr* aIcons); williamr@2: williamr@2: /** williamr@2: * From CCoeControl. williamr@2: * Handles pointer events williamr@2: * @param aPointerEvent The pointer event. williamr@2: */ williamr@2: IMPORT_C void HandlePointerEventL(const TPointerEvent& aPointerEvent); williamr@2: williamr@2: protected: williamr@2: /** CAknSelectionListDialog() williamr@2: * Default constructor. williamr@2: */ williamr@2: IMPORT_C CAknSelectionListDialog( TInt &aIndex, MDesCArray *aArray, MEikCommandObserver *aCommand ); williamr@2: /** ~CAknSelectionListDialog() williamr@2: * Destructor. williamr@2: */ williamr@2: IMPORT_C ~CAknSelectionListDialog(); williamr@2: williamr@2: protected: // Customisation from derived classes williamr@2: /** SelectionListProcessCommandL() handles selection list and markable list williamr@2: * default commands. williamr@2: * williamr@2: * For markable lists, this method handles EAknCmdMark, EAknCmdUnmark, EAknMarkAll, EAknUnmarkAll williamr@2: * defined in options menu pane R_AVKON_MENUPANE_MARKABLE_LIST. williamr@2: */ williamr@2: IMPORT_C virtual void SelectionListProcessCommandL(TInt aCommand); williamr@2: williamr@2: /** IsAcceptableListBoxType(): Detection of list and grid layouts williamr@2: * williamr@2: * The CAknSelectionList only works with certain list and grid williamr@2: * layouts. williamr@2: * williamr@2: * You will get Panic() if you use your own list/grid layouts and williamr@2: * you do not have this method implemented! williamr@2: * williamr@2: * If you add new list layouts, you should implement this method to williamr@2: * publish the type of the layout using this method. This is especially williamr@2: * the case where you use CAknSelectionGrid with your own grid layout. williamr@2: * (as there are no predefined grid layouts, you need to do this williamr@2: * every time you use a selection grid) williamr@2: * williamr@2: * The following aControlTypes are already implemented and requires williamr@2: * no action: williamr@2: * @verbatim williamr@2: EAknCtSingleListBox williamr@2: EAknCtSingleNumberListBox williamr@2: EAknCtSingleHeadingListBox williamr@2: EAknCtSingleGraphicListBox williamr@2: EAknCtSingleGraphicHeadingListBox williamr@2: EAknCtSingleNumberHeadingListBox williamr@2: EAknCtSingleLargeListBox williamr@2: EAknCtDoubleListBox williamr@2: EAknCtDoubleNumberListBox williamr@2: EAknCtDoubleTimeListBox williamr@2: EAknCtDoubleLargeListBox williamr@2: EAknCtDoubleGraphicListBox williamr@2: EAknCtSettingListBox williamr@2: EAknCtSettingNumberListBox williamr@2: @endverbatim williamr@2: * williamr@2: * Any other layout requires you to inherit from CAknSelectionList williamr@2: * and implement the following methods: williamr@2: * @code williamr@2: * TBool IsAcceptableListBoxType(TInt aControlType, TBool &aIsFormattedCellList) williamr@2: * { williamr@2: * if (aControlType == EMyCtGridLayout) williamr@2: * { williamr@2: * // CAknGrid is-a formattedcelllistbox. williamr@2: * aIsFormattedCellList = ETrue; williamr@2: * return ETrue; williamr@2: * } williamr@2: * else williamr@2: * { williamr@2: * return EFalse; williamr@2: * } williamr@2: * } williamr@2: * williamr@2: * @endcode williamr@2: * See also CreateCustomControlL(). IsAcceptableListBoxType() and CreateCustomControlL() forms a pair that should williamr@2: * be implemented together. williamr@2: * williamr@2: * @param aControlType type of the control. Ignored in current default implementation. williamr@2: * @param aIsFormattedCellList returns whetehr list is a formatted cell listbox or a column listbox. williamr@2: * Ignored in current default implementation. In derived implementations this must be set according to williamr@2: * dialog's listbox type. williamr@2: * @return whether layout can be used williamr@2: */ williamr@2: IMPORT_C virtual TBool IsAcceptableListBoxType(TInt aControlType, TBool &aIsFormattedCellList) const; williamr@2: protected: williamr@2: /** ProcessCommandL() williamr@2: * From CAknDialog. Processes commands and passes commands to FindBox and ListBox as needed. williamr@2: * @param aCommandId id of the command. williamr@2: */ williamr@2: IMPORT_C void ProcessCommandL( TInt aCommandId ); williamr@2: williamr@2: /** PreLayoutDynInitL() williamr@2: * From CAknDialog. williamr@2: */ williamr@2: IMPORT_C void PreLayoutDynInitL(); williamr@2: williamr@2: /** PreLayoutDynInitL() williamr@2: * From CAknDialog. williamr@2: */ williamr@2: IMPORT_C void PostLayoutDynInitL(); williamr@2: williamr@2: /** SetSizeAndPosition() williamr@2: * From CAknDialog. williamr@2: * Sets dialog's size to whole main pane. williamr@2: * @param aSize ignored williamr@2: */ williamr@2: IMPORT_C void SetSizeAndPosition(const TSize &aSize); williamr@2: williamr@2: /** OkToExitL() williamr@2: * From CAknDialog. williamr@2: * This is not called if the Cancel button is activated unless the EEikDialogFlagNotifyEsc flag has been set. williamr@2: * @param aButtonId The ID of the button that was activated. williamr@2: */ williamr@2: IMPORT_C TBool OkToExitL( TInt aButtonId ); williamr@2: williamr@2: /** HandleListBoxEventL() williamr@2: * From MEikListBoxObserver williamr@2: * Handles listbox events. williamr@2: * @param aListBox currently ignored williamr@2: * @param aEventType type of the listbox event williamr@2: */ williamr@2: IMPORT_C void HandleListBoxEventL( CEikListBox* aListBox, TListBoxEvent aEventType ); williamr@2: williamr@2: /** CountComponentControls() williamr@2: * From CCoeControl williamr@2: */ williamr@2: IMPORT_C TInt CountComponentControls() const; williamr@2: williamr@2: /** ComponentControl() williamr@2: * From CCoeControl williamr@2: */ williamr@2: IMPORT_C CCoeControl* ComponentControl( TInt aIndex ) const; williamr@2: williamr@2: /** OfferKeyEventL() williamr@2: * From CCoeControl williamr@2: */ williamr@2: IMPORT_C TKeyResponse OfferKeyEventL( const TKeyEvent& aKeyEvent, TEventCode aType ); williamr@2: williamr@2: /** CreateCustomControlL() creates own list or grid layouts. williamr@2: * williamr@2: * Normal implementation of this method is: williamr@2: * williamr@2: * @code williamr@2: * SEikControlInfo CreateCustomControlL(TInt aControlType) williamr@2: * { williamr@2: * CCoeControl *control = NULL; williamr@2: * if ( aControlType == EMyCtGridLayout ) williamr@2: * { williamr@2: * // CMyOddStyleGrid should be derived from CAknFormattedCellListBox or CEikColumnListBox. williamr@2: * control = new(ELeave)CMyOddStyleGrid; williamr@2: * } williamr@2: * SEikControlInfo info = {control,0,0}; williamr@2: * return info; williamr@2: * } williamr@2: * @endcode williamr@2: * See also IsAcceptableListBoxType(). CreateCustomControlL() and IsAcceptableListBoxType() forms a pair that should williamr@2: * be implemented together. williamr@2: */ williamr@2: IMPORT_C SEikControlInfo CreateCustomControlL(TInt aControlType); williamr@2: protected: williamr@2: /** ListBox() williamr@2: * accessor to listbox control williamr@2: * @return a pointer to the listbox williamr@2: */ williamr@2: IMPORT_C virtual CEikListBox *ListBox() const; williamr@2: williamr@2: /** FindBox() williamr@2: * accessor to findbox control williamr@2: * @return a pointer to the findbox williamr@2: */ williamr@2: IMPORT_C CAknSearchField *FindBox() const; williamr@2: williamr@2: /** IsFormattedCellListBox() williamr@2: * used to check whether listbox control is a CEikFormattedCellListBox or a CEikColumnListBox. williamr@2: * If you derive from IsAcceptableListBoxType() you must take care of the aIsFormattedCellListParameter to williamr@2: * make this method to work correctly. williamr@2: * @return whether listbox control is a CEikFormattedCellListBox williamr@2: */ williamr@2: IMPORT_C TBool IsFormattedCellListBox() const; williamr@2: williamr@2: /** Draw() williamr@2: * from CCoeControl williamr@2: */ williamr@2: IMPORT_C void Draw(const TRect&) const; williamr@2: private: williamr@2: /** williamr@2: * From CAknControl williamr@2: */ williamr@2: IMPORT_C void* ExtensionInterface( TUid aInterface ); williamr@2: private: williamr@2: IMPORT_C virtual void CEikDialog_Reserved_1(); williamr@2: IMPORT_C virtual void CEikDialog_Reserved_2(); williamr@2: private: williamr@2: IMPORT_C virtual void CAknDialog_Reserved(); williamr@2: private: // new function williamr@2: IMPORT_C virtual void CAknSelectionListDialog_Reserved(); williamr@2: protected: williamr@2: /** iEnterKeyPressed Set as ETrue if EAknCmdOpen is handled in williamr@2: * ProcessCommandL(). This will eventually cause OkToExitL() to williamr@2: * be called with EAknSoftkeyOk as aButtonId. williamr@2: */ williamr@2: TBool iEnterKeyPressed; williamr@2: protected: williamr@2: /** ExitViaIdle() williamr@2: * williamr@2: * Callback function to exit dialog after selecting something with williamr@2: * tapping it. This prevents dialog to be destroyed before dialog williamr@2: * page's handlepointereventl is fully completed. williamr@2: * @param aSelectionList pointer to current CAknSelectionList williamr@2: */ williamr@2: static TInt ExitViaIdle(TAny* aSelectionList ); williamr@2: private: williamr@2: CAknSelectionListDialogExtension *iExtension; williamr@2: private: williamr@2: CAknSearchField *iFindBox; williamr@2: TFindType iFindType; williamr@2: TInt *iSelectedItem; williamr@2: MDesCArray *iArray; williamr@2: MEikCommandObserver *iCmdObserver; williamr@2: TInt iDialogResourceId; williamr@2: TInt iSpare[4]; williamr@2: }; williamr@2: williamr@2: /** CAknMarkableListDialog is an interface for applications williamr@2: * williamr@2: * The class provides a list with items markable with shift+selection_key. williamr@2: * williamr@2: * What this class does: williamr@2: * williamr@2: * 1) Setup listbox for markable list (resource file still needs to be correct for markable lists :) williamr@2: * williamr@2: * 2) Loading default bitmaps williamr@2: * williamr@2: * 3) Handles mark/unmark/mark all/unmark all and edit list options menu visibility williamr@2: * williamr@2: * 4) Handles mark/unmark/mark all/unmark all commands from options menu williamr@2: * williamr@2: * williamr@2: * williamr@2: * @lib Avkon.lib williamr@2: * @since S60 v1.0 williamr@2: * williamr@2: * resource definition for this class: williamr@2: @code williamr@2: * RESOURCE DIALOG r_res_id_for_a_dialog williamr@2: * { williamr@2: * flags = EAknDialogMarkableList; williamr@2: * buttons = R_AVKON_SOFTKEYS_OPTIONS_BACK; williamr@2: * items = williamr@2: * { williamr@2: * DLG_LINE williamr@2: * { williamr@2: * type = EAknCtSingleGraphicListBox; williamr@2: * id = ESelectionListControl; williamr@2: * control = LISTBOX williamr@2: * { williamr@2: * flags = EAknListBoxMarkableList; williamr@2: * }; williamr@2: * } williamr@2: * // the next dlg line is optional. williamr@2: * , williamr@2: * DLG_LINE williamr@2: * { williamr@2: * itemflags = EEikDlgItemNonFocusing; williamr@2: * id = EFindControl; williamr@2: * type = EAknCtSelectionListFixedFind; williamr@2: * } williamr@2: * }; williamr@2: * } williamr@2: @endcode williamr@2: williamr@2: * The listbox type can be one of the following ( defined in avkon.hrh and aknlists.h ): williamr@2: @verbatim williamr@2: EAknCtSingleListBox (See CAknSingleStyleListBox) williamr@2: EAknCtSingleNumberListBox (See CAknSingleNumberStyleListBox) williamr@2: EAknCtSingleHeadingListBox (See CAknSingleHeadingStyleListBox) williamr@2: EAknCtSingleGraphicListBox (See CAknSingleGraphicStyleListBox) williamr@2: EAknCtSingleGraphicHeadingListBox (See CAknSingleGraphicHeadingStyleListBox) williamr@2: EAknCtSingleNumberHeadingListBox (See CAknSingleNumberHeadingStyleListBox) williamr@2: EAknCtSingleLargeListBox (See CAknSingleLargeStyleListBox) williamr@2: EAknCtDoubleListBox (See CAknDoubleStyleListBox) williamr@2: EAknCtDoubleNumberListBox (See CAknDoubleNumberStyleListBox) williamr@2: EAknCtDoubleTimeListBox (See CAknDoubleTimeStyleListBox) williamr@2: EAknCtDoubleLargeListBox (See CAknDoubleLargeStyleListBox) williamr@2: EAknCtDoubleGraphicListBox (See CAknDoubleGraphicStyleListBox) williamr@2: @endverbatim williamr@2: * williamr@2: * The type field while defining find can be one of the following: williamr@2: @verbatim williamr@2: EAknCtSelectionListFixedFind williamr@2: EAknCtSelectionListPopupFind williamr@2: EAknCtSelectionListAdaptiveFind williamr@2: @endverbatim williamr@2: * williamr@2: * The menubar you give for markable list dialog should have williamr@2: * one of the following as menu panes: williamr@2: @verbatim williamr@2: R_AVKON_MENUPANE_MARKABLE_LIST to get edit list menu williamr@2: R_AVKON_MENUPANE_MARKABLE_LIST_WITH_FIND_POPUP to get find and edit list williamr@2: @endverbatim williamr@2: * williamr@2: * @code williamr@2: * RESOURCE MENU_BAR r_res_id_for_a_menubar williamr@2: * { williamr@2: * titles = williamr@2: * { williamr@2: * MENU_TITLE { menu_pane = R_AVKON_MENUPANE_MARKABLE_LIST; } williamr@2: * }; williamr@2: * }; williamr@2: * @endcode williamr@2: * williamr@2: * C++ Usage: williamr@2: * williamr@2: * @code williamr@2: * TInt openedItem = 0; williamr@2: * MDesCArray *arrayOfItems = ...; williamr@2: * CArrayFix *selectedItems = ...; williamr@2: * CAknMarkableListDialog *dialog = CAknMarkableListDialog::NewL(openedItem, selectedItems, arrayOfItems, R_RES_ID_FOR_A_MENUBAR); williamr@2: * TInt result = dialog->ExecuteLD(R_RES_ID_FOR_A_DIALOG); williamr@2: * if (result) williamr@2: * { williamr@2: * ... williamr@2: * } williamr@2: * else williamr@2: * { williamr@2: * ... williamr@2: * } williamr@2: * @endcode williamr@2: * williamr@2: */ williamr@2: class CAknMarkableListDialog : public CAknSelectionListDialog williamr@2: { williamr@2: public: williamr@2: /** CAknMarkableListDialog::NewL() williamr@2: * williamr@2: * Static factory constructor. Uses two phase construction. williamr@2: * williamr@2: * @param aOpenedItem Variable to be modified when user williamr@2: * selects a list item. williamr@2: * @param aSelectedItems array of selected items williamr@2: * @param aArray Content of list items; williamr@2: * A tab-separated string with texts and indexes to icon array williamr@2: * @param aMenuBarResourceId Menu items to be shown in options menu. May be NULL. williamr@2: * @param aOkMenuBarId Resource id of a menu bar. This menu bar is displayed, williamr@2: * when there are marked items in the list williamr@2: * and user presses selection ( OK ) key. May be NULL. williamr@2: * @param aObserver Observer for the menu bar. May be NULL. williamr@2: * @return A pointer to created object williamr@2: */ williamr@2: IMPORT_C static CAknMarkableListDialog *NewL( TInt &aOpenedItem, williamr@2: CArrayFix *aSelectedItems, williamr@2: MDesCArray *aArray, williamr@2: TInt aMenuBarResourceId, williamr@2: TInt aOkMenuBarId, williamr@2: MEikCommandObserver *aObserver =0 ); williamr@2: williamr@2: /** CAknMarkableListDialog::NewL() williamr@2: * williamr@2: * Static factory constructor. Uses two phase construction. williamr@2: * Leaves created object to cleanup stack. williamr@2: * williamr@2: * @param aOpenedItem Variable to be modified when user williamr@2: * selects a list item. williamr@2: * @param aSelectedItems array of selected items williamr@2: * @param aArray Content of list items; williamr@2: * A tab-separated string with texts and indexes to icon array williamr@2: * @param aMenuBarResourceId Menu items to be shown in options menu. May be NULL. williamr@2: * @param aOkMenuBarId Resource id of a menu bar. This menu bar is displayed, williamr@2: * when there are marked items in the list williamr@2: * and user presses selection ( OK ) key. May be NULL. williamr@2: * @param aObserver Observer for the menu bar. May be NULL. williamr@2: * @return A pointer to created object williamr@2: */ williamr@2: IMPORT_C static CAknMarkableListDialog *NewLC( TInt &aOpenedItem, williamr@2: CArrayFix *aSelectedItems, williamr@2: MDesCArray *aArray, williamr@2: TInt aMenuBarResourceId, williamr@2: TInt aOkMenuBarId, williamr@2: MEikCommandObserver *aObserver =0 ); williamr@2: williamr@2: /** ConstructL() williamr@2: * 2nd phase constructor. williamr@2: * @param aMenuTitleResourceId Menu items to be shown in options menu williamr@2: */ williamr@2: IMPORT_C void ConstructL( TInt aMenuTitleResourceId ); williamr@2: williamr@2: /* ~CAknMarkableListDialog() williamr@2: * Destructor. williamr@2: */ williamr@2: IMPORT_C ~CAknMarkableListDialog(); williamr@2: williamr@2: public: // From CCoeControl williamr@2: /** HandlePointerEventL() williamr@2: * from CCoeControl. williamr@2: * @param aPointerEvent a pointer event. williamr@2: */ williamr@2: IMPORT_C void HandlePointerEventL(const TPointerEvent& aPointerEvent); williamr@2: williamr@2: protected: williamr@2: /** CAknMarkableListDialog() williamr@2: * williamr@2: * Default constructor. williamr@2: * @param aOpenedItem Variable to be modified when user williamr@2: * selects a list item. williamr@2: * @param aSelectedItems array of selected items williamr@2: * @param aArray Content of list items; williamr@2: * A tab-separated string with texts and indexes to icon array williamr@2: * @param aMenuBarResourceId Menu items to be shown in options menu. May be NULL. williamr@2: * @param aOkMenuBarResourceId Resource id of a menu bar. This menu bar is displayed, williamr@2: * when there are marked items in the list williamr@2: * and user presses selection ( OK ) key. May be NULL. williamr@2: * @param aObserver Observer for the menu bar. May be NULL. williamr@2: * @return A pointer to created object williamr@2: */ williamr@2: IMPORT_C CAknMarkableListDialog( TInt &aOpenedItem, williamr@2: CArrayFix *aSelectedItems, williamr@2: MDesCArray *aArray, williamr@2: TInt aMenuBarResourceId, williamr@2: TInt aOkMenuBarResourceId, williamr@2: MEikCommandObserver *aObserver ); williamr@2: /** PreLayoutDynInitL() williamr@2: * From CAknDialog. williamr@2: */ williamr@2: IMPORT_C void PreLayoutDynInitL(); williamr@2: williamr@2: /** PreLayoutDynInitL() williamr@2: * From CAknDialog. williamr@2: */ williamr@2: IMPORT_C void PostLayoutDynInitL(); williamr@2: williamr@2: /** SelectionListProcessCommandL() handles selection list and markable list williamr@2: * default commands. williamr@2: * williamr@2: * For markable lists, this method handles EAknCmdMark, EAknCmdUnmark, EAknMarkAll, EAknUnmarkAll williamr@2: * defined in options menu pane R_AVKON_MENUPANE_MARKABLE_LIST. williamr@2: */ williamr@2: IMPORT_C void SelectionListProcessCommandL(TInt aCommand); williamr@2: williamr@2: /** ProcessCommandL() williamr@2: * From CAknDialog. Processes commands and passes commands to FindBox and ListBox as needed. williamr@2: * @param aCommand id of the command. williamr@2: */ williamr@2: IMPORT_C void ProcessCommandL(TInt aCommand); williamr@2: williamr@2: /** DynInitMenuPaneL() williamr@2: * From MEikCommandObserver williamr@2: * @param aResourceId resource id of the menu pane to be modified williamr@2: * @param aMenuPane pointer to menu pane to be modified williamr@2: */ williamr@2: IMPORT_C void DynInitMenuPaneL(TInt aResourceId, CEikMenuPane *aMenuPane); williamr@2: williamr@2: /** HandleListBoxEventL() williamr@2: * From MEikListBoxObserver williamr@2: * Handles listbox events. williamr@2: * @param aListBox currently ignored williamr@2: * @param aEventType type of the listbox event williamr@2: */ williamr@2: IMPORT_C void HandleListBoxEventL( CEikListBox* aListBox, TListBoxEvent aEventType ); williamr@2: williamr@2: /** OfferKeyEventL() williamr@2: * From CCoeControl williamr@2: */ williamr@2: IMPORT_C TKeyResponse OfferKeyEventL( const TKeyEvent& aKeyEvent, TEventCode aType ); williamr@2: williamr@2: /** OkToExitL() williamr@2: * From CAknDialog. williamr@2: * This is not called if the Cancel button is activated unless the EEikDialogFlagNotifyEsc flag has been set. williamr@2: * @param aButtonId The ID of the button that was activated. williamr@2: */ williamr@2: IMPORT_C TBool OkToExitL(TInt aButtonId); williamr@2: williamr@2: private: williamr@2: CArrayFix *iSelectionIndexArray; // Not owned williamr@2: williamr@2: protected: williamr@2: /** williamr@2: * resource id of the menu bar williamr@2: */ williamr@2: TInt iMenuBarResourceId; williamr@2: williamr@2: /** williamr@2: * resource id of the OK menu bar williamr@2: */ williamr@2: TInt iOkMenuBarResourceId; williamr@2: williamr@2: public: // DEPRECATED METHODS, DO NOT USE williamr@2: /** NewL() williamr@2: * @deprecated Do not use. williamr@2: */ williamr@2: IMPORT_C static CAknMarkableListDialog *NewL(TInt &aOpenedItem, CArrayFix *aSelectedItems, williamr@2: MDesCArray *aArray, TInt aMenuBarResourceId, MEikCommandObserver *aObserver =0); williamr@2: /** NewLC() williamr@2: * @deprecated Do not use. williamr@2: */ williamr@2: IMPORT_C static CAknMarkableListDialog *NewLC(TInt &aOpenedItem, CArrayFix *aSelectedItems, williamr@2: MDesCArray *aArray, TInt aMenuBarResourceId, MEikCommandObserver *aObserver =0); williamr@2: protected: // DEPRECATED METHODS, DO NOT USE williamr@2: /** CAknMarkableListDialog() williamr@2: * @deprecated Do not use. williamr@2: */ williamr@2: IMPORT_C CAknMarkableListDialog(TInt &aValue, CArrayFix *aSelectedItems, MDesCArray *aArray, MEikCommandObserver *aObserver); williamr@2: williamr@2: private: williamr@2: /** williamr@2: * From CAknControl williamr@2: */ williamr@2: IMPORT_C void* ExtensionInterface( TUid aInterface ); williamr@2: private: williamr@2: IMPORT_C virtual void CEikDialog_Reserved_1(); williamr@2: IMPORT_C virtual void CEikDialog_Reserved_2(); williamr@2: private: williamr@2: IMPORT_C virtual void CAknDialog_Reserved(); williamr@2: private: williamr@2: IMPORT_C virtual void CAknSelectionListDialog_Reserved(); williamr@2: private: williamr@2: CAknMarkableListDialogExtension *iMarkableExtension; williamr@2: private: williamr@2: TInt iSpare[2]; williamr@2: }; williamr@2: williamr@2: williamr@2: typedef CAknSelectionListDialog CAknSelectionGridDialog; williamr@2: typedef CAknMarkableListDialog CAknMarkableGridDialog; williamr@2: williamr@2: williamr@2: #endif