GTK+ 2 Reference Manual | ||||
---|---|---|---|---|
Top | Description | Object Hierarchy | Properties | Signals |
#include <gtk/gtk.h> struct GtkAdjustment; GtkObject * gtk_adjustment_new (gdouble value
,gdouble lower
,gdouble upper
,gdouble step_increment
,gdouble page_increment
,gdouble page_size
); gdouble gtk_adjustment_get_value (GtkAdjustment *adjustment
); void gtk_adjustment_set_value (GtkAdjustment *adjustment
,gdouble value
); void gtk_adjustment_clamp_page (GtkAdjustment *adjustment
,gdouble lower
,gdouble upper
); void gtk_adjustment_changed (GtkAdjustment *adjustment
); void gtk_adjustment_value_changed (GtkAdjustment *adjustment
); void gtk_adjustment_configure (GtkAdjustment *adjustment
,gdouble value
,gdouble lower
,gdouble upper
,gdouble step_increment
,gdouble page_increment
,gdouble page_size
); gdouble gtk_adjustment_get_lower (GtkAdjustment *adjustment
); gdouble gtk_adjustment_get_page_increment (GtkAdjustment *adjustment
); gdouble gtk_adjustment_get_page_size (GtkAdjustment *adjustment
); gdouble gtk_adjustment_get_step_increment (GtkAdjustment *adjustment
); gdouble gtk_adjustment_get_upper (GtkAdjustment *adjustment
); void gtk_adjustment_set_lower (GtkAdjustment *adjustment
,gdouble lower
); void gtk_adjustment_set_page_increment (GtkAdjustment *adjustment
,gdouble page_increment
); void gtk_adjustment_set_page_size (GtkAdjustment *adjustment
,gdouble page_size
); void gtk_adjustment_set_step_increment (GtkAdjustment *adjustment
,gdouble step_increment
); void gtk_adjustment_set_upper (GtkAdjustment *adjustment
,gdouble upper
);
"lower" gdouble : Read / Write "page-increment" gdouble : Read / Write "page-size" gdouble : Read / Write "step-increment" gdouble : Read / Write "upper" gdouble : Read / Write "value" gdouble : Read / Write
The GtkAdjustment object represents a value which has an associated lower and upper bound, together with step and page increments, and a page size. It is used within several GTK+ widgets, including GtkSpinButton, GtkViewport, and GtkRange (which is a base class for GtkHScrollbar, GtkVScrollbar, GtkHScale, and GtkVScale).
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 owner of the GtkAdjustment typically calls the
gtk_adjustment_value_changed()
and gtk_adjustment_changed()
functions
after changing the value and its bounds. This results in the emission of the
"value_changed" or "changed" signal respectively.
struct GtkAdjustment;
The GtkAdjustment struct contains the following fields.
gdouble lower; | the minimum value. |
gdouble upper; | the maximum value. |
gdouble value; | the current value. |
gdouble step_increment; | the increment to use to make minor changes to the value. In a GtkScrollbar this increment is used when the mouse is clicked on the arrows at the top and bottom of the scrollbar, to scroll by a small amount. |
gdouble page_increment; | the increment to use to make major changes to the value. In a GtkScrollbar this increment is used when the mouse is clicked in the trough, to scroll by a large amount. |
gdouble page_size; | the page size. In a GtkScrollbar this is the size of the area which is currently visible. |
GtkObject * gtk_adjustment_new (gdouble value
,gdouble lower
,gdouble upper
,gdouble step_increment
,gdouble page_increment
,gdouble page_size
);
Creates a new GtkAdjustment.
|
the initial value. |
|
the minimum value. |
|
the maximum value. |
|
the step increment. |
|
the page increment. |
|
the page size. |
Returns : |
a new GtkAdjustment. |
gdouble gtk_adjustment_get_value (GtkAdjustment *adjustment
);
Gets the current value of the adjustment. See
gtk_adjustment_set_value()
.
|
a GtkAdjustment |
Returns : |
The current value of the adjustment. |
void gtk_adjustment_set_value (GtkAdjustment *adjustment
,gdouble value
);
Sets the GtkAdjustment value. The value is clamped to lie between
adjustment->lower
and
adjustment->upper
.
Note that for adjustments which are used in a GtkScrollbar, the effective
range of allowed values goes from adjustment->lower
to
adjustment->upper - adjustment->page_size
.
|
a GtkAdjustment. |
|
the new value. |
void gtk_adjustment_clamp_page (GtkAdjustment *adjustment
,gdouble lower
,gdouble upper
);
Updates the GtkAdjustment value
to ensure that the range between lower
and upper
is in the current page (i.e. between value
and 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 "changed" signal will be emitted if the value is changed.
|
a GtkAdjustment. |
|
the lower value. |
|
the upper value. |
void gtk_adjustment_changed (GtkAdjustment *adjustment
);
Emits a "changed" signal from the GtkAdjustment. This is typically called by the owner of the GtkAdjustment after it has changed any of the GtkAdjustment fields other than the value.
|
a GtkAdjustment |
void gtk_adjustment_value_changed (GtkAdjustment *adjustment
);
Emits a "value_changed" signal from the GtkAdjustment. This is typically called by the owner of the GtkAdjustment after it has changed the GtkAdjustment value field.
|
a GtkAdjustment |
void gtk_adjustment_configure (GtkAdjustment *adjustment
,gdouble value
,gdouble lower
,gdouble upper
,gdouble step_increment
,gdouble page_increment
,gdouble page_size
);
Sets all properties of the adjustment at once.
Use this function to avoid multiple emissions of the "changed"
signal. See gtk_adjustment_set_lower()
for an alternative way
of compressing multiple emissions of "changed" into one.
|
a GtkAdjustment |
|
the new value |
|
the new minimum value |
|
the new maximum value |
|
the new step increment |
|
the new page increment |
|
the new page size |
Since 2.14
gdouble gtk_adjustment_get_lower (GtkAdjustment *adjustment
);
Retrieves the minimum value of the adjustment.
|
a GtkAdjustment |
Returns : |
The current minimum value of the adjustment. |
Since 2.14
gdouble gtk_adjustment_get_page_increment (GtkAdjustment *adjustment
);
Retrieves the page increment of the adjustment.
|
a GtkAdjustment |
Returns : |
The current page increment of the adjustment. |
Since 2.14
gdouble gtk_adjustment_get_page_size (GtkAdjustment *adjustment
);
Retrieves the page size of the adjustment.
|
a GtkAdjustment |
Returns : |
The current page size of the adjustment. |
Since 2.14
gdouble gtk_adjustment_get_step_increment (GtkAdjustment *adjustment
);
Retrieves the step increment of the adjustment.
|
a GtkAdjustment |
Returns : |
The current step increment of the adjustment. |
Since 2.14
gdouble gtk_adjustment_get_upper (GtkAdjustment *adjustment
);
Retrieves the maximum value of the adjustment.
|
a GtkAdjustment |
Returns : |
The current maximum value of the adjustment. |
Since 2.14
void gtk_adjustment_set_lower (GtkAdjustment *adjustment
,gdouble lower
);
Sets the minimum value of the adjustment.
When setting multiple adjustment properties via their individual
setters, multiple "changed" signals will be emitted. However, since
the emission of the "changed" signal is tied to the emission of the
"GObject::notify" signals of the changed properties, it's possible
to compress the "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 gtk_adjustment_configure()
has the same effect
of compressing "changed" emissions.
|
a GtkAdjustment |
|
the new minimum value |
Since 2.14
void gtk_adjustment_set_page_increment (GtkAdjustment *adjustment
,gdouble page_increment
);
Sets the page increment of the adjustment.
See gtk_adjustment_set_lower()
about how to compress multiple
emissions of the "changed" signal when setting multiple adjustment
properties.
|
a GtkAdjustment |
|
the new page increment |
Since 2.14
void gtk_adjustment_set_page_size (GtkAdjustment *adjustment
,gdouble page_size
);
Sets the page size of the adjustment.
See gtk_adjustment_set_lower()
about how to compress multiple
emissions of the "changed" signal when setting multiple adjustment
properties.
|
a GtkAdjustment |
|
the new page size |
Since 2.14
void gtk_adjustment_set_step_increment (GtkAdjustment *adjustment
,gdouble step_increment
);
Sets the step increment of the adjustment.
See gtk_adjustment_set_lower()
about how to compress multiple
emissions of the "changed" signal when setting multiple adjustment
properties.
|
a GtkAdjustment |
|
the new step increment |
Since 2.14
void gtk_adjustment_set_upper (GtkAdjustment *adjustment
,gdouble upper
);
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 gtk_adjustment_set_lower()
about how to compress multiple
emissions of the "changed" signal when setting multiple adjustment
properties.
|
a GtkAdjustment |
|
the new maximum value |
Since 2.14
"lower"
property"lower" gdouble : Read / Write
The minimum value of the adjustment.
Default value: 0
Since 2.4
"page-increment"
property"page-increment" gdouble : Read / Write
The page increment of the adjustment.
Default value: 0
Since 2.4
"page-size"
property"page-size" gdouble : Read / Write
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.
Default value: 0
Since 2.4
"step-increment"
property"step-increment" gdouble : Read / Write
The step increment of the adjustment.
Default value: 0
Since 2.4
"upper"
property"upper" gdouble : Read / Write
The maximum value of the adjustment.
Note that values will be restricted by
upper - page-size
if the page-size
property is nonzero.
Default value: 0
Since 2.4
"value"
property"value" gdouble : Read / Write
The value of the adjustment.
Default value: 0
Since 2.4
"changed"
signalvoid user_function (GtkAdjustment *adjustment,
gpointer user_data) : No Recursion
Emitted when one or more of the GtkAdjustment fields have been changed, other than the value field.
|
the object which received the signal. |
|
user data set when the signal handler was connected. |
"value-changed"
signalvoid user_function (GtkAdjustment *adjustment,
gpointer user_data) : No Recursion
Emitted when the GtkAdjustment value field has been changed.
|
the object which received the signal. |
|
user data set when the signal handler was connected. |