javauis/eswt_akn/org.eclipse.ercp.swt.s60/native/src/swttablelistbox.cpp
branchRCL_3
changeset 24 0fd27995241b
parent 19 04becd199f91
child 34 71c436fe3ce0
equal deleted inserted replaced
20:f9bb0fca356a 24:0fd27995241b
   354 #ifdef RD_JAVA_S60_RELEASE_9_2
   354 #ifdef RD_JAVA_S60_RELEASE_9_2
   355                                            EAknsCIQsnLineColorsCG15
   355                                            EAknsCIQsnLineColorsCG15
   356 #else
   356 #else
   357                                            EAknsCIQsnLineColorsCG6
   357                                            EAknsCIQsnLineColorsCG6
   358 #endif
   358 #endif
   359                                            );
   359                                           );
   360     aGc.SetPenColor(gridLineColor);
   360     aGc.SetPenColor(gridLineColor);
   361     aGc.SetPenSize(TSize(lineWidth, lineWidth));
   361     aGc.SetPenSize(TSize(lineWidth, lineWidth));
   362     aGc.SetPenStyle(CGraphicsContext::ESolidPen);
   362     aGc.SetPenStyle(CGraphicsContext::ESolidPen);
   363     aGc.SetBrushStyle(CGraphicsContext::ENullBrush);
   363     aGc.SetBrushStyle(CGraphicsContext::ENullBrush);
   364 
   364 
   375     if (drawRect.iBr.iX < iView->ViewRect().iBr.iX)
   375     if (drawRect.iBr.iX < iView->ViewRect().iBr.iX)
   376     {
   376     {
   377         drawRect.iBr.iX = iView->ViewRect().iBr.iX;
   377         drawRect.iBr.iX = iView->ViewRect().iBr.iX;
   378     }
   378     }
   379 
   379 
   380     // Last index means also last index partially visible, 
   380     // Last index means also last index partially visible,
   381     // therefore intentionally we do not substract 1 here. 
   381     // therefore intentionally we do not substract 1 here.
   382     TInt lastIndex = iView->TopItemIndex() 
   382     TInt lastIndex = iView->TopItemIndex()
   383         + iView->NumberOfItemsThatFitInRect(iView->ViewRect());
   383                      + iView->NumberOfItemsThatFitInRect(iView->ViewRect());
   384     TInt lastPotentialItemIndex = Min(iModel->NumberOfItems() - 1, lastIndex);
   384     TInt lastPotentialItemIndex = Min(iModel->NumberOfItems() - 1, lastIndex);
   385     drawRect.iBr.iY = iView->ItemPos(lastPotentialItemIndex).iY 
   385     drawRect.iBr.iY = iView->ItemPos(lastPotentialItemIndex).iY
   386         + iView->ItemSize(lastPotentialItemIndex).iHeight;
   386                       + iView->ItemSize(lastPotentialItemIndex).iHeight;
   387 
   387 
   388     if (drawRect.iBr.iY > viewRect.iBr.iY) drawRect.iBr.iY = viewRect.iBr.iY;
   388     if (drawRect.iBr.iY > viewRect.iBr.iY) drawRect.iBr.iY = viewRect.iBr.iY;
   389 
   389 
   390     TInt headerHeight(iTable.GetHeaderHeight());
   390     TInt headerHeight(iTable.GetHeaderHeight());
   391 
   391 
   401     {
   401     {
   402         aGc.DrawLine(p1, p2);
   402         aGc.DrawLine(p1, p2);
   403         p1.iY += itemHeight;
   403         p1.iY += itemHeight;
   404         p2.iY += itemHeight;
   404         p2.iY += itemHeight;
   405     }
   405     }
   406     
   406 
   407     // Then draw the vertical lines
   407     // Then draw the vertical lines
   408 
   408 
   409     // Compute the first column edge location
   409     // Compute the first column edge location
   410     TSwtTableMargins margins(iTable.GetMargins());
   410     TSwtTableMargins margins(iTable.GetMargins());
   411     TInt directionFactor;
   411     TInt directionFactor;
   694         {
   694         {
   695             TInt deltaX(iDragPos.iX - aPointerEvent.iPosition.iX);
   695             TInt deltaX(iDragPos.iX - aPointerEvent.iPosition.iX);
   696             if (deltaX != 0)
   696             if (deltaX != 0)
   697                 iView->HScroll(deltaX);
   697                 iView->HScroll(deltaX);
   698         }
   698         }
   699         
   699 
   700         iDragPos = aPointerEvent.iPosition;
   700         iDragPos = aPointerEvent.iPosition;
   701         CEikTextListBox::HandlePointerEventL(aPointerEvent);
   701         CEikTextListBox::HandlePointerEventL(aPointerEvent);
   702 
   702 
   703         if (aPointerEvent.iType == TPointerEvent::EButton1Up)
   703         if (aPointerEvent.iType == TPointerEvent::EButton1Up)
   704         {
   704         {
   705             TInt focusIndex = CurrentItemIndex();
   705             TInt focusIndex = CurrentItemIndex();
   706             
   706 
   707             if (iListBoxFlags & EMultipleSelection)
   707             if (iListBoxFlags & EMultipleSelection)
   708             {
   708             {
   709                 // Multi lists
   709                 // Multi lists
   710                 if (iOldSelectionArray->Count() != iView->SelectionIndexes()->Count())
   710                 if (iOldSelectionArray->Count() != iView->SelectionIndexes()->Count())
   711                 {
   711                 {
   716                         {
   716                         {
   717                             View()->DeselectItem(focusIndex);
   717                             View()->DeselectItem(focusIndex);
   718                         }
   718                         }
   719                         else
   719                         else
   720                         {
   720                         {
   721                             View()->SelectItemL(focusIndex);   
   721                             View()->SelectItemL(focusIndex);
   722                         }
   722                         }
   723                     }
   723                     }
   724                     else
   724                     else
   725                     {
   725                     {
   726                         iTable.PostSelectionEventL(KSwtStyleCheck, focusIndex);                        
   726                         iTable.PostSelectionEventL(KSwtStyleCheck, focusIndex);
   727                     }
   727                     }
   728                 }
   728                 }
   729             }
   729             }
   730             else
   730             else
   731             {
   731             {
  1001     if (heightOfItemArea > viewRect.Height())
  1001     if (heightOfItemArea > viewRect.Height())
  1002     {
  1002     {
  1003         heightOfItemArea = viewRect.Height();
  1003         heightOfItemArea = viewRect.Height();
  1004     }
  1004     }
  1005 
  1005 
  1006     // Last index means also last index partially visible, 
  1006     // Last index means also last index partially visible,
  1007     // therefore intentionally we do not substract 1 here.
  1007     // therefore intentionally we do not substract 1 here.
  1008     TInt lastIndex = iView->TopItemIndex() 
  1008     TInt lastIndex = iView->TopItemIndex()
  1009         + iView->NumberOfItemsThatFitInRect(iView->ViewRect());
  1009                      + iView->NumberOfItemsThatFitInRect(iView->ViewRect());
  1010     TInt lastPotentialItemIndex = Min(iModel->NumberOfItems() - 1, lastIndex);
  1010     TInt lastPotentialItemIndex = Min(iModel->NumberOfItems() - 1, lastIndex);
  1011 
  1011 
  1012     // Clear the unused portion of the viewing area
  1012     // Clear the unused portion of the viewing area
  1013     TRect usedPortionOfViewRect(viewRect.iTl.iX, iView->ItemPos(iView->TopItemIndex()).iY,
  1013     TRect usedPortionOfViewRect(viewRect.iTl.iX, iView->ItemPos(iView->TopItemIndex()).iY,
  1014                                 viewRect.iBr.iX, iView->ItemPos(lastPotentialItemIndex).iY
  1014                                 viewRect.iBr.iX, iView->ItemPos(lastPotentialItemIndex).iY
  1015                                 + iView->ItemSize(lastPotentialItemIndex).iHeight);
  1015                                 + iView->ItemSize(lastPotentialItemIndex).iHeight);
  1016     
  1016 
  1017     // This is needed as the horizontal scrollbar is transparent. 
  1017     // This is needed as the horizontal scrollbar is transparent.
  1018     if (usedPortionOfViewRect.iBr.iY > viewRect.iBr.iY)
  1018     if (usedPortionOfViewRect.iBr.iY > viewRect.iBr.iY)
  1019         usedPortionOfViewRect.iBr.iY = viewRect.iBr.iY;
  1019         usedPortionOfViewRect.iBr.iY = viewRect.iBr.iY;
  1020 
  1020 
  1021     if (iTable.BackgroundSet())
  1021     if (iTable.BackgroundSet())
  1022     {
  1022     {