Base class for GtkHScale and GtkVScale
A <gtk-scale>
is a slider control used to select a numeric value. To use
it, you'll probably want to investigate the methods on its base class,
<gtk-range>
, in addition to the methods for <gtk-scale>
itself. To
set the value of a scale, you would normally use gtk-range-set-value
. To
detect changes to the value, you would normally use the "value_changed" signal.
The <gtk-scale>
widget is an abstract class, used only for deriving the
subclasses <gtk-hscale>
and <gtk-vscale>
. To create a scale
widget, call gtk-hscale-new-with-range
or
gtk-vscale-new-with-range
.
Derives from
<gtk-range>
.This class defines the following slots:
digits
- The number of decimal places that are displayed in the value
draw-value
- Whether the current value is displayed as a string next to the slider
value-pos
- The position in which the current value is displayed
<gdouble>
) ⇒ <gchararray>
Signal which allows you to change how the scale value is displayed. Connect a signal handler which returns an allocated string representing value. That string will then be used to display the scale's value. Here's an example signal handler which displays a value 1.0 as with "–>1.0<–".
static gchar* format_value_callback (GtkScale *scale, gdouble value) { return g_strdup_printf ("-->%0.*g<--", gtk_scale_get_digits (scale), value); }
<gtk-scale>
) (digits int
)Sets the number of decimal places that are displayed in the value. Also causes the value of the adjustment to be rounded off to this number of digits, so the retrieved value matches the value the user saw.
- scale
- a
<gtk-scale>
.- digits
- the number of decimal places to display, e.g. use 1 to display 1.0, 2 to display 1.00 etc.
<gtk-scale>
) (draw_value bool
)Specifies whether the current value is displayed as a string next to the slider.
- scale
- a
<gtk-scale>
.- draw-value
- a boolean.
<gtk-scale>
) (pos <gtk-position-type>
)Sets the position in which the current value is displayed.
- scale
- a
<gtk-scale>
.- pos
- the position in which the current value is displayed.
<gtk-scale>
) ⇒ (ret int
)Gets the number of decimal places that are displayed in the value.
- scale
- a
<gtk-scale>
.- ret
- the number of decimal places that are displayed.
<gtk-scale>
) ⇒ (ret bool
)Returns whether the current value is displayed as a string next to the slider.
- scale
- a
<gtk-scale>
.- ret
- whether the current value is displayed as a string.
<gtk-scale>
) ⇒ (ret <gtk-position-type>
)Gets the position in which the current value is displayed.
- scale
- a
<gtk-scale>
.- ret
- the position in which the current value is displayed.
<gtk-scale>
) ⇒ (ret <pango-layout>
)Gets the
<pango-layout>
used to display the scale. The returned object is owned by the scale so does not need to be freed by the caller.
- scale
- A
<gtk-scale>
- ret
- the
<pango-layout>
for this scale, or ‘#f
’ if the draw_value property is ‘#f
’.Since 2.4
<gtk-scale>
) ⇒ (x int
) (y int
)Obtains the coordinates where the scale will draw the
<pango-layout>
representing the text in the scale. Remember when using the<pango-layout>
function you need to convert to and from pixels usingpango-pixels
or<pango-scale>
.If the draw_value property is ‘
#f
’, the return values are undefined.
- scale
- a
<gtk-scale>
- x
- location to store X offset of layout, or ‘
#f
’- y
- location to store Y offset of layout, or ‘
#f
’Since 2.4