uifw/AvKon/src/akngrid.cpp
branchRCL_3
changeset 9 0aa5fbdfbc30
parent 7 08e69e956a8c
child 17 a1caeb42b3a3
equal deleted inserted replaced
8:71dd06cfe933 9:0aa5fbdfbc30
   658         // because of iSBFrame->VerticalScrollBar owning window.
   658         // because of iSBFrame->VerticalScrollBar owning window.
   659         if( iSBFrame && TRect(iSBFrame->VerticalScrollBar()->Position(), 
   659         if( iSBFrame && TRect(iSBFrame->VerticalScrollBar()->Position(), 
   660             iSBFrame->VerticalScrollBar()->Size()).Contains ( aPointerEvent.iPosition ))
   660             iSBFrame->VerticalScrollBar()->Size()).Contains ( aPointerEvent.iPosition ))
   661             {
   661             {
   662             if ( !ScrollingDisabled()
   662             if ( !ScrollingDisabled()
       
   663                 && iExtension 
   663                 && iExtension->iFlags & EAknGridStateButton1DownInGrid )
   664                 && iExtension->iFlags & EAknGridStateButton1DownInGrid )
   664                 {
   665                 {
   665                 if ( aPointerEvent.iType == TPointerEvent::EButton1Up )
   666                 if ( aPointerEvent.iType == TPointerEvent::EButton1Up )
   666                     {
   667                     {
   667                     iExtension->iFlags &= ~EAknGridStateButton1DownInGrid;
   668                     iExtension->iFlags &= ~EAknGridStateButton1DownInGrid;
   685         
   686         
   686         // switch pointer event type and set button 1 down in grid flag on and off depending where event happened.
   687         // switch pointer event type and set button 1 down in grid flag on and off depending where event happened.
   687             switch (aPointerEvent.iType)
   688             switch (aPointerEvent.iType)
   688                 {
   689                 {
   689                 case TPointerEvent::EButton1Down:
   690                 case TPointerEvent::EButton1Down:
   690                     iExtension->iLastPoint = aPointerEvent.iPosition;
   691                 	{
   691                     if ( visibleItemsRect.Contains(aPointerEvent.iPosition) )
   692                     if( iExtension )
   692                         {
   693                       {
   693                         iExtension->iFlags |= EAknGridStateButton1DownInGrid;                
   694                       iExtension->iLastPoint = aPointerEvent.iPosition;
   694                         }
   695                       if ( visibleItemsRect.Contains(aPointerEvent.iPosition) )
       
   696                           {
       
   697                           iExtension->iFlags |= EAknGridStateButton1DownInGrid;
       
   698                           }
       
   699                       }
   695                     _AKNTRACE( "TPointerEvent::EButton1Down" );
   700                     _AKNTRACE( "TPointerEvent::EButton1Down" );
   696                     break;
   701                     break;
   697 
   702                 	}
       
   703                 	
   698                 case TPointerEvent::EButton1Up:
   704                 case TPointerEvent::EButton1Up:
   699                     {
   705                     {
   700                     iExtension->iFlags &= ~EAknGridStateButton1DownInGrid;
   706                     if ( iExtension )
       
   707                         {
       
   708                         iExtension->iFlags &= ~EAknGridStateButton1DownInGrid;
       
   709                         }
   701                     _AKNTRACE( "TPointerEvent::EButton1Up" );
   710                     _AKNTRACE( "TPointerEvent::EButton1Up" );
   702                     break;
   711                     break;
   703                     }
   712                     }
   704 
   713 
   705                 default:
   714                 default:
  1085         else
  1094         else
  1086             selectionMode = CListBoxView::ENoSelection;
  1095             selectionMode = CListBoxView::ENoSelection;
  1087         }
  1096         }
  1088         
  1097         
  1089     // With single click first key event enables highlight
  1098     // With single click first key event enables highlight
  1090     if ( iExtension->iSingleClickEnabled
  1099     if ( iExtension 
       
  1100             && iExtension->iSingleClickEnabled
  1091             && ItemDrawer()->Flags()
  1101             && ItemDrawer()->Flags()
  1092             &  CListItemDrawer::ESingleClickDisabledHighlight )
  1102             &  CListItemDrawer::ESingleClickDisabledHighlight )
  1093         {
  1103         {
  1094         if ( aKeyEvent.iCode == EKeyUpArrow || 
  1104         if ( aKeyEvent.iCode == EKeyUpArrow || 
  1095              aKeyEvent.iCode == EKeyDownArrow ||
  1105              aKeyEvent.iCode == EKeyDownArrow ||
  1497         return;     
  1507         return;     
  1498         }
  1508         }
  1499     
  1509     
  1500     if ( AknLayoutUtils::PenEnabled() )
  1510     if ( AknLayoutUtils::PenEnabled() )
  1501         {
  1511         {
  1502         if ( !(iExtension->iFlags & EAknGridStateButton1DownInGrid) )
  1512         if ( !( iExtension && iExtension->iFlags & EAknGridStateButton1DownInGrid) )
  1503             {
  1513             {
  1504             _AKNTRACE_FUNC_EXIT;
  1514             _AKNTRACE_FUNC_EXIT;
  1505             return;
  1515             return;
  1506             }
  1516             }
  1507 
  1517 
  1513         TBool pointerIsOverAnItem = gridView->XYPosToItemIndex(aPointerPos, itemIndex);
  1523         TBool pointerIsOverAnItem = gridView->XYPosToItemIndex(aPointerPos, itemIndex);
  1514         // SERIES60 LAF
  1524         // SERIES60 LAF
  1515         CListBoxView::TSelectionMode selectionMode = CListBoxView::ENoSelection;
  1525         CListBoxView::TSelectionMode selectionMode = CListBoxView::ENoSelection;
  1516         //        CListBoxView::TSelectionMode selectionMode = (iListBoxFlags & EMultipleSelection) ? CListBoxView::EContiguousSelection : CListBoxView::ESingleSelection;
  1526         //        CListBoxView::TSelectionMode selectionMode = (iListBoxFlags & EMultipleSelection) ? CListBoxView::EContiguousSelection : CListBoxView::ESingleSelection;
  1517         // END OF SERIES60 LAF
  1527         // END OF SERIES60 LAF
  1518         TInt speed = iExtension->GetScrollingSpeed( pointerIsOverAnItem, itemIndex, 
  1528         TInt speed = iExtension ? iExtension->GetScrollingSpeed( pointerIsOverAnItem, itemIndex, 
  1519                                                     *gridView, aPointerPos );
  1529                                                     *gridView, aPointerPos ):0;
  1520         
  1530         
  1521         TInt oldCurrentItemIndex = CurrentItemIndex();
  1531         TInt oldCurrentItemIndex = CurrentItemIndex();
  1522         TRect currentItemRect(gridView->ItemPos(oldCurrentItemIndex), gridView->ItemSize(oldCurrentItemIndex));       
  1532         TRect currentItemRect(gridView->ItemPos(oldCurrentItemIndex), gridView->ItemSize(oldCurrentItemIndex));       
  1523         TInt numOfRows =  Max(GridView()->GridCellDimensions().iHeight,1);
  1533         TInt numOfRows =  Max(GridView()->GridCellDimensions().iHeight,1);
  1524         const TInt placesInGrid = numOfRows * iNumOfColsInView;   
  1534         const TInt placesInGrid = numOfRows * iNumOfColsInView;   
  1858             vSbarModel.iThumbPosition = topRow;
  1868             vSbarModel.iThumbPosition = topRow;
  1859             }
  1869             }
  1860         if (vSbarModel.iScrollSpan-vSbarModel.iThumbPosition<vSbarModel.iThumbSpan)
  1870         if (vSbarModel.iScrollSpan-vSbarModel.iThumbPosition<vSbarModel.iThumbSpan)
  1861             {
  1871             {
  1862             vSbarModel.iThumbPosition=Max(0,vSbarModel.iScrollSpan-vSbarModel.iThumbSpan);
  1872             vSbarModel.iThumbPosition=Max(0,vSbarModel.iScrollSpan-vSbarModel.iThumbSpan);
  1863             if ( !iExtension->iSingleClickEnabled )
  1873             if ( iExtension && !iExtension->iSingleClickEnabled )
  1864                 {
  1874                 {
  1865                 // force a scroll if neccessary
  1875                 // force a scroll if neccessary
  1866                 gridView->MoveToItemIndexL( currentIndex, 
  1876                 gridView->MoveToItemIndexL( currentIndex, 
  1867                     CListBoxView::ENoSelection );
  1877                     CListBoxView::ENoSelection );
  1868                 }
  1878                 }