]> Pileus Git - ~andy/gtk/blob - gtk/gtkspinbutton.h
New API to set the shadow type of the arrow panel.
[~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        = 1 << 0,
45   GTK_UPDATE_IF_VALID      = 1 << 1,
46   GTK_UPDATE_SNAP_TO_TICKS = 1 << 2
47 } GtkSpinButtonUpdatePolicy;
48   
49   
50 typedef struct _GtkSpinButton       GtkSpinButton;
51 typedef struct _GtkSpinButtonClass  GtkSpinButtonClass;
52
53
54 struct _GtkSpinButton
55 {
56   GtkEntry entry;
57   
58   GtkAdjustment *adjustment;
59   
60   GdkWindow *panel;
61   GtkShadowType shadow_type;
62
63   guint32 timer;
64   
65   gfloat climb_rate;
66   gfloat timer_step;
67   
68   guint8 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 };
79
80 struct _GtkSpinButtonClass
81 {
82   GtkEntryClass parent_class;
83 };
84
85 guint           gtk_spin_button_get_type           (void);
86
87 void            gtk_spin_button_construct          (GtkSpinButton  *spin_button,
88                                                     GtkAdjustment  *adjustment,
89                                                     gfloat          climb_rate,
90                                                     gint            digits);
91
92 GtkWidget*      gtk_spin_button_new                (GtkAdjustment  *adjustment,
93                                                     gfloat          climb_rate,
94                                                     gint            digits);
95
96 void            gtk_spin_button_set_adjustment     (GtkSpinButton  *spin_button,
97                                                     GtkAdjustment  *adjustment);
98
99 GtkAdjustment*  gtk_spin_button_get_adjustment     (GtkSpinButton  *spin_button);
100
101 void            gtk_spin_button_set_digits         (GtkSpinButton  *spin_button,
102                                                     gint            digits);
103
104 gfloat          gtk_spin_button_get_value_as_float (GtkSpinButton  *spin_button);
105
106 gint            gtk_spin_button_get_value_as_int   (GtkSpinButton  *spin_button);
107
108 void            gtk_spin_button_set_value          (GtkSpinButton  *spin_button, 
109                                                     gfloat          value);
110
111 void            gtk_spin_button_set_update_policy  (GtkSpinButton  *spin_button,
112                                                     GtkSpinButtonUpdatePolicy  policy);
113
114 void            gtk_spin_button_set_numeric        (GtkSpinButton  *spin_button,
115                                                     gint            numeric);
116
117 void            gtk_spin_button_spin               (GtkSpinButton *spin_button,
118                                                     guint          direction,
119                                                     gfloat         step);
120
121 void            gtk_spin_button_set_wrap           (GtkSpinButton  *spin_button,
122                                                     gint            wrap);
123
124 void            gtk_spin_button_set_shadow_type    (GtkSpinButton  *spin_button,
125                                                     GtkShadowType   shadow_type);
126
127
128
129
130 #ifdef __cplusplus
131 }
132 #endif /* __cplusplus */
133
134
135 #endif /* __GTK_SPIN_BUTTON_H__ */