|
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: Taskswitcher view class |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #include <AknUtils.h> |
|
20 #include <AknsUtils.h> |
|
21 #include <aknlayoutscalable_apps.cdl.h> |
|
22 #include <aknlayoutscalable_avkon.cdl.h> |
|
23 #include <layoutmetadata.cdl.h> |
|
24 #include <AknsFrameBackgroundControlContext.h> |
|
25 #include <AknsDrawUtils.h> |
|
26 #include <eikmenub.h> |
|
27 #include <gfxtranseffect/gfxtranseffect.h> |
|
28 #include <akntransitionutils.h> |
|
29 #include <akntranseffect.h> |
|
30 #include <aknPopupHeadingPane.h> |
|
31 #include <StringLoader.h> |
|
32 #include <tstaskswitcher.rsg> |
|
33 #include <touchfeedback.h> |
|
34 |
|
35 #include "tsappview.h" |
|
36 #include "tsappui.h" |
|
37 #include "tsapplogging.h" |
|
38 #include "tsfastswaparea.h" |
|
39 #include "tseventcontroler.h" |
|
40 #include "tsuid.hrh" |
|
41 |
|
42 // ----------------------------------------------------------------------------- |
|
43 // CTsAppView::NewL |
|
44 // ----------------------------------------------------------------------------- |
|
45 // |
|
46 CTsAppView* CTsAppView::NewL( const TRect& aRect, |
|
47 CTsDeviceState& aDeviceState ) |
|
48 { |
|
49 CTsAppView* self = CTsAppView::NewLC( aRect, aDeviceState ); |
|
50 CleanupStack::Pop( self ); |
|
51 return self; |
|
52 } |
|
53 |
|
54 // ----------------------------------------------------------------------------- |
|
55 // CTsAppView::NewLC |
|
56 // ----------------------------------------------------------------------------- |
|
57 // |
|
58 CTsAppView* CTsAppView::NewLC( const TRect& aRect, |
|
59 CTsDeviceState& aDeviceState ) |
|
60 { |
|
61 CTsAppView* self = new (ELeave) CTsAppView( aDeviceState ); |
|
62 CleanupStack::PushL( self ); |
|
63 self->ConstructL( aRect ); |
|
64 return self; |
|
65 } |
|
66 |
|
67 // ----------------------------------------------------------------------------- |
|
68 // CTsAppView::CTsAppView |
|
69 // ----------------------------------------------------------------------------- |
|
70 // |
|
71 CTsAppView::CTsAppView(CTsDeviceState& aDeviceState) |
|
72 : iDeviceState( aDeviceState ) |
|
73 { |
|
74 // no implementation required |
|
75 } |
|
76 |
|
77 // ----------------------------------------------------------------------------- |
|
78 // InvalidateWindows |
|
79 // ----------------------------------------------------------------------------- |
|
80 // |
|
81 static void InvalidateWindows( CCoeControl* aControl ) |
|
82 { |
|
83 if ( aControl ) |
|
84 { |
|
85 if ( aControl->OwnsWindow() ) |
|
86 { |
|
87 static_cast<RWindow*>( aControl->DrawableWindow() )->ClearRedrawStore(); |
|
88 } |
|
89 |
|
90 for ( TInt i = aControl->CountComponentControls() - 1; i >= 0; --i ) |
|
91 { |
|
92 InvalidateWindows( aControl->ComponentControl( i ) ); |
|
93 } |
|
94 } |
|
95 } |
|
96 |
|
97 // ----------------------------------------------------------------------------- |
|
98 // CTsAppView::~CTsAppView |
|
99 // ----------------------------------------------------------------------------- |
|
100 // |
|
101 CTsAppView::~CTsAppView() |
|
102 { |
|
103 GfxTransEffect::SetTransitionObserver( 0 ); |
|
104 if ( GfxTransEffect::IsRegistered( this ) ) |
|
105 { |
|
106 MakeVisible( EFalse ); |
|
107 CAknTransitionUtils::MakeVisibleSubComponents( this, |
|
108 CAknTransitionUtils::EForceInvisible ); |
|
109 GfxTransEffect::Deregister( this ); |
|
110 } |
|
111 delete iBgContext; |
|
112 delete iFastSwapArea; |
|
113 delete iAppsHeading; |
|
114 |
|
115 delete iEvtHandler; |
|
116 } |
|
117 |
|
118 // ----------------------------------------------------------------------------- |
|
119 // CTsAppView::ConstructL |
|
120 // ----------------------------------------------------------------------------- |
|
121 // |
|
122 void CTsAppView::ConstructL( const TRect& aRect ) |
|
123 { |
|
124 TSLOG_CONTEXT( CTsAppView::ConstructL, TSLOG_LOCAL ); |
|
125 TSLOG_IN(); |
|
126 |
|
127 // Create a window for this application view |
|
128 CreateWindowL(); |
|
129 |
|
130 // Store rect |
|
131 TInt variety = Layout_Meta_Data::IsLandscapeOrientation() ? 1 : 0; |
|
132 TAknLayoutRect mainView; |
|
133 mainView.LayoutRect( aRect, |
|
134 AknLayoutScalable_Apps::main_tport_pane( variety ) ); |
|
135 iViewRect = mainView.Rect(); |
|
136 |
|
137 // Background control context is for a frame |
|
138 UpdatePopupRects(); |
|
139 iBgContext = CAknsFrameBackgroundControlContext::NewL( |
|
140 KAknsIIDQsnFrPopup, |
|
141 iBgContextOuterRect, |
|
142 iBgContextInnerRect, |
|
143 ETrue ); |
|
144 iBgContext->SetFrameRects(iBgContextOuterRect, iBgContextInnerRect); |
|
145 iBgContext->SetCenter( KAknsIIDQsnFrPopupCenter ); |
|
146 |
|
147 TSLOG4( TSLOG_INFO, "view rect = %d %d %d %d", |
|
148 iViewRect.iTl.iX, iViewRect.iTl.iY, |
|
149 iViewRect.iBr.iX, iViewRect.iBr.iY ); |
|
150 |
|
151 // Create components |
|
152 CreateControlsL(); |
|
153 |
|
154 // Hide 'active applications' item in Options menu |
|
155 CEikMenuBar* menub = iEikonEnv->AppUiFactory()->MenuBar(); |
|
156 if ( menub ) |
|
157 { |
|
158 menub->SetMenuType( CEikMenuBar::EMenuOptionsNoTaskSwapper ); |
|
159 } |
|
160 |
|
161 // Register for notifications about orientation etc. changes |
|
162 iDeviceState.AddObserverL( *this, MTsDeviceStateObserver::EAny ); |
|
163 SetRect( iViewRect ); |
|
164 //SetExtentToWholeScreen(); |
|
165 iViewRect = Rect(); |
|
166 // try to enable window transparency |
|
167 if( CAknEnv::Static()->TransparencyEnabled() ) |
|
168 { |
|
169 Window().SetRequiredDisplayMode( EColor16MA ); |
|
170 if ( Window().SetTransparencyAlphaChannel() == KErrNone ) |
|
171 { |
|
172 Window().SetBackgroundColor( ~0 ); |
|
173 } |
|
174 } |
|
175 |
|
176 DrawableWindow()->EnableBackup(EWindowBackupFullScreen); |
|
177 Window().SetOrdinalPosition( 0, ECoeWinPriorityNormal ); |
|
178 SetComponentsToInheritVisibility(ETrue); |
|
179 MakeVisible(ETrue); |
|
180 // Ready to be drawn |
|
181 ActivateL(); |
|
182 |
|
183 TSLOG_OUT(); |
|
184 } |
|
185 |
|
186 // ----------------------------------------------------------------------------- |
|
187 // CTsAppView::DisableAppSwitchEffects |
|
188 // ----------------------------------------------------------------------------- |
|
189 // |
|
190 void CTsAppView::DisableAppSwitchEffects() |
|
191 { |
|
192 TInt flags = AknTransEffect::TParameter::ENoEffects; |
|
193 GfxTransEffect::BeginFullScreen( |
|
194 AknTransEffect::ENone, |
|
195 TRect(0,0,0,0), |
|
196 AknTransEffect::EParameterType, |
|
197 AknTransEffect::GfxTransParam( TUid::Uid(KTsAppUidValue), flags ) ); |
|
198 } |
|
199 |
|
200 // ----------------------------------------------------------------------------- |
|
201 // CTsAppView::GetPopupRects |
|
202 // ----------------------------------------------------------------------------- |
|
203 // |
|
204 void CTsAppView::UpdatePopupRects( ) |
|
205 { |
|
206 TSLOG_CONTEXT( UpdatePopupRects, TSLOG_LOCAL ); |
|
207 TSLOG_IN(); |
|
208 |
|
209 TInt variety = Layout_Meta_Data::IsLandscapeOrientation() ? 1 : 0; |
|
210 |
|
211 TAknLayoutRect bgTport; |
|
212 bgTport.LayoutRect( iViewRect, |
|
213 AknLayoutScalable_Apps::bg_popup_window_pane_cp01( variety ) ); |
|
214 iBgContextOuterRect = bgTport.Rect(); |
|
215 bgTport.LayoutRect( iBgContextOuterRect, |
|
216 AknLayoutScalable_Avkon::aid_inside_area_window_primary( variety ) ); |
|
217 iBgContextInnerRect = bgTport.Rect(); |
|
218 TSLOG4( TSLOG_INFO, "outer rect for popup = %d %d %d %d", |
|
219 iBgContextOuterRect.iTl.iX, iBgContextOuterRect.iTl.iY, |
|
220 iBgContextOuterRect.iBr.iX, iBgContextOuterRect.iBr.iY ); |
|
221 TSLOG4( TSLOG_INFO, "inner rect for popup = %d %d %d %d", |
|
222 iBgContextInnerRect.iTl.iX, iBgContextInnerRect.iTl.iY, |
|
223 iBgContextInnerRect.iBr.iX, iBgContextInnerRect.iBr.iY ); |
|
224 |
|
225 #ifdef TASKSWITCHER_USE_CUSTOM_LAYOUT |
|
226 if ( iFastSwapArea ) |
|
227 { |
|
228 iBgContextOuterRect = iFastSwapArea->Rect(); |
|
229 iBgContextInnerRect = iFastSwapArea->Rect(); |
|
230 } |
|
231 #endif |
|
232 |
|
233 TSLOG_OUT(); |
|
234 } |
|
235 |
|
236 // ----------------------------------------------------------------------------- |
|
237 // CTsAppView::CreateControlsL |
|
238 // ----------------------------------------------------------------------------- |
|
239 // |
|
240 void CTsAppView::CreateControlsL() |
|
241 { |
|
242 RArray<TRect> rects; |
|
243 CleanupClosePushL( rects ); |
|
244 rects.ReserveL( 2 ); // so appending in GetRects cannot fail |
|
245 GetRects( rects ); |
|
246 |
|
247 iEvtHandler = CTsEventControler::NewL(*this, *this); |
|
248 iFastSwapArea = CTsFastSwapArea::NewL(rects[1], *this, |
|
249 iDeviceState, *iEvtHandler); |
|
250 iAppsHeading = new ( ELeave ) CAknPopupHeadingPane; |
|
251 |
|
252 iFastSwapArea->SetMopParent( this ); |
|
253 iFastSwapArea->SetFocusing( ETrue ); |
|
254 iFastSwapArea->Setup( *this ); |
|
255 iFastSwapArea->SetDataChangeObserver( this ); |
|
256 |
|
257 iAppsHeading->SetContainerWindowL( *this ); |
|
258 iAppsHeading->ConstructL( KNullDesC() ); |
|
259 iAppsHeading->SetLayout( CAknPopupHeadingPane::EListHeadingPane ); |
|
260 |
|
261 //TODO: check why we need to set rect (set already in contructL) |
|
262 iFastSwapArea->SetRect( rects[1] ); // cannot be before iAppsHeading constructL |
|
263 iAppsHeading->SetRect( rects[0] ); |
|
264 |
|
265 CleanupStack::PopAndDestroy( &rects ); |
|
266 |
|
267 UpdateHeadingsL(); |
|
268 } |
|
269 |
|
270 // ----------------------------------------------------------------------------- |
|
271 // CTsAppView::GetRects |
|
272 // ----------------------------------------------------------------------------- |
|
273 // |
|
274 void CTsAppView::GetRects( RArray<TRect>& aRects ) |
|
275 { |
|
276 TSLOG_CONTEXT( CTsAppView::GetRects, TSLOG_LOCAL ); |
|
277 TSLOG_IN(); |
|
278 |
|
279 #ifndef TASKSWITCHER_USE_CUSTOM_LAYOUT |
|
280 TInt variety = Layout_Meta_Data::IsLandscapeOrientation() ? 1 : 0; |
|
281 |
|
282 TAknLayoutRect appsLabel; |
|
283 TAknLayoutRect fastSwapAreaPane; |
|
284 |
|
285 appsLabel.LayoutRect( iViewRect, |
|
286 AknLayoutScalable_Apps::heading_pane_cp07( variety ) ); |
|
287 TSLOG4( TSLOG_INFO, "apps heading rect = %d %d %d %d", |
|
288 appsLabel.Rect().iTl.iX, appsLabel.Rect().iTl.iY, |
|
289 appsLabel.Rect().iBr.iX, appsLabel.Rect().iBr.iY ); |
|
290 |
|
291 |
|
292 fastSwapAreaPane.LayoutRect( iViewRect, |
|
293 AknLayoutScalable_Apps::tport_appsw_pane( variety ) ); |
|
294 TSLOG4( TSLOG_INFO, "fsw rect = %d %d %d %d", |
|
295 fastSwapAreaPane.Rect().iTl.iX, fastSwapAreaPane.Rect().iTl.iY, |
|
296 fastSwapAreaPane.Rect().iBr.iX, fastSwapAreaPane.Rect().iBr.iY ); |
|
297 |
|
298 aRects.Append( appsLabel.Rect() ); |
|
299 aRects.Append( fastSwapAreaPane.Rect() ); |
|
300 #else |
|
301 TRect tempRect; |
|
302 AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::EScreen, tempRect); |
|
303 tempRect.iTl = TPoint(0,0); |
|
304 TRect fastSwapRect, headingRect; |
|
305 fastSwapRect.iTl = TPoint(KFswBorderSize, (tempRect.Height() - KFswItemHeight - KFswHeadingHeight) / 2 + KFswHeadingHeight); |
|
306 fastSwapRect.iBr = TPoint(tempRect.iBr.iX - KFswBorderSize, fastSwapRect.iTl.iY + KFswItemHeight); |
|
307 headingRect.iTl = TPoint(KFswBorderSize, fastSwapRect.iTl.iY - KFswHeadingHeight); |
|
308 headingRect.iBr = TPoint(fastSwapRect.iBr.iX, fastSwapRect.iTl.iY); |
|
309 aRects.Append( headingRect ); |
|
310 aRects.Append( fastSwapRect ); |
|
311 #endif |
|
312 |
|
313 TSLOG_OUT(); |
|
314 } |
|
315 |
|
316 // ----------------------------------------------------------------------------- |
|
317 // CTsAppView::SizeChanged |
|
318 // ----------------------------------------------------------------------------- |
|
319 // |
|
320 void CTsAppView::SizeChanged() |
|
321 { |
|
322 TSLOG_CONTEXT( CTsAppView::SizeChanged, TSLOG_LOCAL ); |
|
323 TSLOG_IN(); |
|
324 UpdatePopupRects(); |
|
325 iBgContext->SetFrameRects(iBgContextOuterRect, iBgContextInnerRect); |
|
326 if ( iFastSwapArea && iAppsHeading ) |
|
327 { |
|
328 RArray<TRect> rects; |
|
329 // make sure that appending in GetRect cannot fail |
|
330 if ( rects.Reserve( 2 ) == KErrNone ) |
|
331 { |
|
332 GetRects( rects ); |
|
333 iAppsHeading->SetRect( rects[0] ); |
|
334 iFastSwapArea->SetRect( rects[1] ); |
|
335 |
|
336 DrawDeferred(); |
|
337 } |
|
338 rects.Close(); |
|
339 |
|
340 // Focus jumps back to fsw |
|
341 ChangeFocus( iFastSwapArea ); |
|
342 } |
|
343 |
|
344 TSLOG_OUT(); |
|
345 } |
|
346 |
|
347 // ----------------------------------------------------------------------------- |
|
348 // CTsAppView::Draw |
|
349 // ----------------------------------------------------------------------------- |
|
350 // |
|
351 void CTsAppView::Draw( const TRect& /*aRect*/ ) const |
|
352 { |
|
353 CWindowGc& gc = SystemGc(); |
|
354 MAknsSkinInstance* skin = AknsUtils::SkinInstance(); |
|
355 AknsDrawUtils::DrawFrame( skin, |
|
356 gc, |
|
357 iBgContextOuterRect, |
|
358 iBgContextInnerRect, |
|
359 KAknsIIDQsnFrPopup, |
|
360 KAknsIIDQsnFrPopupCenter ); |
|
361 } |
|
362 |
|
363 // ----------------------------------------------------------------------------- |
|
364 // CTsAppView::MopSupplyObject |
|
365 // ----------------------------------------------------------------------------- |
|
366 // |
|
367 TTypeUid::Ptr CTsAppView::MopSupplyObject( TTypeUid aId ) |
|
368 { |
|
369 if ( aId.iUid == MAknsControlContext::ETypeId ) |
|
370 { |
|
371 return MAknsControlContext::SupplyMopObject( aId, iBgContext ); |
|
372 } |
|
373 return CCoeControl::MopSupplyObject( aId ); |
|
374 } |
|
375 |
|
376 // ----------------------------------------------------------------------------- |
|
377 // CTsAppView::OfferKeyEventL |
|
378 // ----------------------------------------------------------------------------- |
|
379 // |
|
380 TKeyResponse CTsAppView::OfferKeyEventL( |
|
381 const TKeyEvent& aKeyEvent, |
|
382 TEventCode aType ) |
|
383 { |
|
384 TSLOG_CONTEXT( OfferKeyEventL, TSLOG_LOCAL ); |
|
385 TSLOG2_IN( "iCode = %d type = %d", aKeyEvent.iCode, aType ); |
|
386 |
|
387 TKeyResponse result = EKeyWasNotConsumed; |
|
388 |
|
389 // Always use the portrait version, the layout in landscape is now |
|
390 // similar to portrait. |
|
391 result = OfferKeyEventPortraitStyleL( aKeyEvent, aType ); |
|
392 |
|
393 // handle some other keys |
|
394 if ( result == EKeyWasNotConsumed && aType == EEventKey ) |
|
395 { |
|
396 switch ( aKeyEvent.iCode ) |
|
397 { |
|
398 case EKeyYes: // send (green) key |
|
399 result = EKeyWasConsumed; |
|
400 break; |
|
401 } |
|
402 } |
|
403 |
|
404 // forward to focused control if not yet handled |
|
405 if ( result == EKeyWasNotConsumed && iFocused ) |
|
406 { |
|
407 result = iFocused->OfferKeyEventL( aKeyEvent, aType ); |
|
408 } |
|
409 |
|
410 TSLOG1_OUT( "response = %d", result ); |
|
411 return result; |
|
412 } |
|
413 |
|
414 // ----------------------------------------------------------------------------- |
|
415 // CTsAppView::OfferKeyEventPortraitStyleL |
|
416 // ----------------------------------------------------------------------------- |
|
417 // |
|
418 TKeyResponse CTsAppView::OfferKeyEventPortraitStyleL( |
|
419 const TKeyEvent& /*aKeyEvent*/, TEventCode /*aType*/) |
|
420 { |
|
421 TKeyResponse result = EKeyWasNotConsumed; |
|
422 return result; |
|
423 } |
|
424 |
|
425 |
|
426 // ----------------------------------------------------------------------------- |
|
427 // CTsAppView::CountComponentControls |
|
428 // ----------------------------------------------------------------------------- |
|
429 // |
|
430 TInt CTsAppView::CountComponentControls() const |
|
431 { |
|
432 return 2; |
|
433 } |
|
434 |
|
435 // ----------------------------------------------------------------------------- |
|
436 // CTsAppView::ComponentControl |
|
437 // ----------------------------------------------------------------------------- |
|
438 // |
|
439 CCoeControl* CTsAppView::ComponentControl( TInt aIndex ) const |
|
440 { |
|
441 switch ( aIndex ) |
|
442 { |
|
443 case 0: |
|
444 return iFastSwapArea; |
|
445 case 1: |
|
446 return iAppsHeading; |
|
447 default: |
|
448 return NULL; |
|
449 } |
|
450 } |
|
451 |
|
452 // ----------------------------------------------------------------------------- |
|
453 // CTsAppView::HandleSwitchToBackgroundEvent |
|
454 // ----------------------------------------------------------------------------- |
|
455 // |
|
456 void CTsAppView::HandleSwitchToBackgroundEvent() |
|
457 { |
|
458 // Stop animation and unfade |
|
459 GfxTransEffect::Abort(); |
|
460 iPopupFader.FadeBehindPopup( this, NULL, EFalse ); |
|
461 |
|
462 GfxTransEffect::Begin( this, 5); |
|
463 // Forward event to interested controls |
|
464 iFastSwapArea->HandleSwitchToBackgroundEvent(); |
|
465 |
|
466 // Hide |
|
467 MakeVisible( EFalse ); |
|
468 //GfxTransEffect::NotifyExternalState( ENotifyGlobalAbort ); |
|
469 CAknTransitionUtils::MakeVisibleSubComponents( this, |
|
470 CAknTransitionUtils::EForceInvisible ); |
|
471 } |
|
472 |
|
473 // ----------------------------------------------------------------------------- |
|
474 // CTsAppView::HandleSwitchToForegroundEvent |
|
475 // ----------------------------------------------------------------------------- |
|
476 // |
|
477 void CTsAppView::HandleSwitchToForegroundEvent() |
|
478 { |
|
479 Window().Invalidate(Rect()); |
|
480 |
|
481 // Fade behind the pop-up |
|
482 iPopupFader.FadeBehindPopup( this, NULL, ETrue ); |
|
483 |
|
484 DrawDeferred(); // otherwise some parts may not be drawn properly |
|
485 |
|
486 // Focus jumps back to fsw |
|
487 ChangeFocus( iFastSwapArea ); |
|
488 |
|
489 // Forward event to interested controls |
|
490 iFastSwapArea->HandleSwitchToForegroundEvent(); |
|
491 |
|
492 // Start animation |
|
493 CTsAppUi* appui = |
|
494 static_cast<CTsAppUi*>( iEikonEnv->AppUi() ); |
|
495 if ( appui->EffectsEnabled() ) |
|
496 { |
|
497 InvalidateWindows( this ); |
|
498 appui->StartTransion(AknTransEffect::EApplicationStart); |
|
499 } |
|
500 else |
|
501 { |
|
502 CAknTransitionUtils::MakeVisibleSubComponents( this, |
|
503 CAknTransitionUtils::EForceVisible ); |
|
504 MakeVisible( ETrue ); |
|
505 } |
|
506 |
|
507 DrawDeferred(); |
|
508 } |
|
509 |
|
510 // ----------------------------------------------------------------------------- |
|
511 // CTsAppView::ChangeFocus |
|
512 // ----------------------------------------------------------------------------- |
|
513 // |
|
514 void CTsAppView::ChangeFocus( CCoeControl* aNewFocusedControl ) |
|
515 { |
|
516 if ( iFocused != aNewFocusedControl ) |
|
517 { |
|
518 if ( iFocused ) |
|
519 { |
|
520 iFocused->SetFocus( EFalse, EDrawNow ); |
|
521 } |
|
522 iFocused = aNewFocusedControl; |
|
523 if ( iFocused ) |
|
524 { |
|
525 iFocused->SetFocus( ETrue, EDrawNow ); |
|
526 } |
|
527 } |
|
528 } |
|
529 |
|
530 // ----------------------------------------------------------------------------- |
|
531 // CTsAppView::HandleControlEventL |
|
532 // EEventRequestFocus must be handled to have proper focus change also with |
|
533 // pointer events. |
|
534 // Observed controls are the ganes list and grid. |
|
535 // ----------------------------------------------------------------------------- |
|
536 // |
|
537 void CTsAppView::HandleControlEventL( CCoeControl* aControl, |
|
538 TCoeEvent aEventType ) |
|
539 { |
|
540 switch ( aEventType ) |
|
541 { |
|
542 case EEventRequestFocus: |
|
543 // must use the parent because aControl is the ganes control |
|
544 ChangeFocus( aControl->Parent() ); |
|
545 break; |
|
546 } |
|
547 } |
|
548 |
|
549 // ----------------------------------------------------------------------------- |
|
550 // CTsAppView::HandleDeviceStateChanged |
|
551 // Called when screen orientation, touch awareness, or the skin has been changed. |
|
552 // ----------------------------------------------------------------------------- |
|
553 // |
|
554 void CTsAppView::HandleDeviceStateChanged( TChangeType /*aChangeType*/ ) |
|
555 { |
|
556 TSLOG_CONTEXT( HandleDeviceStateChanged, TSLOG_LOCAL ); |
|
557 TSLOG_IN(); |
|
558 |
|
559 // Just set all the sizes, even when there is a skin change, because this will |
|
560 // guarantee proper redraw also with the ganes controls. |
|
561 |
|
562 iViewRect = Rect(); |
|
563 TSLOG4( TSLOG_INFO, "setting rect %d %d %d %d", |
|
564 iViewRect.iTl.iX, iViewRect.iTl.iY, |
|
565 iViewRect.iBr.iX, iViewRect.iBr.iY ); |
|
566 SetRect( iViewRect ); |
|
567 |
|
568 TSLOG_OUT(); |
|
569 } |
|
570 |
|
571 // ----------------------------------------------------------------------------- |
|
572 // CTsAppView::CountFadedComponents |
|
573 // ----------------------------------------------------------------------------- |
|
574 // |
|
575 TInt CTsAppView::CountFadedComponents() |
|
576 { |
|
577 return 3; |
|
578 } |
|
579 |
|
580 // ----------------------------------------------------------------------------- |
|
581 // CTsAppView::FadedComponent |
|
582 // ----------------------------------------------------------------------------- |
|
583 // |
|
584 CCoeControl* CTsAppView::FadedComponent( TInt aIndex ) |
|
585 { |
|
586 // well, these are in fact the components that will _not_ be faded... |
|
587 // Must return the bottom-level controls here, e.g. the ganes controls, not the wrappers over them. |
|
588 switch ( aIndex ) |
|
589 { |
|
590 case 0: |
|
591 return this; |
|
592 case 1: |
|
593 return iFastSwapArea->GetChildControl(); |
|
594 case 2: |
|
595 return iAppsHeading; |
|
596 // case 3: |
|
597 // return iEikonEnv->AppUiFactory()->Cba(); |
|
598 default: |
|
599 return NULL; |
|
600 } |
|
601 } |
|
602 |
|
603 // ----------------------------------------------------------------------------- |
|
604 // CTsAppView::HandlePointerEventL |
|
605 // ----------------------------------------------------------------------------- |
|
606 // |
|
607 void CTsAppView::HandlePointerEventL( const TPointerEvent &aPointerEvent ) |
|
608 { |
|
609 MTouchFeedback* feedback = MTouchFeedback::Instance(); |
|
610 if(0 != feedback && |
|
611 (TPointerEvent::EButton1Down == aPointerEvent.iType || |
|
612 TPointerEvent::EButton1Up == aPointerEvent.iType)) |
|
613 { |
|
614 feedback->InstantFeedback(this, |
|
615 ETouchFeedbackBasic, |
|
616 ETouchFeedbackVibra, |
|
617 aPointerEvent); |
|
618 } |
|
619 iFastSwapArea->HandlePointerEventL(aPointerEvent); |
|
620 } |
|
621 |
|
622 // ----------------------------------------------------------------------------- |
|
623 // CTsAppView::DataChanged |
|
624 // ----------------------------------------------------------------------------- |
|
625 // |
|
626 void CTsAppView::DataChanged( CCoeControl* /*aWhere*/, TInt /*aNewCount*/ ) |
|
627 { |
|
628 TRAP_IGNORE( UpdateHeadingsL() ); |
|
629 } |
|
630 |
|
631 // ----------------------------------------------------------------------------- |
|
632 // CTsAppView::UpdateHeadingsL |
|
633 // ----------------------------------------------------------------------------- |
|
634 // |
|
635 void CTsAppView::UpdateHeadingsL() |
|
636 { |
|
637 #ifndef TASKSWITCHER_USE_CUSTOM_LAYOUT |
|
638 HBufC* text = StringLoader::LoadLC( |
|
639 R_TASK_SWITCHER_HEADING_APPLICATIONS ); |
|
640 #else |
|
641 _LIT( KTitle, "Task switcher" ); |
|
642 HBufC* text = KTitle().AllocLC(); |
|
643 #endif |
|
644 iAppsHeading->SetTextL( *text ); |
|
645 iAppsHeading->DrawDeferred(); |
|
646 CleanupStack::PopAndDestroy( text ); |
|
647 |
|
648 } |
|
649 |
|
650 |
|
651 // ----------------------------------------------------------------------------- |
|
652 // CTsAppView::HandleAppKey |
|
653 // ----------------------------------------------------------------------------- |
|
654 // |
|
655 void CTsAppView::HandleAppKey(TInt aType) |
|
656 { |
|
657 iFastSwapArea->HandleAppKey(aType); |
|
658 } |
|
659 |
|
660 // ----------------------------------------------------------------------------- |
|
661 // CTsAppView::MoveOffset |
|
662 // ----------------------------------------------------------------------------- |
|
663 // |
|
664 void CTsAppView::MoveOffset(const TPoint& aOffset) |
|
665 { |
|
666 iFastSwapArea->MoveOffset(aOffset); |
|
667 } |
|
668 |
|
669 // ----------------------------------------------------------------------------- |
|
670 // CTsAppView::TapL |
|
671 // ----------------------------------------------------------------------------- |
|
672 // |
|
673 void CTsAppView::TapL(const TPoint& aPoint) |
|
674 { |
|
675 if(iFastSwapArea->Rect().Contains(aPoint)) |
|
676 { |
|
677 iFastSwapArea->TapL(aPoint); |
|
678 DrawNow(); |
|
679 } |
|
680 else if( !iAppsHeading->Rect().Contains(aPoint)) |
|
681 { |
|
682 //move task switcher to background |
|
683 iEikonEnv->EikAppUi()->HandleCommandL(EAknSoftkeyExit); |
|
684 } |
|
685 } |
|
686 |
|
687 // ----------------------------------------------------------------------------- |
|
688 // CTsAppView::LongTapL |
|
689 // ----------------------------------------------------------------------------- |
|
690 // |
|
691 void CTsAppView::LongTapL(const TPoint& aPoint) |
|
692 { |
|
693 if(iFastSwapArea->Rect().Contains(aPoint)) |
|
694 { |
|
695 iFastSwapArea->LongTapL(aPoint); |
|
696 } |
|
697 else if( !iAppsHeading->Rect().Contains(aPoint)) |
|
698 { |
|
699 //move task switcher to background |
|
700 iEikonEnv->EikAppUi()->HandleCommandL(EAknSoftkeyExit); |
|
701 } |
|
702 } |
|
703 |
|
704 // ----------------------------------------------------------------------------- |
|
705 // CTsAppView::Drag() |
|
706 // ----------------------------------------------------------------------------- |
|
707 // |
|
708 void CTsAppView::Drag(const MAknTouchGestureFwDragEvent& aEvent) |
|
709 { |
|
710 iFastSwapArea->Drag(aEvent); |
|
711 } |
|
712 |
|
713 // ----------------------------------------------------------------------------- |
|
714 // CTsAppView::Stop |
|
715 // ----------------------------------------------------------------------------- |
|
716 // |
|
717 void CTsAppView::Stop() |
|
718 { |
|
719 iFastSwapArea->Stop(); |
|
720 } |
|
721 |
|
722 // ----------------------------------------------------------------------------- |
|
723 // CTsAppView::ViewPos |
|
724 // ----------------------------------------------------------------------------- |
|
725 // |
|
726 TPoint CTsAppView::ViewPos() const |
|
727 { |
|
728 return iFastSwapArea->ViewPos(); |
|
729 } |
|
730 |
|
731 // End of file |