taskswitcher/taskswitcherui/taskswitcherapp/inc/tsappui.h
changeset 4 4d54b72983ae
child 9 f966699dea19
equal deleted inserted replaced
3:fb3763350a08 4:4d54b72983ae
       
     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     /**
       
    48      * Perform the second phase construction of a CTsAppUi object
       
    49      * this needs to be public due to the way the framework constructs the AppUi
       
    50      */
       
    51     void ConstructL();
       
    52 
       
    53     /**
       
    54      * Perform the first phase of two phase construction.
       
    55      * This needs to be public due to the way the framework constructs the AppUi
       
    56      */
       
    57     CTsAppUi();
       
    58 
       
    59     /**
       
    60      * Destroy the object and release all memory objects
       
    61      */
       
    62     ~CTsAppUi();
       
    63 
       
    64 public: //effects
       
    65     /**
       
    66      * @return value of theme effects enabled flag
       
    67      */
       
    68     TBool EffectsEnabled() const;
       
    69     
       
    70     /**
       
    71      * Function start transition  
       
    72      */
       
    73     void StartTransion( TUint aTransitionType );
       
    74     
       
    75     /**
       
    76      * from MGfxTransEffectObserver
       
    77      */
       
    78     void TransitionFinished(const CCoeControl* aControl, TUint aAction);
       
    79     
       
    80     void MoveAppToForeground( TUint aTransitionType );
       
    81     void MoveAppToBackground( TUint aTransitionType );
       
    82     
       
    83 public:
       
    84     /**
       
    85      * From MTsCenrepChangeObserver
       
    86      */
       
    87     void CenrepChanged( TUint32 aKey, TInt aNewValue );
       
    88     
       
    89 
       
    90 private:
       
    91 
       
    92     // From MTsPropertyChangeObserver
       
    93     void PropertyChanged( TUid aCategory, TUint aKey );
       
    94 
       
    95     // From CEikAppUi
       
    96     void HandleResourceChangeL( TInt aType );
       
    97     void HandleForegroundEventL( TBool aForeground );
       
    98     void HandleCommandL( TInt aCommand );
       
    99     
       
   100     void StartTransition( TUint aTranstionId,
       
   101                           TBool aVisibility,
       
   102                           TBool aLayers, 
       
   103                           TUint aSubCom );
       
   104 
       
   105 private: // New functions
       
   106     
       
   107     /**
       
   108      * Called from HandleForegroundEventL if the app came to foreground.
       
   109      */
       
   110     void HandleSwitchToForegroundEvent();
       
   111     
       
   112     /**
       
   113      * Called from HandleForegroundEventL if the app went to background.
       
   114      */
       
   115     void HandleSwitchToBackgroundEvent();
       
   116 
       
   117     /**
       
   118      * Sets P&S property which is used to monitor and set Taskswitcher to 
       
   119      * background/foreground and short/long app key press.
       
   120      * 
       
   121      * @param aValue Property value. 
       
   122      */
       
   123     void SetTaskswitcherStateProperty( TInt aValue );
       
   124     
       
   125     /**
       
   126      * Sends request for close some 
       
   127      * other apps to free memory for 
       
   128      * task switcher app
       
   129      */
       
   130     void FreeMemoryRequest();
       
   131 
       
   132     static TInt GoToBackgroundTimerCallback( TAny* aParam );
       
   133 
       
   134 private:
       
   135 
       
   136     // Taskswitcher application view, owned
       
   137     CTsAppView* iAppView;
       
   138     
       
   139     // Listener for app key long press P&S, owned
       
   140     CTsPropertyListener* iPropListener;
       
   141     
       
   142     // Tells if Taskswitcher is in foreground or in background
       
   143     TBool iForeground;
       
   144     
       
   145     // Application arch task which refers to our own app
       
   146     TApaTask iApplicationTask;
       
   147 
       
   148     // Device state
       
   149     CTsDeviceState* iDeviceState;
       
   150 
       
   151     // Buffer to keeping some memory allocation while being in background.    
       
   152     TUint8* iMemAllocBuf;
       
   153 
       
   154     CPeriodic* iGoToBackgroundTimer;
       
   155     
       
   156     TBool iEffectsEnabled;
       
   157     
       
   158     /**
       
   159      * Cenrep listener for the tfxserver enabled/disabled key.
       
   160      */    
       
   161     CTsCenrepListener* iThemeEffectsEnabledWatcher;
       
   162     };
       
   163 
       
   164 #endif // TSAPPUI_H