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