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"
31 #include "gtkprivate.h"
34 static void gtk_scrollbar_class_init (GtkScrollbarClass *klass);
35 static void gtk_scrollbar_init (GtkScrollbar *scrollbar);
36 static void gtk_scrollbar_style_set (GtkWidget *widget,
39 static gpointer parent_class;
42 gtk_scrollbar_get_type (void)
44 static GType scrollbar_type = 0;
48 static const GTypeInfo scrollbar_info =
50 sizeof (GtkScrollbarClass),
52 NULL, /* base_finalize */
53 (GClassInitFunc) gtk_scrollbar_class_init,
54 NULL, /* class_finalize */
55 NULL, /* class_data */
56 sizeof (GtkScrollbar),
58 (GInstanceInitFunc) gtk_scrollbar_init,
59 NULL, /* value_table */
63 g_type_register_static (GTK_TYPE_RANGE, I_("GtkScrollbar"),
64 &scrollbar_info, G_TYPE_FLAG_ABSTRACT);
67 return scrollbar_type;
71 gtk_scrollbar_class_init (GtkScrollbarClass *class)
73 GtkWidgetClass *widget_class;
75 widget_class = GTK_WIDGET_CLASS (class);
77 parent_class = g_type_class_peek_parent (class);
79 widget_class->style_set = gtk_scrollbar_style_set;
81 gtk_widget_class_install_style_property (widget_class,
82 g_param_spec_int ("min-slider-length",
83 P_("Minimum Slider Length"),
84 P_("Minimum length of scrollbar slider"),
90 gtk_widget_class_install_style_property (widget_class,
91 g_param_spec_boolean ("fixed-slider-length",
92 P_("Fixed slider size"),
93 P_("Don't change slider size, just lock it to the minimum length"),
98 gtk_widget_class_install_style_property (widget_class,
99 g_param_spec_boolean ("has-backward-stepper",
100 P_("Backward stepper"),
101 P_("Display the standard backward arrow button"),
104 GTK_PARAM_READABLE));
106 gtk_widget_class_install_style_property (widget_class,
107 g_param_spec_boolean ("has-forward-stepper",
108 P_("Forward stepper"),
109 P_("Display the standard forward arrow button"),
112 GTK_PARAM_READABLE));
114 gtk_widget_class_install_style_property (widget_class,
115 g_param_spec_boolean ("has-secondary-backward-stepper",
116 P_("Secondary backward stepper"),
117 P_("Display a second backward arrow button on the opposite end of the scrollbar"),
120 GTK_PARAM_READABLE));
122 gtk_widget_class_install_style_property (widget_class,
123 g_param_spec_boolean ("has-secondary-forward-stepper",
124 P_("Secondary forward stepper"),
125 P_("Display a secondary forward arrow button on the opposite end of the scrollbar"),
128 GTK_PARAM_READABLE));
132 gtk_scrollbar_init (GtkScrollbar *scrollbar)
136 range = GTK_RANGE (scrollbar);
140 gtk_scrollbar_style_set (GtkWidget *widget,
145 gboolean has_a, has_b, has_c, has_d;
148 range = GTK_RANGE (widget);
150 gtk_widget_style_get (widget,
151 "min-slider-length", &slider_length,
152 "fixed-slider-length", &fixed_size,
153 "has-backward-stepper", &has_a,
154 "has-secondary-forward-stepper", &has_b,
155 "has-secondary-backward-stepper", &has_c,
156 "has-forward-stepper", &has_d,
159 range->min_slider_size = slider_length;
160 range->slider_size_fixed = fixed_size;
162 range->has_stepper_a = has_a;
163 range->has_stepper_b = has_b;
164 range->has_stepper_c = has_c;
165 range->has_stepper_d = has_d;
167 (* GTK_WIDGET_CLASS (parent_class)->style_set) (widget, previous);
170 #define __GTK_SCROLLBAR_C__
171 #include "gtkaliasdef.c"