diff options
author | Veronika Irvine <veronika> | 2004-02-16 21:21:53 +0000 |
---|---|---|
committer | Veronika Irvine <veronika> | 2004-02-16 21:21:53 +0000 |
commit | 71ebc95fbde7ca8462e7145ac352931e77afb53c (patch) | |
tree | c3cdc83bf8497257bd4d1b27b5a28c9df175cdd1 | |
parent | 790e0d3795df726e2fd1cbc36f7d7f112c4be5fb (diff) | |
download | eclipse.platform.swt-71ebc95fbde7ca8462e7145ac352931e77afb53c.tar.gz eclipse.platform.swt-71ebc95fbde7ca8462e7145ac352931e77afb53c.tar.xz eclipse.platform.swt-71ebc95fbde7ca8462e7145ac352931e77afb53c.zip |
gtk_tree_view_get_cell_area - correct for horizontal scrolling
-rw-r--r-- | bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TableItem.java | 24 | ||||
-rw-r--r-- | bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TreeItem.java | 12 |
2 files changed, 36 insertions, 0 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TableItem.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TableItem.java index 798ae02d13..6875db4c70 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TableItem.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TableItem.java @@ -176,6 +176,18 @@ public Rectangle getBounds (int index) { OS.gtk_widget_realize (parentHandle); OS.gtk_tree_view_get_cell_area (parentHandle, path, column, rect); OS.gtk_tree_path_free (path); + /* + * In the horizontal direction, the origin of the bin window is + * not the same as the origin of the scrolled handle. + * The method gtk_tree_view_get_cell_area returns the + * x coordinate relative to the bin window. In order to + * get the coordinates relative to the top left corner + * of the client area, we need to account for the + * horizontal scroll adjustment. + */ + int[] wx = new int[1]; + OS.gtk_tree_view_tree_to_widget_coords(parentHandle, rect.x, 0, wx, null); + rect.x = wx[0]; if (index == 0 && (parent.style & SWT.CHECK) != 0) { if (OS.gtk_major_version () * 100 + OS.gtk_minor_version () * 10 + OS.gtk_micro_version () >= 213) { int [] x = new int [1], w = new int [1]; @@ -395,6 +407,18 @@ public Rectangle getImageBounds (int index) { OS.gtk_widget_realize (parentHandle); OS.gtk_tree_view_get_cell_area (parentHandle, path, column, rect); OS.gtk_tree_path_free (path); + /* + * In the horizontal direction, the origin of the bin window is + * not the same as the origin of the scrolled handle. + * The method gtk_tree_view_get_cell_area returns the + * x coordinate relative to the bin window. In order to + * get the coordinates relative to the top left corner + * of the client area, we need to account for the + * horizontal scroll adjustment. + */ + int[] wx = new int[1]; + OS.gtk_tree_view_tree_to_widget_coords(parentHandle, rect.x, 0, wx, null); + rect.x = wx[0]; /* * The OS call gtk_cell_renderer_get_size() provides the width of image to be drawn * by the cell renderer. If there is no image in the cell, the width is zero. If the table contains diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TreeItem.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TreeItem.java index ee893cf54b..c83f37a21c 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TreeItem.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TreeItem.java @@ -229,6 +229,18 @@ public Rectangle getBounds () { OS.gtk_widget_realize (parentHandle); OS.gtk_tree_view_get_cell_area (parentHandle, path, column, rect); OS.gtk_tree_path_free (path); + /* + * In the horizontal direction, the origin of the bin window is + * not the same as the origin of the scrolled handle. + * The method gtk_tree_view_get_cell_area returns the + * x coordinate relative to the bin window. In order to + * get the coordinates relative to the top left corner + * of the client area, we need to account for the + * horizontal scroll adjustment. + */ + int[] wx = new int[1]; + OS.gtk_tree_view_tree_to_widget_coords(parentHandle, rect.x, 0, wx, null); + rect.x = wx[0]; return new Rectangle (rect.x, rect.y, rect.width, rect.height); } |