backsteppingsrv/inc/bsengine.h
branchRCL_3
changeset 114 a5a39a295112
equal deleted inserted replaced
113:0efa10d348c0 114:a5a39a295112
       
     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:  Engine for BS Engine
       
    15  *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef C_CBSENGINE_H
       
    20 #define C_CBSENGINE_H
       
    21 
       
    22 #include <e32base.h>
       
    23 
       
    24 class CBSConfiguration;
       
    25 class CBSApplicationInfo;
       
    26 class CEikonEnv;
       
    27 
       
    28 /**
       
    29  * Engine for BS solution
       
    30  * It is the place when whole BS logic is implemented.
       
    31  *
       
    32  *  @since S60 v3.2
       
    33  */
       
    34 class CBSEngine : public CBase
       
    35     {
       
    36 public:
       
    37 
       
    38     static CBSEngine* NewL();
       
    39     static CBSEngine* NewLC();
       
    40 
       
    41     /**
       
    42      * Destructor
       
    43      */
       
    44     virtual ~CBSEngine();
       
    45 
       
    46     /*
       
    47      * This method is notified when new application gain focus
       
    48      * 
       
    49      * @since S60 3.2
       
    50      * @param aApp application UID
       
    51      */
       
    52     void HandleFocusChangeL( const TUid& aApp );
       
    53 
       
    54     /**
       
    55      * Invoked when activation event appeared
       
    56      * appliction state changed or focus state changed
       
    57      *
       
    58      * @since S60 3.2
       
    59      * @param aApp application UID
       
    60      * @param aState state of application (like view ids)
       
    61      * @param aFocused indicate if it was item/exit state
       
    62      * @return EBSEngineCommandWasConsumed if event was consumed,
       
    63      *  else EBSEngineCommandWasNotConsumed
       
    64      */
       
    65     TInt HandleActivationEventL( const TUid& aApp, const TDesC8& aState,
       
    66         TBool aFocused );
       
    67 
       
    68     /**
       
    69      * Invoked when back event appeared
       
    70      *
       
    71      * @since S60 3.2
       
    72      * @param aApp application UID
       
    73      * @param aState state of application (like view ids)
       
    74      * @param aCheckOnly indicates if only checking should be done (no actual action)
       
    75      * @return EBSEngineCommandWasConsumed if event was consumed,
       
    76      *  else EBSEngineCommandWasNotConsumed
       
    77      */
       
    78     TInt HandleBackEventL( const TUid& aApp, const TDesC8& aState,
       
    79         TBool aCheckOnly );
       
    80 
       
    81     /**
       
    82      * Remove information about given application from BS stack
       
    83      */
       
    84     void RemoveAppRecord( const TUid& aApp );
       
    85 
       
    86 private:
       
    87 
       
    88     CBSEngine();
       
    89 
       
    90     void ConstructL();
       
    91 
       
    92     /**
       
    93      * Returns previous application in focus stack for given application.
       
    94      *
       
    95      * @since S60 3.2
       
    96      * @param aApp application UID
       
    97      * @return UID of previous application, 
       
    98      * if information is missing returns TUid::Null
       
    99      */
       
   100     TUid FindPreviousApp( const TUid& aApp );
       
   101 
       
   102     /**
       
   103      * Sends given appliction to background
       
   104      * @since S60 3.2
       
   105      * @param aApp application UID
       
   106      */
       
   107     void SendToBackground( const TUid& aApp );
       
   108     /**
       
   109      * Resets BS history
       
   110      */
       
   111     void ResetHistory();
       
   112 
       
   113 private:
       
   114     // data
       
   115 
       
   116     /**
       
   117      * list of application in BS stact
       
   118      */
       
   119     RPointerArray<CBSApplicationInfo> iAppsStack;
       
   120 
       
   121     /**
       
   122      * focus stack
       
   123      */
       
   124     RArray<TInt> iFocusHistory;
       
   125 
       
   126     /**
       
   127      * flag for handling fast swap events
       
   128      */    
       
   129     TBool iSwap;
       
   130 
       
   131     /**
       
   132      * Configuration of BS
       
   133      * Own.  
       
   134      */
       
   135     CBSConfiguration* iConfiguration;
       
   136 
       
   137     /**
       
   138      * Eikon environment
       
   139      * Not own.  
       
   140      */
       
   141     CEikonEnv* iEnv;
       
   142     };
       
   143 
       
   144 #endif // C_CBSENGINE_H