|
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 /** |
|
87 * Marks that application was pressed |
|
88 */ |
|
89 void ApplicationKeyWasPressed(); |
|
90 |
|
91 private: |
|
92 |
|
93 CBSEngine(); |
|
94 |
|
95 void ConstructL(); |
|
96 |
|
97 /** |
|
98 * Returns previous application in focus stack for given application. |
|
99 * |
|
100 * @since S60 3.2 |
|
101 * @param aApp application UID |
|
102 * @return UID of previous application, |
|
103 * if information is missing returns TUid::Null |
|
104 */ |
|
105 TUid FindPreviousApp( const TUid& aApp ); |
|
106 |
|
107 /** |
|
108 * Sends given appliction to background |
|
109 * @since S60 3.2 |
|
110 * @param aApp application UID |
|
111 */ |
|
112 void SendToBackground( const TUid& aApp ); |
|
113 /** |
|
114 * Resets BS history |
|
115 */ |
|
116 void ResetHistory(); |
|
117 |
|
118 private: |
|
119 // data |
|
120 |
|
121 /** |
|
122 * list of application in BS stact |
|
123 */ |
|
124 RPointerArray<CBSApplicationInfo> iAppsStack; |
|
125 |
|
126 /** |
|
127 * focus stack |
|
128 */ |
|
129 RArray<TInt> iFocusHistory; |
|
130 |
|
131 /** |
|
132 * flag for handling fast swap events |
|
133 */ |
|
134 TBool swap; |
|
135 |
|
136 /** |
|
137 * flag for application key state |
|
138 */ |
|
139 TBool wasPressed; |
|
140 |
|
141 /** |
|
142 * Configuration of BS |
|
143 * Own. |
|
144 */ |
|
145 CBSConfiguration* iConfiguration; |
|
146 |
|
147 /** |
|
148 * Eikon environment |
|
149 * Not own. |
|
150 */ |
|
151 CEikonEnv* iEnv; |
|
152 }; |
|
153 |
|
154 #endif // C_CBSENGINE_H |