epoc32/include/mw/akndialog.h
author William Roberts <williamr@symbian.org>
Tue, 16 Mar 2010 16:12:26 +0000
branchSymbian2
changeset 2 2fe1408b6811
parent 1 666f914201fb
child 4 837f303aceeb
permissions -rw-r--r--
Final list of Symbian^2 public API header files
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@2
     5
* 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
     6
* which accompanies this distribution, and is available
williamr@2
     7
* at the URL "http://www.symbianfoundation.org/legal/licencesv10.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
*
williamr@2
    16
*/
williamr@2
    17
williamr@2
    18
williamr@2
    19
#ifndef __AKNDIALOG_H__
williamr@2
    20
#define __AKNDIALOG_H__
williamr@2
    21
williamr@2
    22
williamr@2
    23
#include <eikdialg.h>
williamr@2
    24
#include <eikmobs.h>
williamr@2
    25
williamr@2
    26
williamr@2
    27
class CAknDialogAttributes;
williamr@2
    28
williamr@2
    29
/**
williamr@2
    30
 * Base class for different types of @c AknDialogs
williamr@2
    31
 *
williamr@2
    32
 * Instances of the @c CAikDialog class may be created, and it is possible to
williamr@2
    33
 * add controls directly to them. However it is more normal to create a 
williamr@2
    34
 * subclass, and to handle the controls appearing on the dialog dynamically.
williamr@2
    35
 */
williamr@2
    36
class CAknDialog : public CEikDialog, public MEikMenuObserver
williamr@2
    37
    {
williamr@2
    38
    public :
williamr@2
    39
williamr@2
    40
        /** 
williamr@2
    41
         * C++ default constructor. 
williamr@2
    42
         */ 
williamr@2
    43
        IMPORT_C CAknDialog() ;
williamr@2
    44
williamr@2
    45
        /** 
williamr@2
    46
         * Handles Symbian 2nd phase construction.
williamr@2
    47
         *
williamr@2
    48
         * A menu resource MUST be specified - this function will Panic 
williamr@2
    49
         * otherwise. If a menu is not required use @c CEikDialog!
williamr@2
    50
         * 
williamr@2
    51
         * @param aMenuTitleResourceId Title of the menu.
williamr@2
    52
         */
williamr@2
    53
        IMPORT_C void ConstructL( TInt aMenuTitleResourceId ) ;
williamr@2
    54
		
williamr@2
    55
        /**
williamr@2
    56
         * Destructor. 
williamr@2
    57
         */ 
williamr@2
    58
        IMPORT_C ~CAknDialog() ;
williamr@2
    59
williamr@2
    60
        /**
williamr@2
    61
         * From @c CEikDialog.
williamr@2
    62
         *
williamr@2
    63
         * Loads, displays, and destroys the dialog.
williamr@2
    64
         * 
williamr@2
    65
         * This function loads the specified dialog from a resource and 
williamr@2
    66
         * displays it. The method then destroys the dialog when it exits,
williamr@2
    67
         * therefore there is no need for the application program to 
williamr@2
    68
         * destroy the dialog.
williamr@2
    69
         *
williamr@2
    70
         * @param aResourceId The resource ID of the dialog to load.
williamr@2
    71
         * @return Zero, unless it is a waiting dialog. For a waiting dialog,
williamr@2
    72
         *         the return value is the ID of the button that closed the
williamr@2
    73
         *         dialog, or zero if it was the cancel button 
williamr@2
    74
         *         (@c EEikBidCancel).
williamr@2
    75
         */
williamr@2
    76
		IMPORT_C TInt ExecuteLD( TInt aResourceId ) ;
williamr@2
    77
williamr@2
    78
        /**
williamr@2
    79
         * From @c CEikDialog.
williamr@2
    80
         *
williamr@2
    81
         * Prepares the dialog, by constructing it from the specified resource.
williamr@2
    82
         *
williamr@2
    83
         * @param aResourceId The resource ID of the dialog.
williamr@2
    84
         */
williamr@2
    85
        IMPORT_C  void PrepareLC(TInt aResourceId);
williamr@2
    86
williamr@2
    87
        /**
williamr@2
    88
         * From @c CEikDialog.
williamr@2
    89
         *
williamr@2
    90
         * Runs the dialog and returns the ID of the button used to dismiss it.
williamr@2
    91
         *
williamr@2
    92
         * The dialog is destroyed on exit.
williamr@2
    93
         * 
williamr@2
    94
         * This function is called by the dialog framework (@c ExecuteLD()) to
williamr@2
    95
         * perform dynamic construction (layout) and to display/destroy the 
williamr@2
    96
         * dialog. Static construction of the dialog must already be complete 
williamr@2
    97
         * before this function is called, e.g. using @c PrepareLC().
williamr@2
    98
         *
williamr@2
    99
         * The function returns immediately unless @c EEikDialogFlagWait has 
williamr@2
   100
         * been specified in the @c DIALOG resource. If @c EEikDialogFlagWait 
williamr@2
   101
         * is specified, it returns when the dialog exits.
williamr@2
   102
         *
williamr@2
   103
         * @return The ID of the button used to dismiss the dialog.
williamr@2
   104
         */
williamr@2
   105
        IMPORT_C TInt RunLD();
williamr@2
   106
williamr@2
   107
		// From MEikMenuObserver
williamr@2
   108
        /**
williamr@2
   109
         * From @c MEikMenuObserver.
williamr@2
   110
         *
williamr@2
   111
         * Called by the Uikon framework to handle the emphasising or 
williamr@2
   112
         * de-emphasising of a menu window.
williamr@2
   113
         *
williamr@2
   114
         * @c CEikMenuBar objects call this on their observer to emphasise
williamr@2
   115
         * themselves when they are displayed, and de-emphasise themselves when
williamr@2
   116
         * they stop displaying.
williamr@2
   117
         *
williamr@2
   118
         * @param aMenuControl The menu control. 
williamr@2
   119
         * @param aEmphasis @c ETrue to emphasize the menu, 
williamr@2
   120
         *        @c EFalse otherwise. 
williamr@2
   121
         */ 
williamr@2
   122
        IMPORT_C virtual void SetEmphasis( CCoeControl* aMenuControl,
williamr@2
   123
                                           TBool aEmphasis ) ;
williamr@2
   124
        /**
williamr@2
   125
         * Not implemented.
williamr@2
   126
         *
williamr@2
   127
         * @param aResourceId Not used.
williamr@2
   128
         * @param aMenuPane Not used.
williamr@2
   129
         */ 
williamr@2
   130
        IMPORT_C virtual void DynInitMenuPaneL( TInt aResourceId, 
williamr@2
   131
                                                CEikMenuPane* aMenuPane ) ;
williamr@2
   132
williamr@2
   133
        /**
williamr@2
   134
         * From @c MEikMenuObserver.
williamr@2
   135
         *
williamr@2
   136
         * Hides the menu.
williamr@2
   137
         *
williamr@2
   138
         * @param aCommandId Not used.
williamr@2
   139
         */ 
williamr@2
   140
		IMPORT_C virtual void ProcessCommandL( TInt aCommandId ) ;
williamr@2
   141
williamr@2
   142
		// From CCoeControl
williamr@2
   143
williamr@2
   144
        /** 
williamr@2
   145
         * From @c CCoeControl.
williamr@2
   146
         *
williamr@2
   147
         * Handles key events.
williamr@2
   148
         *
williamr@2
   149
         * If a control wishes to process key events, it should implement this
williamr@2
   150
         * function. The implementation must ensure that the function returns
williamr@2
   151
         * @c EKeyWasNotConsumed if it does not do anything in response to a
williamr@2
   152
         * key event, otherwise, other controls or dialogs may be prevented 
williamr@2
   153
         * from receiving the key event. If it is able to process the event
williamr@2
   154
         * it should return @c EKeyWasConsumed.
williamr@2
   155
         *
williamr@2
   156
         * When a key event occurs, the control framework calls this function 
williamr@2
   157
         * for each control on the control stack, until one of them can process 
williamr@2
   158
         * the key event (and returns @c EKeyWasConsumed).
williamr@2
   159
         *
williamr@2
   160
         * Each keyboard key press results in three separate events: 
williamr@2
   161
         * @c EEventKeyDown, @c EEventKey, and @c EEventKeyUp, in that order.
williamr@2
   162
         *
williamr@2
   163
         * To receive key events, which can be processed by this function, 
williamr@2
   164
         * the application should call @c CCoeAppUi::AddToStackL() to add the 
williamr@2
   165
         * control to the stack. This only applies, however, to controls which 
williamr@2
   166
         * are not components of a compound control. Compound controls should 
williamr@2
   167
         * pass key events to their components as necessary: the components 
williamr@2
   168
         * themselves do not go on the stack.
williamr@2
   169
         *
williamr@2
   170
         * @param aKeyEvent The key event. 
williamr@2
   171
         * @param aType The type of key event: @c EEventKey, @c EEventKeyUp or 
williamr@2
   172
         *        @c EEventKeyDown. 
williamr@2
   173
         * @return Indicates whether or not the key event was used by 
williamr@2
   174
         *         this control. 
williamr@2
   175
         */ 
williamr@2
   176
		IMPORT_C TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent,
williamr@2
   177
                                             TEventCode aType) ;
williamr@2
   178
williamr@2
   179
        /** 
williamr@2
   180
         * From @c CCoeControl.
williamr@2
   181
         *
williamr@2
   182
         * Responds to a change in focus.
williamr@2
   183
         *
williamr@2
   184
         * This is called whenever the control gains or loses focus, as a 
williamr@2
   185
         * result of a call to @c SetFocus(). A typical use of 
williamr@2
   186
         * @c FocusChanged() is to change the appearance of the control, 
williamr@2
   187
         * for example by drawing a focus rectangle around it.
williamr@2
   188
         *
williamr@2
   189
         * @param aDrawNow Contains the value that was passed to it by 
williamr@2
   190
         *        @c SetFocus(). 
williamr@2
   191
         */ 
williamr@2
   192
        IMPORT_C void FocusChanged(TDrawNow aDrawNow); 
williamr@2
   193
williamr@2
   194
        /** 
williamr@2
   195
         * From @c CCoeControl.
williamr@2
   196
         *
williamr@2
   197
         * Handles pointer events.
williamr@2
   198
         *
williamr@2
   199
         * This function gets called whenever a pointer event occurs in the
williamr@2
   200
         * control, i.e. when the pointer is within the control's extent, 
williamr@2
   201
         * or when the control has grabbed the pointer. The control should 
williamr@2
   202
         * implement this function to handle pointer events.
williamr@2
   203
         *
williamr@2
   204
         * Note: events of type @c EButton1Down are processed before 
williamr@2
   205
         * @c HandlePointerEventL() is called, in order to transfer keyboard
williamr@2
   206
         * focus to the control in which the @c EButton1Down event occurred.
williamr@2
   207
         *
williamr@2
   208
         * @param aPointerEvent The pointer event
williamr@2
   209
         */ 
williamr@2
   210
        IMPORT_C void HandlePointerEventL(const TPointerEvent& aPointerEvent);
williamr@2
   211
williamr@2
   212
	private: // formerly from MTopSetMember<CEikMenuBar>, now reserved
williamr@2
   213
		
williamr@2
   214
        IMPORT_C virtual void Reserved_MtsmPosition();
williamr@2
   215
williamr@2
   216
        IMPORT_C virtual void Reserved_MtsmObject();
williamr@2
   217
williamr@2
   218
    private:
williamr@2
   219
    
williamr@2
   220
        /**
williamr@2
   221
        * From CAknControl
williamr@2
   222
        */
williamr@2
   223
        IMPORT_C void* ExtensionInterface( TUid aInterface );
williamr@2
   224
williamr@2
   225
    protected:
williamr@2
   226
williamr@2
   227
        /**
williamr@2
   228
         * From @c CEikDialog.
williamr@2
   229
         *
williamr@2
   230
         * Handles a dialog button press for the specified button. 
williamr@2
   231
         *
williamr@2
   232
         * This function is invoked when the user presses a button in the
williamr@2
   233
         * button panel. It is not called if the Cancel button is activated 
williamr@2
   234
         * unless the @c EEikDialogFlagNotifyEsc flag has been set.
williamr@2
   235
         *
williamr@2
   236
         * If there is an Options key then pops up menu, otherwise exits.
williamr@2
   237
         *
williamr@2
   238
         * The function should be overridden by the derived class, and is 
williamr@2
   239
         * usually used to validate the values of the dialog's controls. 
williamr@2
   240
         * The function should return @c ETrue if it is OK to exit, and 
williamr@2
   241
         * @c EFalse to keep the dialog active. It should always return
williamr@2
   242
         * @c ETrue if the button with ID @c EEikBidOK was activated.
williamr@2
   243
         *
williamr@2
   244
         * @param aButtonId The ID of the button that was activated.
williamr@2
   245
         * @return @c ETrue to validate and exit the dialog, 
williamr@2
   246
         *         @c EFalse to keep the dialog active. If @c ETrue, the 
williamr@2
   247
         *         dialog will be destroyed automatically by @c ExecuteLD(). 
williamr@2
   248
         *         The default implementation returns @c ETrue no matter which
williamr@2
   249
         *         button is pressed.
williamr@2
   250
         */
williamr@2
   251
		IMPORT_C virtual TBool OkToExitL( TInt aButtonId ) ;
williamr@2
   252
williamr@2
   253
        /**
williamr@2
   254
         * From @c CEikDialog.
williamr@2
   255
         *
williamr@2
   256
         * Displays menu bar.
williamr@2
   257
         */
williamr@2
   258
		IMPORT_C void DisplayMenuL() ;
williamr@2
   259
williamr@2
   260
        /**
williamr@2
   261
         * From @c CEikDialog.
williamr@2
   262
         *
williamr@2
   263
         * Hides menu bar.
williamr@2
   264
         */
williamr@2
   265
        IMPORT_C void HideMenu() ;
williamr@2
   266
		
williamr@2
   267
        /**
williamr@2
   268
         * From @c CEikDialog.
williamr@2
   269
         *
williamr@2
   270
         * Checks if menu is displayed.
williamr@2
   271
         * 
williamr@2
   272
         * @return @c ETrue if menu is displayed,
williamr@2
   273
         *         @c EFalse otherwise.
williamr@2
   274
         */
williamr@2
   275
        IMPORT_C TBool MenuShowing() const ;
williamr@2
   276
		
williamr@2
   277
        /**
williamr@2
   278
         * From @c CEikDialog.
williamr@2
   279
         *
williamr@2
   280
         * Lays out the dialog's components when the size of the dialog 
williamr@2
   281
         * is changed.
williamr@2
   282
         */
williamr@2
   283
		IMPORT_C virtual void SizeChanged();
williamr@2
   284
	
williamr@2
   285
        /**
williamr@2
   286
         * From @c CEikDialog.
williamr@2
   287
         *
williamr@2
   288
         * Draws the control.
williamr@2
   289
         * 
williamr@2
   290
         * @param aRect Area to be drawn.
williamr@2
   291
         */
williamr@2
   292
        IMPORT_C virtual void Draw(const TRect &aRect) const;
williamr@2
   293
williamr@2
   294
	protected: // from MObjectProvider
williamr@2
   295
		
williamr@2
   296
        /** 
williamr@2
   297
         * From @c MObjectProvider. 
williamr@2
   298
         *
williamr@2
   299
         * Gets Mop supply object of the given type.  
williamr@2
   300
         *
williamr@2
   301
         * @param aId Identifier for the supply object.
williamr@2
   302
         * @return Pointer to the supply object type ID.
williamr@2
   303
         */
williamr@2
   304
        IMPORT_C TTypeUid::Ptr MopSupplyObject(TTypeUid aId);
williamr@2
   305
williamr@2
   306
    private: 
williamr@2
   307
williamr@2
   308
		IMPORT_C virtual void CEikDialog_Reserved_1();
williamr@2
   309
		
williamr@2
   310
        IMPORT_C virtual void CEikDialog_Reserved_2();	
williamr@2
   311
williamr@2
   312
    private: // new function 
williamr@2
   313
williamr@2
   314
		IMPORT_C virtual void CAknDialog_Reserved();
williamr@2
   315
	
williamr@2
   316
    protected: // new function 
williamr@2
   317
williamr@2
   318
        /** 
williamr@2
   319
         * Creates or replaces dialog's menu bar.
williamr@2
   320
         *
williamr@2
   321
         * @param aMenuTitleResourceId Title of the menu bar. 
williamr@2
   322
         */ 
williamr@2
   323
        void CreateMenuBarL(TInt aMenuTitleResourceId);
williamr@2
   324
williamr@2
   325
    protected:
williamr@2
   326
		        
williamr@2
   327
        /**
williamr@2
   328
         * Dialog's menu bar. 
williamr@2
   329
         * Not owned.
williamr@2
   330
         */
williamr@2
   331
		CEikMenuBar* iMenuBar;
williamr@2
   332
williamr@2
   333
private:
williamr@2
   334
williamr@2
   335
	enum TAknDialogFlag
williamr@2
   336
	    {
williamr@2
   337
	    EAknDialogFlagDialogDeleted = 1,
williamr@2
   338
        EAknDialogFlagDefaultSounds = 2,
williamr@2
   339
		EAknDialogFlagNotConstructed = 4
williamr@2
   340
	    };
williamr@2
   341
williamr@2
   342
    CAknDialogAttributes* iAttributes;  // Was TInt iSpare;
williamr@2
   343
williamr@2
   344
	CAknDialogAttributes* AttributesL();
williamr@2
   345
williamr@2
   346
	} ;
williamr@2
   347
williamr@2
   348
#endif // __AKNDIALOG_H__
williamr@2
   349
williamr@2
   350
 
williamr@2
   351
// End of file