27 #include <gfxtranseffect/gfxtranseffect.h> |
27 #include <gfxtranseffect/gfxtranseffect.h> |
28 #include <akntransitionutils.h> |
28 #include <akntransitionutils.h> |
29 #include <akntranseffect.h> |
29 #include <akntranseffect.h> |
30 #include <aknPopupHeadingPane.h> |
30 #include <aknPopupHeadingPane.h> |
31 #include <StringLoader.h> |
31 #include <StringLoader.h> |
32 #include <tstaskswitcher.rsg> |
32 #include <taskswitcher.rsg> |
33 #include <touchfeedback.h> |
|
34 |
|
35 #include "tsappview.h" |
33 #include "tsappview.h" |
36 #include "tsappui.h" |
34 #include "tsappui.h" |
37 #include "tsapplogging.h" |
35 #include "tsapplogging.h" |
38 #include "tsfastswaparea.h" |
36 #include "tsfastswaparea.h" |
39 #include "tseventcontroler.h" |
37 #include "tseventcontroler.h" |
40 #include "tsuid.hrh" |
38 #include "tsuid.hrh" |
41 |
39 |
|
40 |
|
41 |
42 // ----------------------------------------------------------------------------- |
42 // ----------------------------------------------------------------------------- |
43 // CTsAppView::NewL |
43 // CTsAppView::NewL |
44 // ----------------------------------------------------------------------------- |
44 // ----------------------------------------------------------------------------- |
45 // |
45 // |
46 CTsAppView* CTsAppView::NewL( const TRect& aRect, |
46 CTsAppView* CTsAppView::NewL( const TRect& aRect, |
47 CTsDeviceState& aDeviceState ) |
47 CTsDeviceState& aDeviceState, |
48 { |
48 RWindowGroup& aWg) |
49 CTsAppView* self = CTsAppView::NewLC( aRect, aDeviceState ); |
49 { |
|
50 CTsAppView* self = CTsAppView::NewLC( aRect, aDeviceState, aWg ); |
50 CleanupStack::Pop( self ); |
51 CleanupStack::Pop( self ); |
51 return self; |
52 return self; |
52 } |
53 } |
53 |
54 |
54 // ----------------------------------------------------------------------------- |
55 // ----------------------------------------------------------------------------- |
55 // CTsAppView::NewLC |
56 // CTsAppView::NewLC |
56 // ----------------------------------------------------------------------------- |
57 // ----------------------------------------------------------------------------- |
57 // |
58 // |
58 CTsAppView* CTsAppView::NewLC( const TRect& aRect, |
59 CTsAppView* CTsAppView::NewLC( const TRect& aRect, |
59 CTsDeviceState& aDeviceState ) |
60 CTsDeviceState& aDeviceState, |
|
61 RWindowGroup& aWg) |
60 { |
62 { |
61 CTsAppView* self = new (ELeave) CTsAppView( aDeviceState ); |
63 CTsAppView* self = new (ELeave) CTsAppView( aDeviceState ); |
62 CleanupStack::PushL( self ); |
64 CleanupStack::PushL( self ); |
63 self->ConstructL( aRect ); |
65 self->ConstructL( aRect, aWg ); |
64 return self; |
66 return self; |
65 } |
67 } |
66 |
68 |
67 // ----------------------------------------------------------------------------- |
69 // ----------------------------------------------------------------------------- |
68 // CTsAppView::CTsAppView |
70 // CTsAppView::CTsAppView |
98 // CTsAppView::~CTsAppView |
100 // CTsAppView::~CTsAppView |
99 // ----------------------------------------------------------------------------- |
101 // ----------------------------------------------------------------------------- |
100 // |
102 // |
101 CTsAppView::~CTsAppView() |
103 CTsAppView::~CTsAppView() |
102 { |
104 { |
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; |
105 delete iBgContext; |
112 delete iFastSwapArea; |
106 delete iFastSwapArea; |
113 delete iAppsHeading; |
107 delete iAppsHeading; |
114 |
108 |
115 delete iEvtHandler; |
109 delete iEvtHandler; |
117 |
111 |
118 // ----------------------------------------------------------------------------- |
112 // ----------------------------------------------------------------------------- |
119 // CTsAppView::ConstructL |
113 // CTsAppView::ConstructL |
120 // ----------------------------------------------------------------------------- |
114 // ----------------------------------------------------------------------------- |
121 // |
115 // |
122 void CTsAppView::ConstructL( const TRect& aRect ) |
116 void CTsAppView::ConstructL( const TRect& aRect, RWindowGroup& aWg ) |
123 { |
117 { |
124 TSLOG_CONTEXT( CTsAppView::ConstructL, TSLOG_LOCAL ); |
118 TSLOG_CONTEXT( CTsAppView::ConstructL, TSLOG_LOCAL ); |
125 TSLOG_IN(); |
119 TSLOG_IN(); |
126 |
120 |
127 // Create a window for this application view |
121 // Create a window for this application view |
128 CreateWindowL(); |
122 CreateWindowL(aWg); |
129 |
123 |
130 // Store rect |
124 // Store rect |
131 TInt variety = Layout_Meta_Data::IsLandscapeOrientation() ? 1 : 0; |
125 TInt variety = Layout_Meta_Data::IsLandscapeOrientation() ? 1 : 0; |
132 TAknLayoutRect mainView; |
126 TAknLayoutRect mainView; |
133 mainView.LayoutRect( aRect, |
127 mainView.LayoutRect( aRect, |
219 iBgContextOuterRect.iTl.iX, iBgContextOuterRect.iTl.iY, |
212 iBgContextOuterRect.iTl.iX, iBgContextOuterRect.iTl.iY, |
220 iBgContextOuterRect.iBr.iX, iBgContextOuterRect.iBr.iY ); |
213 iBgContextOuterRect.iBr.iX, iBgContextOuterRect.iBr.iY ); |
221 TSLOG4( TSLOG_INFO, "inner rect for popup = %d %d %d %d", |
214 TSLOG4( TSLOG_INFO, "inner rect for popup = %d %d %d %d", |
222 iBgContextInnerRect.iTl.iX, iBgContextInnerRect.iTl.iY, |
215 iBgContextInnerRect.iTl.iX, iBgContextInnerRect.iTl.iY, |
223 iBgContextInnerRect.iBr.iX, iBgContextInnerRect.iBr.iY ); |
216 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 |
217 |
233 TSLOG_OUT(); |
218 TSLOG_OUT(); |
234 } |
219 } |
235 |
220 |
236 // ----------------------------------------------------------------------------- |
221 // ----------------------------------------------------------------------------- |
453 // CTsAppView::HandleSwitchToBackgroundEvent |
439 // CTsAppView::HandleSwitchToBackgroundEvent |
454 // ----------------------------------------------------------------------------- |
440 // ----------------------------------------------------------------------------- |
455 // |
441 // |
456 void CTsAppView::HandleSwitchToBackgroundEvent() |
442 void CTsAppView::HandleSwitchToBackgroundEvent() |
457 { |
443 { |
458 // Stop animation and unfade |
|
459 GfxTransEffect::Abort(); |
|
460 iPopupFader.FadeBehindPopup( this, NULL, EFalse ); |
444 iPopupFader.FadeBehindPopup( this, NULL, EFalse ); |
461 |
445 |
462 GfxTransEffect::Begin( this, 5); |
|
463 // Forward event to interested controls |
|
464 iFastSwapArea->HandleSwitchToBackgroundEvent(); |
446 iFastSwapArea->HandleSwitchToBackgroundEvent(); |
465 |
447 |
466 // Hide |
|
467 MakeVisible( EFalse ); |
|
468 //GfxTransEffect::NotifyExternalState( ENotifyGlobalAbort ); |
|
469 CAknTransitionUtils::MakeVisibleSubComponents( this, |
|
470 CAknTransitionUtils::EForceInvisible ); |
|
471 } |
448 } |
472 |
449 |
473 // ----------------------------------------------------------------------------- |
450 // ----------------------------------------------------------------------------- |
474 // CTsAppView::HandleSwitchToForegroundEvent |
451 // CTsAppView::HandleSwitchToForegroundEvent |
475 // ----------------------------------------------------------------------------- |
452 // ----------------------------------------------------------------------------- |
476 // |
453 // |
477 void CTsAppView::HandleSwitchToForegroundEvent() |
454 void CTsAppView::HandleSwitchToForegroundEvent() |
478 { |
455 { |
|
456 TSLOG_CONTEXT( CTsAppView::HandleSwitchToForegroundEvent, TSLOG_LOCAL ); |
|
457 TSLOG_IN(); |
|
458 |
479 Window().Invalidate(Rect()); |
459 Window().Invalidate(Rect()); |
480 |
460 |
481 // Fade behind the pop-up |
461 // Fade behind the pop-up |
482 iPopupFader.FadeBehindPopup( this, NULL, ETrue ); |
462 iPopupFader.FadeBehindPopup( this, NULL, ETrue ); |
483 |
463 |
493 CTsAppUi* appui = |
473 CTsAppUi* appui = |
494 static_cast<CTsAppUi*>( iEikonEnv->AppUi() ); |
474 static_cast<CTsAppUi*>( iEikonEnv->AppUi() ); |
495 if ( appui->EffectsEnabled() ) |
475 if ( appui->EffectsEnabled() ) |
496 { |
476 { |
497 InvalidateWindows( this ); |
477 InvalidateWindows( this ); |
498 appui->StartTransion(AknTransEffect::EApplicationStart); |
478 appui->StartTransion(CTsAppUi::EForegroundTransition); |
499 } |
479 } |
500 else |
480 else |
501 { |
481 { |
502 CAknTransitionUtils::MakeVisibleSubComponents( this, |
482 CAknTransitionUtils::MakeVisibleSubComponents( this, |
503 CAknTransitionUtils::EForceVisible ); |
483 CAknTransitionUtils::EForceVisible ); |
504 MakeVisible( ETrue ); |
484 MakeVisible( ETrue ); |
505 } |
485 } |
506 |
486 |
507 DrawDeferred(); |
487 DrawDeferred(); |
|
488 |
|
489 TSLOG_OUT(); |
508 } |
490 } |
509 |
491 |
510 // ----------------------------------------------------------------------------- |
492 // ----------------------------------------------------------------------------- |
511 // CTsAppView::ChangeFocus |
493 // CTsAppView::ChangeFocus |
512 // ----------------------------------------------------------------------------- |
494 // ----------------------------------------------------------------------------- |
549 // ----------------------------------------------------------------------------- |
531 // ----------------------------------------------------------------------------- |
550 // CTsAppView::HandleDeviceStateChanged |
532 // CTsAppView::HandleDeviceStateChanged |
551 // Called when screen orientation, touch awareness, or the skin has been changed. |
533 // Called when screen orientation, touch awareness, or the skin has been changed. |
552 // ----------------------------------------------------------------------------- |
534 // ----------------------------------------------------------------------------- |
553 // |
535 // |
554 void CTsAppView::HandleDeviceStateChanged( TChangeType /*aChangeType*/ ) |
536 void CTsAppView::HandleDeviceStateChanged( TChangeType aChangeType ) |
555 { |
537 { |
556 TSLOG_CONTEXT( HandleDeviceStateChanged, TSLOG_LOCAL ); |
538 TSLOG_CONTEXT( HandleDeviceStateChanged, TSLOG_LOCAL ); |
557 TSLOG_IN(); |
539 TSLOG_IN(); |
558 |
540 |
559 // Just set all the sizes, even when there is a skin change, because this will |
541 // Just set all the sizes, even when there is a skin change, because this will |
560 // guarantee proper redraw also with the ganes controls. |
542 // guarantee proper redraw also with the ganes controls. |
561 |
543 |
562 iViewRect = Rect(); |
544 if(aChangeType == EOrientation) |
563 TSLOG4( TSLOG_INFO, "setting rect %d %d %d %d", |
545 { |
564 iViewRect.iTl.iX, iViewRect.iTl.iY, |
546 SetRect( static_cast<CAknAppUi*>(iEikonEnv->AppUi())->ApplicationRect() ); |
565 iViewRect.iBr.iX, iViewRect.iBr.iY ); |
547 } |
566 SetRect( iViewRect ); |
548 else |
|
549 { |
|
550 iViewRect = Rect(); |
|
551 TSLOG4( TSLOG_INFO, "setting rect %d %d %d %d", |
|
552 iViewRect.iTl.iX, iViewRect.iTl.iY, |
|
553 iViewRect.iBr.iX, iViewRect.iBr.iY ); |
|
554 SetRect( iViewRect ); |
|
555 } |
|
556 |
|
557 InvalidateWindows(this); |
567 |
558 |
568 TSLOG_OUT(); |
559 TSLOG_OUT(); |
569 } |
560 } |
570 |
561 |
571 // ----------------------------------------------------------------------------- |
562 // ----------------------------------------------------------------------------- |
604 // CTsAppView::HandlePointerEventL |
595 // CTsAppView::HandlePointerEventL |
605 // ----------------------------------------------------------------------------- |
596 // ----------------------------------------------------------------------------- |
606 // |
597 // |
607 void CTsAppView::HandlePointerEventL( const TPointerEvent &aPointerEvent ) |
598 void CTsAppView::HandlePointerEventL( const TPointerEvent &aPointerEvent ) |
608 { |
599 { |
609 MTouchFeedback* feedback = MTouchFeedback::Instance(); |
600 if( TPointerEvent::EButton1Down == aPointerEvent.iType ) |
610 if(0 != feedback && |
601 { |
611 (TPointerEvent::EButton1Down == aPointerEvent.iType || |
602 LaunchFeedback(ETouchFeedbackBasic, TTouchFeedbackType( |
612 TPointerEvent::EButton1Up == aPointerEvent.iType)) |
603 ETouchFeedbackVibra | ETouchFeedbackAudio), aPointerEvent); |
613 { |
|
614 feedback->InstantFeedback(this, |
|
615 ETouchFeedbackBasic, |
|
616 ETouchFeedbackVibra, |
|
617 aPointerEvent); |
|
618 } |
604 } |
619 iFastSwapArea->HandlePointerEventL(aPointerEvent); |
605 iFastSwapArea->HandlePointerEventL(aPointerEvent); |
620 } |
606 } |
621 |
607 |
622 // ----------------------------------------------------------------------------- |
608 // ----------------------------------------------------------------------------- |
655 void CTsAppView::HandleAppKey(TInt aType) |
641 void CTsAppView::HandleAppKey(TInt aType) |
656 { |
642 { |
657 iFastSwapArea->HandleAppKey(aType); |
643 iFastSwapArea->HandleAppKey(aType); |
658 } |
644 } |
659 |
645 |
|
646 |
|
647 // ----------------------------------------------------------------------------- |
|
648 // CTsAppView::OrderBackgrRedraw |
|
649 // ----------------------------------------------------------------------------- |
|
650 // |
|
651 void CTsAppView::OrderFullWindowRedraw() |
|
652 { |
|
653 InvalidateWindows(this); |
|
654 DrawNow(); |
|
655 } |
|
656 |
|
657 |
660 // ----------------------------------------------------------------------------- |
658 // ----------------------------------------------------------------------------- |
661 // CTsAppView::MoveOffset |
659 // CTsAppView::MoveOffset |
662 // ----------------------------------------------------------------------------- |
660 // ----------------------------------------------------------------------------- |
663 // |
661 // |
664 void CTsAppView::MoveOffset(const TPoint& aOffset) |
662 void CTsAppView::MoveOffset(const TPoint& aOffset) |
700 iEikonEnv->EikAppUi()->HandleCommandL(EAknSoftkeyExit); |
698 iEikonEnv->EikAppUi()->HandleCommandL(EAknSoftkeyExit); |
701 } |
699 } |
702 } |
700 } |
703 |
701 |
704 // ----------------------------------------------------------------------------- |
702 // ----------------------------------------------------------------------------- |
705 // CTsAppView::Drag() |
703 // CTsAppView::DragL() |
706 // ----------------------------------------------------------------------------- |
704 // ----------------------------------------------------------------------------- |
707 // |
705 // |
708 void CTsAppView::Drag(const MAknTouchGestureFwDragEvent& aEvent) |
706 void CTsAppView::DragL(const MAknTouchGestureFwDragEvent& aEvent) |
709 { |
707 { |
710 iFastSwapArea->Drag(aEvent); |
708 if( aEvent.State() == EAknTouchGestureFwStop ) |
|
709 { |
|
710 LaunchFeedback(ETouchFeedbackBasic, TTouchFeedbackType( |
|
711 ETouchFeedbackVibra | ETouchFeedbackAudio), TPointerEvent()); |
|
712 } |
|
713 if( iFastSwapArea->Rect().Contains(aEvent.StartPosition()) || |
|
714 iAppsHeading->Rect().Contains(aEvent.StartPosition()) ) |
|
715 { |
|
716 iFastSwapArea->DragL(aEvent); |
|
717 } |
|
718 else |
|
719 { |
|
720 //move task switcher to background |
|
721 iEikonEnv->EikAppUi()->HandleCommandL(EAknSoftkeyExit); |
|
722 } |
711 } |
723 } |
712 |
724 |
713 // ----------------------------------------------------------------------------- |
725 // ----------------------------------------------------------------------------- |
714 // CTsAppView::Stop |
726 // CTsAppView::Stop |
715 // ----------------------------------------------------------------------------- |
727 // ----------------------------------------------------------------------------- |
726 TPoint CTsAppView::ViewPos() const |
738 TPoint CTsAppView::ViewPos() const |
727 { |
739 { |
728 return iFastSwapArea->ViewPos(); |
740 return iFastSwapArea->ViewPos(); |
729 } |
741 } |
730 |
742 |
|
743 // ----------------------------------------------------------------------------- |
|
744 // CTsAppView::LaunchFeedback |
|
745 // ----------------------------------------------------------------------------- |
|
746 // |
|
747 void CTsAppView::LaunchFeedback( TTouchLogicalFeedback aLogicalType, |
|
748 TTouchFeedbackType aFeedbackType, |
|
749 const TPointerEvent& aPointerEvent) |
|
750 { |
|
751 MTouchFeedback* feedback = MTouchFeedback::Instance(); |
|
752 if(0 != feedback) |
|
753 { |
|
754 feedback->InstantFeedback(this, aLogicalType, |
|
755 aFeedbackType, |
|
756 aPointerEvent); |
|
757 } |
|
758 } |
|
759 |
|
760 |
|
761 |
|
762 |
731 // End of file |
763 // End of file |