]> Pileus Git - ~andy/gtk/blob - gtk/gtkspinbutton.h
Changed GtkSpinButtonUpdatePolicy enum, added keyboard
[~andy/gtk] / gtk / gtkspinbutton.h
1 /* GTK - The GIMP Toolkit
2  * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
3  *
4  * GtkSpinButton widget for GTK+
5  * Copyright (C) 1998 Lars Hamann and Stefan Jeske
6  *
7  * This library is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Library General Public
9  * License as published by the Free Software Foundation; either
10  * version 2 of the License, or (at your option) any later version.
11  *
12  * This library is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15  * Library General Public License for more details.
16  *
17  * You should have received a copy of the GNU Library General Public
18  * License along with this library; if not, write to the
19  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
20  * Boston, MA 02111-1307, USA.
21  */
22
23 #ifndef __GTK_SPIN_BUTTON_H__
24 #define __GTK_SPIN_BUTTON_H__
25
26
27 #include <gdk/gdk.h>
28 #include <gtk/gtkentry.h>
29 #include <gtk/gtkadjustment.h>
30
31
32 #ifdef __cplusplus
33 extern "C" {
34 #endif /* __cplusplus */
35   
36   
37 #define GTK_SPIN_BUTTON(obj)          GTK_CHECK_CAST (obj, gtk_spin_button_get_type (), GtkSpinButton)
38 #define GTK_SPIN_BUTTON_CLASS(klass)  GTK_CHECK_CLASS_CAST (klass, gtk_spin_button_get_type (), GtkSpinButtonClass)
39 #define GTK_IS_SPIN_BUTTON(obj)       GTK_CHECK_TYPE (obj, gtk_spin_button_get_type ())
40   
41   
42 typedef enum
43 {
44   GTK_UPDATE_ALWAYS,
45   GTK_UPDATE_IF_VALID
46 } GtkSpinButtonUpdatePolicy;
47   
48   
49 typedef struct _GtkSpinButton       GtkSpinButton;
50 typedef struct _GtkSpinButtonClass  GtkSpinButtonClass;
51
52
53 struct _GtkSpinButton
54 {
55   GtkEntry entry;
56   
57   GtkAdjustment *adjustment;
58   
59   GdkWindow *panel;
60   GtkShadowType shadow_type;
61
62   guint32 timer;
63   guint32 ev_time;
64   
65   gfloat climb_rate;
66   gfloat timer_step;
67   
68   GtkSpinButtonUpdatePolicy update_policy;
69   
70   guint in_child : 2;
71   guint click_child : 2;
72   guint button : 2;
73   guint need_timer : 1;
74   guint timer_calls : 3;
75   guint digits : 3;
76   guint numeric : 1;
77   guint wrap : 1;
78   guint snap_to_ticks : 1;
79 };
80
81 struct _GtkSpinButtonClass
82 {
83   GtkEntryClass parent_class;
84 };
85
86 guint           gtk_spin_button_get_type           (void);
87
88 void            gtk_spin_button_construct          (GtkSpinButton  *spin_button,
89                                                     GtkAdjustment  *adjustment,
90                                                     gfloat          climb_rate,
91                                                     gint            digits);
92
93 GtkWidget*      gtk_spin_button_new                (GtkAdjustment  *adjustment,
94                                                     gfloat          climb_rate,
95                                                     gint            digits);
96
97 void            gtk_spin_button_set_adjustment     (GtkSpinButton  *spin_button,
98                                                     GtkAdjustment  *adjustment);
99
100 GtkAdjustment*  gtk_spin_button_get_adjustment     (GtkSpinButton  *spin_button);
101
102 void            gtk_spin_button_set_digits         (GtkSpinButton  *spin_button,
103                                                     gint            digits);
104
105 gfloat          gtk_spin_button_get_value_as_float (GtkSpinButton  *spin_button);
106
107 gint            gtk_spin_button_get_value_as_int   (GtkSpinButton  *spin_button);
108
109 void            gtk_spin_button_set_value          (GtkSpinButton  *spin_button, 
110                                                     gfloat          value);
111
112 void            gtk_spin_button_set_update_policy  (GtkSpinButton  *spin_button,
113                                                     GtkSpinButtonUpdatePolicy  policy);
114
115 void            gtk_spin_button_set_numeric        (GtkSpinButton  *spin_button,
116                                                     gint            numeric);
117
118 void            gtk_spin_button_spin               (GtkSpinButton *spin_button,
119                                                     guint          direction,
120                                                     gfloat         step);
121
122 void            gtk_spin_button_set_wrap           (GtkSpinButton  *spin_button,
123                                                     gint            wrap);
124
125 void            gtk_spin_button_set_shadow_type    (GtkSpinButton  *spin_button,
126                                                     GtkShadowType   shadow_type);
127
128 void            gtk_spin_button_set_snap_to_ticks  (GtkSpinButton  *spin_button,
129                                                     gint            snap_to_ticks);
130
131
132 #ifdef __cplusplus
133 }
134 #endif /* __cplusplus */
135
136
137 #endif /* __GTK_SPIN_BUTTON_H__ */