Re: [gtk-list] Manual listbox scrolling

Stefan Jeske <> writes:

> Hi !
> I'd like to implement the above, and have to find out if the
> selected list item is inside or (partly) outside the visible
> part of the list box, in order to scroll one line up or down.
> How can I check this ?

There's a sort of fundemental problem here in that a listbox
knows very little about the scrolledwindow it lives in.

That being said, a rough way of achieving this might be to 
use the function:

  void        gdk_window_get_geometry    (GdkWindow       *window,
                                          gint            *x,
                                          gint            *y,
                                          gint            *width,
                                          gint            *height,
                                          gint            *depth);

To find out the location of the window with respect to the parent

  gdk_window_get_geometry (list_item->window, NULL, &y, NULL, &height,NULL);

Then check if the parent widget is a viewport. 

 if (gtk_type_is_a(GTK_TYPE(widget->parent), gtk_viewport_get_type))
     [ Look at viewport->adjustment->vadjustment, and 
     figure out from that, list_widget->allocation.height, and geometry
     of the list item, whether the list item is visible. ]

Hope this helps,

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