83
|
1 |
/*
|
|
2 |
* Copyright (c) 2008 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: appui
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
|
|
19 |
#ifndef TSAPPVIEW_H
|
|
20 |
#define TSAPPVIEW_H
|
|
21 |
|
|
22 |
#include <e32base.h>
|
|
23 |
#include <coecntrl.h>
|
|
24 |
#include <AknPopupFader.h>
|
|
25 |
#include <touchfeedback.h>
|
|
26 |
#include "tsdevicestate.h"
|
|
27 |
#include "tsdatachangeobserver.h"
|
|
28 |
#include "tseventcontrolerobserver.h"
|
|
29 |
|
|
30 |
// FORWARD DECLARATIONS
|
|
31 |
class CAknsFrameBackgroundControlContext;
|
|
32 |
class CTsFastSwapArea;
|
|
33 |
class CAknPopupHeadingPane;
|
|
34 |
class CTsEventControler;
|
|
35 |
|
|
36 |
/**
|
|
37 |
* Taskswitcher applicatio view class.
|
|
38 |
*/
|
|
39 |
class CTsAppView : public CCoeControl, public MCoeControlObserver,
|
|
40 |
public MTsDeviceStateObserver,
|
|
41 |
public MAknFadedComponent,
|
|
42 |
public MTsDataChangeObserver,
|
|
43 |
public MTsEventControlerObserver
|
|
44 |
{
|
|
45 |
public:
|
|
46 |
|
|
47 |
/**
|
|
48 |
* Two-phase constructor.
|
|
49 |
*
|
|
50 |
* @param aRect Area where view should draw itself.
|
|
51 |
*/
|
|
52 |
static CTsAppView* NewL(const TRect& aRect,
|
|
53 |
CTsDeviceState& aDeviceState,
|
|
54 |
RWindowGroup& aWg);
|
|
55 |
|
|
56 |
/**
|
|
57 |
* @copydoc NewL
|
|
58 |
*/
|
|
59 |
static CTsAppView* NewLC(const TRect& aRect,
|
|
60 |
CTsDeviceState& aDeviceState,
|
|
61 |
RWindowGroup& aWg);
|
|
62 |
|
|
63 |
/**
|
|
64 |
* Destructor.
|
|
65 |
*/
|
|
66 |
~CTsAppView();
|
|
67 |
|
|
68 |
/**
|
|
69 |
* Called from appui if the app came to foreground.
|
|
70 |
*/
|
|
71 |
void HandleSwitchToForegroundEvent();
|
|
72 |
|
|
73 |
/**
|
|
74 |
* Called from appui if the app went to background.
|
|
75 |
*/
|
|
76 |
void HandleSwitchToBackgroundEvent();
|
|
77 |
|
|
78 |
/**
|
|
79 |
* From CCoeControl Method handling the pointer events while the fsw is used.
|
|
80 |
*
|
|
81 |
* @param aPointerEvent Information about the event.
|
|
82 |
*/
|
|
83 |
void HandlePointerEventL( const TPointerEvent &aPointerEvent );
|
|
84 |
|
|
85 |
public:
|
|
86 |
// from CCoeControl
|
|
87 |
void Draw( const TRect& aRect ) const;
|
|
88 |
TTypeUid::Ptr MopSupplyObject( TTypeUid aId );
|
|
89 |
TKeyResponse OfferKeyEventL( const TKeyEvent& aKeyEvent, TEventCode aType );
|
|
90 |
TInt CountComponentControls() const;
|
|
91 |
CCoeControl* ComponentControl(TInt aIndex) const;
|
|
92 |
void SizeChanged();
|
|
93 |
|
|
94 |
//Own
|
|
95 |
/*
|
|
96 |
* Forward app key handling to fasswaparea control.
|
|
97 |
*/
|
|
98 |
void HandleAppKey(TInt aType);
|
|
99 |
|
|
100 |
/**
|
|
101 |
* Orders window invalidation to perform full
|
|
102 |
* background redraw.
|
|
103 |
*/
|
|
104 |
void OrderFullWindowRedraw();
|
|
105 |
|
|
106 |
/**
|
|
107 |
* Orders window invalidation to perform full
|
|
108 |
* background redraw.
|
|
109 |
*/
|
|
110 |
void EnableDragEvents( TBool aEnable );
|
|
111 |
|
|
112 |
/**
|
|
113 |
* Checks if app with the given wg id is closing
|
|
114 |
*
|
|
115 |
* @param aWgId id of window group which is checked
|
|
116 |
* if it is closing
|
|
117 |
* @return ETrue if application is being closed, EFalse otherwise
|
|
118 |
*/
|
|
119 |
TBool AppCloseInProgress( TInt aWgId );
|
|
120 |
|
|
121 |
/**
|
|
122 |
* Checks if app with the given window group id is present on taskswitcher
|
|
123 |
* list.
|
|
124 |
*
|
|
125 |
* @param aWgId window group of the application to be checked
|
|
126 |
* @return ETrue if there is application with the given id is on the list
|
|
127 |
*/
|
|
128 |
TBool WgOnTaskList( TInt aWgId );
|
|
129 |
|
|
130 |
protected:
|
|
131 |
// from MCoeControlObserver
|
|
132 |
void HandleControlEventL( CCoeControl* aControl, TCoeEvent aEventType );
|
|
133 |
|
|
134 |
// from MTsDeviceStateObserver
|
|
135 |
void HandleDeviceStateChanged( TChangeType aChangeType );
|
|
136 |
|
|
137 |
protected: // from MAknFadedComponent
|
|
138 |
TInt CountFadedComponents();
|
|
139 |
CCoeControl* FadedComponent( TInt aIndex );
|
|
140 |
|
|
141 |
protected: // from MTsCenrepChangeObserver
|
|
142 |
void CenrepChanged( TUint32 aKey, TInt aNewValue );
|
|
143 |
|
|
144 |
protected: // from MTsDataChangeObserver
|
|
145 |
void DataChanged( CCoeControl* aWhere, TInt aNewCount );
|
|
146 |
|
|
147 |
private:
|
|
148 |
|
|
149 |
/**
|
|
150 |
* @copydoc NewL
|
|
151 |
*/
|
|
152 |
void ConstructL( const TRect& aRect, RWindowGroup& aWg );
|
|
153 |
|
|
154 |
/**
|
|
155 |
* C++ constructor.
|
|
156 |
*/
|
|
157 |
CTsAppView( CTsDeviceState& aDeviceState );
|
|
158 |
|
|
159 |
/**
|
|
160 |
* Updates the internal state for currently focused control.
|
|
161 |
* @param aNewFocusedControl ptr to new focused control, ownership not taken
|
|
162 |
*/
|
|
163 |
void ChangeFocus( CCoeControl* aNewFocusedControl );
|
|
164 |
|
|
165 |
/**
|
|
166 |
* Creates components.
|
|
167 |
*/
|
|
168 |
void CreateControlsL();
|
|
169 |
|
|
170 |
/**
|
|
171 |
* Appends component rects to the given array.
|
|
172 |
* @param aRects array
|
|
173 |
*/
|
|
174 |
void GetRects( RArray<TRect>& aRects );
|
|
175 |
|
|
176 |
/**
|
|
177 |
* Handles key event according to the portrait-style (vertical) layout.
|
|
178 |
*/
|
|
179 |
TKeyResponse OfferKeyEventPortraitStyleL( const TKeyEvent& aKeyEvent, TEventCode aType);
|
|
180 |
|
|
181 |
/**
|
|
182 |
* Calculates and returns the following:
|
|
183 |
* - the rectangle for main_tport_pane
|
|
184 |
* - the outer rectangle for the frame
|
|
185 |
* - the inner rectangle for the frame
|
|
186 |
*/
|
|
187 |
void UpdatePopupRects( );
|
|
188 |
|
|
189 |
/**
|
|
190 |
* Updates the text in the applications and suggestions heading panes.
|
|
191 |
*/
|
|
192 |
void UpdateHeadingsL( TInt aNewCount );
|
|
193 |
|
|
194 |
/**
|
|
195 |
* Disables transition animations for taskswitcher app.
|
|
196 |
* (the automatic effects that are applied when coming/leaving foreground)
|
|
197 |
*/
|
|
198 |
void DisableAppSwitchEffects();
|
|
199 |
|
|
200 |
/**
|
|
201 |
* Launches feedback through MTouchFeedback::Instance()
|
|
202 |
*
|
|
203 |
* @param aType - The logical feedback type to play.
|
|
204 |
* @param aFeedbackType - Feedback types to be played as a bitmask
|
|
205 |
* combination of enumeration items from
|
|
206 |
* TTouchFeedbackType
|
|
207 |
* @param aPointerEvent - Pointer event, which triggered this feedback.
|
|
208 |
*/
|
|
209 |
void LaunchFeedback( TTouchLogicalFeedback aType,
|
|
210 |
TTouchFeedbackType aFeedbackType,
|
|
211 |
const TPointerEvent& aPointerEvent);
|
|
212 |
|
|
213 |
/**
|
|
214 |
* Area, where drag events are being handled.
|
|
215 |
*/
|
|
216 |
TRect DragArea();
|
|
217 |
|
|
218 |
public://From MTsEventControlerObserver
|
|
219 |
/**
|
|
220 |
* Declare drag gesture handling.
|
|
221 |
* @param aOffset - drag distance
|
|
222 |
*/
|
|
223 |
virtual void MoveOffset(const TPoint& aOffset, TBool aDrawNow);
|
|
224 |
|
|
225 |
/**
|
|
226 |
* Declare tap gesture handling.
|
|
227 |
* @param aPoint - tap position
|
|
228 |
*/
|
|
229 |
virtual void TapL(const TPoint& aPoint);
|
|
230 |
|
|
231 |
/**
|
|
232 |
* Declare long tap gesture handling.
|
|
233 |
* @param aPoint - tap position
|
|
234 |
*/
|
|
235 |
virtual void LongTapL(const TPoint& aPoint);
|
|
236 |
|
|
237 |
/**
|
|
238 |
*
|
|
239 |
*/
|
|
240 |
virtual void DragL(
|
|
241 |
const AknTouchGestureFw::MAknTouchGestureFwDragEvent& aEvent);
|
|
242 |
|
|
243 |
/**
|
|
244 |
* Declare animation stop handling
|
|
245 |
*/
|
|
246 |
virtual void Stop();
|
|
247 |
|
|
248 |
/**
|
|
249 |
* Declare getter for view position
|
|
250 |
*/
|
|
251 |
virtual TPoint ViewPos() const;
|
|
252 |
|
|
253 |
private: // Data
|
|
254 |
|
|
255 |
// Ref to container for commonly used instances
|
|
256 |
CTsDeviceState& iDeviceState;
|
|
257 |
|
|
258 |
// Background context, owned
|
|
259 |
CAknsFrameBackgroundControlContext* iBgContext;
|
|
260 |
|
|
261 |
// Fast Swap area, owned
|
|
262 |
CTsFastSwapArea* iFastSwapArea;
|
|
263 |
|
|
264 |
/**
|
|
265 |
* Heading pane, own
|
|
266 |
*/
|
|
267 |
CAknPopupHeadingPane* iAppsHeading;
|
|
268 |
|
|
269 |
/**
|
|
270 |
* Currently focused control, not own
|
|
271 |
*/
|
|
272 |
CCoeControl* iFocused;
|
|
273 |
|
|
274 |
/**
|
|
275 |
* Rectangle of the control.
|
|
276 |
*/
|
|
277 |
TRect iViewRect;
|
|
278 |
|
|
279 |
/**
|
|
280 |
* Popup fader instance.
|
|
281 |
*/
|
|
282 |
TAknPopupFader iPopupFader;
|
|
283 |
|
|
284 |
/**
|
|
285 |
* Pointer for background image, owned
|
|
286 |
*/
|
|
287 |
TRect iBgContextOuterRect;
|
|
288 |
TRect iBgContextInnerRect;
|
|
289 |
CTsEventControler* iEvtHandler; //own
|
|
290 |
|
|
291 |
/**
|
|
292 |
* Flag for marking exit on pointer events
|
|
293 |
*/
|
|
294 |
TBool iExitOnPointerUp;
|
|
295 |
};
|
|
296 |
|
|
297 |
#endif // TSAPPVIEW_H
|