RFC: gtk_scrolled_window_set_corner_widget()



hi all,

as per owen's request, i'd like to ask for comments on
adding a function:

/* set a widget to be displayed in the corner of of the two scrollbars for
 * scrolled windows that have GTK_POLICY_ALWAYS for both dimensions.
 */
void   gtk_scrolled_window_set_corner_widget (GtkScrolledWindow *scrolled_window,
                                              GtkWidget         *corner_widget);

implementation wise, this function acts pretty much like
gtk_container_add(), with gtk_scrolled_window_set_corner_widget (sw, NULL)
mimicking gtk_container_remove() functionality.
however, the corner_widget is _only_ shown if
(hscrollbar_policy == GTK_POLICY_ALWAYS &&
 vscrollbar_policy == GTK_POLICY_ALWAYS)

rationale for including this function is as follows:
- a couple of scrolled window uses involve always having GTK_POLICY_ALWAYS
  for both scrollbars, resulting in an unused corner rectangle where the
  scrollbars come closest to each other
- it's often usefull to provide add-on functionality over the scrollbars to
  adjust the visible portion of the area to be scrolled. for instance BEAST
  uses a gnome-canvas as scrollable area and provides a button as
  corner_widget which, when clicked, adjusts the scrollable region so that
  all contained canvas-items get recentered (and the scrollable area is
  widened/shrunk if appropriate). for another example, gimp (though they
  don't actually use a scrolled window for the packing but a table to
  also support rulers etc) provides a corner_widget for images that
  provides a popup thumbnail for two-dimensional adjustment of the visible
  area.
- adding a corner_widget to the exisiting GtkScrolledWindow widget is quite
  hard, derivation is requires, as well as overriding _forall, size_allocate,
  size_request, map, unmap, and destroy. for those interested in example
  code, the CVS module beast implements a corner widget in
  beast/beast-gtk/bstzoomedwindow.c.

as far as owen indicated, he's expecting issues with themability or the like,
i don't really expect that to happen, since
gtk_scrolled_window_set_corner_widget() pretty much maps gtk_container_add().
so this is effectively, very similar to adding another child to e.g. an hbox
or a table.

---
ciaoTJ





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