1
<!-- ##### SECTION Title ##### -->
4
<!-- ##### SECTION Short_Description ##### -->
5
A GtkObject representing an adjustable bounded value
7
<!-- ##### SECTION Long_Description ##### -->
9
The #GtkAdjustment object represents a value which has an associated lower
10
and upper bound, together with step and page increments, and a page size.
11
It is used within several GTK+ widgets, including
12
#GtkSpinButton, #GtkViewport, and #GtkRange (which is a base class for
13
#GtkHScrollbar, #GtkVScrollbar, #GtkHScale, and #GtkVScale).
16
The #GtkAdjustment object does not update the value itself. Instead
17
it is left up to the owner of the #GtkAdjustment to control the value.
20
The owner of the #GtkAdjustment typically calls the
21
gtk_adjustment_value_changed() and gtk_adjustment_changed() functions
22
after changing the value and its bounds. This results in the emission of the
23
"value_changed" or "changed" signal respectively.
26
<!-- ##### SECTION See_Also ##### -->
31
<!-- ##### SECTION Stability_Level ##### -->
34
<!-- ##### STRUCT GtkAdjustment ##### -->
36
The #GtkAdjustment-struct struct contains the following fields.
38
<informaltable pgwide="1" frame="none" role="struct">
39
<tgroup cols="2"><colspec colwidth="2*"/><colspec colwidth="8*"/>
43
<entry>#gdouble lower;</entry>
44
<entry>the minimum value.</entry>
48
<entry>#gdouble upper;</entry>
49
<entry>the maximum value.</entry>
53
<entry>#gdouble value;</entry>
54
<entry>the current value.</entry>
58
<entry>#gdouble step_increment;</entry>
59
<entry>the increment to use to make minor changes to the value.
60
In a #GtkScrollbar this increment is used when the mouse is clicked on the
61
arrows at the top and bottom of the scrollbar, to scroll by a small amount.
66
<entry>#gdouble page_increment;</entry>
67
<entry>the increment to use to make major changes to the value.
68
In a #GtkScrollbar this increment is used when the mouse is clicked in the
69
trough, to scroll by a large amount.
74
<entry>#gdouble page_size;</entry>
76
In a #GtkScrollbar this is the size of the area which is currently visible.
80
</tbody></tgroup></informaltable>
85
<!-- ##### SIGNAL GtkAdjustment::changed ##### -->
87
Emitted when one or more of the #GtkAdjustment fields have been changed,
88
other than the value field.
91
@adjustment: the object which received the signal.
93
<!-- ##### SIGNAL GtkAdjustment::value-changed ##### -->
95
Emitted when the #GtkAdjustment value field has been changed.
98
@adjustment: the object which received the signal.
100
<!-- ##### ARG GtkAdjustment:lower ##### -->
105
<!-- ##### ARG GtkAdjustment:page-increment ##### -->
110
<!-- ##### ARG GtkAdjustment:page-size ##### -->
115
<!-- ##### ARG GtkAdjustment:step-increment ##### -->
120
<!-- ##### ARG GtkAdjustment:upper ##### -->
125
<!-- ##### ARG GtkAdjustment:value ##### -->
130
<!-- ##### FUNCTION gtk_adjustment_new ##### -->
132
Creates a new #GtkAdjustment.
135
@value: the initial value.
136
@lower: the minimum value.
137
@upper: the maximum value.
138
@step_increment: the step increment.
139
@page_increment: the page increment.
140
@page_size: the page size.
141
@Returns: a new #GtkAdjustment.
144
<!-- ##### FUNCTION gtk_adjustment_get_value ##### -->
153
<!-- ##### FUNCTION gtk_adjustment_set_value ##### -->
155
Sets the #GtkAdjustment value. The value is clamped to lie between
156
<literal>adjustment->lower</literal> and
157
<literal>adjustment->upper</literal>.
160
Note that for adjustments which are used in a #GtkScrollbar, the effective
161
range of allowed values goes from <literal>adjustment->lower</literal> to
162
<literal>adjustment->upper - adjustment->page_size</literal>.
165
@adjustment: a #GtkAdjustment.
166
@value: the new value.
169
<!-- ##### FUNCTION gtk_adjustment_clamp_page ##### -->
171
Updates the #GtkAdjustment @value to ensure that the range between @lower
172
and @upper is in the current page (i.e. between @value and @value +
174
If the range is larger than the page size, then only the start of it will
175
be in the current page.
176
A "changed" signal will be emitted if the value is changed.
179
@adjustment: a #GtkAdjustment.
180
@lower: the lower value.
181
@upper: the upper value.
184
<!-- ##### FUNCTION gtk_adjustment_changed ##### -->
186
Emits a "changed" signal from the #GtkAdjustment.
187
This is typically called by the owner of the #GtkAdjustment after it has
188
changed any of the #GtkAdjustment fields other than the value.
191
@adjustment: a #GtkAdjustment
194
<!-- ##### FUNCTION gtk_adjustment_value_changed ##### -->
196
Emits a "value_changed" signal from the #GtkAdjustment.
197
This is typically called by the owner of the #GtkAdjustment after it has
198
changed the #GtkAdjustment value field.
201
@adjustment: a #GtkAdjustment