]> Pileus Git - ~andy/gtk/blob - gtk/gtkspinbutton.h
patch from lars for construct behaviour.
[~andy/gtk] / gtk / gtkspinbutton.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
19 #ifndef __GTK_SPIN_BUTTON_H__
20 #define __GTK_SPIN_BUTTON_H__
21
22
23 #include <gdk/gdk.h>
24 #include <gtk/gtkentry.h>
25 #include <gtk/gtkadjustment.h>
26
27
28 #ifdef __cplusplus
29 extern "C" {
30 #endif /* __cplusplus */
31
32
33 #define GTK_SPIN_BUTTON(obj)          GTK_CHECK_CAST (obj, gtk_spin_button_get_type (), GtkSpinButton)
34 #define GTK_SPIN_BUTTON_CLASS(klass)  GTK_CHECK_CLASS_CAST (klass, gtk_spin_button_get_type (), GtkSpinButtonClass)
35 #define GTK_IS_SPIN_BUTTON(obj)       GTK_CHECK_TYPE (obj, gtk_spin_button_get_type ())
36
37
38 typedef enum
39 {
40   GTK_UPDATE_ALWAYS        = 1 << 0,
41   GTK_UPDATE_IF_VALID      = 1 << 1,
42   GTK_UPDATE_SNAP_TO_TICKS = 1 << 2
43 } GtkSpinButtonUpdatePolicy;
44
45
46 typedef struct _GtkSpinButton       GtkSpinButton;
47 typedef struct _GtkSpinButtonClass  GtkSpinButtonClass;
48
49
50 struct _GtkSpinButton
51 {
52   GtkEntry entry;
53
54   GtkAdjustment *adjustment;
55
56   GdkWindow *panel;
57
58   guint32 timer;
59
60   gfloat climb_rate;
61   gfloat timer_step;
62
63   guint8 update_policy;
64
65   guint snapped : 1;
66   guint in_child : 2;
67   guint click_child : 2;
68   guint button : 2;
69   guint need_timer : 1;
70   guint timer_calls : 3;
71   guint digits : 7;
72 };
73
74 struct _GtkSpinButtonClass
75 {
76   GtkEntryClass parent_class;
77 };
78
79 guint
80 gtk_spin_button_get_type           (void);
81
82 void
83 gtk_spin_button_construct          (GtkSpinButton  *spin_button,
84                                     GtkAdjustment  *adjustment,
85                                     gfloat          climb_rate,
86                                     gint            digits);
87
88 GtkWidget *
89 gtk_spin_button_new                (GtkAdjustment  *adjustment,
90                                     gfloat          climb_rate,
91                                     gint            digits);
92
93 void 
94 gtk_spin_button_set_adjustment     (GtkSpinButton  *spin_button,
95                                     GtkAdjustment  *adjustment);
96
97 GtkAdjustment *
98 gtk_spin_button_get_adjustment     (GtkSpinButton  *spin_button);
99
100 void
101 gtk_spin_button_set_digits         (GtkSpinButton  *spin_button,
102                                     gint            digits);
103
104 gfloat 
105 gtk_spin_button_get_value_as_float (GtkSpinButton  *spin_button);
106
107 gint 
108 gtk_spin_button_get_value_as_int   (GtkSpinButton  *spin_button);
109
110 void 
111 gtk_spin_button_set_value          (GtkSpinButton  *spin_button, 
112                                     gfloat          value);
113
114 void
115 gtk_spin_button_set_update_policy  (GtkSpinButton             *spin_button,
116                                     GtkSpinButtonUpdatePolicy  policy);
117
118 #ifdef __cplusplus
119 }
120 #endif /* __cplusplus */
121
122
123 #endif /* __GTK_SPIN_BUTTON_H__ */