![]() |
![]() |
![]() |
GTK+ Reference Manual | ![]() |
---|---|---|---|---|
#include <gtk/gtk.h> GtkScaleButton; GtkWidget* gtk_scale_button_new (GtkIconSize size, gdouble min, gdouble max, gdouble step, const gchar **icons); void gtk_scale_button_set_adjustment (GtkScaleButton *button, GtkAdjustment *adjustment); void gtk_scale_button_set_icons (GtkScaleButton *button, const gchar **icons); void gtk_scale_button_set_value (GtkScaleButton *button, gdouble value); GtkAdjustment* gtk_scale_button_get_adjustment (GtkScaleButton *button); gdouble gtk_scale_button_get_value (GtkScaleButton *button);
typedef struct { GtkButton parent; GtkWidget *plus_button; GtkWidget *minus_button; GtkScaleButtonPrivate *priv; } GtkScaleButton;
GtkWidget* gtk_scale_button_new (GtkIconSize size, gdouble min, gdouble max, gdouble step, const gchar **icons);
Creates a GtkScaleButton, with a range between lower and upper, with a stepping of step_increment.
size : |
a stock icon size |
min : |
|
max : |
|
step : |
|
icons : |
a NULL -terminated array of icon names, or NULL if
you want to set the list later with gtk_scale_button_set_icons() . See
gtk_scale_button_set_icons() for details.
|
Returns : | a new GtkScaleButton |
Since 2.12
void gtk_scale_button_set_adjustment (GtkScaleButton *button, GtkAdjustment *adjustment);
Sets the GtkAdjustment to be used as a model for the GtkScaleButton's scale.
See gtk_range_set_adjustment()
for details.
button : |
a GtkScaleButton |
adjustment : |
a GtkAdjustment |
Since 2.12
void gtk_scale_button_set_icons (GtkScaleButton *button, const gchar **icons);
Sets the icons to be used by the scale button. The first item in the array will be used in the button when the current value is the lowest value, the second item for the highest value. All the subsequent icons will be used for all the other values, spread evenly over the range of values.
If there's only one icon in the icons
array, it will be used for all the
values. If only two icons are in the icons
array, the first one will be
used for the bottom 50% of the scale, and the second one for the top 50%.
So it is recommended to use at least 3 icons so that the GtkScaleButton
reflects the current value of the scale better for the users.
Since 2.12
button : |
a GtkScaleButton |
icons : |
a NULL -terminated array of icon names
|
void gtk_scale_button_set_value (GtkScaleButton *button, gdouble value);
Sets the current value of the scale; if the value is outside the minimum or maximum range values, it will be clamped to fit inside them. The scale button emits the "value_changed" signal if the value changes.
button : |
a GtkScaleButton |
value : |
new value of the scale button |
Since 2.12
GtkAdjustment* gtk_scale_button_get_adjustment (GtkScaleButton *button);
Gets the GtkAdjustment associated with the GtkScaleButton's scale.
See gtk_range_get_adjustment()
for details.
button : |
a GtkScaleButton |
Returns : |
Since 2.12
gdouble gtk_scale_button_get_value (GtkScaleButton *button);
Gets the current value of the scale button.
button : |
a GtkScaleButton |
Returns : | current value of the scale button |
Since 2.12