1 <!-- ##### SECTION Title ##### -->
4 <!-- ##### SECTION Short_Description ##### -->
5 a base class for #GtkHScale and #GtkVScale.
7 <!-- ##### SECTION Long_Description ##### -->
9 A #GtkScale is a slider control used to select a numeric value.
10 To use it, you'll probably want to investigate the methods on
11 its base class, #GtkRange, in addition to the methods for #GtkScale itself.
12 To set the value of a scale, you would normally use gtk_range_set_value().
13 To detect changes to the value, you would normally use the "value_changed"
17 The #GtkScale widget is an abstract class, used only for deriving the
18 subclasses #GtkHScale and #GtkVScale. To create a scale widget,
19 call gtk_hscale_new_with_range() or gtk_vscale_new_with_range().
22 <!-- ##### SECTION See_Also ##### -->
27 <!-- ##### STRUCT GtkScale ##### -->
29 The #GtkScale-struct struct contains the following fields.
30 (These fields should be considered read-only. They should never be set by
33 <informaltable pgwide=1 frame="none" role="struct">
34 <tgroup cols="2"><colspec colwidth="2*"><colspec colwidth="8*">
38 <entry>#guint <structfield>draw_value</structfield>;</entry>
39 <entry>non-zero if the scale's current value is displayed next to the
44 <entry>#guint <structfield>value_pos</structfield>;</entry>
45 <entry>the position in which the textual value is displayed, selected from
46 #GtkPositionType.</entry>
49 </tbody></tgroup></informaltable>
53 <!-- ##### FUNCTION gtk_scale_set_digits ##### -->
55 Sets the number of decimal places that are displayed in the value. Also causes
56 the value of the adjustment to be rounded off to this number of digits, so the
57 retrieved value matches the value the user saw.
61 @digits: the number of decimal places to display, e.g. use 1 to display 1.0,
62 2 to display 1.00 etc.
65 <!-- ##### FUNCTION gtk_scale_set_draw_value ##### -->
67 Specifies whether the current value is displayed as a string next to the
72 @draw_value: a boolean.
75 <!-- ##### FUNCTION gtk_scale_set_value_pos ##### -->
77 Sets the position in which the current value is displayed.
81 @pos: the position in which the current value is displayed.
84 <!-- ##### FUNCTION gtk_scale_get_digits ##### -->
86 Gets the number of decimal places that are displayed in the value.
90 @Returns: the number of decimal places that are displayed.
93 <!-- ##### FUNCTION gtk_scale_get_draw_value ##### -->
95 Returns whether the current value is displayed as a string next to the
100 @Returns: whether the current value is displayed as a string.
103 <!-- ##### FUNCTION gtk_scale_get_value_pos ##### -->
105 Gets the position in which the current value is displayed.
109 @Returns: the position in which the current value is displayed.
112 <!-- ##### SIGNAL GtkScale::format-value ##### -->
114 Signal which allows you to change how the scale value is displayed. Connect a
115 signal handler which returns an allocated string representing @value.
116 That string will then be used to display the scale's value.
117 Here's an example signal handler which displays a value 1.0 as
119 <informalexample><programlisting>
121 format_value_callback (GtkScale *scale,
124 return g_strdup_printf ("-->%0.*g<--",
125 gtk_scale_get_digits (scale), value);
127 </programlisting></informalexample>
130 @scale: the object which received the signal.
132 @Returns: allocated string representing @value
133 <!-- # Unused Parameters # -->
134 @value: value to format
136 <!-- ##### ARG GtkScale:digits ##### -->
138 The number of decimal places that are displayed in the value.
141 <!-- ##### ARG GtkScale:draw-value ##### -->
143 If the current value is displayed as a string next to the slider.
146 <!-- ##### ARG GtkScale:value-pos ##### -->
148 The position in which the current value is displayed.