emailuis/emailui/src/FreestyleEmailUiLauncherGridVisualiser.cpp
branchRCL_3
changeset 61 dcf0eedfc1a3
parent 52 efd4f1afd43e
equal deleted inserted replaced
60:d620048b4810 61:dcf0eedfc1a3
   293 // ---------------------------------------------------------------------------
   293 // ---------------------------------------------------------------------------
   294 //
   294 //
   295 void CFSEmailUiLauncherGridVisualiser::ResizeItemIcon( TBool aReduce )
   295 void CFSEmailUiLauncherGridVisualiser::ResizeItemIcon( TBool aReduce )
   296     {
   296     {
   297     TInt selectedItem( iCurrentLevel.iSelected );
   297     TInt selectedItem( iCurrentLevel.iSelected );
       
   298     TInt count = iCurrentLevel.iItemVisualData.Count();
       
   299     if ( selectedItem < 0 || selectedItem >= count )
       
   300         {
       
   301         return;  // incorrect index
       
   302         }
       
   303     
   298     if( selectedItem >= 0 )
   304     if( selectedItem >= 0 )
   299         {
   305         {
   300         TReal transition( KScaleNotSelected );
   306         TReal transition( KScaleNotSelected );
   301         if( !aReduce )
   307         if( !aReduce )
   302             {
   308             {
  1224                 TPoint delta( 0, iPreviousPosition.iY - position.iY );
  1230                 TPoint delta( 0, iPreviousPosition.iY - position.iY );
  1225                 iTotalDragging = iTotalDragging + delta.iY;
  1231                 iTotalDragging = iTotalDragging + delta.iY;
  1226                 if (Abs(iTotalDragging) >= iPhysics->DragThreshold() || iIsDragging )
  1232                 if (Abs(iTotalDragging) >= iPhysics->DragThreshold() || iIsDragging )
  1227                     {
  1233                     {
  1228                     // Hide focus always when dragging.
  1234                     // Hide focus always when dragging.
  1229                     iAppUi.SetFocusVisibility( EFalse );
  1235                     HandleButtonReleaseEvent();
  1230                     if ( iSelector )
  1236  
  1231                         {
       
  1232                         TAlfTimedValue selectorOpacity;
       
  1233                         selectorOpacity.SetValueNow( 0 );
       
  1234                         iSelector->SetOpacity( selectorOpacity );
       
  1235                         }
       
  1236 
       
  1237                     iIsDragging = ETrue;
  1237                     iIsDragging = ETrue;
  1238                 
  1238                 
  1239                     iPhysics->RegisterPanningPosition( delta );
  1239                     iPhysics->RegisterPanningPosition( delta );
  1240                     iScrolled = ETrue;
  1240                     iScrolled = ETrue;
  1241                     }
  1241                     }
  1436 
  1436 
  1437 
  1437 
  1438 void CFSEmailUiLauncherGridVisualiser::MoveSelectorToCurrentItem( TDirection aDir )
  1438 void CFSEmailUiLauncherGridVisualiser::MoveSelectorToCurrentItem( TDirection aDir )
  1439     {
  1439     {
  1440     FUNC_LOG;
  1440     FUNC_LOG;
       
  1441     TInt count = iCurrentLevel.iItemVisualData.Count();
       
  1442     if ( iCurrentLevel.iSelected < 0 || iCurrentLevel.iSelected >= count )
       
  1443         {
       
  1444         return;  // incorrect index
       
  1445         }
       
  1446     
  1441     TAlfRealPoint curPos = iSelector->Pos().ValueNow(); // this is the wrapped value of the current position
  1447     TAlfRealPoint curPos = iSelector->Pos().ValueNow(); // this is the wrapped value of the current position
  1442     iSelector->SetPos( curPos, 0 ); // wrap position now
  1448     iSelector->SetPos( curPos, 0 ); // wrap position now
  1443 
  1449 
  1444     // Calculate where are we heading
  1450     // Calculate where are we heading
  1445     CAlfVisual* selectedBase = iCurrentLevel.iItemVisualData[iCurrentLevel.iSelected].iBase;
  1451     CAlfVisual* selectedBase = iCurrentLevel.iItemVisualData[iCurrentLevel.iSelected].iBase;
  1605 
  1611 
  1606 	    TAknLayoutRect gridIconRect;
  1612 	    TAknLayoutRect gridIconRect;
  1607 	    gridIconRect.LayoutRect(itemrc, AknLayoutScalable_Apps::cell_cmail_l_pane_g1(var));
  1613 	    gridIconRect.LayoutRect(itemrc, AknLayoutScalable_Apps::cell_cmail_l_pane_g1(var));
  1608 
  1614 
  1609 	    TAknLayoutText gridText;
  1615 	    TAknLayoutText gridText;
  1610 	    gridText.LayoutText(itemrc, AknLayoutScalable_Apps::cell_cmail_l_pane_t1(var));
  1616 	    gridText.LayoutText(itemrc, AknLayoutScalable_Apps::cell_cmail_l_pane_t1(0));
  1611 
  1617 
  1612         if ( aLevel.iParent >= 0 )
  1618         if ( aLevel.iParent >= 0 )
  1613             {
  1619             {
  1614             iModel->FindChildren( aLevel.iParent, aLevel.iItems );
  1620             iModel->FindChildren( aLevel.iParent, aLevel.iItems );
  1615 
  1621 
  1676                 opacity.SetValueNow ( KDefaultCaptionOpacity );
  1682                 opacity.SetValueNow ( KDefaultCaptionOpacity );
  1677                 newItem.iText->SetOpacity( opacity );
  1683                 newItem.iText->SetOpacity( opacity );
  1678 
  1684 
  1679                 newItem.iText->SetTextStyle( iAppUi.LayoutHandler()->FSTextStyleFromLayoutL(AknLayoutScalable_Apps::cell_cmail_l_pane_t1(var)).Id() );//FSTextStyleFromIdL( EFSFontTypeSmall )->Id() );
  1685                 newItem.iText->SetTextStyle( iAppUi.LayoutHandler()->FSTextStyleFromLayoutL(AknLayoutScalable_Apps::cell_cmail_l_pane_t1(var)).Id() );//FSTextStyleFromIdL( EFSFontTypeSmall )->Id() );
  1680                 newItem.iText->SetWrapping( CAlfTextVisual::ELineWrapTruncate );
  1686                 newItem.iText->SetWrapping( CAlfTextVisual::ELineWrapTruncate );
  1681                 newItem.iText->SetAlign( EAlfAlignHCenter, EAlfAlignVTop );
  1687                 TAlfAlignHorizontal alfAlign;
       
  1688                 switch( gridText.Align() )
       
  1689                     {
       
  1690                     case ELeft: 
       
  1691                         alfAlign = EAlfAlignHLeft;
       
  1692                         break;
       
  1693                     case ECenter:
       
  1694                         alfAlign = EAlfAlignHCenter;
       
  1695                         break;
       
  1696                     case ERight:
       
  1697                         alfAlign = EAlfAlignHRight;
       
  1698                         break;
       
  1699                     default:
       
  1700                         alfAlign = EAlfAlignHCenter;
       
  1701                     }
       
  1702                 newItem.iText->SetAlign( alfAlign, EAlfAlignVCenter );
  1682 
  1703 
  1683                 newItem.iImage = CAlfImageVisual::AddNewL( *iControl, newItem.iBase );
  1704                 newItem.iImage = CAlfImageVisual::AddNewL( *iControl, newItem.iBase );
  1684                 newItem.iImage->SetScaleMode( CAlfImageVisual::EScaleFit );
  1705                 newItem.iImage->SetScaleMode( CAlfImageVisual::EScaleFit );
  1685                 newItem.iImage->SetImage( TAlfImage( *aLevel.iItems[i].iIconTexture ) );
  1706                 newItem.iImage->SetImage( TAlfImage( *aLevel.iItems[i].iIconTexture ) );
  1686                 newItem.iImage->SetFlag( EAlfVisualFlagManualSize );
  1707                 newItem.iImage->SetFlag( EAlfVisualFlagManualSize );
  2751 // ----------------------------------------------------------------------------
  2772 // ----------------------------------------------------------------------------
  2752 //
  2773 //
  2753 void CFSEmailUiLauncherGridVisualiser::LaunchStylusPopupMenu(
  2774 void CFSEmailUiLauncherGridVisualiser::LaunchStylusPopupMenu(
  2754 	const TInt aItemId )
  2775 	const TInt aItemId )
  2755 	{
  2776 	{
       
  2777     TInt count = iCurrentLevel.iItemVisualData.Count();
       
  2778     if ( aItemId < 0 || aItemId >= count )
       
  2779         {
       
  2780         return;  // incorrect index
       
  2781         }
       
  2782     
       
  2783     count = iCurrentLevel.iItems.Count();
       
  2784     if ( aItemId < 0 || aItemId >= count )
       
  2785         {
       
  2786         return;  // incorrect index
       
  2787         }
  2756 	// Get the ID of the mailbox in case the user wants to delete it.
  2788 	// Get the ID of the mailbox in case the user wants to delete it.
  2757 	iMailboxToDelete = iCurrentLevel.iItems[aItemId].iMailBoxId;
  2789 	iMailboxToDelete = iCurrentLevel.iItems[aItemId].iMailBoxId;
  2758 
  2790 
  2759 	// Get the item position and use it to determine the position of the menu.
  2791 	// Get the item position and use it to determine the position of the menu.
  2760 	const TRect rect(
  2792 	const TRect rect(