]> Pileus Git - ~andy/gtk/blob - gtk/gtkspinbutton.h
Added wrapping capabilities to GtkSpinButton. New function :
[~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 Free
19  * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20  */
21
22 #ifndef __GTK_SPIN_BUTTON_H__
23 #define __GTK_SPIN_BUTTON_H__
24
25
26 #include <gdk/gdk.h>
27 #include <gtk/gtkentry.h>
28 #include <gtk/gtkadjustment.h>
29
30
31 #ifdef __cplusplus
32 extern "C" {
33 #endif /* __cplusplus */
34   
35   
36 #define GTK_SPIN_BUTTON(obj)          GTK_CHECK_CAST (obj, gtk_spin_button_get_type (), GtkSpinButton)
37 #define GTK_SPIN_BUTTON_CLASS(klass)  GTK_CHECK_CLASS_CAST (klass, gtk_spin_button_get_type (), GtkSpinButtonClass)
38 #define GTK_IS_SPIN_BUTTON(obj)       GTK_CHECK_TYPE (obj, gtk_spin_button_get_type ())
39   
40   
41 typedef enum
42 {
43   GTK_UPDATE_ALWAYS        = 1 << 0,
44   GTK_UPDATE_IF_VALID      = 1 << 1,
45   GTK_UPDATE_SNAP_TO_TICKS = 1 << 2
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   
61   guint32 timer;
62   
63   gfloat climb_rate;
64   gfloat timer_step;
65   
66   guint8 update_policy;
67   
68   guint in_child : 2;
69   guint click_child : 2;
70   guint button : 2;
71   guint need_timer : 1;
72   guint timer_calls : 3;
73   guint digits : 3;
74   guint numeric : 1;
75   guint wrap : 1;
76 };
77
78 struct _GtkSpinButtonClass
79 {
80   GtkEntryClass parent_class;
81 };
82
83 guint           gtk_spin_button_get_type           (void);
84
85 void            gtk_spin_button_construct          (GtkSpinButton  *spin_button,
86                                                     GtkAdjustment  *adjustment,
87                                                     gfloat          climb_rate,
88                                                     gint            digits);
89
90 GtkWidget*      gtk_spin_button_new                (GtkAdjustment  *adjustment,
91                                                     gfloat          climb_rate,
92                                                     gint            digits);
93
94 void            gtk_spin_button_set_adjustment     (GtkSpinButton  *spin_button,
95                                                     GtkAdjustment  *adjustment);
96
97 GtkAdjustment*  gtk_spin_button_get_adjustment     (GtkSpinButton  *spin_button);
98
99 void            gtk_spin_button_set_digits         (GtkSpinButton  *spin_button,
100                                                     gint            digits);
101
102 gfloat          gtk_spin_button_get_value_as_float (GtkSpinButton  *spin_button);
103
104 gint            gtk_spin_button_get_value_as_int   (GtkSpinButton  *spin_button);
105
106 void            gtk_spin_button_set_value          (GtkSpinButton  *spin_button, 
107                                                     gfloat          value);
108
109 void            gtk_spin_button_set_update_policy  (GtkSpinButton  *spin_button,
110                                                     GtkSpinButtonUpdatePolicy  policy);
111
112 void            gtk_spin_button_set_numeric        (GtkSpinButton  *spin_button,
113                                                     gint            numeric);
114
115 void            gtk_spin_button_spin               (GtkSpinButton *spin_button,
116                                                     guint          direction,
117                                                     gfloat         step);
118
119 void            gtk_spin_button_set_wrap           (GtkSpinButton  *spin_button,
120                                                     gint            wrap);
121
122
123
124
125 #ifdef __cplusplus
126 }
127 #endif /* __cplusplus */
128
129
130 #endif /* __GTK_SPIN_BUTTON_H__ */