Commit 4e4748e8 authored by Kristian Rietveld's avatar Kristian Rietveld Committed by Kristian Rietveld

Audit of GtkTreeView coordinate system usage. (#142494).

2007-06-13  Kristian Rietveld  <kris@imendio.com>

	Audit of GtkTreeView coordinate system usage. (#142494).

	* gtk/gtktreeview.[ch]: general documentation updates,
	(gtk_tree_view_scroll_to_cell), (gtk_tree_view_get_dest_row_at_pos):
	update coordinate translations,
	(gtk_tree_view_tree_to_widget_coords),
	(gtk_tree_view_widget_to_tree_coords): Deprecated,
	(gtk_tree_view_convert_.*_coords): 6 new functions for doing
	transformations between coordinate systems.

	* gtk/gtk.symbols: updated.

	* tests/testtooltips.c (query_tooltip_tree_view_cb): fix testcase
	with new gtk_tree_view_convert_widget_to_bin_window_coords().

	* docs/reference/gtk/Makefile.am
	* docs/reference/gtk/images/tree-view-coordinates.png: add new image.

	* docs/reference/gtk/tmpl/gtktreeview.sgml: eloborate on the
	different coordinate systems.


svn path=/trunk/; revision=18119
parent 56efde1a
2007-06-13 Kristian Rietveld <kris@imendio.com>
Audit of GtkTreeView coordinate system usage. (#142494).
* gtk/gtktreeview.[ch]: general documentation updates,
(gtk_tree_view_scroll_to_cell), (gtk_tree_view_get_dest_row_at_pos):
update coordinate translations,
(gtk_tree_view_tree_to_widget_coords),
(gtk_tree_view_widget_to_tree_coords): Deprecated,
(gtk_tree_view_convert_.*_coords): 6 new functions for doing
transformations between coordinate systems.
* gtk/gtk.symbols: updated.
* tests/testtooltips.c (query_tooltip_tree_view_cb): fix testcase
with new gtk_tree_view_convert_widget_to_bin_window_coords().
* docs/reference/gtk/Makefile.am
* docs/reference/gtk/images/tree-view-coordinates.png: add new image.
* docs/reference/gtk/tmpl/gtktreeview.sgml: eloborate on the
different coordinate systems.
2007-06-13 Kristian Rietveld <kris@imendio.com>
* gtk/gtkcellrendererprogress.c
......
......@@ -313,6 +313,7 @@ HTML_IMAGES = \
$(srcdir)/images/statusbar.png \
$(srcdir)/images/toggle-button.png \
$(srcdir)/images/toolbar.png \
$(srcdir)/images/tree-view-coordinates.png \
$(srcdir)/images/volumebutton.png \
$(srcdir)/images/window.png
......
......@@ -16,6 +16,26 @@ for an overview of all the objects and data types related to the tree widget and
they work together.
</para>
<para>
Several different coordinate systems are exposed in the GtkTreeView API.
These are:
<inlinegraphics fileref="tree-view-coordinates.png" format="PNG"></inlinegraphic>
<simplelist>
<member>Widget coordinates -- coordinates relative to the widget (usually <literal>widget-&gt;window</literal>.</member>
<member>Bin window coordinates -- coordinates relative to the window that GtkTreeView renders to.</member>
<member>Tree coordinates -- coordinates relative to the entire scrollable area of GtkTreeView. These coordinates start at (0, 0) for row 0 of the tree.</member>
</simplelist>
</para>
<para>
Several functions are available for converting between the different
coordinate systems. The most common translations are between widget and bin window coordinates and between bin window and tree coordinates. For the former
you can use <literal>gtk_tree_view_convert_widget_to_bin_window_coords (<!-- -->)</literal>
(and vice versa), for the latter <literal>gtk_tree_view_convert_bin_window_to_tree_coords (<!-- -->)</literal> (and vice versa).
</para>
<!-- ##### SECTION See_Also ##### -->
<para>
#GtkTreeViewColumn, #GtkTreeSelection, #GtkTreeDnd, #GtkTreeMode, #GtkTreeSortable, #GtkTreeModelSort, #GtkListStore, #GtkTreeStore, #GtkCellRenderer, #GtkCellEditable, #GtkCellRendererPixbuf, #GtkCellRendererText, #GtkCellRendererToggle
......@@ -35,21 +55,21 @@ they work together.
</para>
@treeview: the object which received the signal.
@tree_view: the object which received the signal.
<!-- ##### SIGNAL GtkTreeView::cursor-changed ##### -->
<para>
</para>
@treeview: the object which received the signal.
@tree_view: the object which received the signal.
<!-- ##### SIGNAL GtkTreeView::expand-collapse-cursor-row ##### -->
<para>
</para>
@treeview: the object which received the signal.
@tree_view: the object which received the signal.
@arg1:
@arg2:
@arg3:
......@@ -60,7 +80,7 @@ they work together.
</para>
@treeview: the object which received the signal.
@tree_view: the object which received the signal.
@arg1:
@arg2:
@Returns:
......@@ -70,7 +90,7 @@ they work together.
</para>
@treeview: the object which received the signal.
@tree_view: the object which received the signal.
@arg1:
@arg2:
......@@ -79,7 +99,7 @@ they work together.
</para>
@treeview: the object which received the signal.
@tree_view: the object which received the signal.
@arg1:
@arg2:
......@@ -88,7 +108,7 @@ they work together.
</para>
@treeview: the object which received the signal.
@tree_view: the object which received the signal.
@arg1:
@arg2:
......@@ -97,7 +117,7 @@ they work together.
</para>
@treeview: the object which received the signal.
@tree_view: the object which received the signal.
@Returns:
<!-- ##### SIGNAL GtkTreeView::select-cursor-parent ##### -->
......@@ -105,7 +125,7 @@ they work together.
</para>
@treeview: the object which received the signal.
@tree_view: the object which received the signal.
@Returns:
<!-- ##### SIGNAL GtkTreeView::select-cursor-row ##### -->
......@@ -113,7 +133,7 @@ they work together.
</para>
@treeview: the object which received the signal.
@tree_view: the object which received the signal.
@arg1:
@Returns:
......@@ -122,7 +142,7 @@ they work together.
</para>
@treeview: the object which received the signal.
@tree_view: the object which received the signal.
@arg1:
@arg2:
......@@ -131,7 +151,7 @@ they work together.
</para>
@treeview: the object which received the signal.
@tree_view: the object which received the signal.
@Returns:
<!-- ##### SIGNAL GtkTreeView::test-collapse-row ##### -->
......@@ -139,7 +159,7 @@ they work together.
</para>
@treeview: the object which received the signal.
@tree_view: the object which received the signal.
@arg1:
@arg2:
@Returns:
......@@ -149,7 +169,7 @@ they work together.
</para>
@treeview: the object which received the signal.
@tree_view: the object which received the signal.
@arg1:
@arg2:
@Returns:
......@@ -159,7 +179,7 @@ they work together.
</para>
@treeview: the object which received the signal.
@tree_view: the object which received the signal.
@Returns:
<!-- ##### SIGNAL GtkTreeView::unselect-all ##### -->
......@@ -167,7 +187,7 @@ they work together.
</para>
@treeview: the object which received the signal.
@tree_view: the object which received the signal.
@Returns:
<!-- ##### ARG GtkTreeView:enable-grid-lines ##### -->
......
......@@ -4328,6 +4328,12 @@ gtk_tree_view_column_set_widget
gtk_tree_view_append_column
gtk_tree_view_collapse_all
gtk_tree_view_collapse_row
gtk_tree_view_convert_bin_window_to_tree_coords
gtk_tree_view_convert_bin_window_to_widget_coords
gtk_tree_view_convert_tree_to_bin_window_coords
gtk_tree_view_convert_tree_to_widget_coords
gtk_tree_view_convert_widget_to_bin_window_coords
gtk_tree_view_convert_widget_to_tree_coords
gtk_tree_view_create_row_drag_icon
gtk_tree_view_enable_model_drag_dest
gtk_tree_view_enable_model_drag_source
......@@ -4408,10 +4414,14 @@ gtk_tree_view_set_search_equal_func
gtk_tree_view_set_search_position_func
gtk_tree_view_set_show_expanders
gtk_tree_view_set_vadjustment
#ifndef GTK_DISABLE_DEPRECATED
gtk_tree_view_tree_to_widget_coords
#endif
gtk_tree_view_unset_rows_drag_dest
gtk_tree_view_unset_rows_drag_source
#ifndef GTK_DISABLE_DEPRECATED
gtk_tree_view_widget_to_tree_coords
#endif
gtk_tree_view_columns_autosize
#endif
#endif
......
This diff is collapsed.
......@@ -257,6 +257,8 @@ void gtk_tree_view_get_background_area (GtkTreeView
GdkRectangle *rect);
void gtk_tree_view_get_visible_rect (GtkTreeView *tree_view,
GdkRectangle *visible_rect);
#ifndef GTK_DISABLE_DEPRECATED
void gtk_tree_view_widget_to_tree_coords (GtkTreeView *tree_view,
gint wx,
gint wy,
......@@ -267,6 +269,7 @@ void gtk_tree_view_tree_to_widget_coords (GtkTreeView
gint ty,
gint *wx,
gint *wy);
#endif /* !GTK_DISABLE_DEPRECATED */
gboolean gtk_tree_view_get_visible_range (GtkTreeView *tree_view,
GtkTreePath **start_path,
GtkTreePath **end_path);
......@@ -322,6 +325,38 @@ void gtk_tree_view_set_search_position_func (GtkTreeVie
gpointer data,
GDestroyNotify destroy);
/* Convert between the different coordinate systems */
void gtk_tree_view_convert_widget_to_tree_coords (GtkTreeView *tree_view,
gint wx,
gint wy,
gint *tx,
gint *ty);
void gtk_tree_view_convert_tree_to_widget_coords (GtkTreeView *tree_view,
gint tx,
gint ty,
gint *wx,
gint *wy);
void gtk_tree_view_convert_widget_to_bin_window_coords (GtkTreeView *tree_view,
gint wx,
gint wy,
gint *bx,
gint *by);
void gtk_tree_view_convert_bin_window_to_widget_coords (GtkTreeView *tree_view,
gint bx,
gint by,
gint *wx,
gint *wy);
void gtk_tree_view_convert_tree_to_bin_window_coords (GtkTreeView *tree_view,
gint tx,
gint ty,
gint *bx,
gint *by);
void gtk_tree_view_convert_bin_window_to_tree_coords (GtkTreeView *tree_view,
gint bx,
gint by,
gint *tx,
gint *ty);
/* This function should really never be used. It is just for use by ATK.
*/
typedef void (* GtkTreeDestroyCountFunc) (GtkTreeView *tree_view,
......
......@@ -117,8 +117,14 @@ query_tooltip_tree_view_cb (GtkWidget *widget,
}
else
{
gint bin_x, bin_y;
gtk_tree_view_convert_widget_to_bin_window_coords (tree_view, x, y,
&bin_x, &bin_y);
/* Mouse mode */
if (!gtk_tree_view_get_path_at_pos (tree_view, x, y, &path, NULL, NULL, NULL))
if (!gtk_tree_view_get_path_at_pos (tree_view, bin_x, bin_y,
&path, NULL, NULL, NULL))
return FALSE;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment