package Gtk_Spin_Type_Properties is new Generic_Internal_Discrete_Property (Gtk_Spin_Type);
package Gtk_Spin_Button_Update_Policy_Properties is new Generic_Internal_Discrete_Property (Gtk_Spin_Button_Update_Policy);
package Implements_Gtk_Buildable is new Glib.Types.Implements (Gtk.Buildable.Gtk_Buildable, Gtk_Spin_Button_Record, Gtk_Spin_Button);
package Implements_Gtk_Cell_Editable is new Glib.Types.Implements (Gtk.Cell_Editable.Gtk_Cell_Editable, Gtk_Spin_Button_Record, Gtk_Spin_Button);
package Implements_Gtk_Editable is new Glib.Types.Implements (Gtk.Editable.Gtk_Editable, Gtk_Spin_Button_Record, Gtk_Spin_Button);
package Implements_Gtk_Orientable is new Glib.Types.Implements (Gtk.Orientable.Gtk_Orientable, Gtk_Spin_Button_Record, Gtk_Spin_Button);
type Gtk_Spin_Button_Record is new Gtk_Entry_Record with null record;
type Gtk_Spin_Button is access all Gtk_Spin_Button_Record'Class;
type Gtk_Spin_Type is ( Spin_Step_Forward, Spin_Step_Backward, Spin_Page_Forward, Spin_Page_Backward, Spin_Home, Spin_End, Spin_User_Defined);
type Gtk_Spin_Button_Update_Policy is ( Update_Always, Update_If_Valid);
type Property_Gtk_Spin_Type is new Gtk_Spin_Type_Properties.Property;
type Property_Gtk_Spin_Button_Update_Policy is new Gtk_Spin_Button_Update_Policy_Properties.Property;
type Cb_Gtk_Spin_Button_Gtk_Scroll_Type_Void is not null access procedure (Self : access Gtk_Spin_Button_Record'Class; Object : Gtk.Enums.Gtk_Scroll_Type);
type Cb_GObject_Gtk_Scroll_Type_Void is not null access procedure (Self : access Glib.Object.GObject_Record'Class; Object : Gtk.Enums.Gtk_Scroll_Type);
type Cb_Gtk_Spin_Button_Gdouble_Gint is not null access function (Self : access Gtk_Spin_Button_Record'Class; New_Value : access Gdouble) return Gint;
type Cb_GObject_Gdouble_Gint is not null access function (Self : access Glib.Object.GObject_Record'Class; New_Value : access Gdouble) return Gint;
type Cb_Gtk_Spin_Button_Boolean is not null access function (Self : access Gtk_Spin_Button_Record'Class) return Boolean;
type Cb_GObject_Boolean is not null access function (Self : access Glib.Object.GObject_Record'Class) return Boolean;
type Cb_Gtk_Spin_Button_Void is not null access procedure (Self : access Gtk_Spin_Button_Record'Class);
type Cb_GObject_Void is not null access procedure (Self : access Glib.Object.GObject_Record'Class);
Adjustment_Property : constant Glib.Properties.Property_Object;
Climb_Rate_Property : constant Glib.Properties.Property_Double;
The_Digits_Property : constant Glib.Properties.Property_Uint;
Numeric_Property : constant Glib.Properties.Property_Boolean;
Snap_To_Ticks_Property : constant Glib.Properties.Property_Boolean;
Update_Policy_Property : constant Gtk.Spin_Button.Property_Gtk_Spin_Button_Update_Policy;
Value_Property : constant Glib.Properties.Property_Double;
Wrap_Property : constant Glib.Properties.Property_Boolean;
Signal_Change_Value : constant Glib.Signal_Name := "change-value";
Signal_Input : constant Glib.Signal_Name := "input";
Signal_Output : constant Glib.Signal_Name := "output";
Signal_Value_Changed : constant Glib.Signal_Name := "value-changed";
Signal_Wrapped : constant Glib.Signal_Name := "wrapped";
procedure Gtk_New
( | Spin_Button | : out Gtk_Spin_Button; |
Adjustment | : access Gtk.Adjustment.Gtk_Adjustment_Record'Class; | |
Climb_Rate | : Gdouble; | |
The_Digits | : Guint := 0); |
procedure Initialize
( | Spin_Button | : not null access Gtk_Spin_Button_Record'Class; |
Adjustment | : access Gtk.Adjustment.Gtk_Adjustment_Record'Class; | |
Climb_Rate | : Gdouble; | |
The_Digits | : Guint := 0); |
function Gtk_Spin_Button_New
( | Adjustment | : access Gtk.Adjustment.Gtk_Adjustment_Record'Class; |
Climb_Rate | : Gdouble; | |
The_Digits | : Guint := 0) return Gtk_Spin_Button; |
procedure Gtk_New
( | Spin_Button | : out Gtk_Spin_Button; |
Min | : Gdouble; | |
Max | : Gdouble; | |
Step | : Gdouble); |
procedure Initialize
( | Spin_Button | : not null access Gtk_Spin_Button_Record'Class; |
Min | : Gdouble; | |
Max | : Gdouble; | |
Step | : Gdouble); |
function Gtk_Spin_Button_New_With_Range
( | Min | : Gdouble; |
Max | : Gdouble; | |
Step | : Gdouble) return Gtk_Spin_Button; |
function Get_Type return Glib.GType;
procedure Configure
( | Spin_Button | : not null access Gtk_Spin_Button_Record; |
Adjustment | : access Gtk.Adjustment.Gtk_Adjustment_Record'Class; | |
Climb_Rate | : Gdouble; | |
The_Digits | : Guint); |
function Get_Adjustment
( | Spin_Button | : not null access Gtk_Spin_Button_Record) return Gtk.Adjustment.Gtk_Adjustment; |
procedure Set_Adjustment
( | Spin_Button | : not null access Gtk_Spin_Button_Record; |
Adjustment | : not null access Gtk.Adjustment.Gtk_Adjustment_Record'Class); |
function Get_Digits
( | Spin_Button | : not null access Gtk_Spin_Button_Record) return Guint; |
procedure Set_Digits
( | Spin_Button | : not null access Gtk_Spin_Button_Record; |
The_Digits | : Guint); |
procedure Get_Increments
( | Spin_Button | : not null access Gtk_Spin_Button_Record; |
Step | : out Gdouble; | |
Page | : out Gdouble); |
procedure Set_Increments
( | Spin_Button | : not null access Gtk_Spin_Button_Record; |
Step | : Gdouble; | |
Page | : Gdouble); |
function Get_Numeric
( | Spin_Button | : not null access Gtk_Spin_Button_Record) return Boolean; |
procedure Set_Numeric
( | Spin_Button | : not null access Gtk_Spin_Button_Record; |
Numeric | : Boolean); |
procedure Get_Range
( | Spin_Button | : not null access Gtk_Spin_Button_Record; |
Min | : out Gdouble; | |
Max | : out Gdouble); |
procedure Set_Range
( | Spin_Button | : not null access Gtk_Spin_Button_Record; |
Min | : Gdouble; | |
Max | : Gdouble); |
function Get_Snap_To_Ticks
( | Spin_Button | : not null access Gtk_Spin_Button_Record) return Boolean; |
procedure Set_Snap_To_Ticks
( | Spin_Button | : not null access Gtk_Spin_Button_Record; |
Snap_To_Ticks | : Boolean); |
function Get_Update_Policy
( | Spin_Button | : not null access Gtk_Spin_Button_Record) return Gtk_Spin_Button_Update_Policy; |
procedure Set_Update_Policy
( | Spin_Button | : not null access Gtk_Spin_Button_Record; |
Policy | : Gtk_Spin_Button_Update_Policy); |
function Get_Value
( | Spin_Button | : not null access Gtk_Spin_Button_Record) return Gdouble; |
procedure Set_Value
( | Spin_Button | : not null access Gtk_Spin_Button_Record; |
Value | : Gdouble); |
function Get_Value_As_Int
( | Spin_Button | : not null access Gtk_Spin_Button_Record) return Gint; |
function Get_Wrap
( | Spin_Button | : not null access Gtk_Spin_Button_Record) return Boolean; |
procedure Set_Wrap
( | Spin_Button | : not null access Gtk_Spin_Button_Record; |
Wrap | : Boolean); |
procedure Spin
( | Spin_Button | : not null access Gtk_Spin_Button_Record; |
Direction | : Gtk_Spin_Type; | |
Increment | : Gdouble); |
procedure Update
( | Spin_Button | : not null access Gtk_Spin_Button_Record); |
procedure Editing_Done
( | Cell_Editable | : not null access Gtk_Spin_Button_Record); |
procedure Remove_Widget
( | Cell_Editable | : not null access Gtk_Spin_Button_Record); |
procedure Start_Editing
( | Cell_Editable | : not null access Gtk_Spin_Button_Record; |
Event | : Gdk.Event.Gdk_Event); |
procedure Copy_Clipboard
( | Editable | : not null access Gtk_Spin_Button_Record); |
procedure Cut_Clipboard
( | Editable | : not null access Gtk_Spin_Button_Record); |
procedure Delete_Selection
( | Editable | : not null access Gtk_Spin_Button_Record); |
procedure Delete_Text
( | Editable | : not null access Gtk_Spin_Button_Record; |
Start_Pos | : Gint; | |
End_Pos | : Gint := -1); |
function Get_Chars
( | Editable | : not null access Gtk_Spin_Button_Record; |
Start_Pos | : Gint; | |
End_Pos | : Gint := -1) return UTF8_String; |
function Get_Editable
( | Editable | : not null access Gtk_Spin_Button_Record) return Boolean; |
procedure Set_Editable
( | Editable | : not null access Gtk_Spin_Button_Record; |
Is_Editable | : Boolean); |
function Get_Position
( | Editable | : not null access Gtk_Spin_Button_Record) return Gint; |
procedure Set_Position
( | Editable | : not null access Gtk_Spin_Button_Record; |
Position | : Gint); |
procedure Get_Selection_Bounds
( | Editable | : not null access Gtk_Spin_Button_Record; |
Start_Pos | : out Gint; | |
End_Pos | : out Gint; | |
Has_Selection | : out Boolean); |
procedure Insert_Text
( | Editable | : not null access Gtk_Spin_Button_Record; |
New_Text | : UTF8_String; | |
New_Text_Length | : Gint; | |
Position | : in out Gint); |
procedure Paste_Clipboard
( | Editable | : not null access Gtk_Spin_Button_Record); |
procedure Select_Region
( | Editable | : not null access Gtk_Spin_Button_Record; |
Start_Pos | : Gint; | |
End_Pos | : Gint := -1); |
function Get_Orientation
( | Self | : not null access Gtk_Spin_Button_Record) return Gtk.Enums.Gtk_Orientation; |
procedure Set_Orientation
( | Self | : not null access Gtk_Spin_Button_Record; |
Orientation | : Gtk.Enums.Gtk_Orientation); |
procedure On_Change_Value
( | Self | : not null access Gtk_Spin_Button_Record; |
Call | : Cb_Gtk_Spin_Button_Gtk_Scroll_Type_Void; | |
After | : Boolean := False); |
procedure On_Change_Value
( | Self | : not null access Gtk_Spin_Button_Record; |
Call | : Cb_GObject_Gtk_Scroll_Type_Void; | |
Slot | : not null access Glib.Object.GObject_Record'Class; | |
After | : Boolean := False); |
procedure On_Input
( | Self | : not null access Gtk_Spin_Button_Record; |
Call | : Cb_Gtk_Spin_Button_Gdouble_Gint; | |
After | : Boolean := False); |
procedure On_Input
( | Self | : not null access Gtk_Spin_Button_Record; |
Call | : Cb_GObject_Gdouble_Gint; | |
Slot | : not null access Glib.Object.GObject_Record'Class; | |
After | : Boolean := False); |
procedure On_Output
( | Self | : not null access Gtk_Spin_Button_Record; |
Call | : Cb_Gtk_Spin_Button_Boolean; | |
After | : Boolean := False); |
procedure On_Output
( | Self | : not null access Gtk_Spin_Button_Record; |
Call | : Cb_GObject_Boolean; | |
Slot | : not null access Glib.Object.GObject_Record'Class; | |
After | : Boolean := False); |
procedure On_Value_Changed
( | Self | : not null access Gtk_Spin_Button_Record; |
Call | : Cb_Gtk_Spin_Button_Void; | |
After | : Boolean := False); |
procedure On_Value_Changed
( | Self | : not null access Gtk_Spin_Button_Record; |
Call | : Cb_GObject_Void; | |
Slot | : not null access Glib.Object.GObject_Record'Class; | |
After | : Boolean := False); |
procedure On_Wrapped
( | Self | : not null access Gtk_Spin_Button_Record; |
Call | : Cb_Gtk_Spin_Button_Void; | |
After | : Boolean := False); |
procedure On_Wrapped
( | Self | : not null access Gtk_Spin_Button_Record; |
Call | : Cb_GObject_Void; | |
Slot | : not null access Glib.Object.GObject_Record'Class; | |
After | : Boolean := False); |
function "+"
( | Widget | : access Gtk_Spin_Button_Record'Class) return Gtk.Buildable.Gtk_Buildable renames Implements_Gtk_Buildable.To_Interface; |
function "-"
( | Interf | : Gtk.Buildable.Gtk_Buildable) return Gtk_Spin_Button renames Implements_Gtk_Buildable.To_Object; |
function "+"
( | Widget | : access Gtk_Spin_Button_Record'Class) return Gtk.Cell_Editable.Gtk_Cell_Editable renames Implements_Gtk_Cell_Editable.To_Interface; |
function "-"
( | Interf | : Gtk.Cell_Editable.Gtk_Cell_Editable) return Gtk_Spin_Button renames Implements_Gtk_Cell_Editable.To_Object; |
function "+"
( | Widget | : access Gtk_Spin_Button_Record'Class) return Gtk.Editable.Gtk_Editable renames Implements_Gtk_Editable.To_Interface; |
function "-"
( | Interf | : Gtk.Editable.Gtk_Editable) return Gtk_Spin_Button renames Implements_Gtk_Editable.To_Object; |
function "+"
( | Widget | : access Gtk_Spin_Button_Record'Class) return Gtk.Orientable.Gtk_Orientable renames Implements_Gtk_Orientable.To_Interface; |
function "-"
( | Interf | : Gtk.Orientable.Gtk_Orientable) return Gtk_Spin_Button renames Implements_Gtk_Orientable.To_Object; |
A Gtk.Spin_Button.Gtk_Spin_Button is an ideal way to allow the user to set the value of some attribute. Rather than having to directly type a number into a Gtk.GEntry.Gtk_Entry, GtkSpinButton allows the user to click on one of two arrows to increment or decrement the displayed value. A value can still be typed in, with the bonus that it can be checked to ensure it is in a given range.
The main properties of a GtkSpinButton are through an adjustment. See the Gtk.Adjustment.Gtk_Adjustment section for more details about an adjustment's properties. == Using a GtkSpinButton to get an integer == /* Provides a function to retrieve an integer value from a * GtkSpinButton and creates a spin button to model percentage * values. */ gint grab_int_value (GtkSpinButton *button, gpointer user_data) { return gtk_spin_button_get_value_as_int (button); } void create_integer_spin_button (void) { GtkWidget *window, *button; GtkAdjustment *adjustment; adjustment = gtk_adjustment_new (50.0, 0.0, 100.0, 1.0, 5.0, 0.0); window = gtk_window_new (GTK_WINDOW_TOPLEVEL); gtk_container_set_border_width (GTK_CONTAINER (window), 5); /* creates the spinbutton, with no decimal places */ button = gtk_spin_button_new (adjustment, 1.0, 0); gtk_container_add (GTK_CONTAINER (window), button); gtk_widget_show_all (window); } == Using a GtkSpinButton to get a floating point value == /* Provides a function to retrieve a floating point value from a * GtkSpinButton, and creates a high precision spin button. */ gfloat grab_float_value (GtkSpinButton *button, gpointer user_data) { return gtk_spin_button_get_value (button); } void create_floating_spin_button (void) { GtkWidget *window, *button; GtkAdjustment *adjustment; adjustment = gtk_adjustment_new (2.500, 0.0, 5.0, 0.001, 0.1, 0.0); window = gtk_window_new (GTK_WINDOW_TOPLEVEL); gtk_container_set_border_width (GTK_CONTAINER (window), 5); /* creates the spinbutton, with three decimal places */ button = gtk_spin_button_new (adjustment, 0.001, 3); gtk_container_add (GTK_CONTAINER (window), button); gtk_widget_show_all (window); }