]> Pileus Git - ~andy/gtk/blob - gtk/gtkrange.h
Initial revision
[~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 Library 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  * Library General Public License for more details.
13  *
14  * You should have received a copy of the GNU Library General Public
15  * License along with this library; if not, write to the Free
16  * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
17  */
18 #ifndef __GTK_RANGE_H__
19 #define __GTK_RANGE_H__
20
21
22 #include <gdk/gdk.h>
23 #include <gtk/gtkadjustment.h>
24 #include <gtk/gtkwidget.h>
25
26
27 #ifdef __cplusplus
28 extern "C" {
29 #endif /* __cplusplus */
30
31
32 #define GTK_RANGE(obj)          GTK_CHECK_CAST (obj, gtk_range_get_type (), GtkRange)
33 #define GTK_RANGE_CLASS(klass)  GTK_CHECK_CLASS_CAST (klass, gtk_range_get_type (), GtkRangeClass)
34 #define GTK_IS_RANGE(obj)       GTK_CHECK_TYPE (obj, gtk_range_get_type ())
35
36
37 typedef struct _GtkRange        GtkRange;
38 typedef struct _GtkRangeClass   GtkRangeClass;
39
40 struct _GtkRange
41 {
42   GtkWidget widget;
43
44   GdkWindow *trough;
45   GdkWindow *slider;
46   GdkWindow *step_forw;
47   GdkWindow *step_back;
48
49   gint16 x_click_point;
50   gint16 y_click_point;
51
52   guint8 button;
53   gint8 digits;
54   guint policy : 2;
55   guint scroll_type : 3;
56   guint in_child : 3;
57   guint click_child : 3;
58   guint need_timer : 1;
59
60   guint32 timer;
61
62   gfloat old_value;
63   gfloat old_lower;
64   gfloat old_upper;
65   gfloat old_page_size;
66
67   GtkAdjustment *adjustment;
68 };
69
70 struct _GtkRangeClass
71 {
72   GtkWidgetClass parent_class;
73
74   gint slider_width;
75   gint stepper_size;
76   gint stepper_slider_spacing;
77   gint min_slider_size;
78
79   guint8 trough;
80   guint8 slider;
81   guint8 step_forw;
82   guint8 step_back;
83
84   void (* draw_background) (GtkRange *range);
85   void (* draw_trough)     (GtkRange *range);
86   void (* draw_slider)     (GtkRange *range);
87   void (* draw_step_forw)  (GtkRange *range);
88   void (* draw_step_back)  (GtkRange *range);
89   void (* slider_update)   (GtkRange *range);
90   gint (* trough_click)    (GtkRange *range,
91                             gint      x,
92                             gint      y);
93   gint (* trough_keys)     (GtkRange *range,
94                             GdkEventKey *key,
95                             GtkScrollType *scroll,
96                             GtkTroughType *trough);
97   void (* motion)          (GtkRange *range,
98                             gint      xdelta,
99                             gint      ydelta);
100   gint (* timer)           (GtkRange *range);
101 };
102
103
104 guint          gtk_range_get_type               (void);
105 GtkAdjustment* gtk_range_get_adjustment         (GtkRange      *range);
106 void           gtk_range_set_update_policy      (GtkRange      *range,
107                                                  GtkUpdateType  policy);
108 void           gtk_range_set_adjustment         (GtkRange      *range,
109                                                  GtkAdjustment *adjustment);
110
111 void           gtk_range_draw_background        (GtkRange      *range);
112 void           gtk_range_draw_trough            (GtkRange      *range);
113 void           gtk_range_draw_slider            (GtkRange      *range);
114 void           gtk_range_draw_step_forw         (GtkRange      *range);
115 void           gtk_range_draw_step_back         (GtkRange      *range);
116 void           gtk_range_slider_update          (GtkRange      *range);
117 gint           gtk_range_trough_click           (GtkRange      *range,
118                                                  gint           x,
119                                                  gint           y);
120
121 void           gtk_range_default_hslider_update (GtkRange      *range);
122 void           gtk_range_default_vslider_update (GtkRange      *range);
123 gint           gtk_range_default_htrough_click  (GtkRange      *range,
124                                                  gint           x,
125                                                  gint           y);
126 gint           gtk_range_default_vtrough_click  (GtkRange      *range,
127                                                  gint           x,
128                                                  gint           y);
129 void           gtk_range_default_hmotion        (GtkRange      *range,
130                                                  gint           xdelta,
131                                                  gint           ydelta);
132 void           gtk_range_default_vmotion        (GtkRange      *range,
133                                                  gint           xdelta,
134                                                  gint           ydelta);
135 gfloat         gtk_range_calc_value             (GtkRange      *range,
136                                                  gint           position);
137
138
139 #ifdef __cplusplus
140 }
141 #endif /* __cplusplus */
142
143
144 #endif /* __GTK_RANGE_H__ */