1
2@c %start of fragment
3
4@deftp Class <gtk-scale>
5Derives from @code{<gtk-range>}.
6
7This class defines the following slots:
8
9@table @code
10@item digits
11The number of decimal places that are displayed in the value
12
13@item draw-value
14Whether the current value is displayed as a string next to the slider
15
16@item value-pos
17The position in which the current value is displayed
18
19@end table
20
21@end deftp
22
23@defop Signal <gtk-scale> format-value  (arg0@tie{}@code{<gdouble>}) @result{}@tie{}@code{<gchararray>}
24Signal which allows you to change how the scale value is displayed. Connect a
25signal handler which returns an allocated string representing @var{value}. That
26string will then be used to display the scale's value. Here's an example signal
27handler which displays a value 1.0 as with "-->1.0<--".
28
29@example
30
31static gchar*
32format_value_callback (GtkScale *scale,
33                       gdouble   value)
34@{
35  return g_strdup_printf ("-->%0.*g<--",
36                          gtk_scale_get_digits (scale), value);
37@}
38@end example
39
40@end defop
41
42@deffn Function gtk-scale-set-digits  (self@tie{}@code{<gtk-scale>}) (digits@tie{}@code{int})
43@deffnx Method set-digits
44Sets the number of decimal places that are displayed in the value. Also causes
45the value of the adjustment to be rounded off to this number of digits, so the
46retrieved value matches the value the user saw.
47
48@table @var
49@item scale
50a @code{<gtk-scale>}.
51
52@item digits
53the number of decimal places to display, e.g. use 1 to display 1.0, 2 to display
541.00 etc.
55
56@end table
57
58@end deffn
59
60@deffn Function gtk-scale-set-draw-value  (self@tie{}@code{<gtk-scale>}) (draw_value@tie{}@code{bool})
61@deffnx Method set-draw-value
62Specifies whether the current value is displayed as a string next to the slider.
63
64@table @var
65@item scale
66a @code{<gtk-scale>}.
67
68@item draw-value
69a boolean.
70
71@end table
72
73@end deffn
74
75@deffn Function gtk-scale-set-value-pos  (self@tie{}@code{<gtk-scale>}) (pos@tie{}@code{<gtk-position-type>})
76@deffnx Method set-value-pos
77Sets the position in which the current value is displayed.
78
79@table @var
80@item scale
81a @code{<gtk-scale>}.
82
83@item pos
84the position in which the current value is displayed.
85
86@end table
87
88@end deffn
89
90@deffn Function gtk-scale-get-digits  (self@tie{}@code{<gtk-scale>}) @result{}@tie{} (ret@tie{}@code{int})
91@deffnx Method get-digits
92Gets the number of decimal places that are displayed in the value.
93
94@table @var
95@item scale
96a @code{<gtk-scale>}.
97
98@item ret
99the number of decimal places that are displayed.
100
101@end table
102
103@end deffn
104
105@deffn Function gtk-scale-get-draw-value  (self@tie{}@code{<gtk-scale>}) @result{}@tie{} (ret@tie{}@code{bool})
106@deffnx Method get-draw-value
107Returns whether the current value is displayed as a string next to the slider.
108
109@table @var
110@item scale
111a @code{<gtk-scale>}.
112
113@item ret
114whether the current value is displayed as a string.
115
116@end table
117
118@end deffn
119
120@deffn Function gtk-scale-get-value-pos  (self@tie{}@code{<gtk-scale>}) @result{}@tie{} (ret@tie{}@code{<gtk-position-type>})
121@deffnx Method get-value-pos
122Gets the position in which the current value is displayed.
123
124@table @var
125@item scale
126a @code{<gtk-scale>}.
127
128@item ret
129the position in which the current value is displayed.
130
131@end table
132
133@end deffn
134
135@deffn Function gtk-scale-get-layout  (self@tie{}@code{<gtk-scale>}) @result{}@tie{} (ret@tie{}@code{<pango-layout>})
136@deffnx Method get-layout
137Gets the @code{<pango-layout>} used to display the scale. The returned object is
138owned by the scale so does not need to be freed by the caller.
139
140@table @var
141@item scale
142A @code{<gtk-scale>}
143
144@item ret
145the @code{<pango-layout>} for this scale, or @samp{@code{#f}} if the draw_value
146property is @samp{@code{#f}}.
147
148@end table
149
150Since 2.4
151
152@end deffn
153
154@deffn Function gtk-scale-get-layout-offsets  (self@tie{}@code{<gtk-scale>}) @result{}@tie{} (x@tie{}@code{int}) (y@tie{}@code{int})
155@deffnx Method get-layout-offsets
156Obtains the coordinates where the scale will draw the @code{<pango-layout>}
157representing the text in the scale. Remember when using the
158@code{<pango-layout>} function you need to convert to and from pixels using
159@code{pango-pixels} or @code{<pango-scale>}.
160
161If the draw_value property is @samp{@code{#f}}, the return values are undefined.
162
163@table @var
164@item scale
165a @code{<gtk-scale>}
166
167@item x
168location to store X offset of layout, or @samp{@code{#f}}
169
170@item y
171location to store Y offset of layout, or @samp{@code{#f}}
172
173@end table
174
175Since 2.4
176
177@end deffn
178
179
180@c %end of fragment
181