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 <!-- ##### STRUCT GtkAdjustment ##### -->
33 The #GtkAdjustment-struct struct contains the following fields.
35 <informaltable pgwide="1" frame="none" role="struct">
36 <tgroup cols="2"><colspec colwidth="2*"/><colspec colwidth="8*"/>
40 <entry>#gdouble lower;</entry>
41 <entry>the minimum value.</entry>
45 <entry>#gdouble upper;</entry>
46 <entry>the maximum value.</entry>
50 <entry>#gdouble value;</entry>
51 <entry>the current value.</entry>
55 <entry>#gdouble step_increment;</entry>
56 <entry>the increment to use to make minor changes to the value.
57 In a #GtkScrollbar this increment is used when the mouse is clicked on the
58 arrows at the top and bottom of the scrollbar, to scroll by a small amount.
63 <entry>#gdouble page_increment;</entry>
64 <entry>the increment to use to make major changes to the value.
65 In a #GtkScrollbar this increment is used when the mouse is clicked in the
66 trough, to scroll by a large amount.
71 <entry>#gdouble page_size;</entry>
73 In a #GtkScrollbar this is the size of the area which is currently visible.
77 </tbody></tgroup></informaltable>
82 <!-- ##### SIGNAL GtkAdjustment::changed ##### -->
84 Emitted when one or more of the #GtkAdjustment fields have been changed,
85 other than the value field.
88 @adjustment: the object which received the signal.
90 <!-- ##### SIGNAL GtkAdjustment::value-changed ##### -->
92 Emitted when the #GtkAdjustment value field has been changed.
95 @adjustment: the object which received the signal.
97 <!-- ##### ARG GtkAdjustment:lower ##### -->
102 <!-- ##### ARG GtkAdjustment:page-increment ##### -->
107 <!-- ##### ARG GtkAdjustment:page-size ##### -->
112 <!-- ##### ARG GtkAdjustment:step-increment ##### -->
117 <!-- ##### ARG GtkAdjustment:upper ##### -->
122 <!-- ##### ARG GtkAdjustment:value ##### -->
127 <!-- ##### FUNCTION gtk_adjustment_new ##### -->
129 Creates a new #GtkAdjustment.
132 @value: the initial value.
133 @lower: the minimum value.
134 @upper: the maximum value.
135 @step_increment: the step increment.
136 @page_increment: the page increment.
137 @page_size: the page size.
138 @Returns: a new #GtkAdjustment.
141 <!-- ##### FUNCTION gtk_adjustment_get_value ##### -->
150 <!-- ##### FUNCTION gtk_adjustment_set_value ##### -->
152 Sets the #GtkAdjustment value. The value is clamped to lie between
153 <literal>adjustment->lower</literal> and
154 <literal>adjustment->upper</literal>.
157 Note that for adjustments which are used in a #GtkScrollbar, the effective
158 range of allowed values goes from <literal>adjustment->lower</literal> to
159 <literal>adjustment->upper - adjustment->page_size</literal>.
162 @adjustment: a #GtkAdjustment.
163 @value: the new value.
166 <!-- ##### FUNCTION gtk_adjustment_clamp_page ##### -->
168 Updates the #GtkAdjustment @value to ensure that the range between @lower
169 and @upper is in the current page (i.e. between @value and @value +
171 If the range is larger than the page size, then only the start of it will
172 be in the current page.
173 A "changed" signal will be emitted if the value is changed.
176 @adjustment: a #GtkAdjustment.
177 @lower: the lower value.
178 @upper: the upper value.
181 <!-- ##### FUNCTION gtk_adjustment_changed ##### -->
183 Emits a "changed" signal from the #GtkAdjustment.
184 This is typically called by the owner of the #GtkAdjustment after it has
185 changed any of the #GtkAdjustment fields other than the value.
191 <!-- ##### FUNCTION gtk_adjustment_value_changed ##### -->
193 Emits a "value_changed" signal from the #GtkAdjustment.
194 This is typically called by the owner of the #GtkAdjustment after it has
195 changed the #GtkAdjustment value field.