epoc32/include/mw/aknselectionlist.h
author William Roberts <williamr@symbian.org>
Wed, 31 Mar 2010 12:33:34 +0100
branchSymbian3
changeset 4 837f303aceeb
parent 2 2fe1408b6811
permissions -rw-r--r--
Current Symbian^3 public API header files (from PDK 3.0.h)
This is the epoc32/include tree with the "platform" subtrees removed, and
all but a selected few mbg and rsg files removed.
williamr@2
     1
/*
williamr@2
     2
* Copyright (c) 2002-2006 Nokia Corporation and/or its subsidiary(-ies).
williamr@2
     3
* All rights reserved.
williamr@2
     4
* This component and the accompanying materials are made available
williamr@4
     5
* under the terms of "Eclipse Public License v1.0"
williamr@2
     6
* which accompanies this distribution, and is available
williamr@4
     7
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
williamr@2
     8
*
williamr@2
     9
* Initial Contributors:
williamr@2
    10
* Nokia Corporation - initial contribution.
williamr@2
    11
*
williamr@2
    12
* Contributors:
williamr@2
    13
*
williamr@2
    14
* Description:  Dialogs for selection service implementation.
williamr@2
    15
*
williamr@2
    16
*/
williamr@2
    17
williamr@2
    18
williamr@2
    19
#ifndef __AKNSELECTIONLIST_H__
williamr@2
    20
#define __AKNSELECTIONLIST_H__
williamr@2
    21
williamr@4
    22
#include <AknForm.h>
williamr@2
    23
#include <aknview.h>
williamr@4
    24
#include <AknUtils.h>
williamr@4
    25
#include <aknPopup.h>
williamr@2
    26
#include <avkon.rsg>
williamr@2
    27
williamr@2
    28
class CAknSelectionListDialogExtension;
williamr@2
    29
class CAknMarkableListDialogExtension;
williamr@2
    30
williamr@2
    31
/** CAknSelectionListDialog is the actual interface to the applications.
williamr@2
    32
*
williamr@2
    33
* Use this class to get a full screen list.
williamr@2
    34
*
williamr@2
    35
* This class only works in whole main pane. Do not try to use
williamr@2
    36
* this directly for other places. 
williamr@2
    37
*
williamr@2
    38
* @lib Avkon.lib
williamr@2
    39
* @since S60 v1.0
williamr@2
    40
*  
williamr@2
    41
* resource definition for this class:
williamr@2
    42
* @code
williamr@2
    43
* RESOURCE DIALOG r_res_id_for_a_dialog
williamr@2
    44
*   {
williamr@2
    45
*   flags = EAknDialogSelectionList;
williamr@2
    46
*   buttons = R_AVKON_SOFTKEYS_OPTIONS_BACK;
williamr@2
    47
*   items =
williamr@2
    48
*        {
williamr@2
    49
*        DLG_LINE
williamr@2
    50
*            {
williamr@2
    51
*            type = EAknCtSingleGraphicListBox;
williamr@2
    52
*            id = ESelectionListControl;
williamr@2
    53
*            control = LISTBOX
williamr@2
    54
*                {
williamr@2
    55
*                flags = EAknListBoxSelectionList;
williamr@2
    56
*                };
williamr@2
    57
*            }
williamr@2
    58
*     // the next dlg line is optional.
williamr@2
    59
 *        ,
williamr@2
    60
*        DLG_LINE
williamr@2
    61
*            {
williamr@2
    62
*             itemflags = EEikDlgItemNonFocusing;
williamr@2
    63
*            id = EFindControl;
williamr@2
    64
*            type = EAknCtSelectionListFixedFind;
williamr@2
    65
*            }
williamr@2
    66
*        };
williamr@2
    67
*   }
williamr@2
    68
* @endcode
williamr@2
    69
* The listbox type can be one of the following (defined in avkon.hrh and aknlists.h):
williamr@2
    70
 @verbatim
williamr@2
    71
   EAknCtSingleListBox                (See CAknSingleStyleListBox)
williamr@2
    72
   EAknCtSingleNumberListBox          (See CAknSingleNumberStyleListBox)
williamr@2
    73
   EAknCtSingleHeadingListBox         (See CAknSingleHeadingStyleListBox)
williamr@2
    74
   EAknCtSingleGraphicListBox         (See CAknSingleGraphicStyleListBox)
williamr@2
    75
   EAknCtSingleGraphicHeadingListBox  (See CAknSingleGraphicHeadingStyleListBox)
williamr@2
    76
   EAknCtSingleNumberHeadingListBox   (See CAknSingleNumberHeadingStyleListBox)
williamr@2
    77
   EAknCtSingleLargeListBox           (See CAknSingleLargeStyleListBox)
williamr@2
    78
   EAknCtDoubleListBox                (See CAknDoubleStyleListBox)
williamr@2
    79
   EAknCtDoubleNumberListBox          (See CAknDoubleNumberStyleListBox)
williamr@2
    80
   EAknCtDoubleTimeListBox            (See CAknDoubleTimeStyleListBox)
williamr@2
    81
   EAknCtDoubleLargeListBox           (See CAknDoubleLargeStyleListBox)
williamr@2
    82
   EAknCtDoubleGraphicListBox         (See CAknDoubleGraphicStyleListBox)
williamr@2
    83
 @endverbatim
williamr@2
    84
* The type field while defining find can be one of the following:
williamr@2
    85
@verbatim
williamr@2
    86
EAknCtSelectionListFixedFind
williamr@2
    87
EAknCtSelectionListPopupFind
williamr@2
    88
EAknCtSelectionListAdaptiveFind
williamr@2
    89
@endverbatim
williamr@2
    90
*
williamr@2
    91
* The menubar you give for selection list dialog should have
williamr@2
    92
* one of the following as one of its menu panes (defined in avkon.hrh):
williamr@2
    93
@verbatim
williamr@2
    94
R_AVKON_MENUPANE_SELECTION_LIST
williamr@2
    95
R_AVKON_MENUPANE_SELECTION_LIST_WITH_FIND_POPUP
williamr@2
    96
@endverbatim
williamr@2
    97
* @code
williamr@2
    98
* RESOURCE MENU_BAR r_res_id_for_a_menubar
williamr@2
    99
* {
williamr@2
   100
* titles =
williamr@2
   101
*     {
williamr@2
   102
*     MENU_TITLE { menu_pane = R_AVKON_MENUPANE_SELECTION_LIST; } 
williamr@2
   103
*     };
williamr@2
   104
* };
williamr@2
   105
* @endcode
williamr@2
   106
* C++ Usage:
williamr@2
   107
* @code
williamr@2
   108
*    TInt openedItem = 0;
williamr@2
   109
*    MDesCArray *array = ...;
williamr@2
   110
*    CAknSelectionListDialog *dialog = CAknSelectionListDialog::NewL(openedItem, array, R_RES_ID_FOR_A_MENUBAR);
williamr@2
   111
*    TInt result = dialog->ExecuteLD(R_RES_ID_FOR_A_DIALOG);
williamr@2
   112
*    if (result)
williamr@2
   113
*        {
williamr@2
   114
*        ...use openeditem here...
williamr@2
   115
*        }
williamr@2
   116
*    else
williamr@2
   117
*        {
williamr@2
   118
*        ...canceled...
williamr@2
   119
*        }
williamr@2
   120
*
williamr@2
   121
* @endcode
williamr@2
   122
* Alternatively, you can use:
williamr@2
   123
* @code
williamr@2
   124
*    TInt openedItem = 0;
williamr@2
   125
*    MDesCArray *array = ...;
williamr@2
   126
*    CAknSelectionListDialog *dialog = CAknSelectionListDialog::NewL(openedItem, array, R_RES_ID_FOR_A_MENUBAR);
williamr@2
   127
*    dialog->PrepareLC(R_RES_ID_FOR_A_DIALOG);
williamr@2
   128
*    // do some operations here, for example fill icon array 
williamr@2
   129
*    TInt result = dialog->RunLD();
williamr@2
   130
*    if (result)
williamr@2
   131
*        {
williamr@2
   132
*        ...
williamr@2
   133
*        }
williamr@2
   134
*    else
williamr@2
   135
*        {
williamr@2
   136
*        ...
williamr@2
   137
*        }
williamr@2
   138
* @endcode
williamr@2
   139
*
williamr@2
   140
* Often it is also useful to derive from CAknSelectionListDialog and implement OkToExitL(), constructors and the NewL() methods.
williamr@2
   141
* OkToExitL() implementation helps with providing navigation with other dialogs; OkToExitL() is ideal place to launch
williamr@2
   142
* new dialogs when a list item is selected. This way when backstepping, the state of the first dialog is preserved...
williamr@2
   143
*
williamr@2
   144
*
williamr@2
   145
*/
williamr@2
   146
class CAknSelectionListDialog : public CAknDialog, public MEikListBoxObserver
williamr@2
   147
    {
williamr@2
   148
public:
williamr@2
   149
    /** CAknSelectionListDialog::NewL()
williamr@2
   150
    *
williamr@2
   151
    * Static factory constructor. Uses two phase construction and leaves nothing on the CleanupStack.
williamr@2
   152
    * 
williamr@2
   153
    * @param aOpenedItem   Variable to be modified when user selects a list item.
williamr@2
   154
    * @param aArray        Content of list items; A tab-separated string with texts and indexes to icon array
williamr@2
   155
    * @param aMenuBarResourceId Menu items to be shown in options menu
williamr@2
   156
    * @param aCommand      Callback for state changes. EAknCmdOpen command is send by listbox. Options menu commands come here too.
williamr@2
   157
    * @return A pointer to created object  
williamr@2
   158
    */
williamr@2
   159
    IMPORT_C static CAknSelectionListDialog *NewL( TInt &aOpenedItem, MDesCArray *aArray, TInt aMenuBarResourceId, MEikCommandObserver *aCommand = 0 );
williamr@2
   160
williamr@2
   161
    /** CAknSelectionListDialog::NewLC()
williamr@2
   162
    *
williamr@2
   163
    * Static factory constructor. Uses two phase construction and leaves created object in CleanupStack.
williamr@2
   164
    * 
williamr@2
   165
    * @param aOpenedItem   Variable to be modified when user selects a list item.
williamr@2
   166
    * @param aArray        Content of list items; A tab-separated string with texts and indexes to icon array
williamr@2
   167
    * @param aMenuBarResourceId Menu items to be shown in options menu
williamr@2
   168
    * @param aCommand      Callback for state changes. EAknCmdOpen command is send by listbox. Options menu commands come here too.
williamr@2
   169
    * @return A pointer to created object  
williamr@2
   170
    */
williamr@2
   171
    IMPORT_C static CAknSelectionListDialog *NewLC( TInt &aOpenedItem, MDesCArray *aArray, TInt aMenuBarResourceId, MEikCommandObserver *aCommand = 0 );
williamr@2
   172
williamr@2
   173
    /** ConstructL()
williamr@2
   174
    * Second phase constructor.
williamr@2
   175
    *
williamr@2
   176
    * @param aMenuTitleResourceId Menu items to be shown in options menu. Same as aMenuBarResourceId of NewL(C).
williamr@2
   177
    */
williamr@2
   178
    IMPORT_C void ConstructL(TInt aMenuTitleResourceId);
williamr@2
   179
williamr@2
   180
public:
williamr@2
   181
    /** CAknSelectionListDialog::TFindType
williamr@2
   182
    *   Determines what kind of findbox should be used. Note, that a fixed findbox is not
williamr@2
   183
    *   available with all list types.
williamr@2
   184
    */
williamr@2
   185
    enum TFindType
williamr@2
   186
        {
williamr@2
   187
         /** no findbox should be used */
williamr@2
   188
        ENoFind,
williamr@2
   189
        /** fixed findbox should be used */
williamr@2
   190
        EFixedFind,
williamr@2
   191
        /** popup findbox should be used */
williamr@2
   192
        EPopupFind,
williamr@2
   193
	   /** fixed findbox with adaptive search should be used */
williamr@2
   194
        EAdaptiveFind
williamr@2
   195
        };
williamr@2
   196
        
williamr@2
   197
    /** SetupFind()
williamr@2
   198
    *
williamr@2
   199
    * Provides a way to enable and disable find and find popup on runtime.
williamr@2
   200
    * You still need entry with id EFindControl to resource file for the find, this is only for disabling
williamr@2
   201
    * existing find element.
williamr@2
   202
    *
williamr@2
   203
    * @param aType type of findbox to be used.
williamr@2
   204
    */
williamr@2
   205
    IMPORT_C void SetupFind(TFindType aType);
williamr@2
   206
williamr@2
   207
    /** IconArray()
williamr@2
   208
    *
williamr@2
   209
    * Icons, images and thumbnails are in this array.
williamr@2
   210
    *
williamr@2
   211
    * The list items are tab separated strings with fixed format. Some of the numbers
williamr@2
   212
    * in the list item strings are indexes to this array.
williamr@2
   213
    *
williamr@2
   214
    * This array can be modified by MDesCArray::MdcaPoint() method or at construction of
williamr@2
   215
    * dialog; after PrepareLC() call.
williamr@2
   216
    *
williamr@2
   217
    * @return pointer to iconarray of the list
williamr@2
   218
    */
williamr@2
   219
    IMPORT_C CArrayPtr<CGulIcon>* IconArray() const;
williamr@2
   220
williamr@2
   221
    /**   SetIconArrayL()
williamr@2
   222
    *
williamr@2
   223
    * Icons, images and thumbnails are in this array.
williamr@2
   224
    *
williamr@2
   225
    * The list items are tab separated strings with fixed format. Some of the numbers
williamr@2
   226
    * in the list item strings are indexes to this array.
williamr@2
   227
    *
williamr@2
   228
    * This array can be modified by MDesCArray::MdcaPoint() method or at construction of
williamr@2
   229
    * dialog; after PrepareLC() call.
williamr@2
   230
    *
williamr@2
   231
    * @param aIcons a array containing icons.
williamr@2
   232
    */
williamr@2
   233
    IMPORT_C void SetIconArrayL(CArrayPtr<CGulIcon>* aIcons);
williamr@2
   234
williamr@2
   235
    /**
williamr@2
   236
    * From CCoeControl.     
williamr@2
   237
    * Handles pointer events
williamr@2
   238
    * @param aPointerEvent     The pointer event.
williamr@2
   239
    */
williamr@2
   240
    IMPORT_C void HandlePointerEventL(const TPointerEvent& aPointerEvent);
williamr@2
   241
        
williamr@2
   242
protected:
williamr@2
   243
    /** CAknSelectionListDialog()
williamr@2
   244
    * Default constructor.
williamr@2
   245
    */
williamr@2
   246
    IMPORT_C CAknSelectionListDialog( TInt &aIndex, MDesCArray *aArray, MEikCommandObserver *aCommand );
williamr@2
   247
    /** ~CAknSelectionListDialog()
williamr@2
   248
    * Destructor.
williamr@2
   249
    */        
williamr@2
   250
    IMPORT_C ~CAknSelectionListDialog();
williamr@2
   251
        
williamr@2
   252
protected: // Customisation from derived classes
williamr@2
   253
    /** SelectionListProcessCommandL() handles selection list and markable list
williamr@2
   254
     *  default commands.
williamr@2
   255
     *
williamr@2
   256
     *  For markable lists, this method handles EAknCmdMark, EAknCmdUnmark, EAknMarkAll, EAknUnmarkAll
williamr@2
   257
     *  defined in options menu pane R_AVKON_MENUPANE_MARKABLE_LIST.
williamr@2
   258
     */
williamr@2
   259
    IMPORT_C virtual void SelectionListProcessCommandL(TInt aCommand);
williamr@2
   260
williamr@2
   261
    /** IsAcceptableListBoxType(): Detection of list and grid layouts
williamr@2
   262
    *
williamr@2
   263
    * The CAknSelectionList only works with certain list and grid
williamr@2
   264
    * layouts.
williamr@2
   265
    *
williamr@2
   266
    * You will get Panic() if you use your own list/grid layouts and
williamr@2
   267
    * you do not have this method implemented!
williamr@2
   268
    *
williamr@2
   269
    * If you add new list layouts, you should implement this method to
williamr@2
   270
    * publish the type of the layout using this method. This is especially
williamr@2
   271
    * the case where you use CAknSelectionGrid with your own grid layout.
williamr@2
   272
    * (as there are no predefined grid layouts, you need to do this
williamr@2
   273
    * every time you use a selection grid)
williamr@2
   274
    *
williamr@2
   275
    * The following aControlTypes are already implemented and requires
williamr@2
   276
    * no action:
williamr@2
   277
    * @verbatim
williamr@2
   278
     EAknCtSingleListBox
williamr@2
   279
     EAknCtSingleNumberListBox
williamr@2
   280
     EAknCtSingleHeadingListBox
williamr@2
   281
     EAknCtSingleGraphicListBox
williamr@2
   282
     EAknCtSingleGraphicHeadingListBox
williamr@2
   283
     EAknCtSingleNumberHeadingListBox
williamr@2
   284
     EAknCtSingleLargeListBox
williamr@2
   285
     EAknCtDoubleListBox
williamr@2
   286
     EAknCtDoubleNumberListBox
williamr@2
   287
     EAknCtDoubleTimeListBox
williamr@2
   288
     EAknCtDoubleLargeListBox
williamr@2
   289
     EAknCtDoubleGraphicListBox
williamr@2
   290
     EAknCtSettingListBox
williamr@2
   291
     EAknCtSettingNumberListBox
williamr@2
   292
     @endverbatim
williamr@2
   293
    *
williamr@2
   294
    * Any other layout requires you to inherit from CAknSelectionList
williamr@2
   295
    * and implement the following methods:
williamr@2
   296
    * @code
williamr@2
   297
    * TBool IsAcceptableListBoxType(TInt aControlType, TBool &aIsFormattedCellList)
williamr@2
   298
    *     {
williamr@2
   299
    *     if (aControlType == EMyCtGridLayout)
williamr@2
   300
    *         {
williamr@2
   301
    *         // CAknGrid is-a formattedcelllistbox.
williamr@2
   302
    *         aIsFormattedCellList = ETrue;
williamr@2
   303
    *         return ETrue;
williamr@2
   304
    *         }
williamr@2
   305
    *     else
williamr@2
   306
    *        {
williamr@2
   307
    *        return EFalse;
williamr@2
   308
    *        }
williamr@2
   309
    *     }
williamr@2
   310
    *
williamr@2
   311
    * @endcode
williamr@2
   312
    * See also CreateCustomControlL(). IsAcceptableListBoxType() and CreateCustomControlL() forms a pair that should
williamr@2
   313
    * be implemented together.
williamr@2
   314
    *
williamr@2
   315
    * @param aControlType type of the control. Ignored in current default implementation.
williamr@2
   316
    * @param aIsFormattedCellList returns whetehr list is a formatted cell listbox or a column listbox.
williamr@2
   317
    * Ignored in current default implementation. In derived implementations this must be set according to
williamr@2
   318
    * dialog's listbox type.
williamr@2
   319
    * @return whether layout can be used
williamr@2
   320
    */
williamr@2
   321
    IMPORT_C virtual TBool IsAcceptableListBoxType(TInt aControlType, TBool &aIsFormattedCellList) const;
williamr@2
   322
protected:
williamr@2
   323
    /** ProcessCommandL()
williamr@2
   324
    * From CAknDialog. Processes commands and passes commands to FindBox and ListBox as needed.
williamr@2
   325
    * @param aCommandId id of the command.
williamr@2
   326
    */
williamr@2
   327
    IMPORT_C void ProcessCommandL( TInt aCommandId );
williamr@2
   328
williamr@2
   329
    /** PreLayoutDynInitL()
williamr@2
   330
    * From CAknDialog.
williamr@2
   331
    */
williamr@2
   332
    IMPORT_C void PreLayoutDynInitL();
williamr@2
   333
williamr@2
   334
    /** PreLayoutDynInitL()
williamr@2
   335
    * From CAknDialog.
williamr@2
   336
    */
williamr@2
   337
    IMPORT_C void PostLayoutDynInitL();
williamr@2
   338
williamr@2
   339
    /** SetSizeAndPosition()
williamr@2
   340
    * From CAknDialog.
williamr@2
   341
    * Sets dialog's size to whole main pane.
williamr@2
   342
    * @param aSize ignored
williamr@2
   343
    */
williamr@2
   344
    IMPORT_C void SetSizeAndPosition(const TSize &aSize);
williamr@2
   345
williamr@2
   346
    /** OkToExitL()
williamr@2
   347
    * From CAknDialog.
williamr@2
   348
    * This is not called if the Cancel button is activated unless the EEikDialogFlagNotifyEsc flag has been set.
williamr@2
   349
    * @param aButtonId The ID of the button that was activated.
williamr@2
   350
    */
williamr@2
   351
    IMPORT_C TBool OkToExitL( TInt aButtonId );
williamr@2
   352
williamr@2
   353
    /** HandleListBoxEventL()
williamr@2
   354
    * From MEikListBoxObserver
williamr@2
   355
    * Handles listbox events.
williamr@2
   356
    * @param aListBox currently ignored
williamr@2
   357
    * @param aEventType type of the listbox event
williamr@2
   358
    */
williamr@2
   359
    IMPORT_C void HandleListBoxEventL( CEikListBox* aListBox, TListBoxEvent aEventType );
williamr@2
   360
williamr@2
   361
    /** CountComponentControls()
williamr@2
   362
    * From CCoeControl
williamr@2
   363
    */
williamr@2
   364
    IMPORT_C TInt CountComponentControls() const;
williamr@2
   365
williamr@2
   366
    /** ComponentControl()
williamr@2
   367
    * From CCoeControl
williamr@2
   368
    */
williamr@2
   369
    IMPORT_C CCoeControl* ComponentControl( TInt aIndex ) const;
williamr@2
   370
williamr@2
   371
    /** OfferKeyEventL()
williamr@2
   372
    * From CCoeControl
williamr@2
   373
    */
williamr@2
   374
    IMPORT_C TKeyResponse OfferKeyEventL( const TKeyEvent& aKeyEvent, TEventCode aType );
williamr@2
   375
williamr@2
   376
    /** CreateCustomControlL() creates own list or grid layouts.
williamr@2
   377
    *
williamr@2
   378
    * Normal implementation of this method is:
williamr@2
   379
    *
williamr@2
   380
    * @code
williamr@2
   381
    * SEikControlInfo CreateCustomControlL(TInt aControlType)
williamr@2
   382
    *     {
williamr@2
   383
    *     CCoeControl *control = NULL;
williamr@2
   384
    *     if ( aControlType == EMyCtGridLayout )
williamr@2
   385
    *         {
williamr@2
   386
    *         // CMyOddStyleGrid should be derived from CAknFormattedCellListBox or CEikColumnListBox.
williamr@2
   387
    *         control = new(ELeave)CMyOddStyleGrid;
williamr@2
   388
    *         } 
williamr@2
   389
    *     SEikControlInfo info = {control,0,0};
williamr@2
   390
    *     return info;
williamr@2
   391
    *     }
williamr@2
   392
    * @endcode
williamr@2
   393
    * See also IsAcceptableListBoxType(). CreateCustomControlL() and IsAcceptableListBoxType() forms a pair that should
williamr@2
   394
    * be implemented together.
williamr@2
   395
    */
williamr@2
   396
    IMPORT_C SEikControlInfo CreateCustomControlL(TInt aControlType);
williamr@2
   397
protected:
williamr@2
   398
    /** ListBox()
williamr@2
   399
    * accessor to listbox control
williamr@2
   400
    * @return a pointer to the listbox
williamr@2
   401
    */
williamr@2
   402
    IMPORT_C virtual CEikListBox *ListBox() const;
williamr@2
   403
williamr@2
   404
    /** FindBox()
williamr@2
   405
    * accessor to findbox control
williamr@2
   406
    * @return a pointer to the findbox
williamr@2
   407
    */
williamr@2
   408
    IMPORT_C CAknSearchField *FindBox() const;
williamr@2
   409
williamr@2
   410
    /** IsFormattedCellListBox()
williamr@2
   411
    * used to check whether listbox control is a CEikFormattedCellListBox or a CEikColumnListBox.
williamr@2
   412
    * If you derive from IsAcceptableListBoxType() you must take care of the aIsFormattedCellListParameter to
williamr@2
   413
    * make this method to work correctly.
williamr@2
   414
    * @return whether listbox control is a CEikFormattedCellListBox
williamr@2
   415
    */
williamr@2
   416
    IMPORT_C TBool IsFormattedCellListBox() const;
williamr@2
   417
williamr@2
   418
    /** Draw()
williamr@2
   419
    * from CCoeControl
williamr@2
   420
    */
williamr@2
   421
    IMPORT_C void Draw(const TRect&) const;
williamr@2
   422
private: 
williamr@2
   423
    /**
williamr@2
   424
    * From CAknControl
williamr@2
   425
    */
williamr@2
   426
    IMPORT_C void* ExtensionInterface( TUid aInterface );
williamr@2
   427
private: 
williamr@2
   428
    IMPORT_C virtual void CEikDialog_Reserved_1();
williamr@2
   429
    IMPORT_C virtual void CEikDialog_Reserved_2();
williamr@2
   430
private: 
williamr@2
   431
    IMPORT_C virtual void CAknDialog_Reserved();
williamr@2
   432
private: // new function 
williamr@2
   433
    IMPORT_C virtual void CAknSelectionListDialog_Reserved();
williamr@2
   434
protected:
williamr@2
   435
    /** iEnterKeyPressed Set as ETrue if EAknCmdOpen is handled in
williamr@2
   436
    * ProcessCommandL(). This will eventually cause OkToExitL() to
williamr@2
   437
    * be called with EAknSoftkeyOk as aButtonId.
williamr@2
   438
    */
williamr@2
   439
    TBool iEnterKeyPressed;
williamr@2
   440
protected:
williamr@2
   441
    /** ExitViaIdle()
williamr@2
   442
    *
williamr@2
   443
    * Callback function to exit dialog after selecting something with
williamr@2
   444
    * tapping it.  This prevents dialog to be destroyed before dialog
williamr@2
   445
    * page's handlepointereventl is fully completed.
williamr@2
   446
    * @param aSelectionList pointer to current CAknSelectionList
williamr@2
   447
    */
williamr@2
   448
    static TInt ExitViaIdle(TAny* aSelectionList );    
williamr@2
   449
private:
williamr@2
   450
    CAknSelectionListDialogExtension *iExtension;
williamr@2
   451
private:
williamr@2
   452
    CAknSearchField *iFindBox;
williamr@2
   453
    TFindType iFindType;
williamr@2
   454
    TInt *iSelectedItem;
williamr@2
   455
    MDesCArray *iArray;
williamr@2
   456
    MEikCommandObserver *iCmdObserver;
williamr@2
   457
    TInt iDialogResourceId;
williamr@2
   458
    TInt iSpare[4];
williamr@2
   459
    };
williamr@2
   460
williamr@2
   461
/** CAknMarkableListDialog is an interface for applications
williamr@2
   462
*
williamr@2
   463
* The class provides a list with items markable with shift+selection_key.
williamr@2
   464
*
williamr@2
   465
* What this class does:
williamr@2
   466
*
williamr@2
   467
*   1) Setup listbox for markable list (resource file still needs to be correct for markable lists :)
williamr@2
   468
*
williamr@2
   469
*   2) Loading default bitmaps
williamr@2
   470
*
williamr@2
   471
*   3) Handles mark/unmark/mark all/unmark all and edit list options menu visibility
williamr@2
   472
*
williamr@2
   473
*   4) Handles mark/unmark/mark all/unmark all commands from options menu
williamr@2
   474
*
williamr@2
   475
*
williamr@2
   476
*
williamr@2
   477
* @lib Avkon.lib
williamr@2
   478
* @since S60 v1.0
williamr@2
   479
*
williamr@2
   480
* resource definition for this class:
williamr@2
   481
@code
williamr@2
   482
* RESOURCE DIALOG r_res_id_for_a_dialog
williamr@2
   483
*   {
williamr@2
   484
*   flags = EAknDialogMarkableList;
williamr@2
   485
*   buttons = R_AVKON_SOFTKEYS_OPTIONS_BACK;
williamr@2
   486
*   items =
williamr@2
   487
*        {
williamr@2
   488
*        DLG_LINE
williamr@2
   489
*            {
williamr@2
   490
*            type = EAknCtSingleGraphicListBox;
williamr@2
   491
*            id = ESelectionListControl;
williamr@2
   492
*            control = LISTBOX
williamr@2
   493
*                {
williamr@2
   494
*                flags = EAknListBoxMarkableList;
williamr@2
   495
*                };
williamr@2
   496
*            }
williamr@2
   497
*     // the next dlg line is optional.
williamr@2
   498
*        ,
williamr@2
   499
*        DLG_LINE
williamr@2
   500
*            {
williamr@2
   501
*             itemflags = EEikDlgItemNonFocusing;
williamr@2
   502
*            id = EFindControl;
williamr@2
   503
*            type = EAknCtSelectionListFixedFind;
williamr@2
   504
*            }
williamr@2
   505
*        };
williamr@2
   506
*   }
williamr@2
   507
@endcode
williamr@2
   508
williamr@2
   509
* The listbox type can be one of the following ( defined in avkon.hrh and aknlists.h ):
williamr@2
   510
@verbatim
williamr@2
   511
EAknCtSingleListBox                (See CAknSingleStyleListBox)
williamr@2
   512
EAknCtSingleNumberListBox          (See CAknSingleNumberStyleListBox)
williamr@2
   513
EAknCtSingleHeadingListBox         (See CAknSingleHeadingStyleListBox)
williamr@2
   514
EAknCtSingleGraphicListBox         (See CAknSingleGraphicStyleListBox)
williamr@2
   515
EAknCtSingleGraphicHeadingListBox  (See CAknSingleGraphicHeadingStyleListBox)
williamr@2
   516
EAknCtSingleNumberHeadingListBox   (See CAknSingleNumberHeadingStyleListBox)
williamr@2
   517
EAknCtSingleLargeListBox           (See CAknSingleLargeStyleListBox)
williamr@2
   518
EAknCtDoubleListBox                (See CAknDoubleStyleListBox)
williamr@2
   519
EAknCtDoubleNumberListBox          (See CAknDoubleNumberStyleListBox)
williamr@2
   520
EAknCtDoubleTimeListBox            (See CAknDoubleTimeStyleListBox)
williamr@2
   521
EAknCtDoubleLargeListBox           (See CAknDoubleLargeStyleListBox)
williamr@2
   522
EAknCtDoubleGraphicListBox         (See CAknDoubleGraphicStyleListBox)
williamr@2
   523
@endverbatim
williamr@2
   524
*
williamr@2
   525
* The type field while defining find can be one of the following:
williamr@2
   526
@verbatim
williamr@2
   527
EAknCtSelectionListFixedFind
williamr@2
   528
EAknCtSelectionListPopupFind
williamr@2
   529
EAknCtSelectionListAdaptiveFind
williamr@2
   530
@endverbatim
williamr@2
   531
*
williamr@2
   532
* The menubar you give for markable list dialog should have
williamr@2
   533
* one of the following as menu panes:
williamr@2
   534
@verbatim
williamr@2
   535
R_AVKON_MENUPANE_MARKABLE_LIST   to get edit list menu
williamr@2
   536
R_AVKON_MENUPANE_MARKABLE_LIST_WITH_FIND_POPUP to get find and edit list
williamr@2
   537
@endverbatim
williamr@2
   538
*
williamr@2
   539
* @code
williamr@2
   540
* RESOURCE MENU_BAR r_res_id_for_a_menubar
williamr@2
   541
*     {
williamr@2
   542
*     titles =
williamr@2
   543
*         {
williamr@2
   544
*         MENU_TITLE { menu_pane = R_AVKON_MENUPANE_MARKABLE_LIST; }
williamr@2
   545
*         };
williamr@2
   546
*     };
williamr@2
   547
* @endcode
williamr@2
   548
*
williamr@2
   549
* C++ Usage:
williamr@2
   550
*
williamr@2
   551
* @code
williamr@2
   552
*    TInt openedItem = 0;
williamr@2
   553
*    MDesCArray *arrayOfItems = ...; 
williamr@2
   554
*    CArrayFix<TInt> *selectedItems = ...;
williamr@2
   555
*    CAknMarkableListDialog *dialog = CAknMarkableListDialog::NewL(openedItem, selectedItems, arrayOfItems, R_RES_ID_FOR_A_MENUBAR);
williamr@2
   556
*    TInt result = dialog->ExecuteLD(R_RES_ID_FOR_A_DIALOG);
williamr@2
   557
*    if (result)
williamr@2
   558
*        {
williamr@2
   559
*        ...
williamr@2
   560
*        }
williamr@2
   561
*    else
williamr@2
   562
*        {
williamr@2
   563
*        ...
williamr@2
   564
*        }
williamr@2
   565
* @endcode
williamr@2
   566
*
williamr@2
   567
*/
williamr@2
   568
class CAknMarkableListDialog : public CAknSelectionListDialog
williamr@2
   569
    {
williamr@2
   570
public:
williamr@2
   571
    /** CAknMarkableListDialog::NewL()
williamr@2
   572
    *
williamr@2
   573
    * Static factory constructor. Uses two phase construction.
williamr@2
   574
    * 
williamr@2
   575
    * @param aOpenedItem        Variable to be modified when user
williamr@2
   576
    *                           selects a list item.
williamr@2
   577
    * @param aSelectedItems     array of selected items
williamr@2
   578
    * @param aArray             Content of list items;
williamr@2
   579
    *                           A tab-separated string with texts and indexes to icon array
williamr@2
   580
    * @param aMenuBarResourceId Menu items to be shown in options menu.  May be NULL.
williamr@2
   581
    * @param aOkMenuBarId       Resource id of a menu bar. This menu bar is displayed,
williamr@2
   582
    *                           when there are marked items in the list
williamr@2
   583
    *                           and user presses selection ( OK )  key.  May be NULL.
williamr@2
   584
    * @param aObserver          Observer for the menu bar.  May be NULL.
williamr@2
   585
    * @return A pointer to created object  
williamr@2
   586
    */
williamr@2
   587
    IMPORT_C static CAknMarkableListDialog *NewL( TInt &aOpenedItem,
williamr@2
   588
                                                  CArrayFix<TInt> *aSelectedItems,
williamr@2
   589
                                                  MDesCArray *aArray,
williamr@2
   590
                                                  TInt aMenuBarResourceId,
williamr@2
   591
                                                  TInt aOkMenuBarId,
williamr@2
   592
                                                  MEikCommandObserver *aObserver =0 );
williamr@2
   593
        
williamr@2
   594
    /** CAknMarkableListDialog::NewL()
williamr@2
   595
    *
williamr@2
   596
    * Static factory constructor. Uses two phase construction.
williamr@2
   597
    * Leaves created object to cleanup stack.
williamr@2
   598
    * 
williamr@2
   599
    * @param aOpenedItem        Variable to be modified when user
williamr@2
   600
    *                           selects a list item.
williamr@2
   601
    * @param aSelectedItems     array of selected items
williamr@2
   602
    * @param aArray             Content of list items;
williamr@2
   603
    *                           A tab-separated string with texts and indexes to icon array
williamr@2
   604
    * @param aMenuBarResourceId Menu items to be shown in options menu. May be NULL.
williamr@2
   605
    * @param aOkMenuBarId       Resource id of a menu bar. This menu bar is displayed,
williamr@2
   606
    *                           when there are marked items in the list
williamr@2
   607
    *                           and user presses selection ( OK )  key. May be NULL.
williamr@2
   608
    * @param aObserver          Observer for the menu bar. May be NULL.
williamr@2
   609
    * @return A pointer to created object  
williamr@2
   610
    */
williamr@2
   611
    IMPORT_C static CAknMarkableListDialog *NewLC( TInt &aOpenedItem,
williamr@2
   612
                                                   CArrayFix<TInt> *aSelectedItems,
williamr@2
   613
                                                   MDesCArray *aArray,
williamr@2
   614
                                                   TInt aMenuBarResourceId,
williamr@2
   615
                                                   TInt aOkMenuBarId,
williamr@2
   616
                                                   MEikCommandObserver *aObserver =0 );
williamr@2
   617
williamr@2
   618
    /** ConstructL()
williamr@2
   619
    * 2nd phase constructor.
williamr@2
   620
    * @param aMenuTitleResourceId Menu items to be shown in options menu
williamr@2
   621
    */
williamr@2
   622
    IMPORT_C void ConstructL( TInt aMenuTitleResourceId );
williamr@2
   623
williamr@2
   624
    /* ~CAknMarkableListDialog()
williamr@2
   625
    * Destructor.
williamr@2
   626
    */
williamr@2
   627
    IMPORT_C ~CAknMarkableListDialog();
williamr@2
   628
williamr@2
   629
public: // From CCoeControl
williamr@2
   630
    /** HandlePointerEventL()
williamr@2
   631
    * from CCoeControl.
williamr@2
   632
    * @param aPointerEvent a pointer event.
williamr@2
   633
    */
williamr@2
   634
    IMPORT_C void HandlePointerEventL(const TPointerEvent& aPointerEvent);
williamr@2
   635
williamr@2
   636
protected:
williamr@2
   637
    /** CAknMarkableListDialog()
williamr@2
   638
    *
williamr@2
   639
    * Default constructor.
williamr@2
   640
    * @param aOpenedItem           Variable to be modified when user
williamr@2
   641
    *                              selects a list item.
williamr@2
   642
    * @param aSelectedItems        array of selected items
williamr@2
   643
    * @param aArray                Content of list items;
williamr@2
   644
    *                              A tab-separated string with texts and indexes to icon array
williamr@2
   645
    * @param aMenuBarResourceId    Menu items to be shown in options menu. May be NULL.
williamr@2
   646
    * @param aOkMenuBarResourceId  Resource id of a menu bar. This menu bar is displayed,
williamr@2
   647
    *                              when there are marked items in the list
williamr@2
   648
    *                              and user presses selection ( OK )  key. May be NULL.
williamr@2
   649
    * @param aObserver             Observer for the menu bar. May be NULL.
williamr@2
   650
    * @return                      A pointer to created object  
williamr@2
   651
    */
williamr@2
   652
    IMPORT_C CAknMarkableListDialog( TInt &aOpenedItem,
williamr@2
   653
                                     CArrayFix<TInt> *aSelectedItems,
williamr@2
   654
                                     MDesCArray *aArray,
williamr@2
   655
                                     TInt aMenuBarResourceId,
williamr@2
   656
                                     TInt aOkMenuBarResourceId,
williamr@2
   657
                                     MEikCommandObserver *aObserver );
williamr@2
   658
    /** PreLayoutDynInitL()
williamr@2
   659
    * From CAknDialog.
williamr@2
   660
    */
williamr@2
   661
    IMPORT_C void PreLayoutDynInitL();
williamr@2
   662
williamr@2
   663
    /** PreLayoutDynInitL()
williamr@2
   664
    * From CAknDialog.
williamr@2
   665
    */
williamr@2
   666
    IMPORT_C void PostLayoutDynInitL();
williamr@2
   667
williamr@2
   668
    /** SelectionListProcessCommandL() handles selection list and markable list
williamr@2
   669
    *  default commands.
williamr@2
   670
    *
williamr@2
   671
    *  For markable lists, this method handles EAknCmdMark, EAknCmdUnmark, EAknMarkAll, EAknUnmarkAll
williamr@2
   672
    *  defined in options menu pane R_AVKON_MENUPANE_MARKABLE_LIST.
williamr@2
   673
    */
williamr@2
   674
    IMPORT_C void SelectionListProcessCommandL(TInt aCommand);
williamr@2
   675
williamr@2
   676
    /** ProcessCommandL()
williamr@2
   677
    * From CAknDialog. Processes commands and passes commands to FindBox and ListBox as needed.
williamr@2
   678
    * @param aCommand id of the command.
williamr@2
   679
    */
williamr@2
   680
    IMPORT_C void ProcessCommandL(TInt aCommand);
williamr@2
   681
williamr@2
   682
    /** DynInitMenuPaneL()
williamr@2
   683
    * From MEikCommandObserver
williamr@2
   684
    * @param aResourceId resource id of the menu pane to be modified
williamr@2
   685
    * @param aMenuPane pointer to menu pane to be modified
williamr@2
   686
    */
williamr@2
   687
    IMPORT_C void DynInitMenuPaneL(TInt aResourceId, CEikMenuPane *aMenuPane);
williamr@2
   688
williamr@2
   689
    /** HandleListBoxEventL()
williamr@2
   690
    * From MEikListBoxObserver
williamr@2
   691
    * Handles listbox events.
williamr@2
   692
    * @param aListBox currently ignored
williamr@2
   693
    * @param aEventType type of the listbox event
williamr@2
   694
    */
williamr@2
   695
    IMPORT_C void HandleListBoxEventL( CEikListBox* aListBox, TListBoxEvent aEventType );
williamr@2
   696
williamr@2
   697
    /** OfferKeyEventL()
williamr@2
   698
    * From CCoeControl
williamr@2
   699
    */
williamr@2
   700
    IMPORT_C TKeyResponse OfferKeyEventL( const TKeyEvent& aKeyEvent, TEventCode aType );
williamr@2
   701
williamr@2
   702
    /** OkToExitL()
williamr@2
   703
    * From CAknDialog.
williamr@2
   704
    * This is not called if the Cancel button is activated unless the EEikDialogFlagNotifyEsc flag has been set.
williamr@2
   705
    * @param aButtonId The ID of the button that was activated.
williamr@2
   706
    */
williamr@2
   707
    IMPORT_C TBool OkToExitL(TInt aButtonId);
williamr@2
   708
williamr@2
   709
private:
williamr@2
   710
    CArrayFix<TInt> *iSelectionIndexArray; // Not owned
williamr@2
   711
williamr@2
   712
protected:
williamr@2
   713
    /**
williamr@2
   714
    * resource id of the menu bar
williamr@2
   715
    */
williamr@2
   716
    TInt iMenuBarResourceId;
williamr@2
   717
williamr@2
   718
    /**
williamr@2
   719
    * resource id of the OK menu bar
williamr@2
   720
    */        
williamr@2
   721
    TInt iOkMenuBarResourceId;
williamr@2
   722
williamr@2
   723
public: // DEPRECATED METHODS, DO NOT USE
williamr@2
   724
    /** NewL()
williamr@2
   725
    * @deprecated Do not use.
williamr@2
   726
    */
williamr@2
   727
    IMPORT_C static CAknMarkableListDialog *NewL(TInt &aOpenedItem, CArrayFix<TInt> *aSelectedItems,
williamr@2
   728
                                                 MDesCArray *aArray, TInt aMenuBarResourceId, MEikCommandObserver *aObserver =0);
williamr@2
   729
    /** NewLC()
williamr@2
   730
    * @deprecated Do  not use.
williamr@2
   731
    */
williamr@2
   732
    IMPORT_C static CAknMarkableListDialog *NewLC(TInt &aOpenedItem, CArrayFix<TInt> *aSelectedItems,
williamr@2
   733
                                                  MDesCArray *aArray, TInt aMenuBarResourceId, MEikCommandObserver *aObserver =0);
williamr@2
   734
protected: // DEPRECATED METHODS, DO NOT USE
williamr@2
   735
     /** CAknMarkableListDialog()
williamr@2
   736
     * @deprecated Do not use.
williamr@2
   737
     */
williamr@2
   738
    IMPORT_C CAknMarkableListDialog(TInt &aValue, CArrayFix<TInt> *aSelectedItems, MDesCArray *aArray, MEikCommandObserver *aObserver);
williamr@2
   739
williamr@2
   740
private: 
williamr@2
   741
    /**
williamr@2
   742
    * From CAknControl
williamr@2
   743
    */
williamr@2
   744
    IMPORT_C void* ExtensionInterface( TUid aInterface );
williamr@2
   745
private: 
williamr@2
   746
    IMPORT_C virtual void CEikDialog_Reserved_1();
williamr@2
   747
    IMPORT_C virtual void CEikDialog_Reserved_2();
williamr@2
   748
private: 
williamr@2
   749
    IMPORT_C virtual void CAknDialog_Reserved();
williamr@2
   750
private: 
williamr@2
   751
    IMPORT_C virtual void CAknSelectionListDialog_Reserved();
williamr@2
   752
private:  
williamr@2
   753
    CAknMarkableListDialogExtension *iMarkableExtension;
williamr@2
   754
private:
williamr@2
   755
    TInt iSpare[2];
williamr@2
   756
    };
williamr@2
   757
williamr@2
   758
williamr@2
   759
typedef CAknSelectionListDialog CAknSelectionGridDialog;
williamr@2
   760
typedef CAknMarkableListDialog CAknMarkableGridDialog;
williamr@2
   761
williamr@2
   762
williamr@2
   763
#endif