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/.
29 #include "gtkscrollbar.h"
33 static void gtk_scrollbar_class_init (GtkScrollbarClass *klass);
34 static void gtk_scrollbar_init (GtkScrollbar *scrollbar);
35 static void gtk_scrollbar_style_set (GtkWidget *widget,
38 static gpointer parent_class;
41 gtk_scrollbar_get_type (void)
43 static GType scrollbar_type = 0;
47 static const GTypeInfo scrollbar_info =
49 sizeof (GtkScrollbarClass),
51 NULL, /* base_finalize */
52 (GClassInitFunc) gtk_scrollbar_class_init,
53 NULL, /* class_finalize */
54 NULL, /* class_data */
55 sizeof (GtkScrollbar),
57 (GInstanceInitFunc) gtk_scrollbar_init,
58 NULL, /* value_table */
62 g_type_register_static (GTK_TYPE_RANGE, "GtkScrollbar",
63 &scrollbar_info, G_TYPE_FLAG_ABSTRACT);
66 return scrollbar_type;
70 gtk_scrollbar_class_init (GtkScrollbarClass *class)
72 GtkWidgetClass *widget_class;
74 widget_class = GTK_WIDGET_CLASS (class);
76 parent_class = g_type_class_peek_parent (class);
78 widget_class->style_set = gtk_scrollbar_style_set;
80 gtk_widget_class_install_style_property (widget_class,
81 g_param_spec_int ("min-slider-length",
82 P_("Minimum Slider Length"),
83 P_("Minimum length of scrollbar slider"),
89 gtk_widget_class_install_style_property (widget_class,
90 g_param_spec_boolean ("fixed-slider-length",
91 P_("Fixed slider size"),
92 P_("Don't change slider size, just lock it to the minimum length"),
97 gtk_widget_class_install_style_property (widget_class,
98 g_param_spec_boolean ("has-backward-stepper",
99 P_("Backward stepper"),
100 P_("Display the standard backward arrow button"),
105 gtk_widget_class_install_style_property (widget_class,
106 g_param_spec_boolean ("has-forward-stepper",
107 P_("Forward stepper"),
108 P_("Display the standard forward arrow button"),
113 gtk_widget_class_install_style_property (widget_class,
114 g_param_spec_boolean ("has-secondary-backward-stepper",
115 P_("Secondary backward stepper"),
116 P_("Display a second backward arrow button on the opposite end of the scrollbar"),
121 gtk_widget_class_install_style_property (widget_class,
122 g_param_spec_boolean ("has-secondary-forward-stepper",
123 P_("Secondary forward stepper"),
124 P_("Display a secondary forward arrow button on the opposite end of the scrollbar"),
131 gtk_scrollbar_init (GtkScrollbar *scrollbar)
135 range = GTK_RANGE (scrollbar);
139 gtk_scrollbar_style_set (GtkWidget *widget,
144 gboolean has_a, has_b, has_c, has_d;
147 range = GTK_RANGE (widget);
149 gtk_widget_style_get (widget,
150 "min_slider_length", &slider_length,
151 "fixed_slider_length", &fixed_size,
152 "has_backward_stepper", &has_a,
153 "has_secondary_forward_stepper", &has_b,
154 "has_secondary_backward_stepper", &has_c,
155 "has_forward_stepper", &has_d,
158 range->min_slider_size = slider_length;
159 range->slider_size_fixed = fixed_size;
161 range->has_stepper_a = has_a;
162 range->has_stepper_b = has_b;
163 range->has_stepper_c = has_c;
164 range->has_stepper_d = has_d;
166 (* GTK_WIDGET_CLASS (parent_class)->style_set) (widget, previous);
169 #define __GTK_SCROLLBAR_C__
170 #include "gtkaliasdef.c"