contextframework/cfwplugins/ApplicationStateSourcePlugIn/inc/ApplicationStateSourcePlugin.h
branchRCL_3
changeset 19 924385140d98
parent 3 096dad6e50a9
child 20 c2c61fdca848
equal deleted inserted replaced
18:0818dd463d41 19:924385140d98
    27 #include <viewclipartner.h>
    27 #include <viewclipartner.h>
    28 #endif
    28 #endif
    29 #include <cfcontextsourceplugin.h>
    29 #include <cfcontextsourceplugin.h>
    30 #include <cfcontextobject.h>
    30 #include <cfcontextobject.h>
    31 #include <cenrepnotifyhandler.h>
    31 #include <cenrepnotifyhandler.h>
    32 
    32 #include <w32std.h>
    33 #include <apgwgnam.h>
    33 #include <apgwgnam.h>
    34 #include "cfapplicationstatesettings.h"
    34 #include "cfapplicationstatesettings.h"
    35 #include "uidorientationpair.h"
    35 #include "uidorientationpair.h"
    36 
    36 
    37 // FORWARD DECLARATIONS
    37 // FORWARD DECLARATIONS
    38 class CRepository;
    38 class CRepository;
    39 class CCenRepNotifyHandler;
    39 class CCenRepNotifyHandler;
    40 
    40 // FORWARD DECLARATIONS
       
    41 class CWsEventHandler;
       
    42 
       
    43 NONSHARABLE_CLASS( MWsEventObserver )
       
    44     {
       
    45 public:
       
    46 
       
    47     /**
       
    48      * Handles window server event.
       
    49      * 
       
    50      * @since S60 5.0
       
    51      * @param aEvent New window server event.
       
    52      * @return None.
       
    53      */
       
    54     virtual void HandleWsEventL( RWsSession& aWsSession ) = 0;    
       
    55     };
    41 // CLASS DECLARATION
    56 // CLASS DECLARATION
    42 
    57 
    43 /**
    58 /**
    44  * Application state source plugin.
    59  * Application state source plugin.
    45  * Application state source plugin is responsible for listening view activations
    60  * Application state source plugin is responsible for listening view activations
    49  * @lib -
    64  * @lib -
    50  * @since S60 4.0
    65  * @since S60 4.0
    51  */
    66  */
    52 NONSHARABLE_CLASS( CApplicationStateSourcePlugIn ): 
    67 NONSHARABLE_CLASS( CApplicationStateSourcePlugIn ): 
    53 	public CCFContextSourcePlugIn,
    68 	public CCFContextSourcePlugIn,
    54 	public MVwsSessionWrapperObserver,
    69 	public MWsEventObserver,
    55 	public MCenRepNotifyHandlerCallback
    70 	public MCenRepNotifyHandlerCallback
    56     {
    71     {
    57 public: // Constructors and destructor
    72 public: // Constructors and destructor
    58 
    73 
    59     // Two phased constructors
    74     // Two phased constructors
    74     void DefineContextsL();
    89     void DefineContextsL();
    75 
    90 
    76     // @see CCFContextSourcePlugIn
    91     // @see CCFContextSourcePlugIn
    77     void InitializeL();
    92     void InitializeL();
    78 
    93 
    79 public: // From MVwsSessionWrapperObserver
    94 
    80 
       
    81     // @see MVwsSessionWrapperObserver
       
    82     void HandleViewEventL( const TVwsViewEvent& aEvent );
       
    83 
    95 
    84 public: // From MCenRepNotifyHandlerCallback
    96 public: // From MCenRepNotifyHandlerCallback
    85 
    97 
    86     // @see MCenRepNotifyHandlerCallback
    98     // @see MCenRepNotifyHandlerCallback
    87     void HandleNotifyGeneric( TUint32 aId );
    99     void HandleNotifyGeneric( TUint32 aId );
   109     // Initialize application settings from XML
   121     // Initialize application settings from XML
   110     void InitializeApplicationsFromXMLL();
   122     void InitializeApplicationsFromXMLL();
   111     
   123     
   112     // Initialize the fg application context
   124     // Initialize the fg application context
   113     void InitializeFgApplicationL();
   125     void InitializeFgApplicationL();
   114     
   126     void HandleWsEventL( RWsSession& aWsSession );
   115     // Handles the view server event
   127     // Handles the view server event
   116     void DoHandleViewEventL( const TVwsViewEvent& aEvent );
   128     void DoHandleViewEventL( const TVwsViewEvent& aEvent );
   117     
   129     
   118     // Resolve fg app orientation
   130     // Resolve fg app orientation
   119     TPtrC ResolveFgAppOrientation( const TUid& aUid );
   131     TPtrC ResolveFgAppOrientation( const TUid& aUid );
   147     // My settings.
   159     // My settings.
   148     CCFContextSourceSettingArray* iSettings;
   160     CCFContextSourceSettingArray* iSettings;
   149 
   161 
   150     // Foreground application setting list
   162     // Foreground application setting list
   151     RApplicationStateSettingsPointerArray iApplicationSettings;
   163     RApplicationStateSettingsPointerArray iApplicationSettings;
   152     
   164     CWsEventHandler* iWsEventHandler;
   153     
   165     
   154     // Previous foreground application orientation
   166     // Previous foreground application orientation
   155     TPtrC iPreviousOrientation;
   167     TPtrC iPreviousOrientation;
   156     
   168     
   157     // KCRUidDefaultAppOrientation cenrep
   169     // KCRUidDefaultAppOrientation cenrep
   164     RUidOrientationList iUidOrientationList;
   176     RUidOrientationList iUidOrientationList;
   165     
   177     
   166     // KCRUidDefaultAppOrientation listener
   178     // KCRUidDefaultAppOrientation listener
   167     CCenRepNotifyHandler* iCRAppOrientationListener;
   179     CCenRepNotifyHandler* iCRAppOrientationListener;
   168     };
   180     };
   169 
   181 /**
       
   182  * Listens events from window server and forwards them to observer.
       
   183  */
       
   184 NONSHARABLE_CLASS( CWsEventHandler ): public CActive
       
   185     {
       
   186 public:
       
   187 
       
   188     /**
       
   189      * Symbian two phased constructors.
       
   190      *
       
   191      * @since S60 5.0
       
   192      * @param None.
       
   193      * @return CDisplayServiceUILayout
       
   194      */
       
   195     static CWsEventHandler* NewL( MWsEventObserver& aObserver );
       
   196     static CWsEventHandler* NewLC( MWsEventObserver& aObserver );
       
   197 
       
   198     /**
       
   199      * C++ destructor.
       
   200      */
       
   201     virtual ~CWsEventHandler();
       
   202     
       
   203 public:
       
   204     
       
   205     /**
       
   206      * Start event listening.
       
   207      * 
       
   208      * @since S60 5.0
       
   209      * @param None.
       
   210      * @return None.
       
   211      */
       
   212     void IssueRequest();
       
   213     
       
   214 protected:
       
   215     
       
   216     // @see CActive
       
   217     virtual void RunL();
       
   218     
       
   219     // @see CActive
       
   220     virtual void DoCancel(); 
       
   221     
       
   222     // @see CActive
       
   223     virtual TInt RunError( TInt aError ); 
       
   224     
       
   225 private:
       
   226 
       
   227     CWsEventHandler( MWsEventObserver& aObserver );
       
   228     void ConstructL();
       
   229 
       
   230 private: // Data
       
   231     
       
   232     /** Observer */
       
   233     MWsEventObserver& iObserver;
       
   234 
       
   235     /** Window server session */
       
   236     RWsSession iWsSession;
       
   237     
       
   238     /** Window group for receiving window server events */
       
   239     RWindowGroup* iWindowGroup;
       
   240     
       
   241     /** Window group name to hide it from the task manager */
       
   242     CApaWindowGroupName* iWindowGroupName;
       
   243     };
   170 #endif // C_APPLICATIONSTATESOURCEPLUGIN_H
   244 #endif // C_APPLICATIONSTATESOURCEPLUGIN_H