]> Pileus Git - ~andy/gtk/blob - gtk/gtkspinbutton.h
removed all occourances of #pragma } and #pragma { which were in place to
[~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_TYPE_SPIN_BUTTON                  (gtk_spin_button_get_type ())
38 #define GTK_SPIN_BUTTON(obj)                  (GTK_CHECK_CAST ((obj), GTK_TYPE_SPIN_BUTTON, GtkSpinButton))
39 #define GTK_SPIN_BUTTON_CLASS(klass)          (GTK_CHECK_CLASS_CAST ((klass), GTK_TYPE_SPIN_BUTTON, GtkSpinButtonClass))
40 #define GTK_IS_SPIN_BUTTON(obj)               (GTK_CHECK_TYPE ((obj), GTK_TYPE_SPIN_BUTTON))
41 #define GTK_IS_SPIN_BUTTON_CLASS(klass)       (GTK_CHECK_CLASS_TYPE ((klass), GTK_TYPE_SPIN_BUTTON))
42
43
44 typedef enum
45 {
46   GTK_UPDATE_ALWAYS,
47   GTK_UPDATE_IF_VALID
48 } GtkSpinButtonUpdatePolicy;
49
50 typedef enum
51 {
52   GTK_SPIN_STEP_FORWARD,
53   GTK_SPIN_STEP_BACKWARD,
54   GTK_SPIN_PAGE_FORWARD,
55   GTK_SPIN_PAGE_BACKWARD,
56   GTK_SPIN_HOME,
57   GTK_SPIN_END,
58   GTK_SPIN_USER_DEFINED
59 } GtkSpinType;
60
61
62 typedef struct _GtkSpinButton       GtkSpinButton;
63 typedef struct _GtkSpinButtonClass  GtkSpinButtonClass;
64
65
66 struct _GtkSpinButton
67 {
68   GtkEntry entry;
69   
70   GtkAdjustment *adjustment;
71   
72   GdkWindow *panel;
73   GtkShadowType shadow_type;
74   
75   guint32 timer;
76   guint32 ev_time;
77   
78   gfloat climb_rate;
79   gfloat timer_step;
80   
81   GtkSpinButtonUpdatePolicy update_policy;
82   
83   guint in_child : 2;
84   guint click_child : 2;
85   guint button : 2;
86   guint need_timer : 1;
87   guint timer_calls : 3;
88   guint digits : 3;
89   guint numeric : 1;
90   guint wrap : 1;
91   guint snap_to_ticks : 1;
92 };
93
94 struct _GtkSpinButtonClass
95 {
96   GtkEntryClass parent_class;
97 };
98
99
100 GtkType         gtk_spin_button_get_type           (void);
101
102 void            gtk_spin_button_configure          (GtkSpinButton  *spin_button,
103                                                     GtkAdjustment  *adjustment,
104                                                     gfloat          climb_rate,
105                                                     guint           digits);
106
107 GtkWidget*      gtk_spin_button_new                (GtkAdjustment  *adjustment,
108                                                     gfloat          climb_rate,
109                                                     guint           digits);
110
111 void            gtk_spin_button_set_adjustment     (GtkSpinButton  *spin_button,
112                                                     GtkAdjustment  *adjustment);
113
114 GtkAdjustment*  gtk_spin_button_get_adjustment     (GtkSpinButton  *spin_button);
115
116 void            gtk_spin_button_set_digits         (GtkSpinButton  *spin_button,
117                                                     guint           digits);
118
119 gfloat          gtk_spin_button_get_value_as_float (GtkSpinButton  *spin_button);
120
121 gint            gtk_spin_button_get_value_as_int   (GtkSpinButton  *spin_button);
122
123 void            gtk_spin_button_set_value          (GtkSpinButton  *spin_button, 
124                                                     gfloat          value);
125
126 void            gtk_spin_button_set_update_policy  (GtkSpinButton  *spin_button,
127                                                     GtkSpinButtonUpdatePolicy  policy);
128
129 void            gtk_spin_button_set_numeric        (GtkSpinButton  *spin_button,
130                                                     gboolean        numeric);
131
132 void            gtk_spin_button_spin               (GtkSpinButton  *spin_button,
133                                                     GtkSpinType     direction,
134                                                     gfloat          increment);
135
136 void            gtk_spin_button_set_wrap           (GtkSpinButton  *spin_button,
137                                                     gboolean        wrap);
138
139 void            gtk_spin_button_set_shadow_type    (GtkSpinButton  *spin_button,
140                                                     GtkShadowType   shadow_type);
141
142 void            gtk_spin_button_set_snap_to_ticks  (GtkSpinButton  *spin_button,
143                                                     gboolean        snap_to_ticks);
144
145 /* deprecated, defined for backwards compatibility */
146 #define gtk_spin_button_construct gtk_spin_button_configure
147
148
149 #ifdef __cplusplus
150 }
151 #endif /* __cplusplus */
152
153
154 #endif /* __GTK_SPIN_BUTTON_H__ */