summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteve Northover <steve>2004-02-13 19:50:42 +0000
committerSteve Northover <steve>2004-02-13 19:50:42 +0000
commite234834b470097d5e9ffb4527d9aa6d850f047c7 (patch)
tree5fa2869487d8cfcb7130ada438833880fbdb7774
parent578025c4d63c406744ffadd9003c6c37c0e3bf84 (diff)
downloadeclipse.platform.swt-e234834b470097d5e9ffb4527d9aa6d850f047c7.tar.gz
eclipse.platform.swt-e234834b470097d5e9ffb4527d9aa6d850f047c7.tar.xz
eclipse.platform.swt-e234834b470097d5e9ffb4527d9aa6d850f047c7.zip
*** empty log message ***
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Table.java20
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/TableItem.java18
2 files changed, 27 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 e23fa55587..f3d6c062e7 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
@@ -2225,24 +2225,28 @@ public void showColumn (TableColumn column) {
int index = indexOf (column);
int hwndHeader = OS.SendMessage (handle, OS.LVM_GETHEADER, 0, 0);
int count = OS.SendMessage (hwndHeader, OS.HDM_GETITEMCOUNT, 0, 0);
- if (count <= 1 || !(0 <= index && index < count)) return;
+ if (count <= 1 || !(0 <= index && index < count)) return;
+ /*
+ * Feature in Windows. Calling LVM_GETSUBITEMRECT with -1 for the
+ * row number gives the bounds of the item that would be above the
+ * first row in the table. This is undocumented and does not work
+ * for the first column. In this case, to get the bounds of the
+ * first column, get the bounds of the second column and subtract
+ * the width of the first. The left edge of the second column is
+ * also used as the right edge of the first.
+ */
RECT rect = new RECT ();
+ rect.left = OS.LVIR_BOUNDS;
if (index == 0) {
- // Can't get subitemrect for first column (with no item)
- // so get subitemrect for second column and subtract width
- // of first column.
- int width = OS.SendMessage (handle, OS.LVM_GETCOLUMNWIDTH, index, 0);
rect.top = 1;
- rect.left = OS.LVIR_BOUNDS;
OS.SendMessage (handle, OS.LVM_GETSUBITEMRECT, -1, rect);
rect.right = rect.left;
+ int width = OS.SendMessage (handle, OS.LVM_GETCOLUMNWIDTH, 0, 0);
rect.left = rect.right - width;
} else {
rect.top = index;
- rect.left = OS.LVIR_BOUNDS;
OS.SendMessage (handle, OS.LVM_GETSUBITEMRECT, -1, rect);
}
-
RECT area = new RECT ();
OS.GetClientRect (handle, area);
if (rect.left < area.left) {
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/TableItem.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/TableItem.java
index 347bc1a5f6..723bb63273 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/TableItem.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/TableItem.java
@@ -172,6 +172,13 @@ public Rectangle getBounds (int index) {
int count = OS.SendMessage (hwndHeader, OS.HDM_GETITEMCOUNT, 0, 0);
if (!(0 <= index && index < count)) return new Rectangle (0, 0, 0, 0);
int gridWidth = parent.getLinesVisible () ? parent.getGridLineWidth () : 0;
+ /*
+ * Feature in Windows. Calling LVM_GETSUBITEMRECT with LVIR_LABEL and
+ * zero for the column number gives the bounds of the first item without
+ * including the bounds of the icon. This behavior is undocumented.
+ * When called with values greater than zero, the icon bounds are
+ * included and this behavior is documented.
+ */
RECT rect = new RECT ();
rect.top = index;
rect.left = OS.LVIR_LABEL;
@@ -378,9 +385,14 @@ public Rectangle getImageBounds (int index) {
int hwnd = parent.handle;
int hwndHeader = OS.SendMessage (hwnd, OS.LVM_GETHEADER, 0, 0);
int count = OS.SendMessage (hwndHeader, OS.HDM_GETITEMCOUNT, 0, 0);
- if (!(0 <= index && index < count)) return new Rectangle (0, 0, 0, 0);
- int gridWidth = 0;
- if (parent.getLinesVisible ()) gridWidth = parent.getGridLineWidth ();
+ if (!(0 <= index && index < count)) return new Rectangle (0, 0, 0, 0);
+ int gridWidth = parent.getLinesVisible () ? parent.getGridLineWidth () : 0;
+ /*
+ * Feature in Windows. Calling LVM_GETSUBITEMRECT with LVIR_ICON and
+ * zero for the column number gives the bounds of the icon (despite the
+ * fact that this behaivor is only documented for values greater than
+ * one).
+ */
RECT rect = new RECT ();
rect.top = index;
rect.left = OS.LVIR_ICON;