1 /* GTK - The GIMP Toolkit
2 * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
4 * GtkSpinButton widget for GTK+
5 * Copyright (C) 1998 Lars Hamann and Stefan Jeske
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.
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.
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.
23 #ifndef __GTK_SPIN_BUTTON_H__
24 #define __GTK_SPIN_BUTTON_H__
28 #include <gtk/gtkentry.h>
29 #include <gtk/gtkadjustment.h>
34 #endif /* __cplusplus */
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))
48 } GtkSpinButtonUpdatePolicy;
52 GTK_SPIN_STEP_FORWARD,
53 GTK_SPIN_STEP_BACKWARD,
54 GTK_SPIN_PAGE_FORWARD,
55 GTK_SPIN_PAGE_BACKWARD,
62 typedef struct _GtkSpinButton GtkSpinButton;
63 typedef struct _GtkSpinButtonClass GtkSpinButtonClass;
70 GtkAdjustment *adjustment;
73 GtkShadowType shadow_type;
81 GtkSpinButtonUpdatePolicy update_policy;
84 guint click_child : 2;
87 guint timer_calls : 3;
91 guint snap_to_ticks : 1;
94 struct _GtkSpinButtonClass
96 GtkEntryClass parent_class;
100 GtkType gtk_spin_button_get_type (void);
102 void gtk_spin_button_configure (GtkSpinButton *spin_button,
103 GtkAdjustment *adjustment,
107 GtkWidget* gtk_spin_button_new (GtkAdjustment *adjustment,
111 void gtk_spin_button_set_adjustment (GtkSpinButton *spin_button,
112 GtkAdjustment *adjustment);
114 GtkAdjustment* gtk_spin_button_get_adjustment (GtkSpinButton *spin_button);
116 void gtk_spin_button_set_digits (GtkSpinButton *spin_button,
119 gfloat gtk_spin_button_get_value_as_float (GtkSpinButton *spin_button);
121 gint gtk_spin_button_get_value_as_int (GtkSpinButton *spin_button);
123 void gtk_spin_button_set_value (GtkSpinButton *spin_button,
126 void gtk_spin_button_set_update_policy (GtkSpinButton *spin_button,
127 GtkSpinButtonUpdatePolicy policy);
129 void gtk_spin_button_set_numeric (GtkSpinButton *spin_button,
132 void gtk_spin_button_spin (GtkSpinButton *spin_button,
133 GtkSpinType direction,
136 void gtk_spin_button_set_wrap (GtkSpinButton *spin_button,
139 void gtk_spin_button_set_shadow_type (GtkSpinButton *spin_button,
140 GtkShadowType shadow_type);
142 void gtk_spin_button_set_snap_to_ticks (GtkSpinButton *spin_button,
143 gboolean snap_to_ticks);
145 /* deprecated, defined for backwards compatibility */
146 #define gtk_spin_button_construct gtk_spin_button_configure
151 #endif /* __cplusplus */
154 #endif /* __GTK_SPIN_BUTTON_H__ */