问题
I'm using a GtkTreeView widget. If I have a row's GtkTreeIter, how can I then get that row's current position (vertical pixel coordinate) within the entire GtkTreeView window?
My underlying problem is that I need to get a GtkTreeIter for whatever row is currently placed at a given vertical coordinate relative to the entire GtkTreeView window, but I don't know how.
Any help would be greatly appreciated!! Thanks in advance :-)
回答1:
This function:
gtk_tree_view_get_path_at_pos (GtkTreeView *tree_view,
gint x,
gint y,
GtkTreePath **path,
GtkTreeViewColumn **column,
gint *cell_x,
gint *cell_y)
will give you a path that you can pass to
gtk_tree_model_get_iter()
to get an iterator.
来源:https://stackoverflow.com/questions/14838195/how-to-get-the-coordinates-of-a-gtktreeview-row