]> Pileus Git - ~andy/gtk/blob - gtk/gtkrange.h
Revert name change
[~andy/gtk] / gtk / gtkrange.h
1 /* GTK - The GIMP Toolkit
2  * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with this library; if not, write to the
16  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17  * Boston, MA 02111-1307, USA.
18  */
19
20 /*
21  * Modified by the GTK+ Team and others 1997-2000.  See the AUTHORS
22  * file for a list of people on the GTK+ Team.  See the ChangeLog
23  * files for a list of changes.  These files are distributed with
24  * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
25  */
26
27 #if defined(GTK_DISABLE_SINGLE_INCLUDES) && !defined (__GTK_H_INSIDE__) && !defined (GTK_COMPILATION)
28 #error "Only <gtk/gtk.h> can be included directly."
29 #endif
30
31 #ifndef __GTK_RANGE_H__
32 #define __GTK_RANGE_H__
33
34
35 #include <gdk/gdk.h>
36 #include <gtk/gtkadjustment.h>
37 #include <gtk/gtkwidget.h>
38
39
40 G_BEGIN_DECLS
41
42
43 #define GTK_TYPE_RANGE            (gtk_range_get_type ())
44 #define GTK_RANGE(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_RANGE, GtkRange))
45 #define GTK_RANGE_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_RANGE, GtkRangeClass))
46 #define GTK_IS_RANGE(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_RANGE))
47 #define GTK_IS_RANGE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_RANGE))
48 #define GTK_RANGE_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_RANGE, GtkRangeClass))
49
50 /* These two are private/opaque types, ignore */
51 typedef struct _GtkRangeLayout    GtkRangeLayout;
52 typedef struct _GtkRangeStepTimer GtkRangeStepTimer;
53
54 typedef struct _GtkRange        GtkRange;
55 typedef struct _GtkRangeClass   GtkRangeClass;
56
57 struct _GtkRange
58 {
59   GtkWidget widget;
60
61   GtkAdjustment *GSEAL (adjustment);
62   GtkUpdateType GSEAL (update_policy);
63   guint GSEAL (inverted) : 1;
64
65   /*< protected >*/
66
67   guint GSEAL (flippable) : 1;
68
69   /* Steppers are: < > ---- < >
70    *               a b      c d
71    */
72
73   guint GSEAL (has_stepper_a) : 1;
74   guint GSEAL (has_stepper_b) : 1;
75   guint GSEAL (has_stepper_c) : 1;
76   guint GSEAL (has_stepper_d) : 1;
77
78   guint GSEAL (need_recalc) : 1;
79
80   guint GSEAL (slider_size_fixed) : 1;
81
82   gint GSEAL (min_slider_size);
83
84   GtkOrientation GSEAL (orientation);
85
86   /* Area of entire stepper + trough assembly in widget->window coords */
87   GdkRectangle GSEAL (range_rect);
88   /* Slider range along the long dimension, in widget->window coords */
89   gint GSEAL (slider_start);
90   gint GSEAL (slider_end);
91
92   /* Round off value to this many digits, -1 for no rounding */
93   gint GSEAL (round_digits);
94
95   /*< private >*/
96   guint GSEAL (trough_click_forward) : 1;  /* trough click was on the forward side of slider */
97   guint GSEAL (update_pending) : 1;        /* need to emit value_changed */
98   GtkRangeLayout *GSEAL (layout);
99   GtkRangeStepTimer *GSEAL (timer);
100   gint GSEAL (slide_initial_slider_position);
101   gint GSEAL (slide_initial_coordinate);
102   guint GSEAL (update_timeout_id);
103   GdkWindow *GSEAL (event_window);
104 };
105
106 struct _GtkRangeClass
107 {
108   GtkWidgetClass parent_class;
109
110   /* what detail to pass to GTK drawing functions */
111   gchar *slider_detail;
112   gchar *stepper_detail;
113
114   void (* value_changed)    (GtkRange     *range);
115   void (* adjust_bounds)    (GtkRange     *range,
116                              gdouble       new_value);
117
118   /* action signals for keybindings */
119   void (* move_slider)      (GtkRange     *range,
120                              GtkScrollType scroll);
121
122   /* Virtual functions */
123   void (* get_range_border) (GtkRange     *range,
124                              GtkBorder    *border_);
125
126   gboolean (* change_value) (GtkRange     *range,
127                              GtkScrollType scroll,
128                              gdouble       new_value);
129
130   /* Padding for future expansion */
131   void (*_gtk_reserved1) (void);
132   void (*_gtk_reserved2) (void);
133   void (*_gtk_reserved3) (void);
134 };
135
136
137 GType              gtk_range_get_type                      (void) G_GNUC_CONST;
138
139 void               gtk_range_set_update_policy             (GtkRange      *range,
140                                                             GtkUpdateType  policy);
141 GtkUpdateType      gtk_range_get_update_policy             (GtkRange      *range);
142
143 void               gtk_range_set_adjustment                (GtkRange      *range,
144                                                             GtkAdjustment *adjustment);
145 GtkAdjustment*     gtk_range_get_adjustment                (GtkRange      *range);
146
147 void               gtk_range_set_inverted                  (GtkRange      *range,
148                                                             gboolean       setting);
149 gboolean           gtk_range_get_inverted                  (GtkRange      *range);
150
151 void               gtk_range_set_lower_stepper_sensitivity (GtkRange      *range,
152                                                             GtkSensitivityType sensitivity);
153 GtkSensitivityType gtk_range_get_lower_stepper_sensitivity (GtkRange      *range);
154 void               gtk_range_set_upper_stepper_sensitivity (GtkRange      *range,
155                                                             GtkSensitivityType sensitivity);
156 GtkSensitivityType gtk_range_get_upper_stepper_sensitivity (GtkRange      *range);
157
158 void               gtk_range_set_increments                (GtkRange      *range,
159                                                             gdouble        step,
160                                                             gdouble        page);
161 void               gtk_range_set_range                     (GtkRange      *range,
162                                                             gdouble        min,
163                                                             gdouble        max);
164 void               gtk_range_set_value                     (GtkRange      *range,
165                                                             gdouble        value);
166 gdouble            gtk_range_get_value                     (GtkRange      *range);
167
168 void               gtk_range_set_show_fill_level           (GtkRange      *range,
169                                                             gboolean       show_fill_level);
170 gboolean           gtk_range_get_show_fill_level           (GtkRange      *range);
171 void               gtk_range_set_restrict_to_fill_level    (GtkRange      *range,
172                                                             gboolean       restrict_to_fill_level);
173 gboolean           gtk_range_get_restrict_to_fill_level    (GtkRange      *range);
174 void               gtk_range_set_fill_level                (GtkRange      *range,
175                                                             gdouble        fill_level);
176 gdouble            gtk_range_get_fill_level                (GtkRange      *range);
177
178 gdouble            _gtk_range_get_wheel_delta              (GtkRange      *range,
179                                                             GdkScrollDirection direction);
180
181
182 G_END_DECLS
183
184
185 #endif /* __GTK_RANGE_H__ */