taskswitcher/taskswitcherui/taskswitcherapp/src/tsappview.cpp
branchRCL_3
changeset 23 7be2816dbabd
parent 19 79311d856354
child 25 137ebc85284b
equal deleted inserted replaced
19:79311d856354 23:7be2816dbabd
    69 // -----------------------------------------------------------------------------
    69 // -----------------------------------------------------------------------------
    70 // CTsAppView::CTsAppView
    70 // CTsAppView::CTsAppView
    71 // -----------------------------------------------------------------------------
    71 // -----------------------------------------------------------------------------
    72 //
    72 //
    73 CTsAppView::CTsAppView(CTsDeviceState& aDeviceState)
    73 CTsAppView::CTsAppView(CTsDeviceState& aDeviceState)
    74         : iDeviceState( aDeviceState )
    74         : iDeviceState( aDeviceState ), iExitOnPointerUp(EFalse)
    75     {
    75     {
    76     // no implementation required
    76     // no implementation required
    77     }
    77     }
    78 
    78 
    79 // -----------------------------------------------------------------------------
    79 // -----------------------------------------------------------------------------
   259 void CTsAppView::GetRects( RArray<TRect>& aRects )
   259 void CTsAppView::GetRects( RArray<TRect>& aRects )
   260     {
   260     {
   261     TSLOG_CONTEXT( CTsAppView::GetRects, TSLOG_LOCAL );
   261     TSLOG_CONTEXT( CTsAppView::GetRects, TSLOG_LOCAL );
   262     TSLOG_IN();
   262     TSLOG_IN();
   263     
   263     
   264 #ifndef TASKSWITCHER_USE_CUSTOM_LAYOUT
       
   265     TInt variety = Layout_Meta_Data::IsLandscapeOrientation() ? 1 : 0;
   264     TInt variety = Layout_Meta_Data::IsLandscapeOrientation() ? 1 : 0;
   266     
   265     
   267     TAknLayoutRect appsLabel;
   266     TAknLayoutRect appsLabel;
   268     TAknLayoutRect fastSwapAreaPane;
   267     TAknLayoutRect fastSwapAreaPane;
   269 
   268 
   280             fastSwapAreaPane.Rect().iTl.iX, fastSwapAreaPane.Rect().iTl.iY,
   279             fastSwapAreaPane.Rect().iTl.iX, fastSwapAreaPane.Rect().iTl.iY,
   281             fastSwapAreaPane.Rect().iBr.iX, fastSwapAreaPane.Rect().iBr.iY );
   280             fastSwapAreaPane.Rect().iBr.iX, fastSwapAreaPane.Rect().iBr.iY );
   282 
   281 
   283     aRects.Append( appsLabel.Rect() );
   282     aRects.Append( appsLabel.Rect() );
   284     aRects.Append( fastSwapAreaPane.Rect() );
   283     aRects.Append( fastSwapAreaPane.Rect() );
   285 #else
       
   286     TRect tempRect;
       
   287     AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::EScreen, tempRect);
       
   288     tempRect.iTl = TPoint(0,0);
       
   289     TRect fastSwapRect, headingRect;
       
   290     fastSwapRect.iTl = TPoint(KFswBorderSize, (tempRect.Height() - KFswItemHeight - KFswHeadingHeight) / 2 + KFswHeadingHeight);
       
   291     fastSwapRect.iBr = TPoint(tempRect.iBr.iX - KFswBorderSize, fastSwapRect.iTl.iY + KFswItemHeight);
       
   292     headingRect.iTl = TPoint(KFswBorderSize, fastSwapRect.iTl.iY - KFswHeadingHeight);
       
   293     headingRect.iBr = TPoint(fastSwapRect.iBr.iX, fastSwapRect.iTl.iY);
       
   294     aRects.Append( headingRect );
       
   295     aRects.Append( fastSwapRect );
       
   296 #endif
       
   297 
   284 
   298     TSLOG_OUT();
   285     TSLOG_OUT();
   299     }
   286     }
   300 
   287 
   301 // -----------------------------------------------------------------------------
   288 // -----------------------------------------------------------------------------
   610 //
   597 //
   611 void CTsAppView::HandlePointerEventL( const TPointerEvent &aPointerEvent )
   598 void CTsAppView::HandlePointerEventL( const TPointerEvent &aPointerEvent )
   612     {
   599     {
   613     if( TPointerEvent::EButton1Down == aPointerEvent.iType )
   600     if( TPointerEvent::EButton1Down == aPointerEvent.iType )
   614         {
   601         {
       
   602         iEvtHandler->EnableEventHandling(ETrue);
       
   603         iExitOnPointerUp = EFalse;
   615 		LaunchFeedback(ETouchFeedbackBasic, TTouchFeedbackType(
   604 		LaunchFeedback(ETouchFeedbackBasic, TTouchFeedbackType(
   616 				ETouchFeedbackVibra | ETouchFeedbackAudio), aPointerEvent);
   605 				ETouchFeedbackVibra | ETouchFeedbackAudio), aPointerEvent);
   617 
   606 
   618 		if( !DragArea().Contains(aPointerEvent.iParentPosition))
   607 		if( !DragArea().Contains(aPointerEvent.iParentPosition) ||
       
   608 		    !iFastSwapArea->Count() )
   619 		    {
   609 		    {
   620 		    //move task switcher to background
   610 		    //move task switcher to background
   621 		    iEvtHandler->EnableEventHandling(EFalse);
   611 		    iEvtHandler->EnableEventHandling(EFalse);
   622 		    iEikonEnv->EikAppUi()->HandleCommandL(EAknSoftkeyExit);
   612 		    if ( !iAppsHeading->Rect().Contains( aPointerEvent.iParentPosition ) ||
       
   613 		         !iFastSwapArea->Count() )
       
   614 		        {
       
   615 		        iExitOnPointerUp = ETrue;
       
   616 		        }
   623 		    }
   617 		    }
       
   618         }
       
   619     else if( TPointerEvent::EButton1Up == aPointerEvent.iType && iExitOnPointerUp )
       
   620         {
       
   621         // Possible exit, check if pointer up is outside of control area
       
   622         if( ( !DragArea().Contains(aPointerEvent.iParentPosition) &&
       
   623               !iAppsHeading->Rect().Contains(aPointerEvent.iParentPosition) ) ||
       
   624             !iFastSwapArea->Count() )
       
   625             {
       
   626             iEikonEnv->EikAppUi()->HandleCommandL(EAknSoftkeyExit);
       
   627             }
   624         }
   628         }
   625     iFastSwapArea->HandlePointerEventL(aPointerEvent);
   629     iFastSwapArea->HandlePointerEventL(aPointerEvent);
   626     }
   630     }
   627 
   631 
   628 // -----------------------------------------------------------------------------
   632 // -----------------------------------------------------------------------------
   771 //
   775 //
   772 TBool CTsAppView::AppCloseInProgress( TInt aWgId )
   776 TBool CTsAppView::AppCloseInProgress( TInt aWgId )
   773     {
   777     {
   774     return iFastSwapArea->IsAppClosing(aWgId);
   778     return iFastSwapArea->IsAppClosing(aWgId);
   775     }
   779     }
       
   780 
       
   781 
       
   782 // -----------------------------------------------------------------------------
       
   783 // CTsAppView::WgOnTaskList()
       
   784 // -----------------------------------------------------------------------------
       
   785 //
       
   786 TBool CTsAppView::WgOnTaskList( TInt aWgId )
       
   787     {
       
   788     return iFastSwapArea->WgOnTaskList(aWgId);
       
   789     }
       
   790 
   776 // -----------------------------------------------------------------------------
   791 // -----------------------------------------------------------------------------
   777 // CTsAppView::DragArea
   792 // CTsAppView::DragArea
   778 // -----------------------------------------------------------------------------
   793 // -----------------------------------------------------------------------------
   779 //
   794 //
   780 TRect CTsAppView::DragArea()
   795 TRect CTsAppView::DragArea()
   781 	{
   796 	{
   782 	TRect dragArea;
   797 	TRect dragArea;
   783 	if (Layout_Meta_Data::IsLandscapeOrientation())
   798 	if (Layout_Meta_Data::IsLandscapeOrientation())
   784 		{
   799 		{
   785 		dragArea.SetRect(iAppsHeading->Rect().iTl.iX,
   800 		dragArea.SetRect(iAppsHeading->Rect().iTl.iX,
   786 				iAppsHeading->Rect().iTl.iY, iFastSwapArea->Rect().iBr.iX,
   801 		        iFastSwapArea->Rect().iTl.iY, iFastSwapArea->Rect().iBr.iX,
   787 				iFastSwapArea->Rect().iBr.iY);
   802 				iFastSwapArea->Rect().iBr.iY);
   788 		}
   803 		}
   789 	else
   804 	else
   790 		{
   805 		{
   791 		dragArea.SetRect(Rect().iTl.iX, iAppsHeading->Rect().iTl.iY,
   806 		dragArea.SetRect(Rect().iTl.iX, iFastSwapArea->Rect().iTl.iY,
   792 				Rect().iBr.iX, iFastSwapArea->Rect().iBr.iY);
   807 				Rect().iBr.iX, iFastSwapArea->Rect().iBr.iY);
   793 		}
   808 		}
   794 	return dragArea;
   809 	return dragArea;
   795 	}    
   810 	}    
   796 
   811