]> Pileus Git - ~andy/gtk/blob - gtk/gtkrange.h
Apply patch from Nils Barth fixing event return values. (#51041)
[~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 #ifndef __GTK_RANGE_H__
28 #define __GTK_RANGE_H__
29
30
31 #include <gdk/gdk.h>
32 #include <gtk/gtkadjustment.h>
33 #include <gtk/gtkwidget.h>
34
35
36 #ifdef __cplusplus
37 extern "C" {
38 #endif /* __cplusplus */
39
40
41 #define GTK_TYPE_RANGE            (gtk_range_get_type ())
42 #define GTK_RANGE(obj)            (GTK_CHECK_CAST ((obj), GTK_TYPE_RANGE, GtkRange))
43 #define GTK_RANGE_CLASS(klass)    (GTK_CHECK_CLASS_CAST ((klass), GTK_TYPE_RANGE, GtkRangeClass))
44 #define GTK_IS_RANGE(obj)         (GTK_CHECK_TYPE ((obj), GTK_TYPE_RANGE))
45 #define GTK_IS_RANGE_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), GTK_TYPE_RANGE))
46 #define GTK_RANGE_GET_CLASS(obj)  (GTK_CHECK_GET_CLASS ((obj), GTK_TYPE_RANGE, GtkRangeClass))
47
48
49 typedef struct _GtkRange        GtkRange;
50 typedef struct _GtkRangeClass   GtkRangeClass;
51
52 struct _GtkRange
53 {
54   GtkWidget widget;
55
56   GdkWindow *trough;
57   GdkWindow *slider;
58   GdkWindow *step_forw;
59   GdkWindow *step_back;
60
61   gint16 x_click_point;
62   gint16 y_click_point;
63
64   guint8 button;
65   gint8 digits;
66   guint policy : 2;
67   guint scroll_type : 5;
68   guint in_child : 3;
69   guint click_child : 3;
70   guint need_timer : 1;
71   guint flippable : 1;
72   guint inverted : 1;
73   
74   guint32 timer;
75
76   gdouble old_value;
77   gdouble old_lower;
78   gdouble old_upper;
79   gdouble old_page_size;
80
81   GtkAdjustment *adjustment;
82 };
83
84 struct _GtkRangeClass
85 {
86   GtkWidgetClass parent_class;
87
88   gint slider_width;
89   gint stepper_size;
90   gint stepper_slider_spacing;
91   gint min_slider_size;
92
93   guint8 trough;
94   guint8 slider;
95   guint8 step_forw;
96   guint8 step_back;
97
98   void (* draw_background)  (GtkRange *range);
99   void (* clear_background) (GtkRange *range);
100   void (* draw_trough)      (GtkRange *range);
101   void (* draw_slider)      (GtkRange *range);
102   void (* draw_step_forw)   (GtkRange *range);
103   void (* draw_step_back)   (GtkRange *range);
104   void (* slider_update)    (GtkRange *range);
105   gboolean (* trough_click) (GtkRange *range,
106                              gint      x,
107                              gint      y,
108                              gdouble  *jump_perc);
109   gboolean (* trough_keys)  (GtkRange      *range,
110                              GdkEventKey   *key,
111                              GtkScrollType *scroll,
112                              GtkTroughType *trough);
113   void (* motion)           (GtkRange *range,
114                              gint      xdelta,
115                              gint      ydelta);
116   gboolean (* timer)        (GtkRange *range);
117 };
118
119
120 GtkType        gtk_range_get_type               (void) G_GNUC_CONST;
121 GtkAdjustment* gtk_range_get_adjustment         (GtkRange      *range);
122 void           gtk_range_set_update_policy      (GtkRange      *range,
123                                                  GtkUpdateType  policy);
124 void           gtk_range_set_adjustment         (GtkRange      *range,
125                                                  GtkAdjustment *adjustment);
126
127 void           gtk_range_set_inverted           (GtkRange      *range,
128                                                  gboolean       setting);
129 gboolean       gtk_range_get_inverted           (GtkRange      *range);
130
131 void           _gtk_range_draw_background        (GtkRange      *range);
132 void           _gtk_range_clear_background       (GtkRange      *range);
133 void           _gtk_range_draw_trough            (GtkRange      *range);
134 void           _gtk_range_draw_slider            (GtkRange      *range);
135 void           _gtk_range_draw_step_forw         (GtkRange      *range);
136 void           _gtk_range_draw_step_back         (GtkRange      *range);
137 void           _gtk_range_slider_update          (GtkRange      *range);
138 gboolean       _gtk_range_trough_click           (GtkRange      *range,
139                                                   gint           x,
140                                                   gint           y,
141                                                   gdouble       *jump_perc);
142
143 void           _gtk_range_default_hslider_update (GtkRange      *range);
144 void           _gtk_range_default_vslider_update (GtkRange      *range);
145 gboolean       _gtk_range_default_htrough_click  (GtkRange      *range,
146                                                   gint           x,
147                                                   gint           y,
148                                                   gdouble       *jump_perc);
149 gboolean       _gtk_range_default_vtrough_click  (GtkRange      *range,
150                                                   gint           x,
151                                                   gint           y,
152                                                   gdouble       *jump_perc);
153 void           _gtk_range_default_hmotion        (GtkRange      *range,
154                                                   gint           xdelta,
155                                                   gint           ydelta);
156 void           _gtk_range_default_vmotion        (GtkRange      *range,
157                                                   gint           xdelta,
158                                                   gint           ydelta);
159
160
161 #ifdef __cplusplus
162 }
163 #endif /* __cplusplus */
164
165
166 #endif /* __GTK_RANGE_H__ */