summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteve Northover <steve>2005-10-28 23:02:51 +0000
committerSteve Northover <steve>2005-10-28 23:02:51 +0000
commit4e3d6fc0220c054dcd91e2daf263c9a562c7d4cc (patch)
tree457b44da7e0b7ab72af6d686f3b0eba7d6576c68
parent5c73f9dcffc9cba35c239dfadffba6c017b909a4 (diff)
downloadeclipse.platform.swt-4e3d6fc0220c054dcd91e2daf263c9a562c7d4cc.tar.gz
eclipse.platform.swt-4e3d6fc0220c054dcd91e2daf263c9a562c7d4cc.tar.xz
eclipse.platform.swt-4e3d6fc0220c054dcd91e2daf263c9a562c7d4cc.zip
114039 - Table.computeSize returns bogus Point.y values under Win32 for large tables
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Table.java15
1 files changed, 4 insertions, 11 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Table.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Table.java
index b8bebe6fef..79afc57cbd 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Table.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Table.java
@@ -633,19 +633,12 @@ public Point computeSize (int wHint, int hHint, boolean changed) {
}
bits |= width & 0xFFFF;
}
- if (hHint != SWT.DEFAULT) bits |= hHint << 16;
- int result = OS.SendMessage (handle, OS.LVM_APPROXIMATEVIEWRECT, -1, bits);
- int width = result & 0xFFFF, height = result >> 16;
-
- /*
- * Feature in Windows. The height returned by LVM_APPROXIMATEVIEWRECT
- * includes the trim plus the height of the items plus one extra row.
- * The fix is to subtract the height of one row from the result height.
- */
+ int result = OS.SendMessage (handle, OS.LVM_APPROXIMATEVIEWRECT, -1, bits | 0xFFFF0000);
+ int width = result & 0xFFFF;
int empty = OS.SendMessage (handle, OS.LVM_APPROXIMATEVIEWRECT, 0, 0);
int oneItem = OS.SendMessage (handle, OS.LVM_APPROXIMATEVIEWRECT, 1, 0);
- height -= (oneItem >> 16) - (empty >> 16);
-
+ int itemHeight = (oneItem >> 16) - (empty >> 16);
+ int height = OS.SendMessage (handle, OS.LVM_GETITEMCOUNT, 0, 0) * itemHeight;
if (width == 0) width = DEFAULT_WIDTH;
if (height == 0) height = DEFAULT_HEIGHT;
if (wHint != SWT.DEFAULT) width = wHint;