gtk4/auto/
scale_button.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, Button, ConstraintTarget,
10    LayoutManager, Orientable, Orientation, Overflow, Widget,
11};
12use glib::{
13    object::ObjectType as _,
14    prelude::*,
15    signal::{connect_raw, SignalHandlerId},
16    translate::*,
17};
18use std::boxed::Box as Box_;
19
20#[cfg(feature = "v4_10")]
21#[cfg_attr(docsrs, doc(cfg(feature = "v4_10")))]
22glib::wrapper! {
23    /// Provides a button which pops up a scale widget.
24    ///
25    /// This kind of widget is commonly used for volume controls in multimedia
26    /// applications, and GTK provides a [`VolumeButton`][crate::VolumeButton] subclass that
27    /// is tailored for this use case.
28    ///
29    /// # Shortcuts and Gestures
30    ///
31    /// The following signals have default keybindings:
32    ///
33    /// - [`popup`][struct@crate::ScaleButton#popup]
34    ///
35    /// # CSS nodes
36    ///
37    /// ```text
38    /// scalebutton.scale
39    /// ╰── button.toggle
40    ///     ╰── <icon>
41    /// ```
42    ///
43    /// [`ScaleButton`][crate::ScaleButton] has a single CSS node with name scalebutton and `.scale`
44    /// style class, and contains a `button` node with a `.toggle` style class.
45    ///
46    /// ## Properties
47    ///
48    ///
49    /// #### `active`
50    ///  If the scale button should be pressed in.
51    ///
52    /// Readable
53    ///
54    ///
55    /// #### `adjustment`
56    ///  The [`Adjustment`][crate::Adjustment] that is used as the model.
57    ///
58    /// Readable | Writeable
59    ///
60    ///
61    /// #### `has-frame`
62    ///  If the scale button has a frame.
63    ///
64    /// Readable | Writeable
65    ///
66    ///
67    /// #### `icons`
68    ///  The names of the icons to be used by the scale button.
69    ///
70    /// The first item in the array will be used in the button
71    /// when the current value is the lowest value, the second
72    /// item for the highest value. All the subsequent icons will
73    /// be used for all the other values, spread evenly over the
74    /// range of values.
75    ///
76    /// If there's only one icon name in the @icons array, it will
77    /// be used for all the values. If only two icon names are in
78    /// the @icons array, the first one will be used for the bottom
79    /// 50% of the scale, and the second one for the top 50%.
80    ///
81    /// It is recommended to use at least 3 icons so that the
82    /// [`ScaleButton`][crate::ScaleButton] reflects the current value of the scale
83    /// better for the users.
84    ///
85    /// Readable | Writeable
86    ///
87    ///
88    /// #### `value`
89    ///  The value of the scale.
90    ///
91    /// Readable | Writeable
92    /// <details><summary><h4>Widget</h4></summary>
93    ///
94    ///
95    /// #### `can-focus`
96    ///  Whether the widget or any of its descendents can accept
97    /// the input focus.
98    ///
99    /// This property is meant to be set by widget implementations,
100    /// typically in their instance init function.
101    ///
102    /// Readable | Writeable
103    ///
104    ///
105    /// #### `can-target`
106    ///  Whether the widget can receive pointer events.
107    ///
108    /// Readable | Writeable
109    ///
110    ///
111    /// #### `css-classes`
112    ///  A list of css classes applied to this widget.
113    ///
114    /// Readable | Writeable
115    ///
116    ///
117    /// #### `css-name`
118    ///  The name of this widget in the CSS tree.
119    ///
120    /// This property is meant to be set by widget implementations,
121    /// typically in their instance init function.
122    ///
123    /// Readable | Writeable | Construct Only
124    ///
125    ///
126    /// #### `cursor`
127    ///  The cursor used by @widget.
128    ///
129    /// Readable | Writeable
130    ///
131    ///
132    /// #### `focus-on-click`
133    ///  Whether the widget should grab focus when it is clicked with the mouse.
134    ///
135    /// This property is only relevant for widgets that can take focus.
136    ///
137    /// Readable | Writeable
138    ///
139    ///
140    /// #### `focusable`
141    ///  Whether this widget itself will accept the input focus.
142    ///
143    /// Readable | Writeable
144    ///
145    ///
146    /// #### `halign`
147    ///  How to distribute horizontal space if widget gets extra space.
148    ///
149    /// Readable | Writeable
150    ///
151    ///
152    /// #### `has-default`
153    ///  Whether the widget is the default widget.
154    ///
155    /// Readable
156    ///
157    ///
158    /// #### `has-focus`
159    ///  Whether the widget has the input focus.
160    ///
161    /// Readable
162    ///
163    ///
164    /// #### `has-tooltip`
165    ///  Enables or disables the emission of the [`query-tooltip`][struct@crate::Widget#query-tooltip]
166    /// signal on @widget.
167    ///
168    /// A true value indicates that @widget can have a tooltip, in this case
169    /// the widget will be queried using [`query-tooltip`][struct@crate::Widget#query-tooltip] to
170    /// determine whether it will provide a tooltip or not.
171    ///
172    /// Readable | Writeable
173    ///
174    ///
175    /// #### `height-request`
176    ///  Overrides for height request of the widget.
177    ///
178    /// If this is -1, the natural request will be used.
179    ///
180    /// Readable | Writeable
181    ///
182    ///
183    /// #### `hexpand`
184    ///  Whether to expand horizontally.
185    ///
186    /// Readable | Writeable
187    ///
188    ///
189    /// #### `hexpand-set`
190    ///  Whether to use the `hexpand` property.
191    ///
192    /// Readable | Writeable
193    ///
194    ///
195    /// #### `layout-manager`
196    ///  The [`LayoutManager`][crate::LayoutManager] instance to use to compute
197    /// the preferred size of the widget, and allocate its children.
198    ///
199    /// This property is meant to be set by widget implementations,
200    /// typically in their instance init function.
201    ///
202    /// Readable | Writeable
203    ///
204    ///
205    /// #### `limit-events`
206    ///  Makes this widget act like a modal dialog, with respect to
207    /// event delivery.
208    ///
209    /// Global event controllers will not handle events with targets
210    /// inside the widget, unless they are set up to ignore propagation
211    /// limits. See [`EventControllerExt::set_propagation_limit()`][crate::prelude::EventControllerExt::set_propagation_limit()].
212    ///
213    /// Readable | Writeable
214    ///
215    ///
216    /// #### `margin-bottom`
217    ///  Margin on bottom side of widget.
218    ///
219    /// This property adds margin outside of the widget's normal size
220    /// request, the margin will be added in addition to the size from
221    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
222    ///
223    /// Readable | Writeable
224    ///
225    ///
226    /// #### `margin-end`
227    ///  Margin on end of widget, horizontally.
228    ///
229    /// This property supports left-to-right and right-to-left text
230    /// directions.
231    ///
232    /// This property adds margin outside of the widget's normal size
233    /// request, the margin will be added in addition to the size from
234    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
235    ///
236    /// Readable | Writeable
237    ///
238    ///
239    /// #### `margin-start`
240    ///  Margin on start of widget, horizontally.
241    ///
242    /// This property supports left-to-right and right-to-left text
243    /// directions.
244    ///
245    /// This property adds margin outside of the widget's normal size
246    /// request, the margin will be added in addition to the size from
247    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
248    ///
249    /// Readable | Writeable
250    ///
251    ///
252    /// #### `margin-top`
253    ///  Margin on top side of widget.
254    ///
255    /// This property adds margin outside of the widget's normal size
256    /// request, the margin will be added in addition to the size from
257    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
258    ///
259    /// Readable | Writeable
260    ///
261    ///
262    /// #### `name`
263    ///  The name of the widget.
264    ///
265    /// Readable | Writeable
266    ///
267    ///
268    /// #### `opacity`
269    ///  The requested opacity of the widget.
270    ///
271    /// Readable | Writeable
272    ///
273    ///
274    /// #### `overflow`
275    ///  How content outside the widget's content area is treated.
276    ///
277    /// This property is meant to be set by widget implementations,
278    /// typically in their instance init function.
279    ///
280    /// Readable | Writeable
281    ///
282    ///
283    /// #### `parent`
284    ///  The parent widget of this widget.
285    ///
286    /// Readable
287    ///
288    ///
289    /// #### `receives-default`
290    ///  Whether the widget will receive the default action when it is focused.
291    ///
292    /// Readable | Writeable
293    ///
294    ///
295    /// #### `root`
296    ///  The [`Root`][crate::Root] widget of the widget tree containing this widget.
297    ///
298    /// This will be `NULL` if the widget is not contained in a root widget.
299    ///
300    /// Readable
301    ///
302    ///
303    /// #### `scale-factor`
304    ///  The scale factor of the widget.
305    ///
306    /// Readable
307    ///
308    ///
309    /// #### `sensitive`
310    ///  Whether the widget responds to input.
311    ///
312    /// Readable | Writeable
313    ///
314    ///
315    /// #### `tooltip-markup`
316    ///  Sets the text of tooltip to be the given string, which is marked up
317    /// with Pango markup.
318    ///
319    /// Also see [`Tooltip::set_markup()`][crate::Tooltip::set_markup()].
320    ///
321    /// This is a convenience property which will take care of getting the
322    /// tooltip shown if the given string is not `NULL`:
323    /// [`has-tooltip`][struct@crate::Widget#has-tooltip] will automatically be set to true
324    /// and there will be taken care of [`query-tooltip`][struct@crate::Widget#query-tooltip] in
325    /// the default signal handler.
326    ///
327    /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and
328    /// [`tooltip-markup`][struct@crate::Widget#tooltip-markup] are set, the last one wins.
329    ///
330    /// Readable | Writeable
331    ///
332    ///
333    /// #### `tooltip-text`
334    ///  Sets the text of tooltip to be the given string.
335    ///
336    /// Also see [`Tooltip::set_text()`][crate::Tooltip::set_text()].
337    ///
338    /// This is a convenience property which will take care of getting the
339    /// tooltip shown if the given string is not `NULL`:
340    /// [`has-tooltip`][struct@crate::Widget#has-tooltip] will automatically be set to true
341    /// and there will be taken care of [`query-tooltip`][struct@crate::Widget#query-tooltip] in
342    /// the default signal handler.
343    ///
344    /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and
345    /// [`tooltip-markup`][struct@crate::Widget#tooltip-markup] are set, the last one wins.
346    ///
347    /// Readable | Writeable
348    ///
349    ///
350    /// #### `valign`
351    ///  How to distribute vertical space if widget gets extra space.
352    ///
353    /// Readable | Writeable
354    ///
355    ///
356    /// #### `vexpand`
357    ///  Whether to expand vertically.
358    ///
359    /// Readable | Writeable
360    ///
361    ///
362    /// #### `vexpand-set`
363    ///  Whether to use the `vexpand` property.
364    ///
365    /// Readable | Writeable
366    ///
367    ///
368    /// #### `visible`
369    ///  Whether the widget is visible.
370    ///
371    /// Readable | Writeable
372    ///
373    ///
374    /// #### `width-request`
375    ///  Overrides for width request of the widget.
376    ///
377    /// If this is -1, the natural request will be used.
378    ///
379    /// Readable | Writeable
380    /// </details>
381    /// <details><summary><h4>Accessible</h4></summary>
382    ///
383    ///
384    /// #### `accessible-role`
385    ///  The accessible role of the given [`Accessible`][crate::Accessible] implementation.
386    ///
387    /// The accessible role cannot be changed once set.
388    ///
389    /// Readable | Writeable
390    /// </details>
391    /// <details><summary><h4>Orientable</h4></summary>
392    ///
393    ///
394    /// #### `orientation`
395    ///  The orientation of the orientable.
396    ///
397    /// Readable | Writeable
398    /// </details>
399    ///
400    /// ## Signals
401    ///
402    ///
403    /// #### `popdown`
404    ///  Emitted to dismiss the popup.
405    ///
406    /// This is a [keybinding signal](class.SignalAction.html).
407    ///
408    /// The default binding for this signal is <kbd>Escape</kbd>.
409    ///
410    /// Action
411    ///
412    ///
413    /// #### `popup`
414    ///  Emitted to popup the scale widget.
415    ///
416    /// This is a [keybinding signal](class.SignalAction.html).
417    ///
418    /// The default bindings for this signal are <kbd>Space</kbd>,
419    /// <kbd>Enter</kbd> and <kbd>Return</kbd>.
420    ///
421    /// Action
422    ///
423    ///
424    /// #### `value-changed`
425    ///  Emitted when the value field has changed.
426    ///
427    ///
428    /// <details><summary><h4>Widget</h4></summary>
429    ///
430    ///
431    /// #### `destroy`
432    ///  Signals that all holders of a reference to the widget should release
433    /// the reference that they hold.
434    ///
435    /// May result in finalization of the widget if all references are released.
436    ///
437    /// This signal is not suitable for saving widget state.
438    ///
439    ///
440    ///
441    ///
442    /// #### `direction-changed`
443    ///  Emitted when the text direction of a widget changes.
444    ///
445    ///
446    ///
447    ///
448    /// #### `hide`
449    ///  Emitted when @widget is hidden.
450    ///
451    ///
452    ///
453    ///
454    /// #### `keynav-failed`
455    ///  Emitted if keyboard navigation fails.
456    ///
457    /// See [`WidgetExt::keynav_failed()`][crate::prelude::WidgetExt::keynav_failed()] for details.
458    ///
459    ///
460    ///
461    ///
462    /// #### `map`
463    ///  Emitted when @widget is going to be mapped.
464    ///
465    /// A widget is mapped when the widget is visible (which is controlled with
466    /// [`visible`][struct@crate::Widget#visible]) and all its parents up to the toplevel widget
467    /// are also visible.
468    ///
469    /// The `::map` signal can be used to determine whether a widget will be drawn,
470    /// for instance it can resume an animation that was stopped during the
471    /// emission of [`unmap`][struct@crate::Widget#unmap].
472    ///
473    ///
474    ///
475    ///
476    /// #### `mnemonic-activate`
477    ///  Emitted when a widget is activated via a mnemonic.
478    ///
479    /// The default handler for this signal activates @widget if @group_cycling
480    /// is false, or just makes @widget grab focus if @group_cycling is true.
481    ///
482    ///
483    ///
484    ///
485    /// #### `move-focus`
486    ///  Emitted when the focus is moved.
487    ///
488    /// The `::move-focus` signal is a [keybinding signal](class.SignalAction.html).
489    ///
490    /// The default bindings for this signal are <kbd>Tab</kbd> to move forward,
491    /// and <kbd>Shift</kbd>+<kbd>Tab</kbd> to move backward.
492    ///
493    /// Action
494    ///
495    ///
496    /// #### `query-tooltip`
497    ///  Emitted when the widget’s tooltip is about to be shown.
498    ///
499    /// This happens when the [`has-tooltip`][struct@crate::Widget#has-tooltip] property
500    /// is true and the hover timeout has expired with the cursor hovering
501    /// above @widget; or emitted when @widget got focus in keyboard mode.
502    ///
503    /// Using the given coordinates, the signal handler should determine
504    /// whether a tooltip should be shown for @widget. If this is the case
505    /// true should be returned, false otherwise. Note that if @keyboard_mode
506    /// is true, the values of @x and @y are undefined and should not be used.
507    ///
508    /// The signal handler is free to manipulate @tooltip with the therefore
509    /// destined function calls.
510    ///
511    ///
512    ///
513    ///
514    /// #### `realize`
515    ///  Emitted when @widget is associated with a [`gdk::Surface`][crate::gdk::Surface].
516    ///
517    /// This means that [`WidgetExt::realize()`][crate::prelude::WidgetExt::realize()] has been called
518    /// or the widget has been mapped (that is, it is going to be drawn).
519    ///
520    ///
521    ///
522    ///
523    /// #### `show`
524    ///  Emitted when @widget is shown.
525    ///
526    ///
527    ///
528    ///
529    /// #### `state-flags-changed`
530    ///  Emitted when the widget state changes.
531    ///
532    /// See [`WidgetExt::state_flags()`][crate::prelude::WidgetExt::state_flags()].
533    ///
534    ///
535    ///
536    ///
537    /// #### `unmap`
538    ///  Emitted when @widget is going to be unmapped.
539    ///
540    /// A widget is unmapped when either it or any of its parents up to the
541    /// toplevel widget have been set as hidden.
542    ///
543    /// As `::unmap` indicates that a widget will not be shown any longer,
544    /// it can be used to, for example, stop an animation on the widget.
545    ///
546    ///
547    ///
548    ///
549    /// #### `unrealize`
550    ///  Emitted when the [`gdk::Surface`][crate::gdk::Surface] associated with @widget is destroyed.
551    ///
552    /// This means that [`WidgetExt::unrealize()`][crate::prelude::WidgetExt::unrealize()] has been called
553    /// or the widget has been unmapped (that is, it is going to be hidden).
554    ///
555    ///
556    /// </details>
557    ///
558    /// # Implements
559    ///
560    /// [`ScaleButtonExt`][trait@crate::prelude::ScaleButtonExt], [`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], [`WidgetExtManual`][trait@crate::prelude::WidgetExtManual], [`AccessibleExtManual`][trait@crate::prelude::AccessibleExtManual]
561    #[doc(alias = "GtkScaleButton")]
562    pub struct ScaleButton(Object<ffi::GtkScaleButton, ffi::GtkScaleButtonClass>) @extends Widget, @implements Accessible, Buildable, ConstraintTarget, AccessibleRange, Orientable;
563
564    match fn {
565        type_ => || ffi::gtk_scale_button_get_type(),
566    }
567}
568
569#[cfg(not(any(feature = "v4_10")))]
570glib::wrapper! {
571    #[doc(alias = "GtkScaleButton")]
572    pub struct ScaleButton(Object<ffi::GtkScaleButton, ffi::GtkScaleButtonClass>) @extends Widget, @implements Accessible, Buildable, ConstraintTarget, Orientable;
573
574    match fn {
575        type_ => || ffi::gtk_scale_button_get_type(),
576    }
577}
578
579impl ScaleButton {
580    pub const NONE: Option<&'static ScaleButton> = None;
581
582    /// Creates a [`ScaleButton`][crate::ScaleButton].
583    ///
584    /// The new scale button has a range between @min and @max,
585    /// with a stepping of @step.
586    /// ## `min`
587    /// the minimum value of the scale (usually 0)
588    /// ## `max`
589    /// the maximum value of the scale (usually 100)
590    /// ## `step`
591    /// the stepping of value when a scroll-wheel event,
592    ///   or up/down arrow event occurs (usually 2)
593    /// ## `icons`
594    /// a [`None`]-terminated
595    ///   array of icon names, or [`None`] if you want to set the list
596    ///   later with gtk_scale_button_set_icons()
597    ///
598    /// # Returns
599    ///
600    /// a new [`ScaleButton`][crate::ScaleButton]
601    #[doc(alias = "gtk_scale_button_new")]
602    pub fn new(min: f64, max: f64, step: f64, icons: &[&str]) -> ScaleButton {
603        assert_initialized_main_thread!();
604        unsafe {
605            Widget::from_glib_none(ffi::gtk_scale_button_new(
606                min,
607                max,
608                step,
609                icons.to_glib_none().0,
610            ))
611            .unsafe_cast()
612        }
613    }
614
615    // rustdoc-stripper-ignore-next
616    /// Creates a new builder-pattern struct instance to construct [`ScaleButton`] objects.
617    ///
618    /// This method returns an instance of [`ScaleButtonBuilder`](crate::builders::ScaleButtonBuilder) which can be used to create [`ScaleButton`] objects.
619    pub fn builder() -> ScaleButtonBuilder {
620        ScaleButtonBuilder::new()
621    }
622}
623
624impl Default for ScaleButton {
625    fn default() -> Self {
626        glib::object::Object::new::<Self>()
627    }
628}
629
630// rustdoc-stripper-ignore-next
631/// A [builder-pattern] type to construct [`ScaleButton`] objects.
632///
633/// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html
634#[must_use = "The builder must be built to be used"]
635pub struct ScaleButtonBuilder {
636    builder: glib::object::ObjectBuilder<'static, ScaleButton>,
637}
638
639impl ScaleButtonBuilder {
640    fn new() -> Self {
641        Self {
642            builder: glib::object::Object::builder(),
643        }
644    }
645
646    /// The [`Adjustment`][crate::Adjustment] that is used as the model.
647    pub fn adjustment(self, adjustment: &impl IsA<Adjustment>) -> Self {
648        Self {
649            builder: self
650                .builder
651                .property("adjustment", adjustment.clone().upcast()),
652        }
653    }
654
655    /// If the scale button has a frame.
656    #[cfg(feature = "v4_14")]
657    #[cfg_attr(docsrs, doc(cfg(feature = "v4_14")))]
658    pub fn has_frame(self, has_frame: bool) -> Self {
659        Self {
660            builder: self.builder.property("has-frame", has_frame),
661        }
662    }
663
664    /// The names of the icons to be used by the scale button.
665    ///
666    /// The first item in the array will be used in the button
667    /// when the current value is the lowest value, the second
668    /// item for the highest value. All the subsequent icons will
669    /// be used for all the other values, spread evenly over the
670    /// range of values.
671    ///
672    /// If there's only one icon name in the @icons array, it will
673    /// be used for all the values. If only two icon names are in
674    /// the @icons array, the first one will be used for the bottom
675    /// 50% of the scale, and the second one for the top 50%.
676    ///
677    /// It is recommended to use at least 3 icons so that the
678    /// [`ScaleButton`][crate::ScaleButton] reflects the current value of the scale
679    /// better for the users.
680    pub fn icons(self, icons: impl Into<glib::StrV>) -> Self {
681        Self {
682            builder: self.builder.property("icons", icons.into()),
683        }
684    }
685
686    /// The value of the scale.
687    pub fn value(self, value: f64) -> Self {
688        Self {
689            builder: self.builder.property("value", value),
690        }
691    }
692
693    /// Whether the widget or any of its descendents can accept
694    /// the input focus.
695    ///
696    /// This property is meant to be set by widget implementations,
697    /// typically in their instance init function.
698    pub fn can_focus(self, can_focus: bool) -> Self {
699        Self {
700            builder: self.builder.property("can-focus", can_focus),
701        }
702    }
703
704    /// Whether the widget can receive pointer events.
705    pub fn can_target(self, can_target: bool) -> Self {
706        Self {
707            builder: self.builder.property("can-target", can_target),
708        }
709    }
710
711    /// A list of css classes applied to this widget.
712    pub fn css_classes(self, css_classes: impl Into<glib::StrV>) -> Self {
713        Self {
714            builder: self.builder.property("css-classes", css_classes.into()),
715        }
716    }
717
718    /// The name of this widget in the CSS tree.
719    ///
720    /// This property is meant to be set by widget implementations,
721    /// typically in their instance init function.
722    pub fn css_name(self, css_name: impl Into<glib::GString>) -> Self {
723        Self {
724            builder: self.builder.property("css-name", css_name.into()),
725        }
726    }
727
728    /// The cursor used by @widget.
729    pub fn cursor(self, cursor: &gdk::Cursor) -> Self {
730        Self {
731            builder: self.builder.property("cursor", cursor.clone()),
732        }
733    }
734
735    /// Whether the widget should grab focus when it is clicked with the mouse.
736    ///
737    /// This property is only relevant for widgets that can take focus.
738    pub fn focus_on_click(self, focus_on_click: bool) -> Self {
739        Self {
740            builder: self.builder.property("focus-on-click", focus_on_click),
741        }
742    }
743
744    /// Whether this widget itself will accept the input focus.
745    pub fn focusable(self, focusable: bool) -> Self {
746        Self {
747            builder: self.builder.property("focusable", focusable),
748        }
749    }
750
751    /// How to distribute horizontal space if widget gets extra space.
752    pub fn halign(self, halign: Align) -> Self {
753        Self {
754            builder: self.builder.property("halign", halign),
755        }
756    }
757
758    /// Enables or disables the emission of the [`query-tooltip`][struct@crate::Widget#query-tooltip]
759    /// signal on @widget.
760    ///
761    /// A true value indicates that @widget can have a tooltip, in this case
762    /// the widget will be queried using [`query-tooltip`][struct@crate::Widget#query-tooltip] to
763    /// determine whether it will provide a tooltip or not.
764    pub fn has_tooltip(self, has_tooltip: bool) -> Self {
765        Self {
766            builder: self.builder.property("has-tooltip", has_tooltip),
767        }
768    }
769
770    /// Overrides for height request of the widget.
771    ///
772    /// If this is -1, the natural request will be used.
773    pub fn height_request(self, height_request: i32) -> Self {
774        Self {
775            builder: self.builder.property("height-request", height_request),
776        }
777    }
778
779    /// Whether to expand horizontally.
780    pub fn hexpand(self, hexpand: bool) -> Self {
781        Self {
782            builder: self.builder.property("hexpand", hexpand),
783        }
784    }
785
786    /// Whether to use the `hexpand` property.
787    pub fn hexpand_set(self, hexpand_set: bool) -> Self {
788        Self {
789            builder: self.builder.property("hexpand-set", hexpand_set),
790        }
791    }
792
793    /// The [`LayoutManager`][crate::LayoutManager] instance to use to compute
794    /// the preferred size of the widget, and allocate its children.
795    ///
796    /// This property is meant to be set by widget implementations,
797    /// typically in their instance init function.
798    pub fn layout_manager(self, layout_manager: &impl IsA<LayoutManager>) -> Self {
799        Self {
800            builder: self
801                .builder
802                .property("layout-manager", layout_manager.clone().upcast()),
803        }
804    }
805
806    /// Makes this widget act like a modal dialog, with respect to
807    /// event delivery.
808    ///
809    /// Global event controllers will not handle events with targets
810    /// inside the widget, unless they are set up to ignore propagation
811    /// limits. See [`EventControllerExt::set_propagation_limit()`][crate::prelude::EventControllerExt::set_propagation_limit()].
812    #[cfg(feature = "v4_18")]
813    #[cfg_attr(docsrs, doc(cfg(feature = "v4_18")))]
814    pub fn limit_events(self, limit_events: bool) -> Self {
815        Self {
816            builder: self.builder.property("limit-events", limit_events),
817        }
818    }
819
820    /// Margin on bottom side of widget.
821    ///
822    /// This property adds margin outside of the widget's normal size
823    /// request, the margin will be added in addition to the size from
824    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
825    pub fn margin_bottom(self, margin_bottom: i32) -> Self {
826        Self {
827            builder: self.builder.property("margin-bottom", margin_bottom),
828        }
829    }
830
831    /// Margin on end of widget, horizontally.
832    ///
833    /// This property supports left-to-right and right-to-left text
834    /// directions.
835    ///
836    /// This property adds margin outside of the widget's normal size
837    /// request, the margin will be added in addition to the size from
838    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
839    pub fn margin_end(self, margin_end: i32) -> Self {
840        Self {
841            builder: self.builder.property("margin-end", margin_end),
842        }
843    }
844
845    /// Margin on start of widget, horizontally.
846    ///
847    /// This property supports left-to-right and right-to-left text
848    /// directions.
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_start(self, margin_start: i32) -> Self {
854        Self {
855            builder: self.builder.property("margin-start", margin_start),
856        }
857    }
858
859    /// Margin on top side of widget.
860    ///
861    /// This property adds margin outside of the widget's normal size
862    /// request, the margin will be added in addition to the size from
863    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
864    pub fn margin_top(self, margin_top: i32) -> Self {
865        Self {
866            builder: self.builder.property("margin-top", margin_top),
867        }
868    }
869
870    /// The name of the widget.
871    pub fn name(self, name: impl Into<glib::GString>) -> Self {
872        Self {
873            builder: self.builder.property("name", name.into()),
874        }
875    }
876
877    /// The requested opacity of the widget.
878    pub fn opacity(self, opacity: f64) -> Self {
879        Self {
880            builder: self.builder.property("opacity", opacity),
881        }
882    }
883
884    /// How content outside the widget's content area is treated.
885    ///
886    /// This property is meant to be set by widget implementations,
887    /// typically in their instance init function.
888    pub fn overflow(self, overflow: Overflow) -> Self {
889        Self {
890            builder: self.builder.property("overflow", overflow),
891        }
892    }
893
894    /// Whether the widget will receive the default action when it is focused.
895    pub fn receives_default(self, receives_default: bool) -> Self {
896        Self {
897            builder: self.builder.property("receives-default", receives_default),
898        }
899    }
900
901    /// Whether the widget responds to input.
902    pub fn sensitive(self, sensitive: bool) -> Self {
903        Self {
904            builder: self.builder.property("sensitive", sensitive),
905        }
906    }
907
908    /// Sets the text of tooltip to be the given string, which is marked up
909    /// with Pango markup.
910    ///
911    /// Also see [`Tooltip::set_markup()`][crate::Tooltip::set_markup()].
912    ///
913    /// This is a convenience property which will take care of getting the
914    /// tooltip shown if the given string is not `NULL`:
915    /// [`has-tooltip`][struct@crate::Widget#has-tooltip] will automatically be set to true
916    /// and there will be taken care of [`query-tooltip`][struct@crate::Widget#query-tooltip] in
917    /// the default signal handler.
918    ///
919    /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and
920    /// [`tooltip-markup`][struct@crate::Widget#tooltip-markup] are set, the last one wins.
921    pub fn tooltip_markup(self, tooltip_markup: impl Into<glib::GString>) -> Self {
922        Self {
923            builder: self
924                .builder
925                .property("tooltip-markup", tooltip_markup.into()),
926        }
927    }
928
929    /// Sets the text of tooltip to be the given string.
930    ///
931    /// Also see [`Tooltip::set_text()`][crate::Tooltip::set_text()].
932    ///
933    /// This is a convenience property which will take care of getting the
934    /// tooltip shown if the given string is not `NULL`:
935    /// [`has-tooltip`][struct@crate::Widget#has-tooltip] will automatically be set to true
936    /// and there will be taken care of [`query-tooltip`][struct@crate::Widget#query-tooltip] in
937    /// the default signal handler.
938    ///
939    /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and
940    /// [`tooltip-markup`][struct@crate::Widget#tooltip-markup] are set, the last one wins.
941    pub fn tooltip_text(self, tooltip_text: impl Into<glib::GString>) -> Self {
942        Self {
943            builder: self.builder.property("tooltip-text", tooltip_text.into()),
944        }
945    }
946
947    /// How to distribute vertical space if widget gets extra space.
948    pub fn valign(self, valign: Align) -> Self {
949        Self {
950            builder: self.builder.property("valign", valign),
951        }
952    }
953
954    /// Whether to expand vertically.
955    pub fn vexpand(self, vexpand: bool) -> Self {
956        Self {
957            builder: self.builder.property("vexpand", vexpand),
958        }
959    }
960
961    /// Whether to use the `vexpand` property.
962    pub fn vexpand_set(self, vexpand_set: bool) -> Self {
963        Self {
964            builder: self.builder.property("vexpand-set", vexpand_set),
965        }
966    }
967
968    /// Whether the widget is visible.
969    pub fn visible(self, visible: bool) -> Self {
970        Self {
971            builder: self.builder.property("visible", visible),
972        }
973    }
974
975    /// Overrides for width request of the widget.
976    ///
977    /// If this is -1, the natural request will be used.
978    pub fn width_request(self, width_request: i32) -> Self {
979        Self {
980            builder: self.builder.property("width-request", width_request),
981        }
982    }
983
984    /// The accessible role of the given [`Accessible`][crate::Accessible] implementation.
985    ///
986    /// The accessible role cannot be changed once set.
987    pub fn accessible_role(self, accessible_role: AccessibleRole) -> Self {
988        Self {
989            builder: self.builder.property("accessible-role", accessible_role),
990        }
991    }
992
993    /// The orientation of the orientable.
994    pub fn orientation(self, orientation: Orientation) -> Self {
995        Self {
996            builder: self.builder.property("orientation", orientation),
997        }
998    }
999
1000    // rustdoc-stripper-ignore-next
1001    /// Build the [`ScaleButton`].
1002    #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"]
1003    pub fn build(self) -> ScaleButton {
1004        assert_initialized_main_thread!();
1005        self.builder.build()
1006    }
1007}
1008
1009/// Trait containing all [`struct@ScaleButton`] methods.
1010///
1011/// # Implementors
1012///
1013/// [`ScaleButton`][struct@crate::ScaleButton], [`VolumeButton`][struct@crate::VolumeButton]
1014pub trait ScaleButtonExt: IsA<ScaleButton> + 'static {
1015    /// Queries a [`ScaleButton`][crate::ScaleButton] and returns its current state.
1016    ///
1017    /// Returns [`true`] if the scale button is pressed in and [`false`]
1018    /// if it is raised.
1019    ///
1020    /// # Returns
1021    ///
1022    /// whether the button is pressed
1023    #[cfg(feature = "v4_10")]
1024    #[cfg_attr(docsrs, doc(cfg(feature = "v4_10")))]
1025    #[doc(alias = "gtk_scale_button_get_active")]
1026    #[doc(alias = "get_active")]
1027    #[doc(alias = "active")]
1028    fn is_active(&self) -> bool {
1029        unsafe {
1030            from_glib(ffi::gtk_scale_button_get_active(
1031                self.as_ref().to_glib_none().0,
1032            ))
1033        }
1034    }
1035
1036    /// Gets the [`Adjustment`][crate::Adjustment] associated with the [`ScaleButton`][crate::ScaleButton]’s scale.
1037    ///
1038    /// See [`RangeExt::adjustment()`][crate::prelude::RangeExt::adjustment()] for details.
1039    ///
1040    /// # Returns
1041    ///
1042    /// the adjustment associated with the scale
1043    #[doc(alias = "gtk_scale_button_get_adjustment")]
1044    #[doc(alias = "get_adjustment")]
1045    fn adjustment(&self) -> Adjustment {
1046        unsafe {
1047            from_glib_none(ffi::gtk_scale_button_get_adjustment(
1048                self.as_ref().to_glib_none().0,
1049            ))
1050        }
1051    }
1052
1053    /// Returns whether the button has a frame.
1054    ///
1055    /// # Returns
1056    ///
1057    /// [`true`] if the button has a frame
1058    #[cfg(feature = "v4_14")]
1059    #[cfg_attr(docsrs, doc(cfg(feature = "v4_14")))]
1060    #[doc(alias = "gtk_scale_button_get_has_frame")]
1061    #[doc(alias = "get_has_frame")]
1062    #[doc(alias = "has-frame")]
1063    fn has_frame(&self) -> bool {
1064        unsafe {
1065            from_glib(ffi::gtk_scale_button_get_has_frame(
1066                self.as_ref().to_glib_none().0,
1067            ))
1068        }
1069    }
1070
1071    /// Retrieves the minus button of the [`ScaleButton`][crate::ScaleButton].
1072    ///
1073    /// # Returns
1074    ///
1075    /// the minus button
1076    ///   of the [`ScaleButton`][crate::ScaleButton]
1077    #[doc(alias = "gtk_scale_button_get_minus_button")]
1078    #[doc(alias = "get_minus_button")]
1079    fn minus_button(&self) -> Button {
1080        unsafe {
1081            from_glib_none(ffi::gtk_scale_button_get_minus_button(
1082                self.as_ref().to_glib_none().0,
1083            ))
1084        }
1085    }
1086
1087    /// Retrieves the plus button of the [`ScaleButton`][crate::ScaleButton]
1088    ///
1089    /// # Returns
1090    ///
1091    /// the plus button
1092    ///   of the [`ScaleButton`][crate::ScaleButton]
1093    #[doc(alias = "gtk_scale_button_get_plus_button")]
1094    #[doc(alias = "get_plus_button")]
1095    fn plus_button(&self) -> Button {
1096        unsafe {
1097            from_glib_none(ffi::gtk_scale_button_get_plus_button(
1098                self.as_ref().to_glib_none().0,
1099            ))
1100        }
1101    }
1102
1103    /// Retrieves the popup of the [`ScaleButton`][crate::ScaleButton].
1104    ///
1105    /// # Returns
1106    ///
1107    /// the popup of the [`ScaleButton`][crate::ScaleButton]
1108    #[doc(alias = "gtk_scale_button_get_popup")]
1109    #[doc(alias = "get_popup")]
1110    fn popup(&self) -> Widget {
1111        unsafe {
1112            from_glib_none(ffi::gtk_scale_button_get_popup(
1113                self.as_ref().to_glib_none().0,
1114            ))
1115        }
1116    }
1117
1118    /// Gets the current value of the scale button.
1119    ///
1120    /// # Returns
1121    ///
1122    /// current value of the scale button
1123    #[doc(alias = "gtk_scale_button_get_value")]
1124    #[doc(alias = "get_value")]
1125    fn value(&self) -> f64 {
1126        unsafe { ffi::gtk_scale_button_get_value(self.as_ref().to_glib_none().0) }
1127    }
1128
1129    /// Sets the [`Adjustment`][crate::Adjustment] to be used as a model
1130    /// for the [`ScaleButton`][crate::ScaleButton]’s scale.
1131    ///
1132    /// See [`RangeExt::set_adjustment()`][crate::prelude::RangeExt::set_adjustment()] for details.
1133    /// ## `adjustment`
1134    /// a [`Adjustment`][crate::Adjustment]
1135    #[doc(alias = "gtk_scale_button_set_adjustment")]
1136    #[doc(alias = "adjustment")]
1137    fn set_adjustment(&self, adjustment: &impl IsA<Adjustment>) {
1138        unsafe {
1139            ffi::gtk_scale_button_set_adjustment(
1140                self.as_ref().to_glib_none().0,
1141                adjustment.as_ref().to_glib_none().0,
1142            );
1143        }
1144    }
1145
1146    /// Sets the style of the button.
1147    /// ## `has_frame`
1148    /// whether the button should have a visible frame
1149    #[cfg(feature = "v4_14")]
1150    #[cfg_attr(docsrs, doc(cfg(feature = "v4_14")))]
1151    #[doc(alias = "gtk_scale_button_set_has_frame")]
1152    #[doc(alias = "has-frame")]
1153    fn set_has_frame(&self, has_frame: bool) {
1154        unsafe {
1155            ffi::gtk_scale_button_set_has_frame(
1156                self.as_ref().to_glib_none().0,
1157                has_frame.into_glib(),
1158            );
1159        }
1160    }
1161
1162    /// Sets the icons to be used by the scale button.
1163    /// ## `icons`
1164    /// a [`None`]-terminated array of icon names
1165    #[doc(alias = "gtk_scale_button_set_icons")]
1166    #[doc(alias = "icons")]
1167    fn set_icons(&self, icons: &[&str]) {
1168        unsafe {
1169            ffi::gtk_scale_button_set_icons(self.as_ref().to_glib_none().0, icons.to_glib_none().0);
1170        }
1171    }
1172
1173    /// Sets the current value of the scale.
1174    ///
1175    /// If the value is outside the minimum or maximum range values,
1176    /// it will be clamped to fit inside them.
1177    ///
1178    /// The scale button emits the [`value-changed`][struct@crate::ScaleButton#value-changed]
1179    /// signal if the value changes.
1180    /// ## `value`
1181    /// new value of the scale button
1182    #[doc(alias = "gtk_scale_button_set_value")]
1183    #[doc(alias = "value")]
1184    fn set_value(&self, value: f64) {
1185        unsafe {
1186            ffi::gtk_scale_button_set_value(self.as_ref().to_glib_none().0, value);
1187        }
1188    }
1189
1190    /// The names of the icons to be used by the scale button.
1191    ///
1192    /// The first item in the array will be used in the button
1193    /// when the current value is the lowest value, the second
1194    /// item for the highest value. All the subsequent icons will
1195    /// be used for all the other values, spread evenly over the
1196    /// range of values.
1197    ///
1198    /// If there's only one icon name in the @icons array, it will
1199    /// be used for all the values. If only two icon names are in
1200    /// the @icons array, the first one will be used for the bottom
1201    /// 50% of the scale, and the second one for the top 50%.
1202    ///
1203    /// It is recommended to use at least 3 icons so that the
1204    /// [`ScaleButton`][crate::ScaleButton] reflects the current value of the scale
1205    /// better for the users.
1206    fn icons(&self) -> Vec<glib::GString> {
1207        ObjectExt::property(self.as_ref(), "icons")
1208    }
1209
1210    /// Emitted to dismiss the popup.
1211    ///
1212    /// This is a [keybinding signal](class.SignalAction.html).
1213    ///
1214    /// The default binding for this signal is <kbd>Escape</kbd>.
1215    #[doc(alias = "popdown")]
1216    fn connect_popdown<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1217        unsafe extern "C" fn popdown_trampoline<P: IsA<ScaleButton>, F: Fn(&P) + 'static>(
1218            this: *mut ffi::GtkScaleButton,
1219            f: glib::ffi::gpointer,
1220        ) {
1221            let f: &F = &*(f as *const F);
1222            f(ScaleButton::from_glib_borrow(this).unsafe_cast_ref())
1223        }
1224        unsafe {
1225            let f: Box_<F> = Box_::new(f);
1226            connect_raw(
1227                self.as_ptr() as *mut _,
1228                c"popdown".as_ptr() as *const _,
1229                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1230                    popdown_trampoline::<Self, F> as *const (),
1231                )),
1232                Box_::into_raw(f),
1233            )
1234        }
1235    }
1236
1237    fn emit_popdown(&self) {
1238        self.emit_by_name::<()>("popdown", &[]);
1239    }
1240
1241    /// Emitted to popup the scale widget.
1242    ///
1243    /// This is a [keybinding signal](class.SignalAction.html).
1244    ///
1245    /// The default bindings for this signal are <kbd>Space</kbd>,
1246    /// <kbd>Enter</kbd> and <kbd>Return</kbd>.
1247    #[doc(alias = "popup")]
1248    fn connect_popup<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1249        unsafe extern "C" fn popup_trampoline<P: IsA<ScaleButton>, F: Fn(&P) + 'static>(
1250            this: *mut ffi::GtkScaleButton,
1251            f: glib::ffi::gpointer,
1252        ) {
1253            let f: &F = &*(f as *const F);
1254            f(ScaleButton::from_glib_borrow(this).unsafe_cast_ref())
1255        }
1256        unsafe {
1257            let f: Box_<F> = Box_::new(f);
1258            connect_raw(
1259                self.as_ptr() as *mut _,
1260                c"popup".as_ptr() as *const _,
1261                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1262                    popup_trampoline::<Self, F> as *const (),
1263                )),
1264                Box_::into_raw(f),
1265            )
1266        }
1267    }
1268
1269    fn emit_popup(&self) {
1270        self.emit_by_name::<()>("popup", &[]);
1271    }
1272
1273    /// Emitted when the value field has changed.
1274    /// ## `value`
1275    /// the new value
1276    #[doc(alias = "value-changed")]
1277    fn connect_value_changed<F: Fn(&Self, f64) + 'static>(&self, f: F) -> SignalHandlerId {
1278        unsafe extern "C" fn value_changed_trampoline<
1279            P: IsA<ScaleButton>,
1280            F: Fn(&P, f64) + 'static,
1281        >(
1282            this: *mut ffi::GtkScaleButton,
1283            value: std::ffi::c_double,
1284            f: glib::ffi::gpointer,
1285        ) {
1286            let f: &F = &*(f as *const F);
1287            f(ScaleButton::from_glib_borrow(this).unsafe_cast_ref(), value)
1288        }
1289        unsafe {
1290            let f: Box_<F> = Box_::new(f);
1291            connect_raw(
1292                self.as_ptr() as *mut _,
1293                c"value-changed".as_ptr() as *const _,
1294                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1295                    value_changed_trampoline::<Self, F> as *const (),
1296                )),
1297                Box_::into_raw(f),
1298            )
1299        }
1300    }
1301
1302    #[cfg(feature = "v4_10")]
1303    #[cfg_attr(docsrs, doc(cfg(feature = "v4_10")))]
1304    #[doc(alias = "active")]
1305    fn connect_active_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1306        unsafe extern "C" fn notify_active_trampoline<P: IsA<ScaleButton>, F: Fn(&P) + 'static>(
1307            this: *mut ffi::GtkScaleButton,
1308            _param_spec: glib::ffi::gpointer,
1309            f: glib::ffi::gpointer,
1310        ) {
1311            let f: &F = &*(f as *const F);
1312            f(ScaleButton::from_glib_borrow(this).unsafe_cast_ref())
1313        }
1314        unsafe {
1315            let f: Box_<F> = Box_::new(f);
1316            connect_raw(
1317                self.as_ptr() as *mut _,
1318                c"notify::active".as_ptr() as *const _,
1319                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1320                    notify_active_trampoline::<Self, F> as *const (),
1321                )),
1322                Box_::into_raw(f),
1323            )
1324        }
1325    }
1326
1327    #[doc(alias = "adjustment")]
1328    fn connect_adjustment_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1329        unsafe extern "C" fn notify_adjustment_trampoline<
1330            P: IsA<ScaleButton>,
1331            F: Fn(&P) + 'static,
1332        >(
1333            this: *mut ffi::GtkScaleButton,
1334            _param_spec: glib::ffi::gpointer,
1335            f: glib::ffi::gpointer,
1336        ) {
1337            let f: &F = &*(f as *const F);
1338            f(ScaleButton::from_glib_borrow(this).unsafe_cast_ref())
1339        }
1340        unsafe {
1341            let f: Box_<F> = Box_::new(f);
1342            connect_raw(
1343                self.as_ptr() as *mut _,
1344                c"notify::adjustment".as_ptr() as *const _,
1345                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1346                    notify_adjustment_trampoline::<Self, F> as *const (),
1347                )),
1348                Box_::into_raw(f),
1349            )
1350        }
1351    }
1352
1353    #[cfg(feature = "v4_14")]
1354    #[cfg_attr(docsrs, doc(cfg(feature = "v4_14")))]
1355    #[doc(alias = "has-frame")]
1356    fn connect_has_frame_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1357        unsafe extern "C" fn notify_has_frame_trampoline<
1358            P: IsA<ScaleButton>,
1359            F: Fn(&P) + 'static,
1360        >(
1361            this: *mut ffi::GtkScaleButton,
1362            _param_spec: glib::ffi::gpointer,
1363            f: glib::ffi::gpointer,
1364        ) {
1365            let f: &F = &*(f as *const F);
1366            f(ScaleButton::from_glib_borrow(this).unsafe_cast_ref())
1367        }
1368        unsafe {
1369            let f: Box_<F> = Box_::new(f);
1370            connect_raw(
1371                self.as_ptr() as *mut _,
1372                c"notify::has-frame".as_ptr() as *const _,
1373                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1374                    notify_has_frame_trampoline::<Self, F> as *const (),
1375                )),
1376                Box_::into_raw(f),
1377            )
1378        }
1379    }
1380
1381    #[doc(alias = "icons")]
1382    fn connect_icons_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1383        unsafe extern "C" fn notify_icons_trampoline<P: IsA<ScaleButton>, F: Fn(&P) + 'static>(
1384            this: *mut ffi::GtkScaleButton,
1385            _param_spec: glib::ffi::gpointer,
1386            f: glib::ffi::gpointer,
1387        ) {
1388            let f: &F = &*(f as *const F);
1389            f(ScaleButton::from_glib_borrow(this).unsafe_cast_ref())
1390        }
1391        unsafe {
1392            let f: Box_<F> = Box_::new(f);
1393            connect_raw(
1394                self.as_ptr() as *mut _,
1395                c"notify::icons".as_ptr() as *const _,
1396                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1397                    notify_icons_trampoline::<Self, F> as *const (),
1398                )),
1399                Box_::into_raw(f),
1400            )
1401        }
1402    }
1403
1404    #[doc(alias = "value")]
1405    fn connect_value_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1406        unsafe extern "C" fn notify_value_trampoline<P: IsA<ScaleButton>, F: Fn(&P) + 'static>(
1407            this: *mut ffi::GtkScaleButton,
1408            _param_spec: glib::ffi::gpointer,
1409            f: glib::ffi::gpointer,
1410        ) {
1411            let f: &F = &*(f as *const F);
1412            f(ScaleButton::from_glib_borrow(this).unsafe_cast_ref())
1413        }
1414        unsafe {
1415            let f: Box_<F> = Box_::new(f);
1416            connect_raw(
1417                self.as_ptr() as *mut _,
1418                c"notify::value".as_ptr() as *const _,
1419                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1420                    notify_value_trampoline::<Self, F> as *const (),
1421                )),
1422                Box_::into_raw(f),
1423            )
1424        }
1425    }
1426}
1427
1428impl<O: IsA<ScaleButton>> ScaleButtonExt for O {}