Coordinate translation of tree view cells
- From: Stefan Weber lawo de
- To: gtk-app-devel-list gnome org
- Subject: Coordinate translation of tree view cells
- Date: Tue, 30 Jan 2007 18:34:56 +0100
I'm trying to use 2 GtkTreeViews containing "connectable" items (audio
inputs/outputs). Between them should be a custom drawing area showing
connection lines/beziers. So I have to transform the y-component of cell
coordinates retrieved by gtk_tree_view_get_background_area or
gtk_tree_view_get_cell_area into the coordinate system of the drawing
area. Here's some pseudo code (I actually use gtkmm, but anyway):
gtk_tree_view_get_background_area(signal_view,signal_path,signal_column,&signal_rect);
/* get cell rectangle */
/* now I have tree window coords, but how do I transform them to tree or
widget coords? */
/* if I had tree coords, I would do the following: */
gtk_tree_view_tree_to_widget_coords(signal_view,signal_rect.x,signal_rect.y,&signal_rect.x,&signal_rect.y);
gtk_widget_translate_coordinates(signal_view,my_drawing_area,signal_rect.x,signal_rect.y,&signal_rect.x,&signal_rect.y);
The point is, it doesn't work. I tried a hack making
gtk_tree_view_tree_window_to_tree_coords public, because this function
seemed to solve my problem, but it didn't. The resulting coords are always
expected_y - tree_view->priv->header_height. By hacking in
_GtkTreeViewPrivate and adding header_height to the y-component, I get the
expected result. Did I miss any information, or is it really impossible
without my hack?
Thanks in advance,
Stefan
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]