5 #include "gtk-clutter-scrollable.h"
7 #define I_(str) (g_intern_static_string ((str)))
10 * SECTION:gtk-clutter-scrollable
11 * @short_description: Interface for scrollable actors
13 * #GtkClutterScrollable is an interface for scrollable actors, reusing
14 * the #GtkAdjustment objects from GTK+ do drive the scrolling.
16 * #GtkClutterScrollable is available since Clutter-GTK 0.10
20 gtk_clutter_scrollable_base_init (gpointer g_iface)
22 static gboolean is_initialized = FALSE;
24 if (G_UNLIKELY (!is_initialized))
29 * GtkClutterScrollable:hadjustment:
31 * The #GtkAdjustment that determines the value of the
32 * horizontal position for this scrollable actor.
36 pspec = g_param_spec_object ("hadjustment",
37 "Horizontal adjustment",
38 "The GtkAdjustment that determines "
39 "the value of the horizontal position "
40 "for this scrollable actor",
42 G_PARAM_READWRITE | G_PARAM_CONSTRUCT);
43 g_object_interface_install_property (g_iface, pspec);
46 * GtkClutterScrollable:vadjustment:
48 * The #GtkAdjustment that determines the value of the
49 * vertical position for this scrollable actor.
53 pspec = g_param_spec_object ("vadjustment",
54 "Vertical adjustment",
55 "The GtkAdjustment that determines "
56 "the value of the vertical position "
57 "for this scrollable actor",
59 G_PARAM_READWRITE | G_PARAM_CONSTRUCT);
60 g_object_interface_install_property (g_iface, pspec);
62 is_initialized = TRUE;
67 gtk_clutter_scrollable_get_type (void)
69 static GType scrollable_type = 0;
71 if (G_UNLIKELY (!scrollable_type))
73 const GTypeInfo scrollable_info =
75 sizeof (GtkClutterScrollableIface),
76 (GBaseInitFunc) gtk_clutter_scrollable_base_init,
77 (GBaseFinalizeFunc) NULL,
80 scrollable_type = g_type_register_static (G_TYPE_INTERFACE,
81 I_("GtkClutterScrollable"),
85 return scrollable_type;
89 * gtk_clutter_scrollable_set_adjustments:
90 * @scrollable: a #GtkClutterScrollable
91 * @h_adjust: a #GtkAdjustment, or %NULL
92 * @v_adjust: a #GtkAdjustment, or %NULL
94 * Sets the horizontal and vertical adjustments used to determine
95 * the position of the scrollable actor.
100 gtk_clutter_scrollable_set_adjustments (GtkClutterScrollable *scrollable,
101 GtkAdjustment *h_adjust,
102 GtkAdjustment *v_adjust)
104 GtkClutterScrollableIface *iface;
106 g_return_if_fail (GTK_CLUTTER_IS_SCROLLABLE (scrollable));
107 g_return_if_fail (h_adjust == NULL || GTK_IS_ADJUSTMENT (h_adjust));
109 iface = GTK_CLUTTER_SCROLLABLE_GET_IFACE (scrollable);
110 if (iface->set_adjustments)
111 iface->set_adjustments (scrollable, h_adjust, v_adjust);
115 * gtk_clutter_scrollable_get_adjustments:
116 * @scrollable: a #GtkClutterScrollable
117 * @h_adjust: return location for a #GtkAdjustment, or %NULL
118 * @v_adjust: return location for a #GtkAdjustment, or %NULL
120 * Retrieves the horizontal and vertical adjustments used to
121 * determine the position of the scrollable actor.
126 gtk_clutter_scrollable_get_adjustments (GtkClutterScrollable *scrollable,
127 GtkAdjustment **h_adjust,
128 GtkAdjustment **v_adjust)
130 GtkClutterScrollableIface *iface;
132 g_return_if_fail (GTK_CLUTTER_IS_SCROLLABLE (scrollable));
134 iface = GTK_CLUTTER_SCROLLABLE_GET_IFACE (scrollable);
135 if (iface->get_adjustments)
136 iface->get_adjustments (scrollable, h_adjust, v_adjust);