|
1 /* |
|
2 * Copyright (c) 2005-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: File contains the concrete touch pane class. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #ifndef AKNTOUCHPANE_H |
|
21 #define AKNTOUCHPANE_H |
|
22 |
|
23 #include <coecntrl.h> |
|
24 #include <babitflags.h> |
|
25 #include <AknWsEventObserver.h> |
|
26 |
|
27 class CAknAppUi; |
|
28 class CAknButton; |
|
29 class MAknTouchPaneObserver; |
|
30 class CAknsBasicBackgroundControlContext; |
|
31 class CAknsFrameBackgroundControlContext; |
|
32 class MAknFepPenSupportInterface; |
|
33 class TAknTouchPaneItem; |
|
34 |
|
35 // have been deprecated |
|
36 |
|
37 /** |
|
38 * CAknTouchPane. |
|
39 * |
|
40 * @lib eikcoctl.lib |
|
41 * @since S60 5.0 |
|
42 */ |
|
43 NONSHARABLE_CLASS( CAknTouchPane ) : public CCoeControl, |
|
44 public MCoeControlObserver, |
|
45 public MCoeControlBackground, |
|
46 public MAknWsEventObserver |
|
47 { |
|
48 |
|
49 public: |
|
50 |
|
51 /** Touch pane visibility mode. */ |
|
52 enum TVisibilityMode |
|
53 { |
|
54 /** The visiblity is automatically updated whenever the visibility |
|
55 or resource ID of status pane is changed. The touch pane is set |
|
56 visible only when compatible status pane is visible. */ |
|
57 EAutomaticVisibilityChanges = 1, |
|
58 /** The visibility is not automatically changed, and user can set |
|
59 the visibility with @c MakeVisible() method. */ |
|
60 EManualVisibilityChanges = 2 |
|
61 }; |
|
62 |
|
63 /** |
|
64 * Two-phased constructor. |
|
65 */ |
|
66 IMPORT_C static CAknTouchPane* NewL(); |
|
67 |
|
68 /** |
|
69 * Two-phased constructor. Construct the touch pane from the specified |
|
70 * resource. |
|
71 * @param aResourceId Resource ID specifying the resource. |
|
72 */ |
|
73 IMPORT_C static CAknTouchPane* NewL( TInt aResourceId ); |
|
74 |
|
75 /** |
|
76 * Destructor. |
|
77 */ |
|
78 ~CAknTouchPane(); |
|
79 |
|
80 /** |
|
81 * Reduces the given rectangle from the side that overlaps with |
|
82 * touch pane. |
|
83 * @param aBoundingRect Rectangle to be modified. |
|
84 */ |
|
85 IMPORT_C void ReduceRect( TRect& aBoundingRect ) const; |
|
86 |
|
87 /** |
|
88 * Sets the touch pane's observer. |
|
89 * @param aObserver Observer. |
|
90 */ |
|
91 IMPORT_C void SetObserver( MAknTouchPaneObserver* aObserver ); |
|
92 |
|
93 /** |
|
94 * Sets the visibility mode. By default, the automatic visibility changes |
|
95 * are enabled, which means that the touch pane visibility is updated |
|
96 * whenever the visibility or resource ID of status pane is changed. |
|
97 * @param aMode Visibility mode. |
|
98 */ |
|
99 IMPORT_C void SetVisibilityMode( TVisibilityMode aMode ); |
|
100 |
|
101 /** |
|
102 * Allows input method activation. This method is called by the FEP to |
|
103 * set the input method icon dimmed, when input method activation is |
|
104 * not allowed, and to not dimmed, when input method activation is |
|
105 * allowed. |
|
106 * @param aValue ETrue to allow input method activation, EFalse to |
|
107 * disallow it. |
|
108 */ |
|
109 IMPORT_C void AllowInputMethodActivation( TBool aValue ); |
|
110 |
|
111 /** |
|
112 * Changes the state of the input method icon. This method is called by |
|
113 * the FEP, when the touch input window is opened or closed. |
|
114 * @param aActivated ETrue to change the state of the icon to activated |
|
115 * (pressed down), EFalse to change it back to normal state. |
|
116 */ |
|
117 IMPORT_C void SetInputMethodIconActivated( TBool aActivated ); |
|
118 |
|
119 /** |
|
120 * Refreshes touch pane icons. This method is called by the framework, |
|
121 * whenever application gains foreground or new application view is |
|
122 * activated. Applications should call this, when touch pane has to |
|
123 * change the state of some of its icons, for example, when the help |
|
124 * context of application changes so that the dimming of help icon |
|
125 * has to be switched. |
|
126 */ |
|
127 IMPORT_C void RefreshL(); |
|
128 |
|
129 /** |
|
130 * Sets the interface, which is used by the touch pane to activate |
|
131 * and to deactivate input method window. Recurring calls will replace |
|
132 * the previously used interface with the new one. The ownership of |
|
133 * the interface is not transferred. |
|
134 * @param aFepPenSupportInterface Interface to FEP, which can be used |
|
135 * to activate and deactivate input method window. |
|
136 */ |
|
137 IMPORT_C void SetFepPenSupportInterface( |
|
138 MAknFepPenSupportInterface* aFepPenSupportInterface ); |
|
139 |
|
140 /** |
|
141 * Handles status pane size change. |
|
142 * This method is called from status pane whenever it changes its size |
|
143 * as a result of resource change or visibility change. |
|
144 */ |
|
145 void HandleStatusPaneSizeChange( TInt aInitialResourceId, |
|
146 TInt aLastRequestedResourceId ); |
|
147 |
|
148 // from base classes |
|
149 |
|
150 /** |
|
151 * From CCoeControl. Returns number of controls inside the control. |
|
152 * @return Number of component controls. |
|
153 */ |
|
154 IMPORT_C TInt CountComponentControls() const; |
|
155 |
|
156 /** |
|
157 * From CCoeControl. Returns a control determined by control index. |
|
158 * @param anIndex Index of a control to be returned. |
|
159 * @return Pointer to control. |
|
160 */ |
|
161 IMPORT_C CCoeControl* ComponentControl( TInt aIndex ) const; |
|
162 |
|
163 /** |
|
164 * From MCoeControlBackground. Draw the background for a given control. |
|
165 * The method is intented to be called by the component controls fo touch |
|
166 * pane to draw their backgrounds. |
|
167 * @param aGc Graphics context used for drawing. |
|
168 * @param aControl The control being drawn. |
|
169 * @param aRect The area to be redrawn. |
|
170 */ |
|
171 IMPORT_C void Draw( CWindowGc& aGc, const CCoeControl& aControl, |
|
172 const TRect& aRect ) const; |
|
173 |
|
174 /** |
|
175 * From MCoeControlObserver. Handles an event from an observed control. |
|
176 * @param aControl The control that sent the event. |
|
177 * @param aEventType The event type. |
|
178 */ |
|
179 IMPORT_C void HandleControlEventL( CCoeControl *aControl, |
|
180 TCoeEvent aEventType ); |
|
181 |
|
182 /** |
|
183 * From CCoeControl. Handles a change to the control's resources. |
|
184 * @param aType A message UID value. |
|
185 */ |
|
186 IMPORT_C void HandleResourceChange( TInt aType ); |
|
187 |
|
188 /** |
|
189 * From CCoeControl. Sets the control visible or invisible. |
|
190 * @param aVisible ETrue to make the control visible, EFalse to |
|
191 * to make control invisible. |
|
192 */ |
|
193 IMPORT_C void MakeVisible( TBool aVisible ); |
|
194 |
|
195 /** |
|
196 * From CCoeControl. Handles key events. |
|
197 * @param aKeyEvent The key event. |
|
198 * @param aType The type of key event. |
|
199 * @return Indicates whether or not the key event was used by this |
|
200 * control. |
|
201 */ |
|
202 IMPORT_C TKeyResponse OfferKeyEventL( const TKeyEvent& aKeyEvent, |
|
203 TEventCode aType ); |
|
204 |
|
205 /** |
|
206 * From MAknWsEventObserver. Handles window server events. |
|
207 */ |
|
208 void HandleWsEventL( const TWsEvent& aEvent, CCoeControl* aDestination ); |
|
209 |
|
210 protected: |
|
211 |
|
212 // from base classes |
|
213 |
|
214 /** |
|
215 * From CCoeControl. Handles pointer events. |
|
216 */ |
|
217 IMPORT_C void HandlePointerEventL( const TPointerEvent &aPointerEvent ); |
|
218 |
|
219 /** |
|
220 * From CCoeControl. Responds to changes in the position of a control. |
|
221 */ |
|
222 IMPORT_C void PositionChanged(); |
|
223 |
|
224 /** |
|
225 * From CCoeControl. Sets the size and position of the components. |
|
226 */ |
|
227 IMPORT_C void SizeChanged(); |
|
228 |
|
229 private: |
|
230 |
|
231 /** |
|
232 * C++ default constructor. |
|
233 */ |
|
234 CAknTouchPane(); |
|
235 |
|
236 /** |
|
237 * Symbian 2nd phase constructor. |
|
238 */ |
|
239 void ConstructL( RArray<TAknTouchPaneItem>& aItems ); |
|
240 |
|
241 // Activates application shell. |
|
242 void ActivateApplicationShellL(); |
|
243 // Activates application swapper. |
|
244 void ActivateFastSwapL() const; |
|
245 // Activated idle view. |
|
246 void ActivateIdleViewL() const; |
|
247 // Rotates the screen. |
|
248 void RotateScreenL() const; |
|
249 // Activates/deactivates stylus input. |
|
250 void ActivateStylusInputL( TBool aActivate ) const; |
|
251 // Activates/deactivates popup toolbar. |
|
252 void ActivateToolbarL( TBool aActivate ) const; |
|
253 // Activates/deactivate help. |
|
254 void ActivateHelpL( TBool aActivate ); |
|
255 // Activates/deactivates dialler. |
|
256 void ActivateDiallerL( TBool aActivate ); |
|
257 // Activates/deactivates contacts. |
|
258 void ActivateContactsL( TBool aActivate ); |
|
259 |
|
260 // Creates the specified touch pane component. |
|
261 CAknButton* ConstructDefaultComponentL( TInt aId ); |
|
262 // Notifies the observer of a change in touch pane's size or position. |
|
263 void ReportSizeChange() const; |
|
264 // Sets the required properties for control to be touch pane's component. |
|
265 void SetDefaultPropertiesL( CCoeControl* aControl ); |
|
266 // Sets the size and position of touch pane's window from layout data. |
|
267 void SetWindowLayout(); |
|
268 // Registers the positions of component controls. |
|
269 void RegisterControlPositions() const; |
|
270 // Removes the registered positions of component controls. |
|
271 void DeregisterControlPositions() const; |
|
272 // Updates buttons. |
|
273 void DoRefresh(); |
|
274 |
|
275 // from base classes |
|
276 |
|
277 /** |
|
278 * From CCoeControl. Draws the control. |
|
279 */ |
|
280 void Draw( const TRect& aRect ) const; |
|
281 |
|
282 private: // Data |
|
283 |
|
284 CAknAppUi* iAppUi; // not owned |
|
285 |
|
286 // Component controls |
|
287 CAknButton* iShellIcon; |
|
288 CAknButton* iSwapperIcon; |
|
289 CAknButton* iIdleViewIcon; |
|
290 CAknButton* iDiallerIcon; |
|
291 CAknButton* iRotateIcon; |
|
292 CAknButton* iHelpIcon; |
|
293 CAknButton* iInputMethodIcon; |
|
294 CAknButton* iToolbarIcon; |
|
295 CAknButton* iContactsIcon; |
|
296 |
|
297 // Touch pane's observer |
|
298 MAknTouchPaneObserver* iObserver; // not owned |
|
299 |
|
300 // Background control context |
|
301 CAknsBasicBackgroundControlContext* iBgContext; |
|
302 |
|
303 // Frame control context |
|
304 CAknsFrameBackgroundControlContext* iFrameContext; |
|
305 |
|
306 // Interface for activating/deactivating input method |
|
307 MAknFepPenSupportInterface* iFepPenSupportInterface; // not owned |
|
308 |
|
309 // UID of the application owning the touch pane |
|
310 TUid iUid; |
|
311 |
|
312 // Flags |
|
313 TBitFlags32 iFlags; |
|
314 |
|
315 }; |
|
316 |
|
317 #endif // AKNTOUCHPANE_H |
|
318 |
|
319 // End of File |