epoc32/include/mw/aknlistquerydialog.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 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: 
williamr@2
    15
*   Implementation of CAknListQueryDialog
williamr@2
    16
*
williamr@2
    17
*/
williamr@2
    18
williamr@2
    19
williamr@2
    20
#ifndef AKNLISTQUERYDIALOG_H
williamr@2
    21
#define AKNLISTQUERYDIALOG_H
williamr@2
    22
williamr@4
    23
#include <AknQueryDialog.h>
williamr@2
    24
williamr@2
    25
class CAknMessageQueryControl;
williamr@2
    26
class CAknListQueryMediatorObserver;
williamr@2
    27
williamr@2
    28
/**
williamr@2
    29
 * List query class.
williamr@2
    30
 *
williamr@2
    31
 * This class is be used for list or multiselection list queries. 
williamr@2
    32
 */
williamr@2
    33
class CAknListQueryDialog : public CAknQueryDialog,
williamr@2
    34
                            public MEikListBoxObserver, 
williamr@2
    35
                            public MAknIntermediateState
williamr@2
    36
	{
williamr@2
    37
    public:
williamr@2
    38
        /**
williamr@2
    39
         * C++ default constructor.
williamr@2
    40
         *
williamr@2
    41
         * @param aIndex After the query is dismissed, the index will 
williamr@2
    42
         *        hold the value of selected item.
williamr@2
    43
         */
williamr@2
    44
	    IMPORT_C CAknListQueryDialog(TInt* aIndex);
williamr@2
    45
williamr@2
    46
        /**
williamr@2
    47
         * C++ default constructor.
williamr@2
    48
         *
williamr@2
    49
         * @param aSelectionIndexArray Will hold the values of selected
williamr@2
    50
         *        items (in multiselection list).
williamr@2
    51
         */
williamr@2
    52
        IMPORT_C CAknListQueryDialog(
williamr@2
    53
                  CListBoxView::CSelectionIndexArray* aSelectionIndexArray);
williamr@2
    54
williamr@2
    55
        /**
williamr@2
    56
        * Destructor
williamr@2
    57
        */
williamr@2
    58
	    IMPORT_C virtual ~CAknListQueryDialog();
williamr@2
    59
williamr@2
    60
        /**
williamr@2
    61
         * From @c CEikDialog.   
williamr@2
    62
         *
williamr@2
    63
         * Sets the type and position of the list box.
williamr@2
    64
         *
williamr@2
    65
         * @param aSize Not used.
williamr@2
    66
         */
williamr@2
    67
        IMPORT_C void SetSizeAndPosition(const TSize &aSize);
williamr@2
    68
williamr@2
    69
        /**
williamr@2
    70
         * From @c CCoeControl.  
williamr@2
    71
         *
williamr@2
    72
         * Handles key events. When a key event occurs, @c CONE calls this 
williamr@2
    73
         * function for each control on the control stack, until one of them
williamr@2
    74
         * returns @c EKeyWasConsumed to indicate that it processed the key
williamr@2
    75
         * event.  
williamr@2
    76
         *
williamr@2
    77
         * @param aKeyEvent The key event.
williamr@2
    78
         * @param aType The type of the event: @c EEventKey, @c EEventKeyUp or 
williamr@2
    79
         *        @c EEventKeyDown.
williamr@2
    80
         * @return Indicates whether or not the key event was 
williamr@2
    81
         *         used by this control.
williamr@2
    82
         */
williamr@2
    83
        IMPORT_C TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent, 
williamr@2
    84
                                             TEventCode aType);
williamr@2
    85
	    
williamr@2
    86
        /**
williamr@2
    87
         * From @c MEikListBoxObserver. 
williamr@2
    88
         *
williamr@2
    89
         * Handles events from listbox.
williamr@2
    90
         * 
williamr@2
    91
         * @param aListBox The listbox which caused the event.
williamr@2
    92
         * @param aEventType Type of the event.
williamr@2
    93
         */
williamr@2
    94
        IMPORT_C void HandleListBoxEventL(CEikListBox* aListBox, 
williamr@2
    95
                                          TListBoxEvent aEventType);
williamr@2
    96
williamr@2
    97
        /**
williamr@2
    98
         * Sets item text array to the listbox.
williamr@2
    99
         *
williamr@2
   100
         * @param aItemTextArray Item text array to be added.
williamr@2
   101
         */
williamr@2
   102
        IMPORT_C void SetItemTextArray(MDesCArray* aItemTextArray);
williamr@2
   103
williamr@2
   104
        /**
williamr@2
   105
         * Sets ownership type of the item array.
williamr@2
   106
         *
williamr@2
   107
         * @param aOwnershipType Type of ownership.
williamr@2
   108
         */
williamr@2
   109
        IMPORT_C void SetOwnershipType(
williamr@2
   110
                        TListBoxModelItemArrayOwnership aOwnershipType);
williamr@2
   111
williamr@2
   112
        /**
williamr@2
   113
         * Destroys a possible old icon array in the listbox and installs a new
williamr@2
   114
         * one and takes ownership of the new icon array.
williamr@2
   115
         *
williamr@2
   116
         * @param aIcons Icon pointer which will be installed.
williamr@2
   117
         */
williamr@2
   118
        IMPORT_C void SetIconArrayL(CArrayPtr<CGulIcon>* aIcons);
williamr@2
   119
williamr@2
   120
        /**
williamr@2
   121
         * Gets list query's listbox.
williamr@2
   122
         *
williamr@2
   123
         * @return The requested list box. 
williamr@2
   124
         */
williamr@2
   125
        IMPORT_C CEikListBox* ListBox() const;
williamr@2
   126
williamr@2
   127
        /**
williamr@2
   128
         * Gets pointer to list query control or @c NULL.
williamr@2
   129
         *
williamr@2
   130
         * @return Pointer to list query control or in case that there is 
williamr@2
   131
         *         no such element a @c NULL pointer. 
williamr@2
   132
         */
williamr@2
   133
        IMPORT_C CAknListQueryControl* ListControl() const;
williamr@2
   134
williamr@2
   135
        /**
williamr@2
   136
         * Gets pointer to message query control or @c NULL.
williamr@2
   137
         *
williamr@2
   138
         * @return Pointer to message query control or in case that there 
williamr@2
   139
         *         is no such element a @c NULL pointer. 
williamr@2
   140
         */
williamr@2
   141
        IMPORT_C CAknMessageQueryControl* MessageBox() const;
williamr@2
   142
williamr@2
   143
        /**
williamr@2
   144
         * Gets pointer to query heading or @c NULL.
williamr@2
   145
         *
williamr@2
   146
         * @return Pointer to query heading or in case there is no such
williamr@2
   147
         *         element a @c NULL pointer. 
williamr@2
   148
         */
williamr@2
   149
        IMPORT_C CAknPopupHeadingPane* QueryHeading() const;
williamr@2
   150
williamr@2
   151
        /**
williamr@2
   152
         * From @c CCoeControl.
williamr@2
   153
         *
williamr@2
   154
         * Sets the control to be ready for drawing.
williamr@2
   155
         */
williamr@2
   156
        IMPORT_C void ActivateL();
williamr@2
   157
williamr@2
   158
        /**
williamr@2
   159
         * From @c CCoeControl.     
williamr@2
   160
         *
williamr@2
   161
         * Handles pointer events.
williamr@2
   162
         *
williamr@2
   163
         * This function gets called whenever a pointer event occurs in the 
williamr@2
   164
         * control, i.e. when the pointer is within the control's extent, 
williamr@2
   165
         * or when the control has grabbed the pointer. The control should 
williamr@2
   166
         * implement this function to handle pointer events.
williamr@2
   167
         *
williamr@2
   168
         * Note: events of type @c EButton1Down are processed before 
williamr@2
   169
         * @c HandlePointerEventL() is called, in order to transfer keyboard 
williamr@2
   170
         * focus to the control in which the @c EButton1Down event occurred.
williamr@2
   171
         *
williamr@2
   172
         * If overriding @c HandlePointerEventL(), the implementation must 
williamr@2
   173
         * include a base call to @c CCoeControl's @c HandlePointerEventL().
williamr@2
   174
         *
williamr@2
   175
         * @param &aPointerEvent The pointer event.
williamr@2
   176
         */
williamr@2
   177
        IMPORT_C void HandlePointerEventL(const TPointerEvent& aPointerEvent);
williamr@2
   178
williamr@2
   179
    protected:
williamr@2
   180
        /**
williamr@2
   181
         * From @c CEikDialog.   
williamr@2
   182
         *
williamr@2
   183
         * This function is called by the @c EIKON dialog framework just
williamr@2
   184
         * before the dialog is activated, but before it is sized,
williamr@2
   185
         * and before @c PostLayoutDynInitL() is called.
williamr@2
   186
         */
williamr@2
   187
        IMPORT_C void PreLayoutDynInitL(void);
williamr@2
   188
williamr@2
   189
        /**
williamr@2
   190
         * From @c CEikDialog.   
williamr@2
   191
         *
williamr@2
   192
         * This function is called by the @c EIKON dialog framework 
williamr@2
   193
         * just before the dialog is activated, after it has called
williamr@2
   194
         * @c PreLayoutDynInitL() and the dialog has been sized.
williamr@2
   195
         */
williamr@2
   196
        IMPORT_C void PostLayoutDynInitL();
williamr@2
   197
williamr@2
   198
        /**
williamr@2
   199
         * From @c CEikDialog.   
williamr@2
   200
         *
williamr@2
   201
         * This function is called by the @c EIKON framework if the user 
williamr@2
   202
         * activates a button in the button panel. It is not called if 
williamr@2
   203
         * the @c Cancel button is activated, unless the 
williamr@2
   204
         * @c EEikDialogFlagNotifyEsc flag is set.
williamr@2
   205
         *
williamr@2
   206
         * @param aButtonId The ID of the button that was activated
williamr@2
   207
         * @return @c ETrue if the dialog should exit, 
williamr@2
   208
         *         and @c EFalse if it should not.
williamr@2
   209
         */
williamr@2
   210
        IMPORT_C TBool OkToExitL(TInt aButtonId);
williamr@2
   211
williamr@2
   212
        /**
williamr@2
   213
         * Gets border style of the list query.
williamr@2
   214
         *
williamr@2
   215
         * @return Border style (@c AknBorderId type)
williamr@2
   216
         */
williamr@2
   217
        IMPORT_C TInt BorderStyle();
williamr@2
   218
williamr@2
   219
    protected:
williamr@2
   220
        /**
williamr@2
   221
         * From @c MAknIntermediateState.
williamr@2
   222
         * 
williamr@2
   223
         * Tries to close the query with non-leaving way.
williamr@2
   224
         */
williamr@2
   225
        IMPORT_C void CloseState();
williamr@2
   226
williamr@2
   227
    private:
williamr@2
   228
        /**
williamr@2
   229
         * Closes the dialog.
williamr@2
   230
         *
williamr@2
   231
         * Gets called by iIdle.
williamr@2
   232
         *
williamr@2
   233
         * @param aObj Target dialog to be closed.
williamr@2
   234
         * @return @c EFalse always. 
williamr@2
   235
         */
williamr@2
   236
        static TInt ClosePopup(TAny *aObj);
williamr@2
   237
williamr@2
   238
        /**
williamr@2
   239
         * Closes the dialog and accepts selected item.
williamr@2
   240
         *
williamr@2
   241
         * Gets called by iIdle.
williamr@2
   242
         *
williamr@2
   243
         * @param aObj Target dialog to be closed. 
williamr@2
   244
         * @return @c EFalse always.
williamr@2
   245
         */
williamr@2
   246
        static TInt ClosePopupAcceptingChanges(TAny *aObj);
williamr@2
   247
williamr@2
   248
    private:
williamr@2
   249
        /**
williamr@2
   250
        * From @c CAknControl
williamr@2
   251
        */
williamr@2
   252
        IMPORT_C void* ExtensionInterface( TUid aInterface );
williamr@2
   253
	private: 
williamr@2
   254
		IMPORT_C virtual void CEikDialog_Reserved_1();
williamr@2
   255
		IMPORT_C virtual void CEikDialog_Reserved_2();	
williamr@2
   256
	private: 
williamr@2
   257
		IMPORT_C virtual void CAknDialog_Reserved();
williamr@2
   258
	private:
williamr@2
   259
		IMPORT_C virtual void CAknQueryDialog_Reserved();
williamr@2
   260
    private:
williamr@2
   261
        // Will hold the index of the selected item
williamr@2
   262
        TInt *iIndex;
williamr@2
   263
        // Will hold the selected items' indexes
williamr@2
   264
        CListBoxView::CSelectionIndexArray *iSelectionIndexArray;
williamr@2
   265
        // Was the enter key pressed
williamr@2
   266
	    TBool iEnterKeyPressed;
williamr@2
   267
        // Idle object to close the query if it there's no items to show
williamr@2
   268
	    CIdle *iIdle;
williamr@2
   269
        // Layout for List query control
williamr@2
   270
	    TAknPopupWindowLayoutDef iLayout;
williamr@2
   271
williamr@2
   272
        CAknListQueryMediatorObserver* iMediatorObs;
williamr@2
   273
williamr@2
   274
        TInt iDragActioned;
williamr@2
   275
williamr@2
   276
    protected:
williamr@2
   277
        /**
williamr@2
   278
         * Gets search field if it has been set.
williamr@2
   279
         *
williamr@2
   280
         * @return Pointer to search field. If no search field is used 
williamr@2
   281
         *         returns @c NULL.
williamr@2
   282
         */
williamr@2
   283
        IMPORT_C CAknSearchField* FindBox() const;
williamr@2
   284
        
williamr@2
   285
    public:
williamr@2
   286
        /** 
williamr@2
   287
         * Sets the tone for the dialog.
williamr@2
   288
         *
williamr@2
   289
         * @param aTone Tone to be used by the dialog.
williamr@2
   290
         */
williamr@2
   291
	    IMPORT_C void SetTone(TInt aTone);
williamr@2
   292
	    
williamr@2
   293
	    IMPORT_C void HandleResourceChange(TInt aType);
williamr@2
   294
	    
williamr@2
   295
	    
williamr@2
   296
    	/**
williamr@2
   297
    	* @since 3.1
williamr@2
   298
	    * Override to CEikDialog default functionality
williamr@2
   299
	    * Instantiates mediator support and send a command with given parameters when a 
williamr@2
   300
	    * dialog is brought to display
williamr@2
   301
	    * @param aDialogIndex Unique index to identify a dialog within the category
williamr@2
   302
	    *                     0 has special meaning, it causes implementation to omit all communication
williamr@2
   303
	    *                     with secondary display. (use with sleeping dialogs only)
williamr@2
   304
	    * @param aCatUid  gategory uid, if default paramter is passed, application uid is used
williamr@2
   305
	    *                 as a category
williamr@2
   306
	    * @return void 
williamr@2
   307
	    */
williamr@2
   308
	    IMPORT_C void PublishDialogL(TInt aDialogIndex, TUid aCatUid = KNullUid,  CArrayFixFlat<TInt>* aItemIds = 0);
williamr@2
   309
 
williamr@2
   310
	
williamr@2
   311
       /* @since 3.1
williamr@2
   312
	    * Instantiates mediator support and passes possible feedback to given intance.
williamr@2
   313
	    * If no observer is set, dialog tries to handle feedback by it self.
williamr@2
   314
	    *
williamr@2
   315
	    * Please note that no commands will be instantiated unless command identifiers are 
williamr@2
   316
	    * are set using PublishDialogL
williamr@2
   317
	    *
williamr@2
   318
	    * @param  aObserver pointer to instance implementing MAknDialogMediatorObserver API
williamr@2
   319
	    *         Can be NULL
williamr@2
   320
	    * @return void 
williamr@2
   321
	    */
williamr@2
   322
	    IMPORT_C void SetMediatorObserver(MAknDialogMediatorObserver* aObserver);	    
williamr@2
   323
	};
williamr@2
   324
williamr@2
   325
#endif //  AKNLISTQUERYDIALOG_H
williamr@2
   326
williamr@2
   327
williamr@2
   328
// End of File