2 * Copyright (c) 2005-2007 Nokia Corporation and/or its subsidiary(-ies).
4 * This component and the accompanying materials are made available
5 * under the terms of the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members
6 * which accompanies this distribution, and is available
7 * at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
9 * Initial Contributors:
10 * Nokia Corporation - initial contribution.
14 * Description: File contains the concrete touch pane class.
20 #ifndef AKNTOUCHPANE_H
21 #define AKNTOUCHPANE_H
24 #include <babitflags.h>
25 #include <aknwseventobserver.h>
29 class MAknTouchPaneObserver;
30 class CAknsBasicBackgroundControlContext;
31 class CAknsFrameBackgroundControlContext;
32 class MAknFepPenSupportInterface;
33 class TAknTouchPaneItem;
35 // have been deprecated
43 NONSHARABLE_CLASS( CAknTouchPane ) : public CCoeControl,
44 public MCoeControlObserver,
45 public MCoeControlBackground,
46 public MAknWsEventObserver
51 /** Touch pane visibility mode. */
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
64 * Two-phased constructor.
66 IMPORT_C static CAknTouchPane* NewL();
69 * Two-phased constructor. Construct the touch pane from the specified
71 * @param aResourceId Resource ID specifying the resource.
73 IMPORT_C static CAknTouchPane* NewL( TInt aResourceId );
81 * Reduces the given rectangle from the side that overlaps with
83 * @param aBoundingRect Rectangle to be modified.
85 IMPORT_C void ReduceRect( TRect& aBoundingRect ) const;
88 * Sets the touch pane's observer.
89 * @param aObserver Observer.
91 IMPORT_C void SetObserver( MAknTouchPaneObserver* aObserver );
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.
99 IMPORT_C void SetVisibilityMode( TVisibilityMode aMode );
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
106 * @param aValue ETrue to allow input method activation, EFalse to
109 IMPORT_C void AllowInputMethodActivation( TBool aValue );
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.
117 IMPORT_C void SetInputMethodIconActivated( TBool aActivated );
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.
127 IMPORT_C void RefreshL();
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.
137 IMPORT_C void SetFepPenSupportInterface(
138 MAknFepPenSupportInterface* aFepPenSupportInterface );
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.
145 void HandleStatusPaneSizeChange( TInt aInitialResourceId,
146 TInt aLastRequestedResourceId );
151 * From CCoeControl. Returns number of controls inside the control.
152 * @return Number of component controls.
154 IMPORT_C TInt CountComponentControls() const;
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.
161 IMPORT_C CCoeControl* ComponentControl( TInt aIndex ) const;
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.
171 IMPORT_C void Draw( CWindowGc& aGc, const CCoeControl& aControl,
172 const TRect& aRect ) const;
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.
179 IMPORT_C void HandleControlEventL( CCoeControl *aControl,
180 TCoeEvent aEventType );
183 * From CCoeControl. Handles a change to the control's resources.
184 * @param aType A message UID value.
186 IMPORT_C void HandleResourceChange( TInt aType );
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.
193 IMPORT_C void MakeVisible( TBool aVisible );
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
202 IMPORT_C TKeyResponse OfferKeyEventL( const TKeyEvent& aKeyEvent,
206 * From MAknWsEventObserver. Handles window server events.
208 void HandleWsEventL( const TWsEvent& aEvent, CCoeControl* aDestination );
215 * From CCoeControl. Handles pointer events.
217 IMPORT_C void HandlePointerEventL( const TPointerEvent &aPointerEvent );
220 * From CCoeControl. Responds to changes in the position of a control.
222 IMPORT_C void PositionChanged();
225 * From CCoeControl. Sets the size and position of the components.
227 IMPORT_C void SizeChanged();
232 * C++ default constructor.
237 * Symbian 2nd phase constructor.
239 void ConstructL( RArray<TAknTouchPaneItem>& aItems );
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 );
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;
278 * From CCoeControl. Draws the control.
280 void Draw( const TRect& aRect ) const;
284 CAknAppUi* iAppUi; // not owned
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;
297 // Touch pane's observer
298 MAknTouchPaneObserver* iObserver; // not owned
300 // Background control context
301 CAknsBasicBackgroundControlContext* iBgContext;
303 // Frame control context
304 CAknsFrameBackgroundControlContext* iFrameContext;
306 // Interface for activating/deactivating input method
307 MAknFepPenSupportInterface* iFepPenSupportInterface; // not owned
309 // UID of the application owning the touch pane
317 #endif // AKNTOUCHPANE_H