taskswitcher/taskswitcherui/taskswitcherapp/src/tsappview.cpp
branchRCL_3
changeset 18 d05a55b217df
parent 17 b8fae6b8a148
child 19 79311d856354
equal deleted inserted replaced
17:b8fae6b8a148 18:d05a55b217df
   455 void CTsAppView::HandleSwitchToForegroundEvent()
   455 void CTsAppView::HandleSwitchToForegroundEvent()
   456     {
   456     {
   457     TSLOG_CONTEXT( CTsAppView::HandleSwitchToForegroundEvent, TSLOG_LOCAL );
   457     TSLOG_CONTEXT( CTsAppView::HandleSwitchToForegroundEvent, TSLOG_LOCAL );
   458     TSLOG_IN();
   458     TSLOG_IN();
   459     
   459     
       
   460     // Forward event to interested controls
       
   461     iFastSwapArea->HandleSwitchToForegroundEvent();
       
   462     iFastSwapArea->UpdateComponentVisibility();
       
   463     
   460     // Check for layout updates
   464     // Check for layout updates
   461     CTsAppUi* appUi = static_cast<CTsAppUi*>(iCoeEnv->AppUi());
   465     CTsAppUi* appUi = static_cast<CTsAppUi*>(iCoeEnv->AppUi());
   462     if ( iViewRect != appUi->ApplicationRect() &&
   466     if ( iViewRect != appUi->ApplicationRect() &&
   463          appUi->LayoutChangeAllowed() )
   467          appUi->LayoutChangeAllowed() )
   464         {
   468         {
   474 
   478 
   475     DrawDeferred(); // otherwise some parts may not be drawn properly
   479     DrawDeferred(); // otherwise some parts may not be drawn properly
   476 
   480 
   477     // Focus jumps back to fsw
   481     // Focus jumps back to fsw
   478     ChangeFocus( iFastSwapArea );
   482     ChangeFocus( iFastSwapArea );
   479 
       
   480     // Forward event to interested controls
       
   481     iFastSwapArea->HandleSwitchToForegroundEvent();
       
   482     iFastSwapArea->UpdateComponentVisibility();
       
   483 
   483 
   484     // Start animation
   484     // Start animation
   485     CTsAppUi* appui =
   485     CTsAppUi* appui =
   486         static_cast<CTsAppUi*>( iEikonEnv->AppUi() );
   486         static_cast<CTsAppUi*>( iEikonEnv->AppUi() );
   487     if ( appui->EffectsEnabled() )
   487     if ( appui->EffectsEnabled() )
   612     {
   612     {
   613     if( TPointerEvent::EButton1Down == aPointerEvent.iType )
   613     if( TPointerEvent::EButton1Down == aPointerEvent.iType )
   614         {
   614         {
   615 		LaunchFeedback(ETouchFeedbackBasic, TTouchFeedbackType(
   615 		LaunchFeedback(ETouchFeedbackBasic, TTouchFeedbackType(
   616 				ETouchFeedbackVibra | ETouchFeedbackAudio), aPointerEvent);
   616 				ETouchFeedbackVibra | ETouchFeedbackAudio), aPointerEvent);
   617 		if ( !( iFastSwapArea->Rect().Contains(aPointerEvent.iParentPosition) ||
   617 
   618 		        iAppsHeading->Rect().Contains(aPointerEvent.iParentPosition)
   618 		if( !DragArea().Contains(aPointerEvent.iParentPosition))
   619 		       ) )
       
   620 		    {
   619 		    {
   621 		    //move task switcher to background
   620 		    //move task switcher to background
   622 		    iEvtHandler->EnableEventHandling(EFalse);
   621 		    iEvtHandler->EnableEventHandling(EFalse);
   623 		    iEikonEnv->EikAppUi()->HandleCommandL(EAknSoftkeyExit);
   622 		    iEikonEnv->EikAppUi()->HandleCommandL(EAknSoftkeyExit);
   624 		    }
   623 		    }
   728 // CTsAppView::DragL()
   727 // CTsAppView::DragL()
   729 // -----------------------------------------------------------------------------
   728 // -----------------------------------------------------------------------------
   730 //
   729 //
   731 void CTsAppView::DragL(const MAknTouchGestureFwDragEvent& aEvent)
   730 void CTsAppView::DragL(const MAknTouchGestureFwDragEvent& aEvent)
   732     {
   731     {
   733 	if( aEvent.State() == EAknTouchGestureFwStop )
   732     if(DragArea().Contains(aEvent.StartPosition()))
   734 		{
       
   735 		LaunchFeedback(ETouchFeedbackBasic, TTouchFeedbackType(
       
   736 				ETouchFeedbackVibra | ETouchFeedbackAudio), TPointerEvent());
       
   737 		}
       
   738     if( iFastSwapArea->Rect().Contains(aEvent.StartPosition()) ||
       
   739 		iAppsHeading->Rect().Contains(aEvent.StartPosition()) )
       
   740         {
   733         {
   741 		iFastSwapArea->DragL(aEvent);
   734 		iFastSwapArea->DragL(aEvent);
   742         }
   735         }
   743     }
   736     }
   744 
   737 
   776 	    		aPointerEvent);
   769 	    		aPointerEvent);
   777 	    } 
   770 	    } 
   778 	}
   771 	}
   779 
   772 
   780 
   773 
       
   774 // -----------------------------------------------------------------------------
       
   775 // CTsAppView::AppCloseInProgress()
       
   776 // -----------------------------------------------------------------------------
       
   777 //
       
   778 TBool CTsAppView::AppCloseInProgress( TInt aWgId )
       
   779     {
       
   780     return iFastSwapArea->IsAppClosing(aWgId);
       
   781     }
       
   782 // -----------------------------------------------------------------------------
       
   783 // CTsAppView::DragArea
       
   784 // -----------------------------------------------------------------------------
       
   785 //
       
   786 TRect CTsAppView::DragArea()
       
   787 	{
       
   788 	TRect dragArea;
       
   789 	if (Layout_Meta_Data::IsLandscapeOrientation())
       
   790 		{
       
   791 		dragArea.SetRect(iAppsHeading->Rect().iTl.iX,
       
   792 				iAppsHeading->Rect().iTl.iY, iFastSwapArea->Rect().iBr.iX,
       
   793 				iFastSwapArea->Rect().iBr.iY);
       
   794 		}
       
   795 	else
       
   796 		{
       
   797 		dragArea.SetRect(Rect().iTl.iX, iAppsHeading->Rect().iTl.iY,
       
   798 				Rect().iBr.iX, iFastSwapArea->Rect().iBr.iY);
       
   799 		}
       
   800 	return dragArea;
       
   801 	}    
   781 
   802 
   782 
   803 
   783 // End of file
   804 // End of file