]> Pileus Git - ~andy/gtk/blob - docs/reference/gtk/tmpl/gtkscale.sgml
move README.linux-fb in here
[~andy/gtk] / docs / reference / gtk / tmpl / gtkscale.sgml
1 <!-- ##### SECTION Title ##### -->
2 GtkScale
3
4 <!-- ##### SECTION Short_Description ##### -->
5 a base class for #GtkHScale and #GtkVScale.
6
7 <!-- ##### SECTION Long_Description ##### -->
8 <para>
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" 
14 signal.
15 </para>
16 <para>
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().
20 </para>
21
22 <!-- ##### SECTION See_Also ##### -->
23 <para>
24
25 </para>
26
27 <!-- ##### STRUCT GtkScale ##### -->
28 <para>
29 The #GtkScale-struct struct contains the following fields.
30 (These fields should be considered read-only. They should never be set by
31 an application.)
32
33 <informaltable pgwide=1 frame="none" role="struct">
34 <tgroup cols="2"><colspec colwidth="2*"><colspec colwidth="8*">
35 <tbody>
36
37 <row>
38 <entry>#guint <structfield>draw_value</structfield>;</entry>
39 <entry>non-zero if the scale's current value is displayed next to the
40 slider.</entry>
41 </row>
42
43 <row>
44 <entry>#guint <structfield>value_pos</structfield>;</entry>
45 <entry>the position in which the textual value is displayed, selected from
46 #GtkPositionType.</entry>
47 </row>
48
49 </tbody></tgroup></informaltable>
50 </para>
51
52
53 <!-- ##### FUNCTION gtk_scale_set_digits ##### -->
54 <para>
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.
58 </para>
59
60 @scale: a #GtkScale.
61 @digits: the number of decimal places to display, e.g. use 1 to display 1.0,
62 2 to display 1.00 etc.
63
64
65 <!-- ##### FUNCTION gtk_scale_set_draw_value ##### -->
66 <para>
67 Specifies whether the current value is displayed as a string next to the
68 slider.
69 </para>
70
71 @scale: a #GtkScale.
72 @draw_value: a boolean.
73
74
75 <!-- ##### FUNCTION gtk_scale_set_value_pos ##### -->
76 <para>
77 Sets the position in which the current value is displayed.
78 </para>
79
80 @scale: a #GtkScale.
81 @pos: the position in which the current value is displayed.
82
83
84 <!-- ##### FUNCTION gtk_scale_get_digits ##### -->
85 <para>
86 Gets the number of decimal places that are displayed in the value.
87 </para>
88
89 @scale: a #GtkScale.
90 @Returns: the number of decimal places that are displayed.
91
92
93 <!-- ##### FUNCTION gtk_scale_get_draw_value ##### -->
94 <para>
95 Returns whether the current value is displayed as a string next to the
96 slider.
97 </para>
98
99 @scale: a #GtkScale.
100 @Returns: whether the current value is displayed as a string.
101
102
103 <!-- ##### FUNCTION gtk_scale_get_value_pos ##### -->
104 <para>
105 Gets the position in which the current value is displayed.
106 </para>
107
108 @scale: a #GtkScale.
109 @Returns: the position in which the current value is displayed.
110
111
112 <!-- ##### SIGNAL GtkScale::format-value ##### -->
113 <para>
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
118 with "-->1.0<--".
119 <informalexample><programlisting>
120 static gchar*
121 format_value_callback (GtkScale *scale,
122                        gdouble   value)
123 {
124   return g_strdup_printf ("-->%0.*g<--",
125                           gtk_scale_get_digits (scale), value);
126 }
127 </programlisting></informalexample>
128 </para>
129
130 @scale: the object which received the signal.
131 @arg1: 
132 @Returns: allocated string representing @value
133 <!-- # Unused Parameters # -->
134 @value: value to format
135
136 <!-- ##### ARG GtkScale:digits ##### -->
137 <para>
138 The number of decimal places that are displayed in the value.
139 </para>
140
141 <!-- ##### ARG GtkScale:draw-value ##### -->
142 <para>
143 If the current value is displayed as a string next to the slider.
144 </para>
145
146 <!-- ##### ARG GtkScale:value-pos ##### -->
147 <para>
148 The position in which the current value is displayed.
149 </para>
150