1 /* GTK - The GIMP Toolkit
2 * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
3 * Copyright (C) 2001 Red Hat, Inc.
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version.
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the
17 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 * Boston, MA 02111-1307, USA.
22 * Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
23 * file for a list of people on the GTK+ Team. See the ChangeLog
24 * files for a list of changes. These files are distributed with
25 * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
30 #include "gtkscrollbar.h"
32 #include "gtkprivate.h"
35 static void gtk_scrollbar_style_set (GtkWidget *widget,
38 G_DEFINE_ABSTRACT_TYPE (GtkScrollbar, gtk_scrollbar, GTK_TYPE_RANGE)
41 gtk_scrollbar_class_init (GtkScrollbarClass *class)
43 GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (class);
45 widget_class->style_set = gtk_scrollbar_style_set;
47 GTK_RANGE_CLASS (class)->stepper_detail = "Xscrollbar";
49 gtk_widget_class_install_style_property (widget_class,
50 g_param_spec_int ("min-slider-length",
51 P_("Minimum Slider Length"),
52 P_("Minimum length of scrollbar slider"),
58 gtk_widget_class_install_style_property (widget_class,
59 g_param_spec_boolean ("fixed-slider-length",
60 P_("Fixed slider size"),
61 P_("Don't change slider size, just lock it to the minimum length"),
65 gtk_widget_class_install_style_property (widget_class,
66 g_param_spec_boolean ("has-backward-stepper",
67 P_("Backward stepper"),
68 P_("Display the standard backward arrow button"),
72 gtk_widget_class_install_style_property (widget_class,
73 g_param_spec_boolean ("has-forward-stepper",
74 P_("Forward stepper"),
75 P_("Display the standard forward arrow button"),
79 gtk_widget_class_install_style_property (widget_class,
80 g_param_spec_boolean ("has-secondary-backward-stepper",
81 P_("Secondary backward stepper"),
82 P_("Display a second backward arrow button on the opposite end of the scrollbar"),
86 gtk_widget_class_install_style_property (widget_class,
87 g_param_spec_boolean ("has-secondary-forward-stepper",
88 P_("Secondary forward stepper"),
89 P_("Display a second forward arrow button on the opposite end of the scrollbar"),
95 gtk_scrollbar_init (GtkScrollbar *scrollbar)
100 gtk_scrollbar_style_set (GtkWidget *widget,
103 GtkRange *range = GTK_RANGE (widget);
106 gboolean has_a, has_b, has_c, has_d;
108 gtk_widget_style_get (widget,
109 "min-slider-length", &slider_length,
110 "fixed-slider-length", &fixed_size,
111 "has-backward-stepper", &has_a,
112 "has-secondary-forward-stepper", &has_b,
113 "has-secondary-backward-stepper", &has_c,
114 "has-forward-stepper", &has_d,
117 range->min_slider_size = slider_length;
118 range->slider_size_fixed = fixed_size;
120 range->has_stepper_a = has_a;
121 range->has_stepper_b = has_b;
122 range->has_stepper_c = has_c;
123 range->has_stepper_d = has_d;
125 GTK_WIDGET_CLASS (gtk_scrollbar_parent_class)->style_set (widget, previous);
131 * @orientation: the scrollbar's orientation.
132 * @adjustment: (allow-none): the #GtkAdjustment to use, or %NULL to create a new adjustment.
134 * Creates a new scrollbar with the given orientation.
136 * Return value: the new #GtkScrollbar.
141 gtk_scrollbar_new (GtkOrientation orientation,
142 GtkAdjustment *adjustment)
144 g_return_val_if_fail (adjustment == NULL || GTK_IS_ADJUSTMENT (adjustment),
147 return g_object_new (GTK_TYPE_SCROLLBAR,
148 "orientation", orientation,
149 "adjustment", adjustment,
155 #define __GTK_SCROLLBAR_C__
156 #include "gtkaliasdef.c"