epoc32/include/mw/aknappui.h
author William Roberts <williamr@symbian.org>
Wed, 31 Mar 2010 12:27:01 +0100
branchSymbian2
changeset 3 e1b950c65cb4
parent 1 666f914201fb
child 4 837f303aceeb
permissions -rw-r--r--
Attempt to represent the S^2->S^3 header reorganisation as a series of "hg rename" operations
     1 /*
     2 * Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies).
     3 * All rights reserved.
     4 * This component and the accompanying materials are made available
     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
     6 * which accompanies this distribution, and is available
     7 * at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
     8 *
     9 * Initial Contributors:
    10 * Nokia Corporation - initial contribution.
    11 *
    12 * Contributors:
    13 *
    14 * Description: 
    15 *
    16 */
    17 
    18 #ifndef __AKNAPPUI_H__
    19 #define __AKNAPPUI_H__
    20 
    21 //  INCLUDES
    22 #include <eikappui.h>
    23 #include <Eikspane.h>
    24 #include <eikcba.h>
    25 #include <avkon.hrh>
    26 #include <akndef.h>
    27 #include <AknTouchPaneObserver.h>
    28 
    29 // FORWARD DECLARATIONS
    30 class CEikButtonGroupContainer;
    31 class CAknAppShutter;
    32 class CAknAppUiExtension;
    33 class CAknWsEventMonitor;
    34 class CAknKeySoundSystem;
    35 class CAknAppUiBaseExtension;
    36 class CAknTouchPane;
    37 class CAknToolbar;
    38 class CAknPointerEventModifier;
    39 
    40 // MACROS
    41 #define iAvkonAppUi ((CAknAppUi*)CEikonEnv::Static()->EikAppUi())
    42 #define iAvkonAppUiBase ((CAknAppUiBase*)CEikonEnv::Static()->EikAppUi())
    43 
    44 /**
    45 *  Avkon key resolver interface
    46 *
    47 *  @since S60 3.1
    48 */
    49 class MAknAliasKeyCodeResolver
    50     {
    51 public:
    52     /**
    53     * Resolves keyboard layout dependent keycode for the given event 
    54     *
    55     * @since S60 3.1
    56     * @param aCode reference to variable to contain new keycode 
    57     * @param aKeyEvent reference to original, complete, event
    58     * @param aType indicating original event type
    59     * @return KErrNone on success, otherwise system wide error codes
    60     */
    61     virtual TInt GetAliasKeyCode(TUint& aCode, const TKeyEvent& aKeyEvent,TEventCode aType)=0;        
    62     };
    63 
    64 // CLASS DECLARATION
    65 
    66 /**
    67 *  Abstract Avkon application UI base class
    68 *
    69 *  @since S60 3.0
    70 */
    71 class CAknAppUiBase : public CEikAppUi
    72     {
    73 private:
    74     friend class CAknAppUi;
    75     enum
    76         {
    77         EAppOrientationSpecifiedFlag            = 0x00010000, // In area reserved for System Guis
    78         EAppOrientationLandscapeFlag            = 0x00020000,
    79         EAppOrientationAutomaticFlag            = 0x00040000,
    80         EAknEnableSkinFlag                      = 0x00080000,
    81         // Since 3.0
    82         EAknDisableHighlightAnimationFlag       = 0x00100000,
    83         EAknEnableMSKflag                       = 0x00200000,
    84         /**
    85          * When enabled, avkon does not complete startup effect
    86          * application has to do it by itself.
    87          *
    88          * @since S60 3.2
    89          *
    90          */
    91         EAknExplicitStartupEffectCompletionFlag     = 0x00400000,
    92 
    93         /**
    94          * Application supports touch (doesn't need keyboard). If the flag
    95          * is missing and compatibility mode is enabled in a device,
    96          * application is run in a compatibility mode (QVGA window with a
    97          * virtual keypad.
    98          *
    99          * @since S60 5.0
   100          */
   101         EAknTouchCompatibleFlag                 = 0x00800000
   102         };
   103 
   104     public:
   105 
   106     enum TAppUiOrientation
   107         {
   108         /**
   109         * Use the default device screen rotation of the product for this 
   110         * application. This is the default rotation setting for an 
   111         * application, and it should be used by nearly all applications. 
   112         */
   113         EAppUiOrientationUnspecified,
   114         /**
   115         * Use a portrait screen rotation for this application.
   116         * This should only be used when an application specifically wants
   117         * portrait rotation. The device will select an appropriate portrait
   118         * rotation, if one is available.
   119         */
   120         EAppUiOrientationPortrait,
   121         /**
   122         * Use a landscape screen rotation for this application.
   123         * This should only be used when an application specifically wants
   124         * landscape rotation. The device will select an appropriate landscape
   125         * rotation, if one is available.
   126         */
   127         EAppUiOrientationLandscape,
   128         /**
   129         * Use the normal device screen rotation for this application.
   130         * Both portrait and landscape screen rotations are possible. The 
   131         * application rotation follows device screen rotation.
   132         */
   133         EAppUiOrientationAutomatic
   134         };
   135     enum
   136         {
   137         /**
   138         * Flag indicating that default skin parameters should be provided by
   139         * UI controls created within the scope of this AppUi instance.
   140         * This value (or binary combination with some other values) should
   141         * be given as a parameter to <code>BaseConstructL</code> in case
   142         * the application wants to enable default skin parameters for all
   143         * the Avkon controls supporting them.
   144         *
   145         * Note: The value can be queried by using 
   146         * <code>AknsUtils::AvkonSkinEnabled()</code> from AknSkins.lib.
   147         *
   148         * @since S60 2.0
   149         */
   150         EAknEnableSkin = EAknEnableSkinFlag,
   151         EAppOrientationPortrait     = EAppOrientationSpecifiedFlag,
   152         EAppOrientationLandscape    = EAppOrientationSpecifiedFlag 
   153                                       | EAppOrientationLandscapeFlag,
   154         EAppOrientationAutomatic    = EAppOrientationSpecifiedFlag
   155                                       | EAppOrientationAutomaticFlag,
   156         // Since 3.0
   157         EAknDisableHighlightAnimation = EAknDisableHighlightAnimationFlag,
   158         // Since 3.1
   159         EAknEnableMSK = EAknEnableMSKflag,
   160         // Since 3.2
   161         EAknExplicitStartupEffectCompletion = EAknExplicitStartupEffectCompletionFlag,
   162         // Since 5.0
   163         EAknTouchCompatible = EAknTouchCompatibleFlag
   164         };
   165     enum TKeyEventFlag
   166         {
   167         EDisableSendKeyShort = 0x01, // Short press of send key
   168         EDisableSendKeyLong  = 0x02  // Long press of send key
   169         };    
   170 
   171 public:
   172     /**
   173     * Destructor.
   174     */    
   175     IMPORT_C ~CAknAppUiBase();
   176     
   177     /**
   178     * C++ Default constructor.
   179     */
   180     IMPORT_C CAknAppUiBase();
   181 public: 
   182     
   183     /**
   184     * Initialises this Avkon base app UI with standard values. 
   185     * @c aAppUiFlags values are common with 
   186     * @c CEikAppUi::BaseConstructL(aAppUiFlags).
   187     * @param aAppUiFlags Application user interface flags.
   188     */
   189     IMPORT_C void BaseConstructL( TInt aAppUiFlags );
   190     
   191     /**
   192     * Handles changes in keyboard focus when an application switches to,
   193     * or from, the foreground. This function calls 
   194     * @c CEikAppUi::HandleForegroundEventL.
   195     * @param aForeground @c ETrue if the application is in the foreground, 
   196     * otherwise @c EFalse.
   197     */ 
   198     IMPORT_C void HandleForegroundEventL(TBool aForeground);
   199 
   200 public: // From CEikAppUi
   201     
   202     /**
   203     * From @c CEikAppUi. Completes construction. The implementation of 
   204     * @c ConstructL() in @c CAknAppUiBase simply calls @c BaseConstructL().
   205     */
   206     IMPORT_C void ConstructL();  // virtual
   207     
   208     /** 
   209     * From @c CEikAppUi. Closes the app UI.
   210     */
   211     IMPORT_C void Exit(); //virtual
   212     
   213     /**
   214     * From @c CEikAppUi. Sets whether the windows are faded.
   215     * @param aFaded @c ETrue if windows are faded, otherwise windows are 
   216     * unfaded.
   217     */
   218     IMPORT_C void SetFadedL(TBool aFaded); // virtual
   219     
   220     /**
   221     * From @c CEikAppUi. Handles a change to the application's resources which
   222     * are shared across the environment. This function calls 
   223     * @c CEikAppUi::HandleResourceChangeL except when @c aType is 
   224     * @c KEikDynamicLayoutVariantSwitch.
   225     * @param aType The type of resources that have changed. 
   226     */
   227     IMPORT_C void HandleResourceChangeL(TInt aType); // virtual
   228     
   229     /**
   230     * From @c CEikAppUi. Gets the total area of the screen available to the
   231     * application. This includes the space that is available for a toolbar, 
   232     * toolband or title band, if the application requires them.
   233     * @return The total area of the screen available to the application.
   234     */
   235     IMPORT_C TRect ApplicationRect() const; //virtual
   236 
   237 public: // from CCoeAppUiBase
   238     
   239     /** 
   240     * From @c CCoeAppUiBase. Performs pre-exit processing by calling 
   241     * @c CEikAppUi::PrepareToExit() to ensure the application will exit
   242     * cleanly.
   243     */
   244     IMPORT_C void PrepareToExit();
   245 public: // New Functions
   246     /**
   247     * Determines whether the system is faded.
   248     * @return @c ETrue if system is faded 
   249     */
   250     IMPORT_C TBool IsFaded() const;
   251 
   252     /**
   253     * Returns the object which allows events to be spyed upon in addition to
   254     * normal event handling.
   255     * @return Pointer to window server event monitor object.
   256     */
   257     IMPORT_C CAknWsEventMonitor* EventMonitor() const;
   258     
   259     /**
   260     * Gets a pointer to KeySound API object.
   261     * @return Pointer to KeySound API object. 
   262     */
   263     IMPORT_C CAknKeySoundSystem* KeySounds() const;
   264 
   265     /**
   266     * Determines whether the application is full screen application.
   267     * @return @c ETrue if the application is full screen application.
   268     */
   269     IMPORT_C TBool IsFullScreenApp() const;
   270     
   271     /**
   272     * Determines whether the application is layout aware.
   273     * @return @c ETrue if the application is layout aware.
   274     */
   275     IMPORT_C TBool IsLayoutAwareApp() const;
   276     
   277     /**
   278     * Determines whether the application has MSK enabled.
   279     * @return @c ETrue if the application has MSK enabled.
   280     *
   281     * @since 3.1 
   282     */
   283     TBool IsMSKEnabledApp() const;
   284 
   285     /**
   286     * Determines whether the application is closing.
   287     * In practice this means that CEikonEnv has been destroyed.
   288     * @return @c ETrue if the application is closing.
   289     *
   290     * @since 3.2
   291     */
   292     TBool IsAppClosing() const;
   293     
   294     /**
   295     * Set application layout aware.
   296     * @param aLayoutAwareApp @c ETrue if the application is layout aware, 
   297     * @c EFlase otherwise.
   298     */
   299     IMPORT_C void SetLayoutAwareApp(TBool aLayoutAwareApp);
   300     
   301     /**
   302     * Determines whether the application is foreground.
   303     * @return @c ETrue if the application is foreground.
   304     */
   305     IMPORT_C TBool IsForeground() const;
   306     
   307     /**
   308     * Determines whether the application is partially foreground.
   309     * @return @c ETrue if the application is partially foreground.
   310     */
   311     IMPORT_C TBool IsPartialForeground() const;
   312 
   313     /**
   314     * Gets the application screen orientation.
   315     * @return Application screen orientation.
   316     */
   317     IMPORT_C TAppUiOrientation Orientation() const;
   318     
   319     /**
   320     * Tests whether it is possible for this app to have a
   321     * practical effect on the screen orientation, through
   322     * SetOrientationL().
   323     * @since S60 3.2
   324     * @return ETrue if SetOrientationL can change the orientation, EFalse otherwise.
   325     */
   326     IMPORT_C TBool OrientationCanBeChanged() const;
   327     
   328     /**
   329     * Sets the application screen orientation.
   330     * Note: this API has no effect on non-full-screen app UIs.
   331     * @param aOrientation application screen orientation.
   332     */
   333     IMPORT_C void SetOrientationL(TAppUiOrientation aOrientation);
   334 
   335     /**
   336     * Find the window group ID of the application below this application.
   337     * @return the window group ID of the application below this application.
   338     */
   339     TInt FindAppWgIdBelowMeL();
   340     
   341     /**
   342     * Simply return @c KEikPartialForeground if @c aPartialFg == @c ETrue, 
   343     * otherwise if @c aForeground == @c ETrue then return @c EEventFocusGained
   344     * else return @c EEventFocusLost.  
   345     * @return if @c aPartialFg then return KEikPartialForeground.
   346     */
   347     TInt EventForForegroundState(TBool aPartialFg, TBool aForeground);
   348     
   349     /**
   350     * Determines whether the thread owning this application window group is
   351     * foreground.    
   352     * @return @c ETrue if the thread owning this application window group is
   353     * foreground, @c EFlase otherwise.
   354     */
   355     TBool ThreadIsForeground() const;
   356 
   357     /**
   358     * Simulates an event being received from wserv
   359     * @param aEvent the event id being simulated.
   360     */
   361     void SimulateWsEventL(TInt aEvent);
   362 
   363     /** 
   364      * Gets the application local zoom
   365      * @return Application local zoom
   366      * @since 3.1 
   367      */
   368     IMPORT_C TAknUiZoom LocalUiZoom() const;
   369 
   370     /**
   371     * Sets the application local zoom. However, in order to have any 
   372     * effect, it may be necessary to make a subsequent call to  
   373     * @c ApplyLayoutChangeL.
   374     *
   375     * @param aZoom application local zoom
   376     * @since 3.1 
   377     */
   378     IMPORT_C void SetLocalUiZoom(TAknUiZoom aZoom);
   379 
   380     /*
   381     * Can be used to apply changes to settings that affect the current layout,
   382     * such as changes to the local zoom. Optionally reports the change
   383     * to the layout to all controls in the application. There are a number of 
   384     * different possible usages of this API:
   385     * <ul>
   386     * <li> Can be used to immediately change the local zoom, by passing in 
   387     * ETrue for the reporting parameter.</li>
   388     * <li> Can be called before BaseConstructL without leaving, the effect
   389     * is the same as passing EFalse for the reporting parameter, as 
   390     * the correct layout data is picked up later on during control layout.</li>
   391     * <li>Can be used by implementors of the 
   392     * @c MAknSettingCacheUpdatePlugin interface, in order to set the local 
   393     * zoom whilst updating the settings cache. By passing in EFalse for the 
   394     * reporting parameter, the layout switch is deferred to the usual 
   395     * processing in @c UpdateSettingCacheAndForwardEventL.</li>
   396     * <li> Can be used by controls that require a different local zoom to 
   397     * the underlying application, such as a dialog. By not 
   398     * reporting the change during construction, the dialog will lay itself out 
   399     * correctly. However, the dialog must then report the change back to the 
   400     * app zoom level when it closes, ignoring the resulting resource changed 
   401     * layout switch event.</li>
   402     * </ul>
   403     *
   404     * @param aReportChange if this is true, then the layout event will be 
   405     *               reported to controls on the control stack
   406     * @since 3.1 
   407     */    
   408     IMPORT_C void ApplyLayoutChangeL(TBool aReportChange);
   409     
   410     /**
   411     * Checks if application UI has full or partial foreground status.
   412     * @since 3.2
   413     * @return ETrue if application UI has full or partial foreground status.
   414     *         Otherwise EFalse.
   415     */
   416     TBool HasFullOrPartialForeground() const;    
   417 
   418     /**
   419     * Sets the flags for default key event handling
   420     * @since 5.0
   421     * @param aFlags which can be a combination of flags 
   422     *        declared in enumeration TKeyEventFlag 
   423     */
   424     IMPORT_C void SetKeyEventFlags( const TInt aFlags );
   425     
   426     /**
   427     * Returns a pointer to appui's pointer event modifier. This method is
   428     * intended for internal usage only.
   429     *
   430     * @since S60 v5.0
   431     * @return pointer event modifier
   432     */
   433     IMPORT_C CAknPointerEventModifier* PointerEventModifier();
   434     
   435     /**
   436     * Checks if the application is touch compatible i.e. it has been
   437     * constructed with the flag EAknTouchCompatible.
   438     *
   439     * @since S60 v5.0
   440     * @return ETrue if the application is touch compatible
   441     */
   442     IMPORT_C TBool IsTouchCompatible() const;
   443     
   444 protected: // From CCoeAppUiBase
   445     /**
   446     * From @c CCoeAppUiBase.   
   447     * Calls CCoeAppUi::HandleScreenDeviceChangedL().
   448     */
   449     IMPORT_C virtual void HandleScreenDeviceChangedL(); // was Reserved_1()
   450 
   451 protected: // From CCoeAppUi
   452      
   453     /**
   454     * From @c CCoeAppUi. Handles an application specific event.
   455     * @param aType The type of the event that occurred. This should be a 
   456     * unique identifier constant.
   457     * @param aEvent The window server event that occurred. 
   458     */
   459     IMPORT_C virtual void HandleApplicationSpecificEventL(TInt aType,
   460         const TWsEvent& aEvent);
   461 
   462 protected: // New functions
   463     /**
   464     * Set the application to be a full screen application.
   465     * @param aIsFullScreen is @c ETrue if the application is a full screen
   466     * application, @c EFlase otherwise.
   467     */
   468     IMPORT_C void SetFullScreenApp(TBool aIsFullScreen);
   469     
   470     /**
   471     * Replace current key sound server with new one.
   472     * @param aUid ID of the new key sound server.
   473     */
   474     IMPORT_C void ReplaceKeySoundsL( TInt aUid );
   475 
   476 protected: // from MObjectProvider
   477     IMPORT_C virtual TTypeUid::Ptr MopSupplyObject(TTypeUid aId);
   478 
   479 public: // not exported
   480     void SetScreenModeL(TInt aModeNumber);
   481     TInt ScreenMode() const;
   482 
   483 private:
   484     void UpdateSettingCacheAndForwardEventL( TInt aEventId );
   485     // Method tests on aError. If < KErrNone, it calls CCoeEnv::SetAppUi in order to pass
   486     // ownership to the environment. CCoeEnv then will delete the AppUi at the usual point in the destruct order
   487     void SetAppUiAndLeaveIfErrorL( TInt aError );
   488     TBool AlwaysForwardEvent( TInt aEventId );
   489     void RelinquishPriorityToForegroundAppLC();
   490 
   491 private:
   492     // Avkon app ui class flags
   493     TBitFlags iAknFlags;
   494 
   495     // Added for Avkon. Monitor events for emergency call support
   496     CAknWsEventMonitor* iEventMonitor;
   497 
   498     // Added for Avkon. Provides access to keysound server.
   499     // Moved from CAknAppUi, because CEikSrvUi needs it as well
   500     CAknKeySoundSystem* iKeySounds; 
   501     
   502     CAknAppUiBaseExtension* iAppUiBaseExtension;
   503     };
   504 
   505 /**
   506 *  Abstract Avkon application UI class
   507 *
   508 *  @since S60 0.9
   509 */
   510 
   511 class CAknAppUi : public CAknAppUiBase, MEikStatusPaneObserver,
   512             public MCoeViewDeactivationObserver,
   513             public MAknTouchPaneObserver
   514     {
   515 public:
   516     
   517     /**
   518     * Initialises this Avkon app UI with standard values. @c aAppUiFlags
   519     * values are common with @c CEikAppUi::BaseConstructL(aAppUiFlags). 
   520     * Additionally those @c aAppUiFlags values can be bitwise ORed with
   521     * @c EAknEnableSkin flag to provide default skin parameters for this AppUi
   522     * instance.
   523     * @param aAppUiFlags Application user interface flags.
   524     */
   525     IMPORT_C void BaseConstructL(TInt aAppUiFlags=EStandardApp);
   526     
   527     /**
   528     * Destructor.
   529     */
   530     IMPORT_C ~CAknAppUi();
   531 
   532 public: // From CEikAppUi
   533      /**
   534      * From @c CEikAppUi. Completes construction. The implementation of
   535      * @c ConstructL() in @c CAknAppUi simply calls @c BaseConstructL().
   536      */
   537     IMPORT_C void ConstructL();  // virtual
   538 
   539 public:
   540     /**
   541     * Gets a pointer to the status pane.
   542     * @return Pointer to the status pane 
   543     */
   544     IMPORT_C CEikStatusPane* StatusPane();
   545     /**
   546     * Gets a pointer to the Command Button Area.
   547     * @return Pointer to the CBA 
   548     */
   549     IMPORT_C CEikButtonGroupContainer* Cba();
   550 
   551     /**
   552     * Gets a pointer to the touch pane.
   553     * @return Pointer to the the touch pane
   554     * @since S60 5.0
   555     */
   556     IMPORT_C CAknTouchPane* TouchPane();
   557 
   558     /**
   559     * Gets a pointer to the application toolbar.
   560     * @return Pointer to the applicaton toolbar or NULL
   561     * @since S60 3.1
   562     */
   563     IMPORT_C CAknToolbar* PopupToolbar() const; 
   564     
   565     /**
   566     * Gets a pointer to the current toolbar( view toolbar is priority ).
   567     * @return Pointer to the current toolbar or NULL
   568     * @since S60 3.1
   569     */
   570     IMPORT_C CAknToolbar* CurrentPopupToolbar() const;
   571     
   572     /**
   573     * Gets a pointer to the current fixed toolbar( view toolbar is priority ).
   574     * @return Pointer to the current fixed toolbar or NULL
   575     * @since S60 5.0
   576     */
   577     IMPORT_C CAknToolbar* CurrentFixedToolbar() const; 
   578 
   579     
   580     /**
   581     * Hides popup toolbar if it is visible
   582     * @since S60 3.1
   583     */
   584     void StopDisplayingPopupToolbar(); 
   585         
   586       
   587     /**
   588     * Processes user commands.
   589     * This function passes @c aCommand (except values @c EAknSoftkeyOptions,
   590     * @c EAknCmdExit, @c EEikCmdCanceled) to user derived @c HandleCommandL.
   591     * @param aCommand A command ID.
   592     */
   593     IMPORT_C void ProcessCommandL(TInt aCommand);
   594 
   595     
   596     /**
   597     * Handles errors.
   598     * @param aError The error code.
   599     * @param aExtErr For extended error messages. Not used.
   600     * @param aErrorText Error text. Not used.
   601     * @param aContextText Text describing the context of the error. Not used.
   602     * @return @c ENoDisplay if Error handled proper way, else 
   603     * @c EErrorNotHandled
   604     */
   605     IMPORT_C TErrorHandlerResponse HandleError (TInt aError,
   606         const SExtendedError& aExtErr, TDes& aErrorText, TDes& aContextText); 
   607 
   608     /**
   609     * Run the application shutter if it exists.
   610     */
   611     IMPORT_C void RunAppShutter();
   612     
   613     /**
   614     * Determines whether the application shutter is active.
   615     * @return @c ETrue if application shutter is active.
   616     */
   617     IMPORT_C TBool IsAppShutterRunning() const;
   618 
   619     /**
   620     * Determines whether the application is hidden in background.
   621     * (i.e. HideInBackground has been called and application has not
   622     *       yet been activated)
   623     * @return @c ETrue if application is hidden in background.
   624     */
   625     TBool IsAppHiddenInBackground() const;
   626     
   627 public: // MCoeViewDeactivationObserver
   628 
   629     /**
   630     * From @c MCoeViewDeactivationObserver.
   631     * Handles the deactivation of the view identified by
   632     * @c aViewIdToBeDeactivated before the newly activated view with id
   633     * @c aNewlyActivatedViewId is marked as current.
   634     * Default implementation calls @c iAvkonEnv->CloseAllIntermediateStates()
   635     * without using @c aViewIdToBeDeactivated and @c aNewlyActivatedViewId.
   636     * @param aViewIdToBeDeactivated
   637     * @param aNewlyActivatedViewId  
   638     */
   639     IMPORT_C virtual void HandleViewDeactivation(
   640         const TVwsViewId& aViewIdToBeDeactivated,
   641         const TVwsViewId &aNewlyActivatedViewId);
   642 
   643 public: // from CCoeAppUiBase
   644     
   645     /**
   646     * From @c CCoeAppUiBase. Performs pre-exit processing to ensure the
   647     * application will exit cleanly.
   648     */
   649     IMPORT_C void PrepareToExit();
   650 
   651 public: // from MAknTouchPaneObserver
   652 
   653     /**
   654     * From @MAknTouchPaneObserver.
   655     * Handles a change in the size or position of touch pane.
   656     */
   657     IMPORT_C void HandleTouchPaneSizeChange();
   658 
   659 protected:
   660     // from MEikStatusPaneObserver
   661     /**
   662     * From @c MEikStatusPaneObserver. Handles a change in the position or size
   663     * of the screen area occupied by the status pane.
   664     */  
   665     IMPORT_C void HandleStatusPaneSizeChange();
   666 
   667     // from CCoeAppUi
   668     /**
   669     * From @c CCoeAppUi. Handles system events generated by the window server.
   670     * @param aEvent The window server event that occurred.
   671     */
   672     IMPORT_C void HandleSystemEventL(const TWsEvent& aEvent);
   673 
   674 protected: // formerly from MTopSetMember<CEikMenuBar>, now reserved
   675     IMPORT_C virtual void Reserved_MtsmPosition();
   676     IMPORT_C virtual void Reserved_MtsmObject();
   677 protected:
   678     
   679     /**
   680     * Handles changes in keyboard focus when an application switches to, 
   681     * or from, the foreground.
   682     * @param aForeground @c ETrue if the application is in the foreground,
   683     * otherwise @c EFalse.
   684     */
   685     IMPORT_C void HandleForegroundEventL(TBool aForeground);
   686     
   687     /**
   688     * Handles window server events.
   689     * @param aEvent The window server event that occurred.
   690     * @param aDestination The control associated with the event.
   691     */
   692     IMPORT_C void HandleWsEventL(const TWsEvent& aEvent,
   693         CCoeControl* aDestination);
   694 
   695     /**
   696     * Set key block mode.
   697     * In default mode, the S60 Developer Platform blocks simultaneous key
   698     * presses.
   699     * @param aMode @c ENoKeyBlock if no key block, otherwise
   700     * @c EDefaultBlockMode
   701     */
   702     IMPORT_C void SetKeyBlockMode(TAknKeyBlockMode aMode);
   703     IMPORT_C void HandleErrorL(TInt aError, HBufC** aErrorDesc, TBool aShowNote = ETrue );
   704 
   705 #ifdef _DEBUG
   706     
   707     /**
   708     * Prints out information about the control and all its subcontrols to
   709     * RDebug console.
   710     * @param aControl object to be printed.
   711     * @param aLevel  positioning constant.
   712     * @param aDebug stream for printing.
   713     */
   714     void DumpControl(CCoeControl* aControl, TInt aLevel, RDebug& aDebug);
   715 #endif
   716     /**
   717     * Try to set window server buffer size to @c KAknDefaultWsBufferSize.
   718     */
   719     void DecideWsClientBufferSizesL();
   720 
   721 private:
   722     void UpdateKeyBlockMode();
   723     TBool SimulateHashKeyMarkingEvent(const TWsEvent& aEvent);
   724 
   725 private:
   726     TBool iDumpNextControl;
   727     CAknAppShutter* iAppShutter;// May be set to NULL by the app shutter itself
   728     TAknKeyBlockMode iBlockMode;
   729     CAknAppUiExtension * iExtension;
   730 
   731 public:
   732     /**
   733     * Hide application from Fast-swap window.
   734     * @since S60 2.6
   735     * @param aHide @c ETrue if application is hided from Fast-swap window, otherwise
   736     * @c EFalse
   737     */
   738     IMPORT_C void HideApplicationFromFSW(TBool aHide=ETrue);
   739 
   740     /**
   741     * Gets keyboard layout specific keycode. Uses given resolver
   742     * SetAliasKeyCodeResolverL() if set, by default
   743     * fetches alternative code from avkon server.
   744     *
   745     * @since S60 3.1
   746     * @param aCode reference to variable to contain new keycode 
   747     * @param aKeyEvent reference to original, complete, event
   748     * @param aType indicating original event type
   749     */
   750     IMPORT_C void GetAliasKeyCodeL(TUint& aCode, const TKeyEvent& aKeyEvent,TEventCode aType);
   751 
   752     /**
   753     * Sets custom resolver for keycode aliases
   754     * Creates iExtension if it doesn't exist
   755     * @since S60 3.1
   756     * @param aHandler instance implementing MAknAliasKeyCodeResolver 
   757     */
   758     IMPORT_C void SetAliasKeyCodeResolverL(MAknAliasKeyCodeResolver* aResolver);
   759     
   760     /**
   761     * This is same as RWindowGroup::CaptureKey, except that this version takes
   762     * S60 keymappings into account and captures the key that produces requested
   763     * aKeyCode according to S60 keymappings. Standard RWindowgroup::CaptureKey
   764     * functionality takes place before S60 AppUi framework and has no knowledge
   765     * of S60 keymappings.
   766     * Note: This method requires same capabilites as RWindowGroup::CaptureKey()     
   767     *
   768     * @since S60 V3.2
   769     * @param aKeycode The key code for the key to be captured. Key codes for
   770     *                 special keys are defined in TKeyCode. 
   771     * @param aModifier Mask Only the modifier keys in this mask are tested against
   772     *                      the states specified in aModifier. 
   773     * @param aModifier The key is captured only when the modifier keys specified in
   774     *                  aModifierMask match these states, where 1=modifier set,
   775     *                  and 0=modifier not set. Modifier key states are defined
   776     *                  in TEventModifier. 
   777     * @return A handle identifying the capture key, or one of the system-wide error
   778     *                  codes (if <0). Handles should be kept in order to be passed to
   779     *                  CancelCaptureKey() later. 
   780     */
   781     IMPORT_C TInt32 CaptureKey(TUint aKeycode, TUint aModifierMask, TUint aModifier);         
   782     
   783     /**
   784     * This is same as RWindowGroup::CaptureKey, except that this version takes
   785     * S60 keymappings into account and captures the key that produces requested
   786     * aKeyCode according to S60 keymappings. This version leaves instead of returning
   787     * an error code. Standard RWindowgroup::CaptureKey functionality takes place
   788     * before S60 AppUi framework and has no knowledge of S60 keymappings.
   789     * Note: This method requires same capabilites as RWindowGroup::CaptureKey() 
   790     *
   791     * @since S60 V3.2
   792     * @param aKeycode The key code for the key to be captured. Key codes for
   793     *                 special keys are defined in TKeyCode. 
   794     * @param aModifier Mask Only the modifier keys in this mask are tested against
   795     *                      the states specified in aModifier. 
   796     * @param aModifier The key is captured only when the modifier keys specified in
   797     *                  aModifierMask match these states, where 1=modifier set,
   798     *                  and 0=modifier not set. Modifier key states are defined
   799     *                  in TEventModifier. 
   800     * @param aHandle   identifying the capture key. Handles should be kept in order
   801     *                  to be passed to CancelCaptureKey() later. 
   802     */    
   803     IMPORT_C void CaptureKeyL(TUint aKeycode, TUint aModifierMask, TUint aModifier, TInt32& aHandle);
   804     
   805     /**
   806     * This tells the application if it is allowed to hide itself in the
   807     * background in response to a user (menu or softkey) exit command, 
   808     * instead of actually exiting.
   809     * If the application appears to exit, but actually leaves itself in
   810     * memory, it may appear to start faster next time the user activates it.
   811     *
   812     * @since S60 V5.0
   813     * @return ETrue if the application can hide itself in the background, 
   814     *		  EFalse if it must exit properly by calling Exit().
   815     */    
   816     IMPORT_C TBool ExitHidesInBackground() const;
   817     
   818     /**
   819     * Hide the running instance of this application from the user, which
   820     * makes it appear as if the application has exited.
   821     * This is done by placing the application in the background, behind 
   822     * all other apps, and removing the application from the Fast Swap Window.
   823     * When the application comes to the foreground again, it will be
   824     * restored to the Fast Swap Window (in HandleForegroundEventL). If the
   825     * application is not supposed to be in the Fast Swap Window, it will have
   826     * to remove itself again.
   827     * @since S60 V5.0
   828     */    
   829     IMPORT_C void HideInBackground();
   830     
   831     /**
   832     * Disables next key sound (and repeated key sounds until pointer up event).
   833     *
   834     * @since S60 V5.0
   835     * @param aScanCode Scan code of disabled key.
   836     */
   837     IMPORT_C void DisableNextKeySound( TInt aScanCode ); 
   838     
   839 private:
   840     TBool ExitHidesInBackgroundL() const;
   841     };
   842 
   843 
   844 
   845 #endif
   846 
   847 
   848 
   849 
   850 
   851 
   852