menufw/menufwui/mmwidgets/src/mmdraweranimator.cpp
branchRCL_3
changeset 26 1b758917cafc
parent 19 79311d856354
child 28 d721605b30d0
equal deleted inserted replaced
25:137ebc85284b 26:1b758917cafc
    10  * Nokia Corporation - initial contribution.
    10  * Nokia Corporation - initial contribution.
    11  *
    11  *
    12  * Contributors:
    12  * Contributors:
    13  *
    13  *
    14  * Description:
    14  * Description:
    15  *  Version     : %version: MM_41 % << Don't touch! Updated by Synergy at check-out.
    15  *  Version     : %version: MM_43 % << Don't touch! Updated by Synergy at check-out.
    16  *
    16  *
    17  */
    17  */
    18 
    18 
    19 #include <AknUtils.h>
    19 #include <AknUtils.h>
    20 
    20 
   118 
   118 
   119             TRect beforeRect( current.GetItemPosition(), itemSize );
   119             TRect beforeRect( current.GetItemPosition(), itemSize );
   120             current.MakeStep();
   120             current.MakeStep();
   121             TRect afterRect( current.GetItemPosition(), itemSize );
   121             TRect afterRect( current.GetItemPosition(), itemSize );
   122 
   122 
   123             if( current.GetFloatingItemType() == EDrag )
   123             if( ( current.GetFloatingItemType() == EDrag
       
   124                         && iDrawer.GetFloatingItemIndex( EDragStart ) == KErrNotFound )
       
   125                     || current.GetFloatingItemType() == EDragStart )
   124                 {
   126                 {
   125                 TInt dragTrail = iDrawer.GetFloatingItemIndex( EPostDragRefreshItem );
   127                 TInt dragTrail = iDrawer.GetFloatingItemIndex( EPostDragRefreshItem );
   126                 if( dragTrail != KErrNotFound )
   128                 if( dragTrail != KErrNotFound )
   127                     {
   129                     {
   128                     refreshRect = ( refreshRect == TRect() ) ? beforeRect : refreshRect;
   130                     refreshRect = ( refreshRect == TRect() ) ? beforeRect : refreshRect;
   129                     refreshRect.BoundingRect( afterRect );
   131                     refreshRect.BoundingRect( afterRect );
   130                     static_cast<CMmWidgetContainer*> ( iDrawer.Widget()->Parent() )->
   132                     static_cast<CMmWidgetContainer*> ( iDrawer.Widget()->Parent() )->
   131                             SetAllowMove( EFalse );
   133                             SetAllowMove( EFalse );
   132                     }
   134                     }
   133                 }
   135                 }
   134             else
   136             else if( ( current.GetFloatingItemType() == EDrag
       
   137                             && iDrawer.GetFloatingItemIndex( EDragStart ) == KErrNotFound )
       
   138                         || current.GetFloatingItemType() != EDrag )
   135                 {
   139                 {
   136                 refreshRect = (refreshRect == TRect() ) ? beforeRect : refreshRect;
   140                 refreshRect = (refreshRect == TRect() ) ? beforeRect : refreshRect;
   137                 refreshRect.BoundingRect( beforeRect );
   141                 refreshRect.BoundingRect( beforeRect );
   138                 refreshRect.BoundingRect( afterRect );
   142                 refreshRect.BoundingRect( afterRect );
   139                 }
   143                 }
   147             refreshRect.BoundingRect( highlightedItemRect );
   151             refreshRect.BoundingRect( highlightedItemRect );
   148             iLastNotedHighlight = highlightedItemIndex;
   152             iLastNotedHighlight = highlightedItemIndex;
   149             }
   153             }
   150 
   154 
   151 
   155 
   152       TInt currentVerticalOffset = static_cast<CMmWidgetContainer*>(
   156         TInt currentVerticalOffset = static_cast<CMmWidgetContainer*>(
   153               iDrawer.Widget()->Parent() )->VerticalItemOffset();
   157               iDrawer.Widget()->Parent() )->VerticalItemOffset();
   154 
   158 
   155         if( iLastNotedTopItem != iDrawer.Widget()->TopItemIndex()
   159         if( iLastNotedTopItem != iDrawer.Widget()->TopItemIndex()
   156                 || iLastNotedVerticalOffset != currentVerticalOffset )
   160                 || iLastNotedVerticalOffset != currentVerticalOffset )
   157             {
   161             {
   247             {
   251             {
   248             iTransTfx->EnableEffects( EFalse );
   252             iTransTfx->EnableEffects( EFalse );
   249 
   253 
   250             if( iTransTfxInternal )
   254             if( iTransTfxInternal )
   251                 {
   255                 {
   252         iTransTfxInternal->Remove( MAknListBoxTfxInternal::EListEverything );
   256                 iTransTfxInternal->Remove( MAknListBoxTfxInternal::EListEverything );
   253                 iTransTfxInternal->Draw( iDrawer.Widget()->Rect() );
   257                 iTransTfxInternal->Draw( iDrawer.Widget()->Rect() );
   254                 }
   258                 }
   255             }
   259             }
   256 #endif
   260 #endif
   257 
   261 
   275 //
   279 //
   276 // -----------------------------------------------------------------------------
   280 // -----------------------------------------------------------------------------
   277 //
   281 //
   278 void CMmDrawerAnimator::AnimateDragItemTransitionL()
   282 void CMmDrawerAnimator::AnimateDragItemTransitionL()
   279     {
   283     {
   280     if( KErrNotFound != iDrawer.GetFloatingItemIndex( EDrag ) )
   284     if( KErrNotFound != iDrawer.GetFloatingItemIndex( EDrag )
   281         {
   285             || KErrNotFound != iDrawer.GetFloatingItemIndex( EDragStart ) )
       
   286         {
       
   287         TMmFloatingItemType floatingType =
       
   288                 iDrawer.GetFloatingItemIndex( EDrag ) != KErrNotFound
       
   289                     ? EDrag : EDragStart;
   282         TMmFloatingItem floatingItem(
   290         TMmFloatingItem floatingItem(
   283                 iDrawer.GetFloatingItemL( EDrag ).GetDrawnItemIndex(),
   291                 iDrawer.GetFloatingItemL( floatingType ).GetDrawnItemIndex(),
   284                 iDrawer.GetFloatingItemL( EDrag ).GetItemPosition(),
   292                 iDrawer.GetFloatingItemL( floatingType ).GetItemPosition(),
   285                 EDragTransition, iUsualAnimationFramesCount,
   293                 EDragTransition, floatingType == EDrag
       
   294                     ? iUsualAnimationFramesCount : MmEffects::KNoAnimationFramesCount,
   286                 iDrawer.Widget()->View() );
   295                 iDrawer.Widget()->View() );
   287         TPoint pointEnd = iDrawer.Widget()->View()->ItemPos( floatingItem.GetDrawnItemIndex() );
   296         TPoint pointEnd = iDrawer.Widget()->View()->ItemPos( floatingItem.GetDrawnItemIndex() );
   288         floatingItem.SetPositionStep( pointEnd - floatingItem.GetItemPosition() );
   297         floatingItem.SetPositionStep( pointEnd - floatingItem.GetItemPosition() );
   289         iDrawer.AddFloatingItemL( floatingItem, 0 );
   298         iDrawer.AddFloatingItemL( floatingItem, 0 );
       
   299 
       
   300         TMmFloatingItem postDragRefresh(
       
   301                 iDrawer.GetFloatingItemL( floatingType ).GetDrawnItemIndex(),
       
   302                 pointEnd, EPostDragRefreshItem,
       
   303                 MmEffects::KNoAnimationFramesCount, iDrawer.Widget()->View() );
       
   304         iDrawer.AddFloatingItemL( postDragRefresh );
       
   305 
   290         iDrawer.RemoveFloatingItem( iDrawer.GetFloatingItemIndex( EDrag ) );
   306         iDrawer.RemoveFloatingItem( iDrawer.GetFloatingItemIndex( EDrag ) );
       
   307         iDrawer.RemoveFloatingItem( iDrawer.GetFloatingItemIndex( EDragStart ) );
   291         }
   308         }
   292     }
   309     }
   293 
   310 
   294 // -----------------------------------------------------------------------------
   311 // -----------------------------------------------------------------------------
   295 //
   312 //
   427 void CMmDrawerAnimator::TriggerMoveItemL()
   444 void CMmDrawerAnimator::TriggerMoveItemL()
   428     {
   445     {
   429     static_cast<CMmWidgetContainer*> ( iDrawer.Widget()->Parent() )->
   446     static_cast<CMmWidgetContainer*> ( iDrawer.Widget()->Parent() )->
   430             TriggerMoveItemL();
   447             TriggerMoveItemL();
   431     }
   448     }
       
   449 
       
   450 // -----------------------------------------------------------------------------
       
   451 //
       
   452 // -----------------------------------------------------------------------------
       
   453 //
       
   454 void CMmDrawerAnimator::AnimateDragItemStartL( TInt aDraggedIndex, TPoint aPoint )
       
   455     {
       
   456     TMmFloatingItem floatingItem(
       
   457             aDraggedIndex,
       
   458             iDrawer.Widget()->View()->ItemPos( aDraggedIndex ),
       
   459             EDragStart,
       
   460             MmEffects::KUsualAnimationFramesCountNonTouch,
       
   461             iDrawer.Widget()->View() );
       
   462     floatingItem.SetPositionStep( aPoint - floatingItem.GetItemPosition() );
       
   463     iDrawer.AddFloatingItemL( floatingItem, 0 );
       
   464     }
   432 //End of file
   465 //End of file