Re: GtkTreeView - how to detect if a row is displayed on the screen?



Le Samedi 15 Novembre 2003 23:12, David M. Cook a écrit :
On Tue, Nov 11, 2003 at 06:27:34PM +0100, Benoit DUMONT wrote:
I don't know how to detect if a row is visible on the screen or not.
When using the deprecated CTree or CList widget, I could use:
gtk_ctree_node_is_visible but it is now deprecated and I can't find any
replacement.
You could use TreeView.get_cell_area().  According to the API docs:
http://developer.gnome.org/doc/API/2.0/gtk/GtkTreeView.html#gtk-tree-view-g
et-cell-area
  If path is NULL, or points to a path not currently displayed, the y and
  height fields of the rectangle will be filled with 0.
In other words, if the cell area doesn't overlap the visible area of the
TreeView, these dimensions are just zero.

It works except that even if path is not currently displayed, y and height 
fields are not filled with 0 but with the relative position on the screen.
ie: 
if y+height<0 --> It is not on the screen (before the current position)
if y>page-size of the scrolled window --> It is not on the screen (after the 
current position)

Thanks very much for the help.



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]