/** * gtk_scrollable_set_vscroll_policy: * @scrollable: a #GtkScrollable * @policy: the vertical #GtkScrollablePolicy * * Sets the #GtkScrollablePolicy to determine whether * vertical scrolling should start below the minimum height or * below the natural height. * * Since: 3.0 **/ void gtk_scrollable_set_vscroll_policy (GtkScrollable *scrollable, GtkScrollablePolicy policy) { g_return_if_fail (GTK_IS_SCROLLABLE (scrollable)); g_object_set (scrollable, "vscroll-policy", policy, NULL); }
/** * gtk_scrollable_set_vadjustment: * @scrollable: a #GtkScrollable * @vadjustment: (allow-none): a #GtkAdjustment * * Sets the vertical adjustment of the #GtkScrollable. * * Since: 3.0 **/ void gtk_scrollable_set_vadjustment (GtkScrollable *scrollable, GtkAdjustment *vadjustment) { g_return_if_fail (GTK_IS_SCROLLABLE (scrollable)); g_return_if_fail (vadjustment == NULL || GTK_IS_ADJUSTMENT (vadjustment)); g_object_set (scrollable, "vadjustment", vadjustment, NULL); }
/** * gtk_scrollable_get_vscroll_policy: * @scrollable: a #GtkScrollable * * Gets the vertical #GtkScrollablePolicy. * * Return value: The vertical #GtkScrollablePolicy. * * Since: 3.0 **/ GtkScrollablePolicy gtk_scrollable_get_vscroll_policy (GtkScrollable *scrollable) { GtkScrollablePolicy policy; g_return_val_if_fail (GTK_IS_SCROLLABLE (scrollable), GTK_SCROLL_MINIMUM); g_object_get (scrollable, "vscroll-policy", &policy, NULL); return policy; }
/** * gtk_scrollable_get_vadjustment: * @scrollable: a #GtkScrollable * * Retrieves the #GtkAdjustment used for vertical scrolling. * * Return value: (transfer none): vertical #GtkAdjustment. * * Since: 3.0 **/ GtkAdjustment * gtk_scrollable_get_vadjustment (GtkScrollable *scrollable) { GtkAdjustment *adj = NULL; g_return_val_if_fail (GTK_IS_SCROLLABLE (scrollable), NULL); g_object_get (scrollable, "vadjustment", &adj, NULL); /* Horrid hack; g_object_get() returns a new reference but * that contradicts the memory management conventions * for accessors. */ if (adj) g_object_unref (adj); return adj; }
static void gwy_scroller_add(GtkContainer *container, GtkWidget *child) { if (!GTK_IS_SCROLLABLE(child)) { g_warning("gwy_scroller_add(): cannot add non scrollable widget " "use gwy_scroller_add_with_viewport() instead"); return; } GtkBin *bin = GTK_BIN(container); GtkWidget *current_child = gtk_bin_get_child(bin); g_return_if_fail(!current_child); GTK_CONTAINER_CLASS(gwy_scroller_parent_class)->add(container, child); GwyScroller *scroller = GWY_SCROLLER(container); Scroller *priv = scroller->priv; g_object_set(child, "hadjustment", priv->hadjustment, "vadjustment", priv->vadjustment, NULL); }