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 |
---|
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-1999. 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 | |
---|
47 | |
---|
48 | typedef struct _GtkRange GtkRange; |
---|
49 | typedef struct _GtkRangeClass GtkRangeClass; |
---|
50 | |
---|
51 | struct _GtkRange |
---|
52 | { |
---|
53 | GtkWidget widget; |
---|
54 | |
---|
55 | GdkWindow *trough; |
---|
56 | GdkWindow *slider; |
---|
57 | GdkWindow *step_forw; |
---|
58 | GdkWindow *step_back; |
---|
59 | |
---|
60 | gint16 x_click_point; |
---|
61 | gint16 y_click_point; |
---|
62 | |
---|
63 | guint8 button; |
---|
64 | gint8 digits; |
---|
65 | guint policy : 2; |
---|
66 | guint scroll_type : 3; |
---|
67 | guint in_child : 3; |
---|
68 | guint click_child : 3; |
---|
69 | guint need_timer : 1; |
---|
70 | |
---|
71 | guint32 timer; |
---|
72 | |
---|
73 | gfloat old_value; |
---|
74 | gfloat old_lower; |
---|
75 | gfloat old_upper; |
---|
76 | gfloat old_page_size; |
---|
77 | |
---|
78 | GtkAdjustment *adjustment; |
---|
79 | }; |
---|
80 | |
---|
81 | struct _GtkRangeClass |
---|
82 | { |
---|
83 | GtkWidgetClass parent_class; |
---|
84 | |
---|
85 | gint slider_width; |
---|
86 | gint stepper_size; |
---|
87 | gint stepper_slider_spacing; |
---|
88 | gint min_slider_size; |
---|
89 | |
---|
90 | guint8 trough; |
---|
91 | guint8 slider; |
---|
92 | guint8 step_forw; |
---|
93 | guint8 step_back; |
---|
94 | |
---|
95 | void (* draw_background) (GtkRange *range); |
---|
96 | void (* clear_background) (GtkRange *range); |
---|
97 | void (* draw_trough) (GtkRange *range); |
---|
98 | void (* draw_slider) (GtkRange *range); |
---|
99 | void (* draw_step_forw) (GtkRange *range); |
---|
100 | void (* draw_step_back) (GtkRange *range); |
---|
101 | void (* slider_update) (GtkRange *range); |
---|
102 | gint (* trough_click) (GtkRange *range, |
---|
103 | gint x, |
---|
104 | gint y, |
---|
105 | gfloat *jump_perc); |
---|
106 | gint (* trough_keys) (GtkRange *range, |
---|
107 | GdkEventKey *key, |
---|
108 | GtkScrollType *scroll, |
---|
109 | GtkTroughType *trough); |
---|
110 | void (* motion) (GtkRange *range, |
---|
111 | gint xdelta, |
---|
112 | gint ydelta); |
---|
113 | gint (* timer) (GtkRange *range); |
---|
114 | }; |
---|
115 | |
---|
116 | |
---|
117 | GtkType gtk_range_get_type (void); |
---|
118 | GtkAdjustment* gtk_range_get_adjustment (GtkRange *range); |
---|
119 | void gtk_range_set_update_policy (GtkRange *range, |
---|
120 | GtkUpdateType policy); |
---|
121 | void gtk_range_set_adjustment (GtkRange *range, |
---|
122 | GtkAdjustment *adjustment); |
---|
123 | |
---|
124 | void gtk_range_draw_background (GtkRange *range); |
---|
125 | void gtk_range_clear_background (GtkRange *range); |
---|
126 | void gtk_range_draw_trough (GtkRange *range); |
---|
127 | void gtk_range_draw_slider (GtkRange *range); |
---|
128 | void gtk_range_draw_step_forw (GtkRange *range); |
---|
129 | void gtk_range_draw_step_back (GtkRange *range); |
---|
130 | void gtk_range_slider_update (GtkRange *range); |
---|
131 | gint gtk_range_trough_click (GtkRange *range, |
---|
132 | gint x, |
---|
133 | gint y, |
---|
134 | gfloat *jump_perc); |
---|
135 | |
---|
136 | void gtk_range_default_hslider_update (GtkRange *range); |
---|
137 | void gtk_range_default_vslider_update (GtkRange *range); |
---|
138 | gint gtk_range_default_htrough_click (GtkRange *range, |
---|
139 | gint x, |
---|
140 | gint y, |
---|
141 | gfloat *jump_perc); |
---|
142 | gint gtk_range_default_vtrough_click (GtkRange *range, |
---|
143 | gint x, |
---|
144 | gint y, |
---|
145 | gfloat *jump_perc); |
---|
146 | void gtk_range_default_hmotion (GtkRange *range, |
---|
147 | gint xdelta, |
---|
148 | gint ydelta); |
---|
149 | void gtk_range_default_vmotion (GtkRange *range, |
---|
150 | gint xdelta, |
---|
151 | gint ydelta); |
---|
152 | |
---|
153 | void _gtk_range_get_props (GtkRange *range, |
---|
154 | gint *slider_width, |
---|
155 | gint *trough_border, |
---|
156 | gint *stepper_size, |
---|
157 | gint *stepper_spacing); |
---|
158 | |
---|
159 | #ifdef __cplusplus |
---|
160 | } |
---|
161 | #endif /* __cplusplus */ |
---|
162 | |
---|
163 | |
---|
164 | #endif /* __GTK_RANGE_H__ */ |
---|