diff options
author | Michael Natterer <mitch@imendio.com> | 2008-11-11 17:47:13 +0000 |
---|---|---|
committer | Michael Natterer <mitch@src.gnome.org> | 2008-11-11 17:47:13 +0000 |
commit | 0498dca831099c1fac3c0d0a38b0bb08c4bd96de (patch) | |
tree | 684058a5c5624ce509bff9b297d9bd1e6f17206b /gtk/gtkscrollbar.c | |
parent | 4d8f9d2ef380f9158e0611df6f791042d0ebae76 (diff) | |
download | gtk+-0498dca831099c1fac3c0d0a38b0bb08c4bd96de.tar.gz |
Bug 553765 – Add orientation API to GtkRange
2008-11-11 Michael Natterer <mitch@imendio.com>
Bug 553765 – Add orientation API to GtkRange
* gtk/gtkrange.[ch]: implement the GtkOrientable interface. Add
evil code that makes sure that the stepper_detail and slider_detail
set in GtkRangeClass continue to work with the hacked subclasses
below.
* gtk/gtkscale.[ch]: swallow all code from GtkHScale and GtkVScale
and add gtk_scale_new() and gtk_scale_new_with_range() which take
a GtkOrientation argument. Set slider_detail to "Xscale" so above
evil code works.
* gtk/gtkscrollbar.[ch]: add gtk_scrollbar_new() which takes a
GtkOrientation argument. Set stepper_detail to "Xscrollbar" so
above evil code works.
* gtk/gtkhscale.c
* gtk/gtkvscale.c
* gtk/gtkhscrollbar.c
* gtk/gtkvscrollbar.c: remove all code except the constructor and
call gtk_orientable_set_orientation() in init().
* gtk/gtk.symbols: changed accordingly.
svn path=/trunk/; revision=21779
Diffstat (limited to 'gtk/gtkscrollbar.c')
-rw-r--r-- | gtk/gtkscrollbar.c | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/gtk/gtkscrollbar.c b/gtk/gtkscrollbar.c index cd81b8ba10..4c69983817 100644 --- a/gtk/gtkscrollbar.c +++ b/gtk/gtkscrollbar.c @@ -35,7 +35,7 @@ static void gtk_scrollbar_style_set (GtkWidget *widget, GtkStyle *previous); -G_DEFINE_ABSTRACT_TYPE (GtkScrollbar, gtk_scrollbar, GTK_TYPE_RANGE) +G_DEFINE_TYPE (GtkScrollbar, gtk_scrollbar, GTK_TYPE_RANGE) static void gtk_scrollbar_class_init (GtkScrollbarClass *class) @@ -44,6 +44,8 @@ gtk_scrollbar_class_init (GtkScrollbarClass *class) widget_class->style_set = gtk_scrollbar_style_set; + GTK_RANGE_CLASS (class)->stepper_detail = "Xscrollbar"; + gtk_widget_class_install_style_property (widget_class, g_param_spec_int ("min-slider-length", P_("Minimum Slider Length"), @@ -123,5 +125,29 @@ gtk_scrollbar_style_set (GtkWidget *widget, GTK_WIDGET_CLASS (gtk_scrollbar_parent_class)->style_set (widget, previous); } +/** + * gtk_scrollbar_new: + * @orientation: the scrollbar's orientation. + * @adjustment: the #GtkAdjustment to use, or %NULL to create a new adjustment. + * + * Creates a new scrollbar with the given orientation. + * + * Return value: the new #GtkScrollbar. + * + * Since: 2.16 + **/ +GtkWidget * +gtk_scrollbar_new (GtkOrientation orientation, + GtkAdjustment *adjustment) +{ + g_return_val_if_fail (adjustment == NULL || GTK_IS_ADJUSTMENT (adjustment), + NULL); + + return g_object_new (GTK_TYPE_SCROLLBAR, + "orientation", orientation, + "adjustment", adjustment, + NULL); +} + #define __GTK_SCROLLBAR_C__ #include "gtkaliasdef.c" |