|
1 /* |
|
2 * Copyright (c) 2002-2004 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: |
|
15 * Xuikon UI state controller |
|
16 * |
|
17 */ |
|
18 |
|
19 #ifndef XNUISTATELISTENER_H |
|
20 #define XNUISTATELISTENER_H |
|
21 |
|
22 // System includes |
|
23 #include <e32base.h> |
|
24 #include <hwrmlight.h> |
|
25 #include <eikspane.h> |
|
26 |
|
27 // User includes |
|
28 #include "xnpropertysubscriber.h" |
|
29 |
|
30 // Forward declarations |
|
31 class CXnAppUiAdapter; |
|
32 |
|
33 // Constants |
|
34 |
|
35 // Class declaration |
|
36 /** |
|
37 * UI resource change observer interface |
|
38 * |
|
39 * @ingroup group_xnlayoutengine |
|
40 * @lib xn3layoutengine.lib |
|
41 * @since S60 5.0 |
|
42 */ |
|
43 NONSHARABLE_CLASS( MXnUiResourceChangeObserver ) |
|
44 { |
|
45 public: |
|
46 /** |
|
47 * Notifies statuspane is changed. |
|
48 * |
|
49 * @since S60 5.0 |
|
50 */ |
|
51 virtual void NotifyStatusPaneSizeChanged() = 0; |
|
52 |
|
53 /** |
|
54 * Notifies resource changes |
|
55 * |
|
56 * @since S60 5.0 |
|
57 * @param aType Resource type |
|
58 */ |
|
59 virtual void NotifyResourceChanged( TInt aType ) = 0; |
|
60 |
|
61 /** |
|
62 * Notifies HW flip/slide status changes |
|
63 * |
|
64 * @since S60 5.0 |
|
65 * @param aStatus flip/slide status |
|
66 */ |
|
67 /* virtual void NotifyFlipStatusChangedL( TInt aStatus ) = 0;*/ |
|
68 }; |
|
69 |
|
70 // Class declaration |
|
71 /** |
|
72 * UI state observer interface |
|
73 * |
|
74 * @ingroup group_xnlayoutengine |
|
75 * @lib xn3layoutengine.lib |
|
76 * @since S60 5.0 |
|
77 */ |
|
78 NONSHARABLE_CLASS( MXnUiStateObserver ) |
|
79 { |
|
80 public: |
|
81 // new types |
|
82 enum TForegroundStatus |
|
83 { |
|
84 EUnknown, |
|
85 EBackground, |
|
86 EForeground, |
|
87 EPartialForeground, |
|
88 }; |
|
89 public: |
|
90 /** |
|
91 * Notifies foreground changes |
|
92 * |
|
93 * @since S60 5.0 |
|
94 * @param aState Foreground state |
|
95 */ |
|
96 virtual void NotifyForegroundChanged( |
|
97 TForegroundStatus aStatus ) = 0; |
|
98 |
|
99 /** |
|
100 * Notifies primary display light status is changed. |
|
101 * |
|
102 * @since S60 5.0 |
|
103 * @param aLightsOn ETrue if lights on, EFalse otherwise |
|
104 */ |
|
105 virtual void NotifyLightStatusChanged( TBool aLightsOn ) = 0; |
|
106 |
|
107 /** |
|
108 * Notifies in-call state is changed. |
|
109 * |
|
110 * @since S60 5.0 |
|
111 * @param aInCall ETrue if in-call on, EFalse otherwise |
|
112 */ |
|
113 virtual void NotifyInCallStateChaged( TBool aInCall ) = 0; |
|
114 }; |
|
115 |
|
116 /** |
|
117 * UI state listener |
|
118 * |
|
119 * @ingroup group_xnlayoutengine |
|
120 * @lib xn3layoutengine.lib |
|
121 * @since S60 5.0 |
|
122 */ |
|
123 NONSHARABLE_CLASS( CXnUiStateListener ) : public CBase, |
|
124 public MCoeMessageMonitorObserver, |
|
125 public MEikStatusPaneObserver, |
|
126 public MHWRMLightObserver, |
|
127 public MXnPropertyChangeObserver |
|
128 { |
|
129 private: |
|
130 // friend classes |
|
131 friend class CXnAppUiAdapterImpl; |
|
132 |
|
133 public: |
|
134 /** |
|
135 * Two-phased constructor. |
|
136 */ |
|
137 static CXnUiStateListener* NewL( CXnAppUiAdapter& aAdapter ); |
|
138 static CXnUiStateListener* NewLC( CXnAppUiAdapter& aAdapter ); |
|
139 |
|
140 /** |
|
141 * Destructor. |
|
142 */ |
|
143 ~CXnUiStateListener(); |
|
144 |
|
145 private: |
|
146 /** |
|
147 * 2nd phase construtor |
|
148 */ |
|
149 void ConstructL(); |
|
150 |
|
151 /** |
|
152 * C++ default constructor. |
|
153 */ |
|
154 CXnUiStateListener( CXnAppUiAdapter& aAdapter ); |
|
155 |
|
156 public: |
|
157 // New functions |
|
158 |
|
159 /* |
|
160 * Adds MXnUiStateObserver |
|
161 * |
|
162 * @since S60 5.0 |
|
163 * @param aObserver Observer to add |
|
164 */ |
|
165 void AddObserver( const MXnUiStateObserver& aObserver ); |
|
166 |
|
167 /* |
|
168 * Removes MXnUiStateObserver |
|
169 * |
|
170 * @since S60 5.0 |
|
171 * @param aObserver Observer to remove |
|
172 */ |
|
173 void RemoveObserver( const MXnUiStateObserver& aObserver ); |
|
174 |
|
175 /* |
|
176 * Adds MXnUiResourceChangeObserver |
|
177 * |
|
178 * @since S60 5.0 |
|
179 * @param aObserver Observer to add |
|
180 */ |
|
181 void AddObserver( const MXnUiResourceChangeObserver& aObserver ); |
|
182 |
|
183 /* |
|
184 * Removes MXnUiResourceChangeObserver |
|
185 * |
|
186 * @since S60 5.0 |
|
187 * @param aObserver Observer to remove |
|
188 */ |
|
189 void RemoveObserver( const MXnUiResourceChangeObserver& aObserver ); |
|
190 |
|
191 public: |
|
192 void SetEditModeActive( TBool aActive ); |
|
193 |
|
194 private: |
|
195 // New functions |
|
196 void HandleResourceChangeL( TInt aType ); |
|
197 |
|
198 private: |
|
199 // from MCoeMessageMonitorObserver |
|
200 void MonitorWsMessage( const TWsEvent& aEvent ); |
|
201 |
|
202 private: |
|
203 // from MEikStatusPaneObserver |
|
204 void HandleStatusPaneSizeChange(); |
|
205 |
|
206 private: |
|
207 // from MHWRMLightObserver |
|
208 void LightStatusChanged( TInt aTarget, CHWRMLight::TLightStatus aStatus ); |
|
209 |
|
210 private: |
|
211 // from MXnPropertyChangeObserver |
|
212 void PropertyChangedL( const TUint32 aKey, const TInt aValue ); |
|
213 |
|
214 private: |
|
215 // Data |
|
216 |
|
217 // AppUi, not owned */ |
|
218 CXnAppUiAdapter& iAppUiAdapter; |
|
219 /** Light status observer, Owned */ |
|
220 CHWRMLight* iLightObserver; |
|
221 /** Publish&Subscribe observer for call state, Owned */ |
|
222 CXnPropertySubscriber* iCallStateObserver; |
|
223 /** MXnUiStateObservers, Not owned */ |
|
224 RPointerArray< MXnUiStateObserver > iUiStateObservers; |
|
225 /** MXnUiResourceChangeObservers, Not owned */ |
|
226 RPointerArray< MXnUiResourceChangeObserver > iResourceChangeObservers; |
|
227 /** Foreground status */ |
|
228 MXnUiStateObserver::TForegroundStatus iForegroundStatus; |
|
229 /** Light status */ |
|
230 CHWRMLight::TLightStatus iLightStatus; |
|
231 /** In-call state */ |
|
232 TBool iInCallState; |
|
233 /** Last received foreground message */ |
|
234 TInt iForegroundType; |
|
235 }; |
|
236 |
|
237 #endif // XNUISTATELISTENER_H |
|
238 |
|
239 // End of file |
|
240 |