taskswitcher/taskswitcherui/taskswitcherapp/inc/tsappui.h
branchRCL_3
changeset 34 5456b4e8b3a8
child 35 3321d3e205b6
equal deleted inserted replaced
33:5f0182e07bfb 34:5456b4e8b3a8
       
     1 /*
       
     2 * Copyright (c) 2008 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 "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  appui
       
    15  *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef TSAPPUI_H
       
    20 #define TSAPPUI_H
       
    21 
       
    22 #include <e32base.h> 
       
    23 #include <aknappui.h>
       
    24 
       
    25 #include <gfxtranseffect/gfxtranseffect.h>
       
    26 #include <akntransitionutils.h>
       
    27 
       
    28 #include "tsproplistener.h"
       
    29 #include "tscenreplistener.h"
       
    30 
       
    31 // FORWARD DECLARATIONS
       
    32 class CTsAppView;
       
    33 class CTsActionUtility;
       
    34 class CTsDeviceState;
       
    35 
       
    36 /**
       
    37  * CTsAppUi
       
    38  * Appui for tsak swicher app
       
    39  */
       
    40 class CTsAppUi : public CAknAppUi, 
       
    41                          public MTsPropertyChangeObserver,
       
    42                          public MTsCenrepChangeObserver,
       
    43                          public MGfxTransEffectObserver
       
    44     {
       
    45 
       
    46 public:
       
    47     enum {
       
    48     //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
       
    49     //TODO make maping to NGA transition id
       
    50     //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
       
    51     ENoneTransition = 0,
       
    52     EForegroundTransition = 3,
       
    53     EBackgroundTransition = 4,
       
    54     EActivationTransition = 5,
       
    55     EActivationAppShowTransition = 1507,
       
    56     
       
    57     };
       
    58     /**
       
    59      * Perform the second phase construction of a CTsAppUi object
       
    60      * this needs to be public due to the way the framework constructs the AppUi
       
    61      */
       
    62     void ConstructL();
       
    63 
       
    64     /**
       
    65      * Perform the first phase of two phase construction.
       
    66      * This needs to be public due to the way the framework constructs the AppUi
       
    67      */
       
    68     CTsAppUi();
       
    69 
       
    70     /**
       
    71      * Destroy the object and release all memory objects
       
    72      */
       
    73     ~CTsAppUi();
       
    74 
       
    75 public: //effects
       
    76     /**
       
    77      * @return value of theme effects enabled flag
       
    78      */
       
    79     TBool EffectsEnabled() const;
       
    80     
       
    81     /**
       
    82      * Function start transition  
       
    83      */
       
    84     void StartTransion( TUint aTransitionType,
       
    85             TUid aNextAppUid = TUid::Null(),
       
    86             TInt aWgId = 0 );
       
    87     
       
    88     /**
       
    89      * from MGfxTransEffectObserver
       
    90      */
       
    91     void TransitionFinished(const CCoeControl* aControl, TUint aAction);
       
    92     
       
    93     void MoveAppToForeground( TUint aTransitionType );
       
    94     void MoveAppToBackground( TUint aTransitionType,
       
    95             TUid aAppUid = TUid::Null(),
       
    96             TInt aWgId = 0 );
       
    97     
       
    98     /**
       
    99      * Functions for showing/hiding popups.
       
   100      */
       
   101     void RequestPopUpL();
       
   102     void DisablePopUpL();
       
   103     
       
   104     /**
       
   105      * Function for layout change check
       
   106      */
       
   107     TBool LayoutChangeAllowed();
       
   108     
       
   109     /**
       
   110      * Checks if task switcher is in foreground
       
   111      */
       
   112     TBool IsForeground() const;
       
   113     
       
   114     /**
       
   115      * Checks if delayed foreground launch is taking place.
       
   116      * 
       
   117      * @return  ETrue if delayed foreground launch is in progress
       
   118      */
       
   119     TBool DelayedForegroundLaunched();
       
   120     
       
   121 public:
       
   122     /**
       
   123      * From MTsCenrepChangeObserver
       
   124      */
       
   125     void CenrepChanged( TUint32 aKey, TInt aNewValue );
       
   126     
       
   127 
       
   128 private:
       
   129 
       
   130     // From MTsPropertyChangeObserver
       
   131     void PropertyChanged( TUid aCategory, TUint aKey );
       
   132 
       
   133     // From CEikAppUi
       
   134     void HandleResourceChangeL( TInt aType );
       
   135     void HandleForegroundEventL( TBool aForeground );
       
   136     void HandleCommandL( TInt aCommand );
       
   137     void HandleWsEventL(const TWsEvent& aEvent,
       
   138             CCoeControl* aDestination);
       
   139     
       
   140     void StartTransition( TUint aTranstionId,
       
   141                           TBool aVisibility,
       
   142                           TBool aLayers, 
       
   143                           TUint aSubCom );
       
   144     
       
   145     void StartAppActivateTransition( TUid aNextAppUid, TInt aWgId );
       
   146 
       
   147 private: // New functions
       
   148     
       
   149     /**
       
   150      * Called from HandleForegroundEventL if the app came to foreground.
       
   151      */
       
   152     void HandleSwitchToForegroundEvent();
       
   153     
       
   154     /**
       
   155      * Called from HandleForegroundEventL if the app went to background.
       
   156      */
       
   157     void HandleSwitchToBackgroundEvent();
       
   158 
       
   159     /**
       
   160      * Sets P&S property which is used to monitor and set Taskswitcher to 
       
   161      * background/foreground and short/long app key press.
       
   162      * 
       
   163      * @param aValue Property value. 
       
   164      */
       
   165     void SetTaskswitcherStateProperty( TInt aValue );
       
   166     
       
   167     /**
       
   168      * Sends request for close some 
       
   169      * other apps to free memory for 
       
   170      * task switcher app
       
   171      */
       
   172     void FreeMemoryRequest();
       
   173     
       
   174     /**
       
   175      * Returns id of window group lying beneath task
       
   176      * switcher window group. 
       
   177      * In case of embeded app it returns top paren window group.
       
   178      * 
       
   179      * @param  aIgnoreParentChild  if set to ETrue, parent/child relationship
       
   180      *                             will be ignored when deteriminig window
       
   181      *                             group id
       
   182      */
       
   183     TInt WgIdOfUnderlyingAppL( TBool aIgnoreParentChild );
       
   184 
       
   185     static TInt GoToBackgroundTimerCallback( TAny* aParam );
       
   186     static TInt DelayedForegroundCallback( TAny* aParam );
       
   187     
       
   188     /*
       
   189      * Returns id of top parent window group for embeded window group.
       
   190      * @param aChildWg embeded window group id
       
   191      * @return top parent window group id or 0 in case od standlalone 
       
   192      */
       
   193     TInt GetTopParentWg( TInt aChildWg);
       
   194 
       
   195     /*
       
   196      * Returns id of parent window group for embeded window group.
       
   197      * @param aChildWg embeded window group id
       
   198      * @return parent window group id or 0 in case od standlalone 
       
   199      */
       
   200     TInt GetParentWg( TInt aChildWg );
       
   201 
       
   202     /*
       
   203      * Returns window group id of camera app if it's lying beneath task
       
   204      * switcher window group.
       
   205      * This method considers also case, when camera window group is hidden.
       
   206      * @return camera's window group id.
       
   207      */
       
   208     TInt CheckForUnderlyingHiddenAppsL();
       
   209     
       
   210     /**
       
   211      * Checks if underlying application is multimedia application.
       
   212      * 
       
   213      * @return  ETrue if aplication on top of the app stack is multimedia application.
       
   214      *          Currently it recognises only camera app as multimedia app.
       
   215      */
       
   216     TBool IsUnderlyingAppMultimediaL();
       
   217 
       
   218 private:
       
   219 
       
   220     // Taskswitcher application view, owned
       
   221     CTsAppView* iAppView;
       
   222     
       
   223     // Listener for app key long press P&S, owned
       
   224     CTsPropertyListener* iPropListener;
       
   225     
       
   226     // Listener for orientation layout changes
       
   227     CTsPropertyListener* iLayoutListener;
       
   228     
       
   229     // Tells if Taskswitcher is in foreground or in background
       
   230     TBool iForeground;
       
   231     
       
   232     // Application arch task which refers to our own app
       
   233     TApaTask iApplicationTask;
       
   234 
       
   235     // Device state
       
   236     CTsDeviceState* iDeviceState;
       
   237 
       
   238     CPeriodic* iGoToBackgroundTimer;
       
   239     
       
   240     // Delayed launch handling variables
       
   241     CPeriodic* iForegroundDelayTimer;
       
   242     TBool iForegroundDelayed;
       
   243     TBool iDelayedForegroundInProgress;
       
   244     
       
   245     TBool iEffectsEnabled;
       
   246     
       
   247     /**
       
   248      * Cenrep listener for the tfxserver enabled/disabled key.
       
   249      */    
       
   250     CTsCenrepListener* iThemeEffectsEnabledWatcher;
       
   251     
       
   252     // Owned window for showing controls
       
   253     RWindowGroup iWg;
       
   254     
       
   255     // Monitors popup mode
       
   256     TBool iIsPopUpShown;
       
   257     
       
   258     // For starting in background
       
   259     TBool iUiStarted;
       
   260     TBool iDisableAppKeyHandling;
       
   261     
       
   262     TInt iUnderAppWgId;
       
   263     
       
   264     };
       
   265 
       
   266 #endif // TSAPPUI_H