1 /* GTK - The GIMP Toolkit
2 * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
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.
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.
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.
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/.
27 #if defined(GTK_DISABLE_SINGLE_INCLUDES) && !defined (__GTK_H_INSIDE__) && !defined (GTK_COMPILATION)
28 #error "Only <gtk/gtk.h> can be included directly."
31 #ifndef __GTK_RANGE_H__
32 #define __GTK_RANGE_H__
36 #include <gtk/gtkadjustment.h>
37 #include <gtk/gtkwidget.h>
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))
50 /* These two are private/opaque types, ignore */
51 typedef struct _GtkRangeLayout GtkRangeLayout;
52 typedef struct _GtkRangeStepTimer GtkRangeStepTimer;
54 typedef struct _GtkRange GtkRange;
55 typedef struct _GtkRangeClass GtkRangeClass;
61 GtkAdjustment *adjustment;
62 GtkUpdateType update_policy;
69 /* Steppers are: < > ---- < >
73 guint has_stepper_a : 1;
74 guint has_stepper_b : 1;
75 guint has_stepper_c : 1;
76 guint has_stepper_d : 1;
78 guint need_recalc : 1;
80 guint slider_size_fixed : 1;
84 GtkOrientation orientation;
86 /* Area of entire stepper + trough assembly in widget->window coords */
87 GdkRectangle range_rect;
88 /* Slider range along the long dimension, in widget->window coords */
89 gint slider_start, slider_end;
91 /* Round off value to this many digits, -1 for no rounding */
95 guint trough_click_forward : 1; /* trough click was on the forward side of slider */
96 guint update_pending : 1; /* need to emit value_changed */
97 GtkRangeLayout *layout;
98 GtkRangeStepTimer *timer;
99 gint slide_initial_slider_position;
100 gint slide_initial_coordinate;
101 guint update_timeout_id;
102 GdkWindow *event_window;
105 struct _GtkRangeClass
107 GtkWidgetClass parent_class;
109 /* what detail to pass to GTK drawing functions */
110 gchar *slider_detail;
111 gchar *stepper_detail;
113 void (* value_changed) (GtkRange *range);
114 void (* adjust_bounds) (GtkRange *range,
117 /* action signals for keybindings */
118 void (* move_slider) (GtkRange *range,
119 GtkScrollType scroll);
121 /* Virtual functions */
122 void (* get_range_border) (GtkRange *range,
125 gboolean (* change_value) (GtkRange *range,
126 GtkScrollType scroll,
129 /* Padding for future expansion */
130 void (*_gtk_reserved1) (void);
131 void (*_gtk_reserved2) (void);
132 void (*_gtk_reserved3) (void);
136 GType gtk_range_get_type (void) G_GNUC_CONST;
138 void gtk_range_set_update_policy (GtkRange *range,
139 GtkUpdateType policy);
140 GtkUpdateType gtk_range_get_update_policy (GtkRange *range);
142 void gtk_range_set_adjustment (GtkRange *range,
143 GtkAdjustment *adjustment);
144 GtkAdjustment* gtk_range_get_adjustment (GtkRange *range);
146 void gtk_range_set_inverted (GtkRange *range,
148 gboolean gtk_range_get_inverted (GtkRange *range);
150 void gtk_range_set_lower_stepper_sensitivity (GtkRange *range,
151 GtkSensitivityType sensitivity);
152 GtkSensitivityType gtk_range_get_lower_stepper_sensitivity (GtkRange *range);
153 void gtk_range_set_upper_stepper_sensitivity (GtkRange *range,
154 GtkSensitivityType sensitivity);
155 GtkSensitivityType gtk_range_get_upper_stepper_sensitivity (GtkRange *range);
157 void gtk_range_set_increments (GtkRange *range,
160 void gtk_range_set_range (GtkRange *range,
163 void gtk_range_set_value (GtkRange *range,
165 gdouble gtk_range_get_value (GtkRange *range);
167 void gtk_range_set_show_fill_level (GtkRange *range,
168 gboolean show_fill_level);
169 gboolean gtk_range_get_show_fill_level (GtkRange *range);
170 void gtk_range_set_restrict_to_fill_level (GtkRange *range,
171 gboolean restrict_to_fill_level);
172 gboolean gtk_range_get_restrict_to_fill_level (GtkRange *range);
173 void gtk_range_set_fill_level (GtkRange *range,
175 gdouble gtk_range_get_fill_level (GtkRange *range);
177 gdouble _gtk_range_get_wheel_delta (GtkRange *range,
178 GdkScrollDirection direction);
184 #endif /* __GTK_RANGE_H__ */