menufw/menufwui/mmwidgets/src/mmgrid.cpp
branchRCL_3
changeset 54 1b758917cafc
parent 50 137ebc85284b
equal deleted inserted replaced
50:137ebc85284b 54: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_104 % << Don't touch! Updated by Synergy at check-out.
    15 *  Version     : %version: MM_106 % << Don't touch! Updated by Synergy at check-out.
    16 *
    16 *
    17 */
    17 */
    18 
    18 
    19 
    19 
    20 #include <AknsDrawUtils.h>
    20 #include <AknsDrawUtils.h>
   291             aPointerEvent.iPosition, itemUnderPointerIndex ) )
   291             aPointerEvent.iPosition, itemUnderPointerIndex ) )
   292         {
   292         {
   293         if ( CurrentItemIndex() != itemUnderPointerIndex )
   293         if ( CurrentItemIndex() != itemUnderPointerIndex )
   294             {
   294             {
   295             CMmWidgetContainer* parent = static_cast<CMmWidgetContainer*>( Parent() );
   295             CMmWidgetContainer* parent = static_cast<CMmWidgetContainer*>( Parent() );
   296         if ( parent->IsNoItemDragged() )
   296             if ( parent->IsNoItemDragged() )
   297           {
   297                 {
   298           if ( ItemDrawer()->Flags() & CListItemDrawer::EPressedDownState )
   298                 if ( ItemDrawer()->Flags() & CListItemDrawer::EPressedDownState )
   299             {
   299                     {
   300             ItemDrawer()->ClearFlags( CListItemDrawer::EPressedDownState );
   300                     ItemDrawer()->ClearFlags( CListItemDrawer::EPressedDownState );
   301             iView->DrawItem( CurrentItemIndex() );
   301                     iView->DrawItem( CurrentItemIndex() );
   302             }
   302                     }
   303           }
   303                 }
   304         else
   304             else
   305           {
   305                 {
   306           iView->SetCurrentItemIndex( itemUnderPointerIndex );
   306                 iView->SetCurrentItemIndex( itemUnderPointerIndex );
   307         iView->DrawItem(itemUnderPointerIndex);
   307                 iView->DrawItem(itemUnderPointerIndex);
   308           }
   308                 }
   309             }
   309             }
   310         }
   310         }
   311 
   311 
   312     HandleScrollingInEditMode( aPointerEvent );
   312     HandleScrollingInEditMode( aPointerEvent );
   313     }
   313     }
   695             && topRow <= maxPossibleTopRow ) )
   695             && topRow <= maxPossibleTopRow ) )
   696         {
   696         {
   697         topRow = Min( topRow, maxPossibleTopRow );
   697         topRow = Min( topRow, maxPossibleTopRow );
   698         SetTopItemIndex( topRow * numOfCols );
   698         SetTopItemIndex( topRow * numOfCols );
   699         }
   699         }
   700     else if( ( (CMmWidgetContainer* ) Parent() )->IsEditMode()
       
   701             && ( Abs(maxPossibleTopRow - topRow) == 1) // prevention scrolling both scrollbar and view too much rows
       
   702             && !View()->ItemIsPartiallyVisible(TopItemIndex())) // prevention scrolling view during remove item via menu
       
   703         {
       
   704         SetTopItemIndex( maxPossibleTopRow * numOfCols );
       
   705         }
       
   706 
   700 
   707     // prevent problems with view being scrolled up beyond limits
   701     // prevent problems with view being scrolled up beyond limits
   708     if ( topRow == maxPossibleTopRow && VerticalItemOffset() < 0 )
   702     if ( topRow == maxPossibleTopRow && VerticalItemOffset() < 0 )
   709         {
   703         {
   710         TRAP_IGNORE(
   704         TRAP_IGNORE(
   813 void CMmGrid::UpdateScrollBarsL()
   807 void CMmGrid::UpdateScrollBarsL()
   814     {
   808     {
   815     TBool visibilityChanged = HandleScrollbarVisibilityChangeL();
   809     TBool visibilityChanged = HandleScrollbarVisibilityChangeL();
   816     if (ScrollBarFrame()->VerticalScrollBar()->IsVisible())
   810     if (ScrollBarFrame()->VerticalScrollBar()->IsVisible())
   817         {
   811         {
       
   812         CMmWidgetContainer* widget = static_cast< CMmWidgetContainer* >(Parent());
       
   813         if( widget->IsEditMode() && widget->WidgetPositionCache().iValid )
       
   814             {
       
   815             static_cast<CMmGridView*> ( View() )->SetItemOffsetInPixels(
       
   816                     widget->WidgetPositionCache().iVerticalItemOffset );
       
   817             }
   818         CAknGrid::UpdateScrollBarsL();
   818         CAknGrid::UpdateScrollBarsL();
   819         }
   819         }
   820     iCurrentTopItemIndex = TopItemIndex();
   820     iCurrentTopItemIndex = TopItemIndex();
   821     iMmDrawer->TemplateLibrary()->SetScrollbarWidthL(
   821     iMmDrawer->TemplateLibrary()->SetScrollbarWidthL(
   822             ScrollBarFrame()->VerticalScrollBar()->Rect().Width() + ScrollBarOffset() );
   822             ScrollBarFrame()->VerticalScrollBar()->Rect().Width() + ScrollBarOffset() );
  1015 // -----------------------------------------------------------------------------
  1015 // -----------------------------------------------------------------------------
  1016 //
  1016 //
  1017 // -----------------------------------------------------------------------------
  1017 // -----------------------------------------------------------------------------
  1018 //
  1018 //
  1019 void CMmGrid::UpdateScrollBarThumbs()
  1019 void CMmGrid::UpdateScrollBarThumbs()
  1020   {
  1020     {
  1021   CAknGrid::UpdateScrollBarThumbs();
  1021     CAknGrid::UpdateScrollBarThumbs();
  1022   }
  1022     }
  1023 
  1023 
  1024 // -----------------------------------------------------------------------------
  1024 // -----------------------------------------------------------------------------
  1025 //
  1025 //
  1026 // -----------------------------------------------------------------------------
  1026 // -----------------------------------------------------------------------------
  1027 //
  1027 //