gtk4/auto/scale.rs
1// This file was generated by gir (https://github.com/gtk-rs/gir)
2// from gir-files (https://github.com/gtk-rs/gir-files)
3// DO NOT EDIT
4
5#[cfg(feature = "v4_10")]
6#[cfg_attr(docsrs, doc(cfg(feature = "v4_10")))]
7use crate::AccessibleRange;
8use crate::{
9 ffi, Accessible, AccessibleRole, Adjustment, Align, Buildable, ConstraintTarget, LayoutManager,
10 Orientable, Orientation, Overflow, PositionType, Range, Widget,
11};
12use glib::{
13 prelude::*,
14 signal::{connect_raw, SignalHandlerId},
15 translate::*,
16};
17use std::boxed::Box as Box_;
18
19#[cfg(feature = "v4_10")]
20#[cfg_attr(docsrs, doc(cfg(feature = "v4_10")))]
21glib::wrapper! {
22 /// A [`Scale`][crate::Scale] is a slider control used to select a numeric value.
23 ///
24 /// 
25 ///
26 /// To use it, you’ll probably want to investigate the methods on its base
27 /// class, [`Range`][crate::Range], in addition to the methods for [`Scale`][crate::Scale] itself.
28 /// To set the value of a scale, you would normally use [`RangeExt::set_value()`][crate::prelude::RangeExt::set_value()].
29 /// To detect changes to the value, you would normally use the
30 /// [`value-changed`][struct@crate::Range#value-changed] signal.
31 ///
32 /// Note that using the same upper and lower bounds for the [`Scale`][crate::Scale] (through
33 /// the [`Range`][crate::Range] methods) will hide the slider itself. This is useful for
34 /// applications that want to show an undeterminate value on the scale, without
35 /// changing the layout of the application (such as movie or music players).
36 ///
37 /// # GtkScale as GtkBuildable
38 ///
39 /// [`Scale`][crate::Scale] supports a custom `<marks>` element, which can contain multiple
40 /// `<mark\>` elements. The “value” and “position” attributes have the same
41 /// meaning as [`ScaleExt::add_mark()`][crate::prelude::ScaleExt::add_mark()] parameters of the same name. If
42 /// the element is not empty, its content is taken as the markup to show at
43 /// the mark. It can be translated with the usual ”translatable” and
44 /// “context” attributes.
45 ///
46 /// # Shortcuts and Gestures
47 ///
48 /// [`PopoverMenu`][crate::PopoverMenu] supports the following keyboard shortcuts:
49 ///
50 /// - Arrow keys, <kbd>+</kbd> and <kbd>-</kbd> will increment or decrement
51 /// by step, or by page when combined with <kbd>Ctrl</kbd>.
52 /// - <kbd>PgUp</kbd> and <kbd>PgDn</kbd> will increment or decrement by page.
53 /// - <kbd>Home</kbd> and <kbd>End</kbd> will set the minimum or maximum value.
54 ///
55 /// # CSS nodes
56 ///
57 /// ```text
58 /// scale[.fine-tune][.marks-before][.marks-after]
59 /// ├── [value][.top][.right][.bottom][.left]
60 /// ├── marks.top
61 /// │ ├── mark
62 /// │ ┊ ├── [label]
63 /// │ ┊ ╰── indicator
64 /// ┊ ┊
65 /// │ ╰── mark
66 /// ├── marks.bottom
67 /// │ ├── mark
68 /// │ ┊ ├── indicator
69 /// │ ┊ ╰── [label]
70 /// ┊ ┊
71 /// │ ╰── mark
72 /// ╰── trough
73 /// ├── [fill]
74 /// ├── [highlight]
75 /// ╰── slider
76 /// ```
77 ///
78 /// [`Scale`][crate::Scale] has a main CSS node with name scale and a subnode for its contents,
79 /// with subnodes named trough and slider.
80 ///
81 /// The main node gets the style class .fine-tune added when the scale is in
82 /// 'fine-tuning' mode.
83 ///
84 /// If the scale has an origin (see [`ScaleExt::set_has_origin()`][crate::prelude::ScaleExt::set_has_origin()]), there is
85 /// a subnode with name highlight below the trough node that is used for rendering
86 /// the highlighted part of the trough.
87 ///
88 /// If the scale is showing a fill level (see [`RangeExt::set_show_fill_level()`][crate::prelude::RangeExt::set_show_fill_level()]),
89 /// there is a subnode with name fill below the trough node that is used for
90 /// rendering the filled in part of the trough.
91 ///
92 /// If marks are present, there is a marks subnode before or after the trough
93 /// node, below which each mark gets a node with name mark. The marks nodes get
94 /// either the .top or .bottom style class.
95 ///
96 /// The mark node has a subnode named indicator. If the mark has text, it also
97 /// has a subnode named label. When the mark is either above or left of the
98 /// scale, the label subnode is the first when present. Otherwise, the indicator
99 /// subnode is the first.
100 ///
101 /// The main CSS node gets the 'marks-before' and/or 'marks-after' style classes
102 /// added depending on what marks are present.
103 ///
104 /// If the scale is displaying the value (see [`draw-value`][struct@crate::Scale#draw-value]),
105 /// there is subnode with name value. This node will get the .top or .bottom style
106 /// classes similar to the marks node.
107 ///
108 /// # Accessibility
109 ///
110 /// [`Scale`][crate::Scale] uses the [`AccessibleRole::Slider`][crate::AccessibleRole::Slider] role.
111 ///
112 /// ## Properties
113 ///
114 ///
115 /// #### `digits`
116 /// The number of decimal places that are displayed in the value.
117 ///
118 /// Readable | Writeable
119 ///
120 ///
121 /// #### `draw-value`
122 /// Whether the current value is displayed as a string next to the slider.
123 ///
124 /// Readable | Writeable
125 ///
126 ///
127 /// #### `has-origin`
128 /// Whether the scale has an origin.
129 ///
130 /// Readable | Writeable
131 ///
132 ///
133 /// #### `value-pos`
134 /// The position in which the current value is displayed.
135 ///
136 /// Readable | Writeable
137 /// <details><summary><h4>Range</h4></summary>
138 ///
139 ///
140 /// #### `adjustment`
141 /// The adjustment that is controlled by the range.
142 ///
143 /// Readable | Writeable | Construct
144 ///
145 ///
146 /// #### `fill-level`
147 /// The fill level (e.g. prebuffering of a network stream).
148 ///
149 /// Readable | Writeable
150 ///
151 ///
152 /// #### `inverted`
153 /// If [`true`], the direction in which the slider moves is inverted.
154 ///
155 /// Readable | Writeable
156 ///
157 ///
158 /// #### `restrict-to-fill-level`
159 /// Controls whether slider movement is restricted to an
160 /// upper boundary set by the fill level.
161 ///
162 /// Readable | Writeable
163 ///
164 ///
165 /// #### `round-digits`
166 /// The number of digits to round the value to when
167 /// it changes.
168 ///
169 /// See [`change-value`][struct@crate::Range#change-value].
170 ///
171 /// Readable | Writeable
172 ///
173 ///
174 /// #### `show-fill-level`
175 /// Controls whether fill level indicator graphics are displayed
176 /// on the trough.
177 ///
178 /// Readable | Writeable
179 /// </details>
180 /// <details><summary><h4>Widget</h4></summary>
181 ///
182 ///
183 /// #### `can-focus`
184 /// Whether the widget or any of its descendents can accept
185 /// the input focus.
186 ///
187 /// This property is meant to be set by widget implementations,
188 /// typically in their instance init function.
189 ///
190 /// Readable | Writeable
191 ///
192 ///
193 /// #### `can-target`
194 /// Whether the widget can receive pointer events.
195 ///
196 /// Readable | Writeable
197 ///
198 ///
199 /// #### `css-classes`
200 /// A list of css classes applied to this widget.
201 ///
202 /// Readable | Writeable
203 ///
204 ///
205 /// #### `css-name`
206 /// The name of this widget in the CSS tree.
207 ///
208 /// This property is meant to be set by widget implementations,
209 /// typically in their instance init function.
210 ///
211 /// Readable | Writeable | Construct Only
212 ///
213 ///
214 /// #### `cursor`
215 /// The cursor used by @widget.
216 ///
217 /// Readable | Writeable
218 ///
219 ///
220 /// #### `focus-on-click`
221 /// Whether the widget should grab focus when it is clicked with the mouse.
222 ///
223 /// This property is only relevant for widgets that can take focus.
224 ///
225 /// Readable | Writeable
226 ///
227 ///
228 /// #### `focusable`
229 /// Whether this widget itself will accept the input focus.
230 ///
231 /// Readable | Writeable
232 ///
233 ///
234 /// #### `halign`
235 /// How to distribute horizontal space if widget gets extra space.
236 ///
237 /// Readable | Writeable
238 ///
239 ///
240 /// #### `has-default`
241 /// Whether the widget is the default widget.
242 ///
243 /// Readable
244 ///
245 ///
246 /// #### `has-focus`
247 /// Whether the widget has the input focus.
248 ///
249 /// Readable
250 ///
251 ///
252 /// #### `has-tooltip`
253 /// Enables or disables the emission of the [`query-tooltip`][struct@crate::Widget#query-tooltip]
254 /// signal on @widget.
255 ///
256 /// A true value indicates that @widget can have a tooltip, in this case
257 /// the widget will be queried using [`query-tooltip`][struct@crate::Widget#query-tooltip] to
258 /// determine whether it will provide a tooltip or not.
259 ///
260 /// Readable | Writeable
261 ///
262 ///
263 /// #### `height-request`
264 /// Overrides for height request of the widget.
265 ///
266 /// If this is -1, the natural request will be used.
267 ///
268 /// Readable | Writeable
269 ///
270 ///
271 /// #### `hexpand`
272 /// Whether to expand horizontally.
273 ///
274 /// Readable | Writeable
275 ///
276 ///
277 /// #### `hexpand-set`
278 /// Whether to use the `hexpand` property.
279 ///
280 /// Readable | Writeable
281 ///
282 ///
283 /// #### `layout-manager`
284 /// The [`LayoutManager`][crate::LayoutManager] instance to use to compute
285 /// the preferred size of the widget, and allocate its children.
286 ///
287 /// This property is meant to be set by widget implementations,
288 /// typically in their instance init function.
289 ///
290 /// Readable | Writeable
291 ///
292 ///
293 /// #### `limit-events`
294 /// Makes this widget act like a modal dialog, with respect to
295 /// event delivery.
296 ///
297 /// Global event controllers will not handle events with targets
298 /// inside the widget, unless they are set up to ignore propagation
299 /// limits. See [`EventControllerExt::set_propagation_limit()`][crate::prelude::EventControllerExt::set_propagation_limit()].
300 ///
301 /// Readable | Writeable
302 ///
303 ///
304 /// #### `margin-bottom`
305 /// Margin on bottom side of widget.
306 ///
307 /// This property adds margin outside of the widget's normal size
308 /// request, the margin will be added in addition to the size from
309 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
310 ///
311 /// Readable | Writeable
312 ///
313 ///
314 /// #### `margin-end`
315 /// Margin on end of widget, horizontally.
316 ///
317 /// This property supports left-to-right and right-to-left text
318 /// directions.
319 ///
320 /// This property adds margin outside of the widget's normal size
321 /// request, the margin will be added in addition to the size from
322 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
323 ///
324 /// Readable | Writeable
325 ///
326 ///
327 /// #### `margin-start`
328 /// Margin on start of widget, horizontally.
329 ///
330 /// This property supports left-to-right and right-to-left text
331 /// directions.
332 ///
333 /// This property adds margin outside of the widget's normal size
334 /// request, the margin will be added in addition to the size from
335 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
336 ///
337 /// Readable | Writeable
338 ///
339 ///
340 /// #### `margin-top`
341 /// Margin on top side of widget.
342 ///
343 /// This property adds margin outside of the widget's normal size
344 /// request, the margin will be added in addition to the size from
345 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
346 ///
347 /// Readable | Writeable
348 ///
349 ///
350 /// #### `name`
351 /// The name of the widget.
352 ///
353 /// Readable | Writeable
354 ///
355 ///
356 /// #### `opacity`
357 /// The requested opacity of the widget.
358 ///
359 /// Readable | Writeable
360 ///
361 ///
362 /// #### `overflow`
363 /// How content outside the widget's content area is treated.
364 ///
365 /// This property is meant to be set by widget implementations,
366 /// typically in their instance init function.
367 ///
368 /// Readable | Writeable
369 ///
370 ///
371 /// #### `parent`
372 /// The parent widget of this widget.
373 ///
374 /// Readable
375 ///
376 ///
377 /// #### `receives-default`
378 /// Whether the widget will receive the default action when it is focused.
379 ///
380 /// Readable | Writeable
381 ///
382 ///
383 /// #### `root`
384 /// The [`Root`][crate::Root] widget of the widget tree containing this widget.
385 ///
386 /// This will be `NULL` if the widget is not contained in a root widget.
387 ///
388 /// Readable
389 ///
390 ///
391 /// #### `scale-factor`
392 /// The scale factor of the widget.
393 ///
394 /// Readable
395 ///
396 ///
397 /// #### `sensitive`
398 /// Whether the widget responds to input.
399 ///
400 /// Readable | Writeable
401 ///
402 ///
403 /// #### `tooltip-markup`
404 /// Sets the text of tooltip to be the given string, which is marked up
405 /// with Pango markup.
406 ///
407 /// Also see [`Tooltip::set_markup()`][crate::Tooltip::set_markup()].
408 ///
409 /// This is a convenience property which will take care of getting the
410 /// tooltip shown if the given string is not `NULL`:
411 /// [`has-tooltip`][struct@crate::Widget#has-tooltip] will automatically be set to true
412 /// and there will be taken care of [`query-tooltip`][struct@crate::Widget#query-tooltip] in
413 /// the default signal handler.
414 ///
415 /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and
416 /// [`tooltip-markup`][struct@crate::Widget#tooltip-markup] are set, the last one wins.
417 ///
418 /// Readable | Writeable
419 ///
420 ///
421 /// #### `tooltip-text`
422 /// Sets the text of tooltip to be the given string.
423 ///
424 /// Also see [`Tooltip::set_text()`][crate::Tooltip::set_text()].
425 ///
426 /// This is a convenience property which will take care of getting the
427 /// tooltip shown if the given string is not `NULL`:
428 /// [`has-tooltip`][struct@crate::Widget#has-tooltip] will automatically be set to true
429 /// and there will be taken care of [`query-tooltip`][struct@crate::Widget#query-tooltip] in
430 /// the default signal handler.
431 ///
432 /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and
433 /// [`tooltip-markup`][struct@crate::Widget#tooltip-markup] are set, the last one wins.
434 ///
435 /// Readable | Writeable
436 ///
437 ///
438 /// #### `valign`
439 /// How to distribute vertical space if widget gets extra space.
440 ///
441 /// Readable | Writeable
442 ///
443 ///
444 /// #### `vexpand`
445 /// Whether to expand vertically.
446 ///
447 /// Readable | Writeable
448 ///
449 ///
450 /// #### `vexpand-set`
451 /// Whether to use the `vexpand` property.
452 ///
453 /// Readable | Writeable
454 ///
455 ///
456 /// #### `visible`
457 /// Whether the widget is visible.
458 ///
459 /// Readable | Writeable
460 ///
461 ///
462 /// #### `width-request`
463 /// Overrides for width request of the widget.
464 ///
465 /// If this is -1, the natural request will be used.
466 ///
467 /// Readable | Writeable
468 /// </details>
469 /// <details><summary><h4>Accessible</h4></summary>
470 ///
471 ///
472 /// #### `accessible-role`
473 /// The accessible role of the given [`Accessible`][crate::Accessible] implementation.
474 ///
475 /// The accessible role cannot be changed once set.
476 ///
477 /// Readable | Writeable
478 /// </details>
479 /// <details><summary><h4>Orientable</h4></summary>
480 ///
481 ///
482 /// #### `orientation`
483 /// The orientation of the orientable.
484 ///
485 /// Readable | Writeable
486 /// </details>
487 ///
488 /// # Implements
489 ///
490 /// [`ScaleExt`][trait@crate::prelude::ScaleExt], [`RangeExt`][trait@crate::prelude::RangeExt], [`WidgetExt`][trait@crate::prelude::WidgetExt], [`trait@glib::ObjectExt`], [`AccessibleExt`][trait@crate::prelude::AccessibleExt], [`BuildableExt`][trait@crate::prelude::BuildableExt], [`ConstraintTargetExt`][trait@crate::prelude::ConstraintTargetExt], [`AccessibleRangeExt`][trait@crate::prelude::AccessibleRangeExt], [`OrientableExt`][trait@crate::prelude::OrientableExt], [`ScaleExtManual`][trait@crate::prelude::ScaleExtManual], [`WidgetExtManual`][trait@crate::prelude::WidgetExtManual], [`AccessibleExtManual`][trait@crate::prelude::AccessibleExtManual]
491 #[doc(alias = "GtkScale")]
492 pub struct Scale(Object<ffi::GtkScale, ffi::GtkScaleClass>) @extends Range, Widget, @implements Accessible, Buildable, ConstraintTarget, AccessibleRange, Orientable;
493
494 match fn {
495 type_ => || ffi::gtk_scale_get_type(),
496 }
497}
498
499#[cfg(not(any(feature = "v4_10")))]
500glib::wrapper! {
501 #[doc(alias = "GtkScale")]
502 pub struct Scale(Object<ffi::GtkScale, ffi::GtkScaleClass>) @extends Range, Widget, @implements Accessible, Buildable, ConstraintTarget, Orientable;
503
504 match fn {
505 type_ => || ffi::gtk_scale_get_type(),
506 }
507}
508
509impl Scale {
510 pub const NONE: Option<&'static Scale> = None;
511
512 /// Creates a new [`Scale`][crate::Scale].
513 /// ## `orientation`
514 /// the scale’s orientation.
515 /// ## `adjustment`
516 /// the [`Adjustment`][crate::Adjustment] which sets
517 /// the range of the scale, or [`None`] to create a new adjustment.
518 ///
519 /// # Returns
520 ///
521 /// a new [`Scale`][crate::Scale]
522 #[doc(alias = "gtk_scale_new")]
523 pub fn new(orientation: Orientation, adjustment: Option<&impl IsA<Adjustment>>) -> Scale {
524 assert_initialized_main_thread!();
525 unsafe {
526 Widget::from_glib_none(ffi::gtk_scale_new(
527 orientation.into_glib(),
528 adjustment.map(|p| p.as_ref()).to_glib_none().0,
529 ))
530 .unsafe_cast()
531 }
532 }
533
534 /// Creates a new scale widget with a range from @min to @max.
535 ///
536 /// The returns scale will have the given orientation and will let the
537 /// user input a number between @min and @max (including @min and @max)
538 /// with the increment @step. @step must be nonzero; it’s the distance
539 /// the slider moves when using the arrow keys to adjust the scale
540 /// value.
541 ///
542 /// Note that the way in which the precision is derived works best if
543 /// @step is a power of ten. If the resulting precision is not suitable
544 /// for your needs, use [`ScaleExt::set_digits()`][crate::prelude::ScaleExt::set_digits()] to correct it.
545 /// ## `orientation`
546 /// the scale’s orientation.
547 /// ## `min`
548 /// minimum value
549 /// ## `max`
550 /// maximum value
551 /// ## `step`
552 /// step increment (tick size) used with keyboard shortcuts
553 ///
554 /// # Returns
555 ///
556 /// a new [`Scale`][crate::Scale]
557 #[doc(alias = "gtk_scale_new_with_range")]
558 #[doc(alias = "new_with_range")]
559 pub fn with_range(orientation: Orientation, min: f64, max: f64, step: f64) -> Scale {
560 assert_initialized_main_thread!();
561 unsafe {
562 Widget::from_glib_none(ffi::gtk_scale_new_with_range(
563 orientation.into_glib(),
564 min,
565 max,
566 step,
567 ))
568 .unsafe_cast()
569 }
570 }
571
572 // rustdoc-stripper-ignore-next
573 /// Creates a new builder-pattern struct instance to construct [`Scale`] objects.
574 ///
575 /// This method returns an instance of [`ScaleBuilder`](crate::builders::ScaleBuilder) which can be used to create [`Scale`] objects.
576 pub fn builder() -> ScaleBuilder {
577 ScaleBuilder::new()
578 }
579}
580
581impl Default for Scale {
582 fn default() -> Self {
583 glib::object::Object::new::<Self>()
584 }
585}
586
587// rustdoc-stripper-ignore-next
588/// A [builder-pattern] type to construct [`Scale`] objects.
589///
590/// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html
591#[must_use = "The builder must be built to be used"]
592pub struct ScaleBuilder {
593 builder: glib::object::ObjectBuilder<'static, Scale>,
594}
595
596impl ScaleBuilder {
597 fn new() -> Self {
598 Self {
599 builder: glib::object::Object::builder(),
600 }
601 }
602
603 /// The number of decimal places that are displayed in the value.
604 pub fn digits(self, digits: i32) -> Self {
605 Self {
606 builder: self.builder.property("digits", digits),
607 }
608 }
609
610 /// Whether the current value is displayed as a string next to the slider.
611 pub fn draw_value(self, draw_value: bool) -> Self {
612 Self {
613 builder: self.builder.property("draw-value", draw_value),
614 }
615 }
616
617 /// Whether the scale has an origin.
618 pub fn has_origin(self, has_origin: bool) -> Self {
619 Self {
620 builder: self.builder.property("has-origin", has_origin),
621 }
622 }
623
624 /// The position in which the current value is displayed.
625 pub fn value_pos(self, value_pos: PositionType) -> Self {
626 Self {
627 builder: self.builder.property("value-pos", value_pos),
628 }
629 }
630
631 /// The adjustment that is controlled by the range.
632 pub fn adjustment(self, adjustment: &impl IsA<Adjustment>) -> Self {
633 Self {
634 builder: self
635 .builder
636 .property("adjustment", adjustment.clone().upcast()),
637 }
638 }
639
640 /// The fill level (e.g. prebuffering of a network stream).
641 pub fn fill_level(self, fill_level: f64) -> Self {
642 Self {
643 builder: self.builder.property("fill-level", fill_level),
644 }
645 }
646
647 /// If [`true`], the direction in which the slider moves is inverted.
648 pub fn inverted(self, inverted: bool) -> Self {
649 Self {
650 builder: self.builder.property("inverted", inverted),
651 }
652 }
653
654 /// Controls whether slider movement is restricted to an
655 /// upper boundary set by the fill level.
656 pub fn restrict_to_fill_level(self, restrict_to_fill_level: bool) -> Self {
657 Self {
658 builder: self
659 .builder
660 .property("restrict-to-fill-level", restrict_to_fill_level),
661 }
662 }
663
664 /// The number of digits to round the value to when
665 /// it changes.
666 ///
667 /// See [`change-value`][struct@crate::Range#change-value].
668 pub fn round_digits(self, round_digits: i32) -> Self {
669 Self {
670 builder: self.builder.property("round-digits", round_digits),
671 }
672 }
673
674 /// Controls whether fill level indicator graphics are displayed
675 /// on the trough.
676 pub fn show_fill_level(self, show_fill_level: bool) -> Self {
677 Self {
678 builder: self.builder.property("show-fill-level", show_fill_level),
679 }
680 }
681
682 /// Whether the widget or any of its descendents can accept
683 /// the input focus.
684 ///
685 /// This property is meant to be set by widget implementations,
686 /// typically in their instance init function.
687 pub fn can_focus(self, can_focus: bool) -> Self {
688 Self {
689 builder: self.builder.property("can-focus", can_focus),
690 }
691 }
692
693 /// Whether the widget can receive pointer events.
694 pub fn can_target(self, can_target: bool) -> Self {
695 Self {
696 builder: self.builder.property("can-target", can_target),
697 }
698 }
699
700 /// A list of css classes applied to this widget.
701 pub fn css_classes(self, css_classes: impl Into<glib::StrV>) -> Self {
702 Self {
703 builder: self.builder.property("css-classes", css_classes.into()),
704 }
705 }
706
707 /// The name of this widget in the CSS tree.
708 ///
709 /// This property is meant to be set by widget implementations,
710 /// typically in their instance init function.
711 pub fn css_name(self, css_name: impl Into<glib::GString>) -> Self {
712 Self {
713 builder: self.builder.property("css-name", css_name.into()),
714 }
715 }
716
717 /// The cursor used by @widget.
718 pub fn cursor(self, cursor: &gdk::Cursor) -> Self {
719 Self {
720 builder: self.builder.property("cursor", cursor.clone()),
721 }
722 }
723
724 /// Whether the widget should grab focus when it is clicked with the mouse.
725 ///
726 /// This property is only relevant for widgets that can take focus.
727 pub fn focus_on_click(self, focus_on_click: bool) -> Self {
728 Self {
729 builder: self.builder.property("focus-on-click", focus_on_click),
730 }
731 }
732
733 /// Whether this widget itself will accept the input focus.
734 pub fn focusable(self, focusable: bool) -> Self {
735 Self {
736 builder: self.builder.property("focusable", focusable),
737 }
738 }
739
740 /// How to distribute horizontal space if widget gets extra space.
741 pub fn halign(self, halign: Align) -> Self {
742 Self {
743 builder: self.builder.property("halign", halign),
744 }
745 }
746
747 /// Enables or disables the emission of the [`query-tooltip`][struct@crate::Widget#query-tooltip]
748 /// signal on @widget.
749 ///
750 /// A true value indicates that @widget can have a tooltip, in this case
751 /// the widget will be queried using [`query-tooltip`][struct@crate::Widget#query-tooltip] to
752 /// determine whether it will provide a tooltip or not.
753 pub fn has_tooltip(self, has_tooltip: bool) -> Self {
754 Self {
755 builder: self.builder.property("has-tooltip", has_tooltip),
756 }
757 }
758
759 /// Overrides for height request of the widget.
760 ///
761 /// If this is -1, the natural request will be used.
762 pub fn height_request(self, height_request: i32) -> Self {
763 Self {
764 builder: self.builder.property("height-request", height_request),
765 }
766 }
767
768 /// Whether to expand horizontally.
769 pub fn hexpand(self, hexpand: bool) -> Self {
770 Self {
771 builder: self.builder.property("hexpand", hexpand),
772 }
773 }
774
775 /// Whether to use the `hexpand` property.
776 pub fn hexpand_set(self, hexpand_set: bool) -> Self {
777 Self {
778 builder: self.builder.property("hexpand-set", hexpand_set),
779 }
780 }
781
782 /// The [`LayoutManager`][crate::LayoutManager] instance to use to compute
783 /// the preferred size of the widget, and allocate its children.
784 ///
785 /// This property is meant to be set by widget implementations,
786 /// typically in their instance init function.
787 pub fn layout_manager(self, layout_manager: &impl IsA<LayoutManager>) -> Self {
788 Self {
789 builder: self
790 .builder
791 .property("layout-manager", layout_manager.clone().upcast()),
792 }
793 }
794
795 /// Makes this widget act like a modal dialog, with respect to
796 /// event delivery.
797 ///
798 /// Global event controllers will not handle events with targets
799 /// inside the widget, unless they are set up to ignore propagation
800 /// limits. See [`EventControllerExt::set_propagation_limit()`][crate::prelude::EventControllerExt::set_propagation_limit()].
801 #[cfg(feature = "v4_18")]
802 #[cfg_attr(docsrs, doc(cfg(feature = "v4_18")))]
803 pub fn limit_events(self, limit_events: bool) -> Self {
804 Self {
805 builder: self.builder.property("limit-events", limit_events),
806 }
807 }
808
809 /// Margin on bottom side of widget.
810 ///
811 /// This property adds margin outside of the widget's normal size
812 /// request, the margin will be added in addition to the size from
813 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
814 pub fn margin_bottom(self, margin_bottom: i32) -> Self {
815 Self {
816 builder: self.builder.property("margin-bottom", margin_bottom),
817 }
818 }
819
820 /// Margin on end of widget, horizontally.
821 ///
822 /// This property supports left-to-right and right-to-left text
823 /// directions.
824 ///
825 /// This property adds margin outside of the widget's normal size
826 /// request, the margin will be added in addition to the size from
827 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
828 pub fn margin_end(self, margin_end: i32) -> Self {
829 Self {
830 builder: self.builder.property("margin-end", margin_end),
831 }
832 }
833
834 /// Margin on start of widget, horizontally.
835 ///
836 /// This property supports left-to-right and right-to-left text
837 /// directions.
838 ///
839 /// This property adds margin outside of the widget's normal size
840 /// request, the margin will be added in addition to the size from
841 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
842 pub fn margin_start(self, margin_start: i32) -> Self {
843 Self {
844 builder: self.builder.property("margin-start", margin_start),
845 }
846 }
847
848 /// Margin on top side of widget.
849 ///
850 /// This property adds margin outside of the widget's normal size
851 /// request, the margin will be added in addition to the size from
852 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
853 pub fn margin_top(self, margin_top: i32) -> Self {
854 Self {
855 builder: self.builder.property("margin-top", margin_top),
856 }
857 }
858
859 /// The name of the widget.
860 pub fn name(self, name: impl Into<glib::GString>) -> Self {
861 Self {
862 builder: self.builder.property("name", name.into()),
863 }
864 }
865
866 /// The requested opacity of the widget.
867 pub fn opacity(self, opacity: f64) -> Self {
868 Self {
869 builder: self.builder.property("opacity", opacity),
870 }
871 }
872
873 /// How content outside the widget's content area is treated.
874 ///
875 /// This property is meant to be set by widget implementations,
876 /// typically in their instance init function.
877 pub fn overflow(self, overflow: Overflow) -> Self {
878 Self {
879 builder: self.builder.property("overflow", overflow),
880 }
881 }
882
883 /// Whether the widget will receive the default action when it is focused.
884 pub fn receives_default(self, receives_default: bool) -> Self {
885 Self {
886 builder: self.builder.property("receives-default", receives_default),
887 }
888 }
889
890 /// Whether the widget responds to input.
891 pub fn sensitive(self, sensitive: bool) -> Self {
892 Self {
893 builder: self.builder.property("sensitive", sensitive),
894 }
895 }
896
897 /// Sets the text of tooltip to be the given string, which is marked up
898 /// with Pango markup.
899 ///
900 /// Also see [`Tooltip::set_markup()`][crate::Tooltip::set_markup()].
901 ///
902 /// This is a convenience property which will take care of getting the
903 /// tooltip shown if the given string is not `NULL`:
904 /// [`has-tooltip`][struct@crate::Widget#has-tooltip] will automatically be set to true
905 /// and there will be taken care of [`query-tooltip`][struct@crate::Widget#query-tooltip] in
906 /// the default signal handler.
907 ///
908 /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and
909 /// [`tooltip-markup`][struct@crate::Widget#tooltip-markup] are set, the last one wins.
910 pub fn tooltip_markup(self, tooltip_markup: impl Into<glib::GString>) -> Self {
911 Self {
912 builder: self
913 .builder
914 .property("tooltip-markup", tooltip_markup.into()),
915 }
916 }
917
918 /// Sets the text of tooltip to be the given string.
919 ///
920 /// Also see [`Tooltip::set_text()`][crate::Tooltip::set_text()].
921 ///
922 /// This is a convenience property which will take care of getting the
923 /// tooltip shown if the given string is not `NULL`:
924 /// [`has-tooltip`][struct@crate::Widget#has-tooltip] will automatically be set to true
925 /// and there will be taken care of [`query-tooltip`][struct@crate::Widget#query-tooltip] in
926 /// the default signal handler.
927 ///
928 /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and
929 /// [`tooltip-markup`][struct@crate::Widget#tooltip-markup] are set, the last one wins.
930 pub fn tooltip_text(self, tooltip_text: impl Into<glib::GString>) -> Self {
931 Self {
932 builder: self.builder.property("tooltip-text", tooltip_text.into()),
933 }
934 }
935
936 /// How to distribute vertical space if widget gets extra space.
937 pub fn valign(self, valign: Align) -> Self {
938 Self {
939 builder: self.builder.property("valign", valign),
940 }
941 }
942
943 /// Whether to expand vertically.
944 pub fn vexpand(self, vexpand: bool) -> Self {
945 Self {
946 builder: self.builder.property("vexpand", vexpand),
947 }
948 }
949
950 /// Whether to use the `vexpand` property.
951 pub fn vexpand_set(self, vexpand_set: bool) -> Self {
952 Self {
953 builder: self.builder.property("vexpand-set", vexpand_set),
954 }
955 }
956
957 /// Whether the widget is visible.
958 pub fn visible(self, visible: bool) -> Self {
959 Self {
960 builder: self.builder.property("visible", visible),
961 }
962 }
963
964 /// Overrides for width request of the widget.
965 ///
966 /// If this is -1, the natural request will be used.
967 pub fn width_request(self, width_request: i32) -> Self {
968 Self {
969 builder: self.builder.property("width-request", width_request),
970 }
971 }
972
973 /// The accessible role of the given [`Accessible`][crate::Accessible] implementation.
974 ///
975 /// The accessible role cannot be changed once set.
976 pub fn accessible_role(self, accessible_role: AccessibleRole) -> Self {
977 Self {
978 builder: self.builder.property("accessible-role", accessible_role),
979 }
980 }
981
982 /// The orientation of the orientable.
983 pub fn orientation(self, orientation: Orientation) -> Self {
984 Self {
985 builder: self.builder.property("orientation", orientation),
986 }
987 }
988
989 // rustdoc-stripper-ignore-next
990 /// Build the [`Scale`].
991 #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"]
992 pub fn build(self) -> Scale {
993 assert_initialized_main_thread!();
994 self.builder.build()
995 }
996}
997
998mod sealed {
999 pub trait Sealed {}
1000 impl<T: super::IsA<super::Scale>> Sealed for T {}
1001}
1002
1003/// Trait containing all [`struct@Scale`] methods.
1004///
1005/// # Implementors
1006///
1007/// [`Scale`][struct@crate::Scale]
1008pub trait ScaleExt: IsA<Scale> + sealed::Sealed + 'static {
1009 /// Adds a mark at @value.
1010 ///
1011 /// A mark is indicated visually by drawing a tick mark next to the scale,
1012 /// and GTK makes it easy for the user to position the scale exactly at the
1013 /// marks value.
1014 ///
1015 /// If @markup is not [`None`], text is shown next to the tick mark.
1016 ///
1017 /// To remove marks from a scale, use [`clear_marks()`][Self::clear_marks()].
1018 /// ## `value`
1019 /// the value at which the mark is placed, must be between
1020 /// the lower and upper limits of the scales’ adjustment
1021 /// ## `position`
1022 /// where to draw the mark. For a horizontal scale, [`PositionType::Top`][crate::PositionType::Top]
1023 /// and [`PositionType::Left`][crate::PositionType::Left] are drawn above the scale, anything else below.
1024 /// For a vertical scale, [`PositionType::Left`][crate::PositionType::Left] and [`PositionType::Top`][crate::PositionType::Top] are drawn to
1025 /// the left of the scale, anything else to the right.
1026 /// ## `markup`
1027 /// Text to be shown at the mark, using Pango markup
1028 #[doc(alias = "gtk_scale_add_mark")]
1029 fn add_mark(&self, value: f64, position: PositionType, markup: Option<&str>) {
1030 unsafe {
1031 ffi::gtk_scale_add_mark(
1032 self.as_ref().to_glib_none().0,
1033 value,
1034 position.into_glib(),
1035 markup.to_glib_none().0,
1036 );
1037 }
1038 }
1039
1040 /// Removes any marks that have been added.
1041 #[doc(alias = "gtk_scale_clear_marks")]
1042 fn clear_marks(&self) {
1043 unsafe {
1044 ffi::gtk_scale_clear_marks(self.as_ref().to_glib_none().0);
1045 }
1046 }
1047
1048 /// Gets the number of decimal places that are displayed in the value.
1049 ///
1050 /// # Returns
1051 ///
1052 /// the number of decimal places that are displayed
1053 #[doc(alias = "gtk_scale_get_digits")]
1054 #[doc(alias = "get_digits")]
1055 fn digits(&self) -> i32 {
1056 unsafe { ffi::gtk_scale_get_digits(self.as_ref().to_glib_none().0) }
1057 }
1058
1059 /// Returns whether the current value is displayed as a string
1060 /// next to the slider.
1061 ///
1062 /// # Returns
1063 ///
1064 /// whether the current value is displayed as a string
1065 #[doc(alias = "gtk_scale_get_draw_value")]
1066 #[doc(alias = "get_draw_value")]
1067 #[doc(alias = "draw-value")]
1068 fn draws_value(&self) -> bool {
1069 unsafe {
1070 from_glib(ffi::gtk_scale_get_draw_value(
1071 self.as_ref().to_glib_none().0,
1072 ))
1073 }
1074 }
1075
1076 /// Returns whether the scale has an origin.
1077 ///
1078 /// # Returns
1079 ///
1080 /// [`true`] if the scale has an origin.
1081 #[doc(alias = "gtk_scale_get_has_origin")]
1082 #[doc(alias = "get_has_origin")]
1083 #[doc(alias = "has-origin")]
1084 fn has_origin(&self) -> bool {
1085 unsafe {
1086 from_glib(ffi::gtk_scale_get_has_origin(
1087 self.as_ref().to_glib_none().0,
1088 ))
1089 }
1090 }
1091
1092 /// Gets the [`pango::Layout`][crate::pango::Layout] used to display the scale.
1093 ///
1094 /// The returned object is owned by the scale so does not need
1095 /// to be freed by the caller.
1096 ///
1097 /// # Returns
1098 ///
1099 /// the [`pango::Layout`][crate::pango::Layout]
1100 /// for this scale, or [`None`] if the [`draw-value`][struct@crate::Scale#draw-value]
1101 /// property is [`false`].
1102 #[doc(alias = "gtk_scale_get_layout")]
1103 #[doc(alias = "get_layout")]
1104 fn layout(&self) -> Option<pango::Layout> {
1105 unsafe { from_glib_none(ffi::gtk_scale_get_layout(self.as_ref().to_glib_none().0)) }
1106 }
1107
1108 /// Obtains the coordinates where the scale will draw the
1109 /// [`pango::Layout`][crate::pango::Layout] representing the text in the scale.
1110 ///
1111 /// Remember when using the [`pango::Layout`][crate::pango::Layout] function you need to
1112 /// convert to and from pixels using `PANGO_PIXELS()` or `PANGO_SCALE`.
1113 ///
1114 /// If the [`draw-value`][struct@crate::Scale#draw-value] property is [`false`], the return
1115 /// values are undefined.
1116 ///
1117 /// # Returns
1118 ///
1119 ///
1120 /// ## `x`
1121 /// location to store X offset of layout
1122 ///
1123 /// ## `y`
1124 /// location to store Y offset of layout
1125 #[doc(alias = "gtk_scale_get_layout_offsets")]
1126 #[doc(alias = "get_layout_offsets")]
1127 fn layout_offsets(&self) -> (i32, i32) {
1128 unsafe {
1129 let mut x = std::mem::MaybeUninit::uninit();
1130 let mut y = std::mem::MaybeUninit::uninit();
1131 ffi::gtk_scale_get_layout_offsets(
1132 self.as_ref().to_glib_none().0,
1133 x.as_mut_ptr(),
1134 y.as_mut_ptr(),
1135 );
1136 (x.assume_init(), y.assume_init())
1137 }
1138 }
1139
1140 /// Gets the position in which the current value is displayed.
1141 ///
1142 /// # Returns
1143 ///
1144 /// the position in which the current value is displayed
1145 #[doc(alias = "gtk_scale_get_value_pos")]
1146 #[doc(alias = "get_value_pos")]
1147 #[doc(alias = "value-pos")]
1148 fn value_pos(&self) -> PositionType {
1149 unsafe { from_glib(ffi::gtk_scale_get_value_pos(self.as_ref().to_glib_none().0)) }
1150 }
1151
1152 /// Sets the number of decimal places that are displayed in the value.
1153 ///
1154 /// Also causes the value of the adjustment to be rounded to this number
1155 /// of digits, so the retrieved value matches the displayed one, if
1156 /// [`draw-value`][struct@crate::Scale#draw-value] is [`true`] when the value changes. If
1157 /// you want to enforce rounding the value when [`draw-value`][struct@crate::Scale#draw-value]
1158 /// is [`false`], you can set [`round-digits`][struct@crate::Range#round-digits] instead.
1159 ///
1160 /// Note that rounding to a small number of digits can interfere with
1161 /// the smooth autoscrolling that is built into [`Scale`][crate::Scale]. As an alternative,
1162 /// you can use [`set_format_value_func()`][Self::set_format_value_func()] to format the displayed
1163 /// value yourself.
1164 /// ## `digits`
1165 /// the number of decimal places to display,
1166 /// e.g. use 1 to display 1.0, 2 to display 1.00, etc
1167 #[doc(alias = "gtk_scale_set_digits")]
1168 #[doc(alias = "digits")]
1169 fn set_digits(&self, digits: i32) {
1170 unsafe {
1171 ffi::gtk_scale_set_digits(self.as_ref().to_glib_none().0, digits);
1172 }
1173 }
1174
1175 /// Specifies whether the current value is displayed as a string next
1176 /// to the slider.
1177 /// ## `draw_value`
1178 /// [`true`] to draw the value
1179 #[doc(alias = "gtk_scale_set_draw_value")]
1180 #[doc(alias = "draw-value")]
1181 fn set_draw_value(&self, draw_value: bool) {
1182 unsafe {
1183 ffi::gtk_scale_set_draw_value(self.as_ref().to_glib_none().0, draw_value.into_glib());
1184 }
1185 }
1186
1187 /// @func allows you to change how the scale value is displayed.
1188 ///
1189 /// The given function will return an allocated string representing
1190 /// @value. That string will then be used to display the scale's value.
1191 ///
1192 /// If #NULL is passed as @func, the value will be displayed on
1193 /// its own, rounded according to the value of the
1194 /// [`digits`][struct@crate::Scale#digits] property.
1195 /// ## `func`
1196 /// function
1197 /// that formats the value
1198 /// ## `destroy_notify`
1199 /// destroy function for @user_data
1200 #[doc(alias = "gtk_scale_set_format_value_func")]
1201 fn set_format_value_func<P: Fn(&Scale, f64) -> String + 'static>(&self, func: P) {
1202 let func_data: Box_<P> = Box_::new(func);
1203 unsafe extern "C" fn func_func<P: Fn(&Scale, f64) -> String + 'static>(
1204 scale: *mut ffi::GtkScale,
1205 value: std::ffi::c_double,
1206 user_data: glib::ffi::gpointer,
1207 ) -> *mut std::ffi::c_char {
1208 let scale = from_glib_borrow(scale);
1209 let callback = &*(user_data as *mut P);
1210 (*callback)(&scale, value).to_glib_full()
1211 }
1212 let func = Some(func_func::<P> as _);
1213 unsafe extern "C" fn destroy_notify_func<P: Fn(&Scale, f64) -> String + 'static>(
1214 data: glib::ffi::gpointer,
1215 ) {
1216 let _callback = Box_::from_raw(data as *mut P);
1217 }
1218 let destroy_call3 = Some(destroy_notify_func::<P> as _);
1219 let super_callback0: Box_<P> = func_data;
1220 unsafe {
1221 ffi::gtk_scale_set_format_value_func(
1222 self.as_ref().to_glib_none().0,
1223 func,
1224 Box_::into_raw(super_callback0) as *mut _,
1225 destroy_call3,
1226 );
1227 }
1228 }
1229
1230 /// Sets whether the scale has an origin.
1231 ///
1232 /// If [`has-origin`][struct@crate::Scale#has-origin] is set to [`true`] (the default),
1233 /// the scale will highlight the part of the trough between the origin
1234 /// (bottom or left side) and the current value.
1235 /// ## `has_origin`
1236 /// [`true`] if the scale has an origin
1237 #[doc(alias = "gtk_scale_set_has_origin")]
1238 #[doc(alias = "has-origin")]
1239 fn set_has_origin(&self, has_origin: bool) {
1240 unsafe {
1241 ffi::gtk_scale_set_has_origin(self.as_ref().to_glib_none().0, has_origin.into_glib());
1242 }
1243 }
1244
1245 /// Sets the position in which the current value is displayed.
1246 /// ## `pos`
1247 /// the position in which the current value is displayed
1248 #[doc(alias = "gtk_scale_set_value_pos")]
1249 #[doc(alias = "value-pos")]
1250 fn set_value_pos(&self, pos: PositionType) {
1251 unsafe {
1252 ffi::gtk_scale_set_value_pos(self.as_ref().to_glib_none().0, pos.into_glib());
1253 }
1254 }
1255
1256 #[doc(alias = "digits")]
1257 fn connect_digits_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1258 unsafe extern "C" fn notify_digits_trampoline<P: IsA<Scale>, F: Fn(&P) + 'static>(
1259 this: *mut ffi::GtkScale,
1260 _param_spec: glib::ffi::gpointer,
1261 f: glib::ffi::gpointer,
1262 ) {
1263 let f: &F = &*(f as *const F);
1264 f(Scale::from_glib_borrow(this).unsafe_cast_ref())
1265 }
1266 unsafe {
1267 let f: Box_<F> = Box_::new(f);
1268 connect_raw(
1269 self.as_ptr() as *mut _,
1270 b"notify::digits\0".as_ptr() as *const _,
1271 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1272 notify_digits_trampoline::<Self, F> as *const (),
1273 )),
1274 Box_::into_raw(f),
1275 )
1276 }
1277 }
1278
1279 #[doc(alias = "draw-value")]
1280 fn connect_draw_value_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1281 unsafe extern "C" fn notify_draw_value_trampoline<P: IsA<Scale>, F: Fn(&P) + 'static>(
1282 this: *mut ffi::GtkScale,
1283 _param_spec: glib::ffi::gpointer,
1284 f: glib::ffi::gpointer,
1285 ) {
1286 let f: &F = &*(f as *const F);
1287 f(Scale::from_glib_borrow(this).unsafe_cast_ref())
1288 }
1289 unsafe {
1290 let f: Box_<F> = Box_::new(f);
1291 connect_raw(
1292 self.as_ptr() as *mut _,
1293 b"notify::draw-value\0".as_ptr() as *const _,
1294 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1295 notify_draw_value_trampoline::<Self, F> as *const (),
1296 )),
1297 Box_::into_raw(f),
1298 )
1299 }
1300 }
1301
1302 #[doc(alias = "has-origin")]
1303 fn connect_has_origin_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1304 unsafe extern "C" fn notify_has_origin_trampoline<P: IsA<Scale>, F: Fn(&P) + 'static>(
1305 this: *mut ffi::GtkScale,
1306 _param_spec: glib::ffi::gpointer,
1307 f: glib::ffi::gpointer,
1308 ) {
1309 let f: &F = &*(f as *const F);
1310 f(Scale::from_glib_borrow(this).unsafe_cast_ref())
1311 }
1312 unsafe {
1313 let f: Box_<F> = Box_::new(f);
1314 connect_raw(
1315 self.as_ptr() as *mut _,
1316 b"notify::has-origin\0".as_ptr() as *const _,
1317 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1318 notify_has_origin_trampoline::<Self, F> as *const (),
1319 )),
1320 Box_::into_raw(f),
1321 )
1322 }
1323 }
1324
1325 #[doc(alias = "value-pos")]
1326 fn connect_value_pos_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1327 unsafe extern "C" fn notify_value_pos_trampoline<P: IsA<Scale>, F: Fn(&P) + 'static>(
1328 this: *mut ffi::GtkScale,
1329 _param_spec: glib::ffi::gpointer,
1330 f: glib::ffi::gpointer,
1331 ) {
1332 let f: &F = &*(f as *const F);
1333 f(Scale::from_glib_borrow(this).unsafe_cast_ref())
1334 }
1335 unsafe {
1336 let f: Box_<F> = Box_::new(f);
1337 connect_raw(
1338 self.as_ptr() as *mut _,
1339 b"notify::value-pos\0".as_ptr() as *const _,
1340 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1341 notify_value_pos_trampoline::<Self, F> as *const (),
1342 )),
1343 Box_::into_raw(f),
1344 )
1345 }
1346 }
1347}
1348
1349impl<O: IsA<Scale>> ScaleExt for O {}