A model for a numeric value.
The GtkAdjustment has an associated lower and upper bound. It also contains step and page increments, and a page size.
Adjustments are used within several GTK widgets, including [classGtk.SpinButton], [classGtk.Viewport], [classGtk.Scrollbar] and [classGtk.Scale].
The GtkAdjustment object does not update the value itself. Instead it is left up to the owner of the GtkAdjustment to control the value.
The meaning of the most important fields can be explained on the following figure (imagine this is a scrollbar):
[-------|=================|-------------------]
lower value value + page_size upper
<group>Scrolling</group>
type Cb_GObject_Void is not null access procedure
(Self : access Glib.Object.GObject_Record'Class);
type Cb_Gtk_Adjustment_Void is not null access procedure (Self : access Gtk_Adjustment_Record'Class);
procedure Clamp_Page
(Self : not null access Gtk_Adjustment_Record;
Lower : Gdouble;
Upper : Gdouble)
Updates the value of the adjustment to ensure that the given range is contained in the current page. The current page goes from value to value + page-size. If the range is larger than the page size, then only the start of it will be in the current page. A [signalGtk.Adjustment::value-changed] signal will be emitted if the value is changed.
the lower value
the upper value
procedure Configure
(Self : not null access Gtk_Adjustment_Record;
Value : Gdouble;
Lower : Gdouble;
Upper : Gdouble;
Step_Increment : Gdouble;
Page_Increment : Gdouble;
Page_Size : Gdouble)
Sets all properties of the adjustment at once. Use this function to avoid multiple emissions of the [signalGtk.Adjustment::changed] signal. See [methodGtk.Adjustment.set_lower] for an alternative way of compressing multiple emissions of [signalGtk.Adjustment::changed] into one.
the new value
the new minimum value
the new maximum value
the new step increment
the new page increment
the new page size
function Get_Lower
(Self : not null access Gtk_Adjustment_Record) return Gdouble
Retrieves the minimum value of the adjustment.
the minimum value
function Get_Minimum_Increment
(Self : not null access Gtk_Adjustment_Record) return Gdouble
Gets the smaller of step increment and page increment.
the minimum increment
function Get_Page_Increment
(Self : not null access Gtk_Adjustment_Record) return Gdouble
Retrieves the page increment of the adjustment.
the page increment
function Get_Page_Size
(Self : not null access Gtk_Adjustment_Record) return Gdouble
Retrieves the page size of the adjustment.
the page size
function Get_Step_Increment
(Self : not null access Gtk_Adjustment_Record) return Gdouble
Retrieves the step increment of the adjustment.
the step increment
function Get_Type return Glib.GType
function Get_Upper
(Self : not null access Gtk_Adjustment_Record) return Gdouble
Retrieves the maximum value of the adjustment.
the maximum value
function Get_Value
(Self : not null access Gtk_Adjustment_Record) return Gdouble
Gets the current value of the adjustment.
the current value
type Gtk_Adjustment is access all Gtk_Adjustment_Record'Class;
function Gtk_Adjustment_New
(Value : Gdouble;
Lower : Gdouble;
Upper : Gdouble;
Step_Increment : Gdouble;
Page_Increment : Gdouble;
Page_Size : Gdouble := 0.0) return Gtk_Adjustment
Create a new adjustment. Value is the initial value of the adjustment. It must be in the range (Lower .. Upper) and the adjustment's value will never be outside this range. Step_Increment is the value used to make minor adjustments, such as when the user clicks on the arrows of a scrollbar. Page_Increment is used to make major adjustments, such as when the user clicks in the through on a scrollbar.
the initial value
the minimum value
the maximum value
the step increment
the page increment
the page size
type Gtk_Adjustment_Record is new GObject_Record with null record;
procedure Gtk_New
(Self : out Gtk_Adjustment;
Value : Gdouble;
Lower : Gdouble;
Upper : Gdouble;
Step_Increment : Gdouble;
Page_Increment : Gdouble;
Page_Size : Gdouble := 0.0)
Create a new adjustment. Value is the initial value of the adjustment. It must be in the range (Lower .. Upper) and the adjustment's value will never be outside this range. Step_Increment is the value used to make minor adjustments, such as when the user clicks on the arrows of a scrollbar. Page_Increment is used to make major adjustments, such as when the user clicks in the through on a scrollbar. Initialize does nothing if the object was already created with another call to Initialize* or G_New.
the initial value
the minimum value
the maximum value
the step increment
the page increment
the page size
procedure Initialize
(Self : not null access Gtk_Adjustment_Record'Class;
Value : Gdouble;
Lower : Gdouble;
Upper : Gdouble;
Step_Increment : Gdouble;
Page_Increment : Gdouble;
Page_Size : Gdouble := 0.0)
Create a new adjustment. Value is the initial value of the adjustment. It must be in the range (Lower .. Upper) and the adjustment's value will never be outside this range. Step_Increment is the value used to make minor adjustments, such as when the user clicks on the arrows of a scrollbar. Page_Increment is used to make major adjustments, such as when the user clicks in the through on a scrollbar. Initialize does nothing if the object was already created with another call to Initialize* or G_New.
the initial value
the minimum value
the maximum value
the step increment
the page increment
the page size
Lower_Property : constant Glib.Properties.Property_Double;
Type: Gdouble The minimum value of the adjustment.
procedure On_Changed
(Self : not null access Gtk_Adjustment_Record;
Call : Cb_GObject_Void;
Slot : not null access Glib.Object.GObject_Record'Class;
After : Boolean := False)
Emitted when one or more of the GtkAdjustment properties have been changed.
Note that the [propertyGtk.Adjustment:value] property is covered by the [signalGtk.Adjustment::value-changed] signal.
procedure On_Changed
(Self : not null access Gtk_Adjustment_Record;
Call : Cb_Gtk_Adjustment_Void;
After : Boolean := False)
Emitted when one or more of the GtkAdjustment properties have been changed.
Note that the [propertyGtk.Adjustment:value] property is covered by the [signalGtk.Adjustment::value-changed] signal.
procedure On_Value_Changed
(Self : not null access Gtk_Adjustment_Record;
Call : Cb_GObject_Void;
Slot : not null access Glib.Object.GObject_Record'Class;
After : Boolean := False)
Emitted when the value has been changed.
procedure On_Value_Changed
(Self : not null access Gtk_Adjustment_Record;
Call : Cb_Gtk_Adjustment_Void;
After : Boolean := False)
Emitted when the value has been changed.
Page_Increment_Property : constant Glib.Properties.Property_Double;
Type: Gdouble The page increment of the adjustment.
Page_Size_Property : constant Glib.Properties.Property_Double;
Type: Gdouble The page size of the adjustment.
Note that the page-size is irrelevant and should be set to zero if the adjustment is used for a simple scalar value, e.g. in a GtkSpinButton.
procedure Set_Lower
(Self : not null access Gtk_Adjustment_Record;
Lower : Gdouble)
Sets the minimum value of the adjustment. When setting multiple adjustment properties via their individual setters, multiple [signalGtk.Adjustment::changed] signals will be emitted. However, since the emission of the [signalGtk.Adjustment::changed] signal is tied to the emission of the ::notify signals of the changed properties, it's possible to compress the [signalGtk.Adjustment::changed] signals into one by calling g_object_freeze_notify and g_object_thaw_notify around the calls to the individual setters. Alternatively, using a single g_object_set for all the properties to change, or using [methodGtk.Adjustment.configure] has the same effect.
the new minimum value
procedure Set_Page_Increment
(Self : not null access Gtk_Adjustment_Record;
Page_Increment : Gdouble)
Sets the page increment of the adjustment. See [methodGtk.Adjustment.set_lower] about how to compress multiple emissions of the [signalGtk.Adjustment::changed] signal when setting multiple adjustment properties.
the new page increment
procedure Set_Page_Size
(Self : not null access Gtk_Adjustment_Record;
Page_Size : Gdouble)
Sets the page size of the adjustment. See [methodGtk.Adjustment.set_lower] about how to compress multiple emissions of the [signalGtk.Adjustment::changed] signal when setting multiple adjustment properties.
the new page size
procedure Set_Step_Increment
(Self : not null access Gtk_Adjustment_Record;
Step_Increment : Gdouble)
Sets the step increment of the adjustment. See [methodGtk.Adjustment.set_lower] about how to compress multiple emissions of the [signalGtk.Adjustment::changed] signal when setting multiple adjustment properties.
the new step increment
procedure Set_Upper
(Self : not null access Gtk_Adjustment_Record;
Upper : Gdouble)
Sets the maximum value of the adjustment. Note that values will be restricted by upper - page-size if the page-size property is nonzero. See [methodGtk.Adjustment.set_lower] about how to compress multiple emissions of the [signalGtk.Adjustment::changed] signal when setting multiple adjustment properties.
the new maximum value
procedure Set_Value
(Self : not null access Gtk_Adjustment_Record;
Value : Gdouble)
Sets the GtkAdjustment value. The value is clamped to lie between [propertyGtk.Adjustment:lower] and [propertyGtk.Adjustment:upper]. Note that for adjustments which are used in a GtkScrollbar, the effective range of allowed values goes from [propertyGtk.Adjustment:lower] to [propertyGtk.Adjustment:upper] - [propertyGtk.Adjustment:page-size].
the new value
Signal_Changed : constant Glib.Signal_Name := "changed";
Emitted when one or more of the GtkAdjustment properties have been changed.
Note that the [propertyGtk.Adjustment:value] property is covered by the [signalGtk.Adjustment::value-changed] signal.
Signal_Value_Changed : constant Glib.Signal_Name := "value-changed";
Emitted when the value has been changed.
Step_Increment_Property : constant Glib.Properties.Property_Double;
Type: Gdouble The step increment of the adjustment.
Upper_Property : constant Glib.Properties.Property_Double;
Type: Gdouble The maximum value of the adjustment.
Note that values will be restricted by upper - page-size if the page-size property is nonzero.
Value_Property : constant Glib.Properties.Property_Double;
Type: Gdouble The value of the adjustment.