uiacceltk/hitchcock/ServerCore/Inc/alfsrvresourcemanager.h
changeset 0 15bf7259bb7c
equal deleted inserted replaced
-1:000000000000 0:15bf7259bb7c
       
     1 /*
       
     2 * Copyright (c) 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 "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:   Manager for cross-session resources.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #ifndef C_ALFSRVRESOURCEMANAGER_H
       
    21 #define C_ALFSRVRESOURCEMANAGER_H
       
    22 
       
    23 #include <e32base.h>
       
    24 #include <hwrmlight.h>
       
    25 #include <uiacceltk/HuiEnv.h>
       
    26 
       
    27 class CAlfAppSrvSessionBase;
       
    28 
       
    29 /**
       
    30  *  Manager for cross-session resources.
       
    31  *
       
    32  *  Handles the scheduler pausing when the lights go off or the 
       
    33  *  application server goes into the background. 
       
    34  *
       
    35  *  This class is a candidate for adding logic when 
       
    36  *  releasing/restoring textures based on the cache side.
       
    37  *
       
    38  *  @since S60 v3.2
       
    39  */
       
    40 NONSHARABLE_CLASS( CAlfSrvResourceManager ): 
       
    41     public CBase, 
       
    42     public MHWRMLightObserver
       
    43     {
       
    44     
       
    45 public:
       
    46 
       
    47     /**
       
    48      * Two-phased constructor
       
    49      *
       
    50      * @param aEnv Environment.
       
    51      * @return New object. Ownership transfrerred.
       
    52      */
       
    53     static CAlfSrvResourceManager* NewL( CHuiEnv& aEnv );
       
    54     
       
    55     /**
       
    56      * Destructor.
       
    57      */
       
    58     virtual ~CAlfSrvResourceManager();
       
    59 
       
    60     /**
       
    61      * Called when the visibility of the appserver window changes.
       
    62      *
       
    63      * @param aVisible ETrue if the window is fully/partially visible
       
    64      *                 EFalse if the window is totally hidden
       
    65      */
       
    66     void SetServerWindowPartiallyVisible( TBool aVisible );
       
    67     
       
    68     /**
       
    69      * Called when the active session changes.
       
    70      *
       
    71      * @param aSession Can be NULL.
       
    72      */
       
    73     void SetActiveSession( CAlfAppSrvSessionBase* aSession );
       
    74 
       
    75 private:
       
    76 
       
    77     /**
       
    78      * Constructor
       
    79      */
       
    80     CAlfSrvResourceManager( CHuiEnv& aEnv );
       
    81     
       
    82     /**
       
    83      * Constructor
       
    84      */
       
    85     void ConstructL();
       
    86     
       
    87     /**
       
    88      * From MHWRMLightObserver
       
    89      *
       
    90      * Called when light status changes.
       
    91      */
       
    92     void LightStatusChanged(TInt aTarget, CHWRMLight::TLightStatus aStatus);
       
    93     
       
    94     /**
       
    95      * Updates the scheduler state based on the current status.
       
    96      */
       
    97     void UpdateSchedulerState();
       
    98     
       
    99     /**
       
   100      * Restarts the scheduler.
       
   101      */
       
   102     void Run();
       
   103     
       
   104     /**
       
   105      * Pauses the scheduler.
       
   106      */
       
   107     void Pause();
       
   108     
       
   109     /**
       
   110      * Return ETrue if any display lights are on
       
   111      * @return ETrue if display lights are ON.
       
   112      */
       
   113     TBool LightsOn() const;
       
   114 
       
   115 private: // data
       
   116 
       
   117     /**
       
   118      * Environment. 
       
   119      * Not own.
       
   120      */
       
   121     CHuiEnv& iEnv;
       
   122     
       
   123     /**
       
   124      * Currently active session. Can be NULL. 
       
   125      * Not own.
       
   126      */
       
   127     CAlfAppSrvSessionBase* iActiveSession;
       
   128         
       
   129     /**
       
   130      * Internal flags.
       
   131      */
       
   132     TUint iFlags;
       
   133     
       
   134     /**
       
   135      * Lights controller/observer.
       
   136      * Own.
       
   137      */
       
   138     CHWRMLight* iLight; 
       
   139     };
       
   140 
       
   141 #endif // C_ALFSRVRESOURCEMANAGER_H