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 #ifndef __GTK_RANGE_H__
28 #define __GTK_RANGE_H__
32 #include <gtk/gtkadjustment.h>
33 #include <gtk/gtkwidget.h>
38 #endif /* __cplusplus */
41 #define GTK_TYPE_RANGE (gtk_range_get_type ())
42 #define GTK_RANGE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_RANGE, GtkRange))
43 #define GTK_RANGE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_RANGE, GtkRangeClass))
44 #define GTK_IS_RANGE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_RANGE))
45 #define GTK_IS_RANGE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_RANGE))
46 #define GTK_RANGE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_RANGE, GtkRangeClass))
48 /* These two are private/opaque types, ignore */
49 typedef struct _GtkRangeLayout GtkRangeLayout;
50 typedef struct _GtkRangeStepTimer GtkRangeStepTimer;
52 typedef struct _GtkRange GtkRange;
53 typedef struct _GtkRangeClass GtkRangeClass;
59 GtkAdjustment *adjustment;
60 GtkUpdateType update_policy;
67 /* Steppers are: < > ---- < >
71 guint has_stepper_a : 1;
72 guint has_stepper_b : 1;
73 guint has_stepper_c : 1;
74 guint has_stepper_d : 1;
76 guint need_recalc : 1;
78 guint slider_size_fixed : 1;
82 GtkOrientation orientation;
84 /* Area of entire stepper + trough assembly in widget->window coords */
85 GdkRectangle range_rect;
86 /* Slider range along the long dimension, in widget->window coords */
87 gint slider_start, slider_end;
89 /* Round off value to this many digits, -1 for no rounding */
93 guint trough_click_forward : 1; /* trough click was on the forward side of slider */
94 guint update_pending : 1; /* need to emit value_changed */
95 GtkRangeLayout *layout;
96 GtkRangeStepTimer *timer;
97 gint slide_initial_slider_position;
98 gint slide_initial_coordinate;
99 guint update_timeout_id;
100 GdkWindow *event_window;
103 struct _GtkRangeClass
105 GtkWidgetClass parent_class;
107 /* what detail to pass to GTK drawing functions */
108 gchar *slider_detail;
109 gchar *stepper_detail;
111 void (* value_changed) (GtkRange *range);
112 void (* adjust_bounds) (GtkRange *range,
115 /* action signals for keybindings */
116 void (* move_slider) (GtkRange *range,
117 GtkScrollType scroll);
119 /* Virtual functions */
120 void (* get_range_border) (GtkRange *range,
123 /* Padding for future expansion */
124 void (*_gtk_reserved1) (void);
125 void (*_gtk_reserved2) (void);
126 void (*_gtk_reserved3) (void);
127 void (*_gtk_reserved4) (void);
131 GType gtk_range_get_type (void) G_GNUC_CONST;
133 void gtk_range_set_update_policy (GtkRange *range,
134 GtkUpdateType policy);
135 GtkUpdateType gtk_range_get_update_policy (GtkRange *range);
136 void gtk_range_set_adjustment (GtkRange *range,
137 GtkAdjustment *adjustment);
138 GtkAdjustment* gtk_range_get_adjustment (GtkRange *range);
139 void gtk_range_set_inverted (GtkRange *range,
141 gboolean gtk_range_get_inverted (GtkRange *range);
142 void gtk_range_set_increments (GtkRange *range,
145 void gtk_range_set_range (GtkRange *range,
148 void gtk_range_set_value (GtkRange *range,
150 gdouble gtk_range_get_value (GtkRange *range);
155 #endif /* __cplusplus */
158 #endif /* __GTK_RANGE_H__ */