]> Pileus Git - ~andy/gtk/blob - gtk/gtkscrollbar.c
Modify the gettext translation domain for the gtk3 rename
[~andy/gtk] / gtk / gtkscrollbar.c
1 /* GTK - The GIMP Toolkit
2  * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
3  * Copyright (C) 2001 Red Hat, Inc.
4  *
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.
9  *
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.
14  *
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.
19  */
20
21 /*
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/.
26  */
27
28 #include "config.h"
29
30 #include "gtkscrollbar.h"
31 #include "gtkintl.h"
32 #include "gtkprivate.h"
33 #include "gtkalias.h"
34
35 static void gtk_scrollbar_style_set (GtkWidget *widget,
36                                      GtkStyle  *previous);
37
38 G_DEFINE_ABSTRACT_TYPE (GtkScrollbar, gtk_scrollbar, GTK_TYPE_RANGE)
39
40 static void
41 gtk_scrollbar_class_init (GtkScrollbarClass *class)
42 {
43   GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (class);
44
45   widget_class->style_set = gtk_scrollbar_style_set;
46
47   GTK_RANGE_CLASS (class)->stepper_detail = "Xscrollbar";
48
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"),
53                                                              0,
54                                                              G_MAXINT,
55                                                              21,
56                                                              GTK_PARAM_READABLE));
57
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"),
62                                                                  FALSE,
63                                                                  GTK_PARAM_READABLE));
64
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"),
69                                                                  TRUE,
70                                                                  GTK_PARAM_READABLE));
71
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"),
76                                                                  TRUE,
77                                                                  GTK_PARAM_READABLE));
78
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"),
83                                                                  FALSE,
84                                                                  GTK_PARAM_READABLE));
85
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"),
90                                                                  FALSE,
91                                                                  GTK_PARAM_READABLE));
92 }
93
94 static void
95 gtk_scrollbar_init (GtkScrollbar *scrollbar)
96 {
97 }
98
99 static void
100 gtk_scrollbar_style_set (GtkWidget *widget,
101                          GtkStyle  *previous)
102 {
103   GtkRange *range = GTK_RANGE (widget);
104   gint slider_length;
105   gboolean fixed_size;
106   gboolean has_a, has_b, has_c, has_d;
107
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,
115                         NULL);
116
117   range->min_slider_size = slider_length;
118   range->slider_size_fixed = fixed_size;
119
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;
124
125   GTK_WIDGET_CLASS (gtk_scrollbar_parent_class)->style_set (widget, previous);
126 }
127
128 #if 0
129 /**
130  * gtk_scrollbar_new:
131  * @orientation: the scrollbar's orientation.
132  * @adjustment: (allow-none): the #GtkAdjustment to use, or %NULL to create a new adjustment.
133  *
134  * Creates a new scrollbar with the given orientation.
135  *
136  * Return value:  the new #GtkScrollbar.
137  *
138  * Since: 2.16
139  **/
140 GtkWidget *
141 gtk_scrollbar_new (GtkOrientation  orientation,
142                    GtkAdjustment  *adjustment)
143 {
144   g_return_val_if_fail (adjustment == NULL || GTK_IS_ADJUSTMENT (adjustment),
145                         NULL);
146
147   return g_object_new (GTK_TYPE_SCROLLBAR,
148                        "orientation", orientation,
149                        "adjustment",  adjustment,
150                        NULL);
151 }
152 #endif
153
154
155 #define __GTK_SCROLLBAR_C__
156 #include "gtkaliasdef.c"