Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSilenio Quarti2007-03-21 15:07:58 +0000
committerSilenio Quarti2007-03-21 15:07:58 +0000
commit521690c3231ee21e18fd7587f0343c638572b8e6 (patch)
tree371665775efabc60a03fd6935d48189817f394a2
parentbfa969319f6e5a1893ccf7e1b760debe9461b9c3 (diff)
downloadeclipse.platform.swt-521690c3231ee21e18fd7587f0343c638572b8e6.tar.gz
eclipse.platform.swt-521690c3231ee21e18fd7587f0343c638572b8e6.tar.xz
eclipse.platform.swt-521690c3231ee21e18fd7587f0343c638572b8e6.zip
174180 - Table.getItem(Point) always returns null when first column is 0 pixels wide
150079 - Table/Tree.getItem() returns null when Table/Tree is horizontally scrolled.
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/Table.java60
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/Tree.java34
2 files changed, 68 insertions, 26 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/Table.java b/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/Table.java
index deb52e99e5..6859819b00 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/Table.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/Table.java
@@ -78,7 +78,7 @@ public class Table extends Composite {
int itemCount, columnCount, column_id, idCount, anchorFirst, anchorLast, headerHeight, itemHeight, lastIndexOf;
boolean ignoreSelect, wasSelected, fixScrollWidth, drawBackground;
Rectangle imageBounds;
- int showIndex, lastHittest;
+ int showIndex, lastHittest, lastHittestColumn;
static final int CHECK_COLUMN_ID = 1024;
static final int COLUMN_ID = 1025;
static final int GRID_WIDTH = 1;
@@ -1440,9 +1440,8 @@ public TableItem getItem (Point point) {
Rect rect = new Rect ();
org.eclipse.swt.internal.carbon.Point pt = new org.eclipse.swt.internal.carbon.Point ();
OS.SetPt (pt, (short) point.x, (short) point.y);
- int columnId = (columnCount == 0) ? column_id : columns [0].id;
- if (0 < lastHittest && lastHittest <= itemCount) {
- if (OS.GetDataBrowserItemPartBounds (handle, lastHittest, columnId, OS.kDataBrowserPropertyEnclosingPart, rect) == OS.noErr) {
+ if (0 < lastHittest && lastHittest <= itemCount && lastHittestColumn != 0) {
+ if (OS.GetDataBrowserItemPartBounds (handle, lastHittest, lastHittestColumn, OS.kDataBrowserPropertyEnclosingPart, rect) == OS.noErr) {
if (rect.top <= pt.v && pt.v <= rect.bottom) {
if ((style & SWT.FULL_SELECTION) != 0) {
return _getItem (lastHittest - 1);
@@ -1463,12 +1462,26 @@ public TableItem getItem (Point point) {
for (int i = 0; i < offsets.length; i++) {
int index = (top[0] - header [0] + point.y) / height [0] + offsets [i];
if (0 <= index && index < itemCount) {
- if (OS.GetDataBrowserItemPartBounds (handle, index + 1, columnId, OS.kDataBrowserPropertyEnclosingPart, rect) == OS.noErr) {
- if (rect.top <= pt.v && pt.v <= rect.bottom) {
- if ((style & SWT.FULL_SELECTION) != 0) {
- return _getItem (index);
- } else {
- return OS.PtInRect (pt, rect) ? _getItem (index) : null;
+ if (columnCount == 0) {
+ if (OS.GetDataBrowserItemPartBounds (handle, index + 1, column_id, OS.kDataBrowserPropertyEnclosingPart, rect) == OS.noErr) {
+ if (rect.top <= pt.v && pt.v <= rect.bottom) {
+ if ((style & SWT.FULL_SELECTION) != 0) {
+ return _getItem (index);
+ } else {
+ return OS.PtInRect (pt, rect) ? _getItem (index) : null;
+ }
+ }
+ }
+ } else {
+ for (int j = 0; j < columnCount; j++) {
+ if (OS.GetDataBrowserItemPartBounds (handle, index + 1, columns [j].id, OS.kDataBrowserPropertyEnclosingPart, rect) == OS.noErr) {
+ if (rect.top <= pt.v && pt.v <= rect.bottom) {
+ if ((style & SWT.FULL_SELECTION) != 0) {
+ return _getItem (index);
+ } else {
+ return OS.PtInRect (pt, rect) ? _getItem (index) : null;
+ }
+ }
}
}
}
@@ -1476,12 +1489,26 @@ public TableItem getItem (Point point) {
}
//TODO - optimize
for (int i=0; i<itemCount; i++) {
- if (OS.GetDataBrowserItemPartBounds (handle, i + 1, columnId, OS.kDataBrowserPropertyEnclosingPart, rect) == OS.noErr) {
- if (rect.top <= pt.v && pt.v <= rect.bottom) {
- if ((style & SWT.FULL_SELECTION) != 0) {
- return _getItem (i);
- } else {
- return OS.PtInRect (pt, rect) ? _getItem (i) : null;
+ if (columnCount == 0) {
+ if (OS.GetDataBrowserItemPartBounds (handle, i + 1, column_id, OS.kDataBrowserPropertyEnclosingPart, rect) == OS.noErr) {
+ if (rect.top <= pt.v && pt.v <= rect.bottom) {
+ if ((style & SWT.FULL_SELECTION) != 0) {
+ return _getItem (i);
+ } else {
+ return OS.PtInRect (pt, rect) ? _getItem (i) : null;
+ }
+ }
+ }
+ } else {
+ for (int j = 0; j < columnCount; j++) {
+ if (OS.GetDataBrowserItemPartBounds (handle, i + 1, columns [j].id, OS.kDataBrowserPropertyEnclosingPart, rect) == OS.noErr) {
+ if (rect.top <= pt.v && pt.v <= rect.bottom) {
+ if ((style & SWT.FULL_SELECTION) != 0) {
+ return _getItem (i);
+ } else {
+ return OS.PtInRect (pt, rect) ? _getItem (i) : null;
+ }
+ }
}
}
}
@@ -1879,6 +1906,7 @@ int helpProc (int inControl, int inGlobalMouse, int inRequest, int outContentPro
int hitTestProc (int browser, int id, int property, int theRect, int mouseRect) {
lastHittest = id;
+ lastHittestColumn = property;
return 1;
}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/Tree.java b/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/Tree.java
index 85ff91b295..be9bfb6286 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/Tree.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/Tree.java
@@ -86,7 +86,7 @@ public class Tree extends Composite {
boolean ignoreRedraw, ignoreSelect, wasSelected, ignoreExpand, wasExpanded, inClearAll, drawBackground;
Rectangle imageBounds;
TreeItem showItem;
- int lastHittest, visibleCount;
+ int lastHittest, lastHittestColumn, visibleCount;
static final int CHECK_COLUMN_ID = 1024;
static final int COLUMN_ID = 1025;
static final int GRID_WIDTH = 1;
@@ -1491,11 +1491,10 @@ public TreeItem getItem (Point point) {
Rect rect = new Rect ();
org.eclipse.swt.internal.carbon.Point pt = new org.eclipse.swt.internal.carbon.Point ();
OS.SetPt (pt, (short) point.x, (short) point.y);
- int columnId = (columnCount == 0) ? column_id : columns [0].id;
- if (0 < lastHittest && lastHittest <= items.length) {
+ if (0 < lastHittest && lastHittest <= items.length && lastHittestColumn != 0) {
TreeItem item = _getItem (lastHittest, false);
if (item != null) {
- if (OS.GetDataBrowserItemPartBounds (handle, item.id, columnId, OS.kDataBrowserPropertyEnclosingPart, rect) == OS.noErr) {
+ if (OS.GetDataBrowserItemPartBounds (handle, item.id, lastHittestColumn, OS.kDataBrowserPropertyEnclosingPart, rect) == OS.noErr) {
if (rect.top <= pt.v && pt.v <= rect.bottom) {
if ((style & SWT.FULL_SELECTION) != 0) {
return item;
@@ -1510,12 +1509,26 @@ public TreeItem getItem (Point point) {
for (int i=0; i<items.length; i++) {
TreeItem item = items [i];
if (item != null) {
- if (OS.GetDataBrowserItemPartBounds (handle, item.id, columnId, OS.kDataBrowserPropertyEnclosingPart, rect) == OS.noErr) {
- if (rect.top <= pt.v && pt.v <= rect.bottom) {
- if ((style & SWT.FULL_SELECTION) != 0) {
- return item;
- } else {
- return OS.PtInRect (pt, rect) ? item : null;
+ if (columnCount == 0) {
+ if (OS.GetDataBrowserItemPartBounds (handle, item.id, column_id, OS.kDataBrowserPropertyEnclosingPart, rect) == OS.noErr) {
+ if (rect.top <= pt.v && pt.v <= rect.bottom) {
+ if ((style & SWT.FULL_SELECTION) != 0) {
+ return item;
+ } else {
+ return OS.PtInRect (pt, rect) ? item : null;
+ }
+ }
+ }
+ } else {
+ for (int j = 0; j < columnCount; j++) {
+ if (OS.GetDataBrowserItemPartBounds (handle, item.id, columns [j].id, OS.kDataBrowserPropertyEnclosingPart, rect) == OS.noErr) {
+ if (rect.top <= pt.v && pt.v <= rect.bottom) {
+ if ((style & SWT.FULL_SELECTION) != 0) {
+ return item;
+ } else {
+ return OS.PtInRect (pt, rect) ? item : null;
+ }
+ }
}
}
}
@@ -1949,6 +1962,7 @@ int helpProc (int inControl, int inGlobalMouse, int inRequest, int outContentPro
int hitTestProc (int browser, int id, int property, int theRect, int mouseRect) {
lastHittest = id;
+ lastHittestColumn = property;
return 1;
}

Back to the top