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 /// [`ScaleButton`][crate::ScaleButton] 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
1009mod sealed {
1010 pub trait Sealed {}
1011 impl<T: super::IsA<super::ScaleButton>> Sealed for T {}
1012}
1013
1014/// Trait containing all [`struct@ScaleButton`] methods.
1015///
1016/// # Implementors
1017///
1018/// [`ScaleButton`][struct@crate::ScaleButton], [`VolumeButton`][struct@crate::VolumeButton]
1019pub trait ScaleButtonExt: IsA<ScaleButton> + sealed::Sealed + 'static {
1020 /// Queries a [`ScaleButton`][crate::ScaleButton] and returns its current state.
1021 ///
1022 /// Returns [`true`] if the scale button is pressed in and [`false`]
1023 /// if it is raised.
1024 ///
1025 /// # Returns
1026 ///
1027 /// whether the button is pressed
1028 #[cfg(feature = "v4_10")]
1029 #[cfg_attr(docsrs, doc(cfg(feature = "v4_10")))]
1030 #[doc(alias = "gtk_scale_button_get_active")]
1031 #[doc(alias = "get_active")]
1032 #[doc(alias = "active")]
1033 fn is_active(&self) -> bool {
1034 unsafe {
1035 from_glib(ffi::gtk_scale_button_get_active(
1036 self.as_ref().to_glib_none().0,
1037 ))
1038 }
1039 }
1040
1041 /// Gets the [`Adjustment`][crate::Adjustment] associated with the [`ScaleButton`][crate::ScaleButton]’s scale.
1042 ///
1043 /// See [`RangeExt::adjustment()`][crate::prelude::RangeExt::adjustment()] for details.
1044 ///
1045 /// # Returns
1046 ///
1047 /// the adjustment associated with the scale
1048 #[doc(alias = "gtk_scale_button_get_adjustment")]
1049 #[doc(alias = "get_adjustment")]
1050 fn adjustment(&self) -> Adjustment {
1051 unsafe {
1052 from_glib_none(ffi::gtk_scale_button_get_adjustment(
1053 self.as_ref().to_glib_none().0,
1054 ))
1055 }
1056 }
1057
1058 /// Returns whether the button has a frame.
1059 ///
1060 /// # Returns
1061 ///
1062 /// [`true`] if the button has a frame
1063 #[cfg(feature = "v4_14")]
1064 #[cfg_attr(docsrs, doc(cfg(feature = "v4_14")))]
1065 #[doc(alias = "gtk_scale_button_get_has_frame")]
1066 #[doc(alias = "get_has_frame")]
1067 #[doc(alias = "has-frame")]
1068 fn has_frame(&self) -> bool {
1069 unsafe {
1070 from_glib(ffi::gtk_scale_button_get_has_frame(
1071 self.as_ref().to_glib_none().0,
1072 ))
1073 }
1074 }
1075
1076 /// Retrieves the minus button of the [`ScaleButton`][crate::ScaleButton].
1077 ///
1078 /// # Returns
1079 ///
1080 /// the minus button
1081 /// of the [`ScaleButton`][crate::ScaleButton]
1082 #[doc(alias = "gtk_scale_button_get_minus_button")]
1083 #[doc(alias = "get_minus_button")]
1084 fn minus_button(&self) -> Button {
1085 unsafe {
1086 from_glib_none(ffi::gtk_scale_button_get_minus_button(
1087 self.as_ref().to_glib_none().0,
1088 ))
1089 }
1090 }
1091
1092 /// Retrieves the plus button of the [`ScaleButton`][crate::ScaleButton]
1093 ///
1094 /// # Returns
1095 ///
1096 /// the plus button
1097 /// of the [`ScaleButton`][crate::ScaleButton]
1098 #[doc(alias = "gtk_scale_button_get_plus_button")]
1099 #[doc(alias = "get_plus_button")]
1100 fn plus_button(&self) -> Button {
1101 unsafe {
1102 from_glib_none(ffi::gtk_scale_button_get_plus_button(
1103 self.as_ref().to_glib_none().0,
1104 ))
1105 }
1106 }
1107
1108 /// Retrieves the popup of the [`ScaleButton`][crate::ScaleButton].
1109 ///
1110 /// # Returns
1111 ///
1112 /// the popup of the [`ScaleButton`][crate::ScaleButton]
1113 #[doc(alias = "gtk_scale_button_get_popup")]
1114 #[doc(alias = "get_popup")]
1115 fn popup(&self) -> Widget {
1116 unsafe {
1117 from_glib_none(ffi::gtk_scale_button_get_popup(
1118 self.as_ref().to_glib_none().0,
1119 ))
1120 }
1121 }
1122
1123 /// Gets the current value of the scale button.
1124 ///
1125 /// # Returns
1126 ///
1127 /// current value of the scale button
1128 #[doc(alias = "gtk_scale_button_get_value")]
1129 #[doc(alias = "get_value")]
1130 fn value(&self) -> f64 {
1131 unsafe { ffi::gtk_scale_button_get_value(self.as_ref().to_glib_none().0) }
1132 }
1133
1134 /// Sets the [`Adjustment`][crate::Adjustment] to be used as a model
1135 /// for the [`ScaleButton`][crate::ScaleButton]’s scale.
1136 ///
1137 /// See [`RangeExt::set_adjustment()`][crate::prelude::RangeExt::set_adjustment()] for details.
1138 /// ## `adjustment`
1139 /// a [`Adjustment`][crate::Adjustment]
1140 #[doc(alias = "gtk_scale_button_set_adjustment")]
1141 #[doc(alias = "adjustment")]
1142 fn set_adjustment(&self, adjustment: &impl IsA<Adjustment>) {
1143 unsafe {
1144 ffi::gtk_scale_button_set_adjustment(
1145 self.as_ref().to_glib_none().0,
1146 adjustment.as_ref().to_glib_none().0,
1147 );
1148 }
1149 }
1150
1151 /// Sets the style of the button.
1152 /// ## `has_frame`
1153 /// whether the button should have a visible frame
1154 #[cfg(feature = "v4_14")]
1155 #[cfg_attr(docsrs, doc(cfg(feature = "v4_14")))]
1156 #[doc(alias = "gtk_scale_button_set_has_frame")]
1157 #[doc(alias = "has-frame")]
1158 fn set_has_frame(&self, has_frame: bool) {
1159 unsafe {
1160 ffi::gtk_scale_button_set_has_frame(
1161 self.as_ref().to_glib_none().0,
1162 has_frame.into_glib(),
1163 );
1164 }
1165 }
1166
1167 /// Sets the icons to be used by the scale button.
1168 /// ## `icons`
1169 /// a [`None`]-terminated array of icon names
1170 #[doc(alias = "gtk_scale_button_set_icons")]
1171 #[doc(alias = "icons")]
1172 fn set_icons(&self, icons: &[&str]) {
1173 unsafe {
1174 ffi::gtk_scale_button_set_icons(self.as_ref().to_glib_none().0, icons.to_glib_none().0);
1175 }
1176 }
1177
1178 /// Sets the current value of the scale.
1179 ///
1180 /// If the value is outside the minimum or maximum range values,
1181 /// it will be clamped to fit inside them.
1182 ///
1183 /// The scale button emits the [`value-changed`][struct@crate::ScaleButton#value-changed]
1184 /// signal if the value changes.
1185 /// ## `value`
1186 /// new value of the scale button
1187 #[doc(alias = "gtk_scale_button_set_value")]
1188 #[doc(alias = "value")]
1189 fn set_value(&self, value: f64) {
1190 unsafe {
1191 ffi::gtk_scale_button_set_value(self.as_ref().to_glib_none().0, value);
1192 }
1193 }
1194
1195 /// The names of the icons to be used by the scale button.
1196 ///
1197 /// The first item in the array will be used in the button
1198 /// when the current value is the lowest value, the second
1199 /// item for the highest value. All the subsequent icons will
1200 /// be used for all the other values, spread evenly over the
1201 /// range of values.
1202 ///
1203 /// If there's only one icon name in the @icons array, it will
1204 /// be used for all the values. If only two icon names are in
1205 /// the @icons array, the first one will be used for the bottom
1206 /// 50% of the scale, and the second one for the top 50%.
1207 ///
1208 /// It is recommended to use at least 3 icons so that the
1209 /// [`ScaleButton`][crate::ScaleButton] reflects the current value of the scale
1210 /// better for the users.
1211 fn icons(&self) -> Vec<glib::GString> {
1212 ObjectExt::property(self.as_ref(), "icons")
1213 }
1214
1215 /// Emitted to dismiss the popup.
1216 ///
1217 /// This is a [keybinding signal](class.SignalAction.html).
1218 ///
1219 /// The default binding for this signal is <kbd>Escape</kbd>.
1220 #[doc(alias = "popdown")]
1221 fn connect_popdown<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1222 unsafe extern "C" fn popdown_trampoline<P: IsA<ScaleButton>, F: Fn(&P) + 'static>(
1223 this: *mut ffi::GtkScaleButton,
1224 f: glib::ffi::gpointer,
1225 ) {
1226 let f: &F = &*(f as *const F);
1227 f(ScaleButton::from_glib_borrow(this).unsafe_cast_ref())
1228 }
1229 unsafe {
1230 let f: Box_<F> = Box_::new(f);
1231 connect_raw(
1232 self.as_ptr() as *mut _,
1233 b"popdown\0".as_ptr() as *const _,
1234 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1235 popdown_trampoline::<Self, F> as *const (),
1236 )),
1237 Box_::into_raw(f),
1238 )
1239 }
1240 }
1241
1242 fn emit_popdown(&self) {
1243 self.emit_by_name::<()>("popdown", &[]);
1244 }
1245
1246 /// Emitted to popup the scale widget.
1247 ///
1248 /// This is a [keybinding signal](class.SignalAction.html).
1249 ///
1250 /// The default bindings for this signal are <kbd>Space</kbd>,
1251 /// <kbd>Enter</kbd> and <kbd>Return</kbd>.
1252 #[doc(alias = "popup")]
1253 fn connect_popup<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1254 unsafe extern "C" fn popup_trampoline<P: IsA<ScaleButton>, F: Fn(&P) + 'static>(
1255 this: *mut ffi::GtkScaleButton,
1256 f: glib::ffi::gpointer,
1257 ) {
1258 let f: &F = &*(f as *const F);
1259 f(ScaleButton::from_glib_borrow(this).unsafe_cast_ref())
1260 }
1261 unsafe {
1262 let f: Box_<F> = Box_::new(f);
1263 connect_raw(
1264 self.as_ptr() as *mut _,
1265 b"popup\0".as_ptr() as *const _,
1266 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1267 popup_trampoline::<Self, F> as *const (),
1268 )),
1269 Box_::into_raw(f),
1270 )
1271 }
1272 }
1273
1274 fn emit_popup(&self) {
1275 self.emit_by_name::<()>("popup", &[]);
1276 }
1277
1278 /// Emitted when the value field has changed.
1279 /// ## `value`
1280 /// the new value
1281 #[doc(alias = "value-changed")]
1282 fn connect_value_changed<F: Fn(&Self, f64) + 'static>(&self, f: F) -> SignalHandlerId {
1283 unsafe extern "C" fn value_changed_trampoline<
1284 P: IsA<ScaleButton>,
1285 F: Fn(&P, f64) + 'static,
1286 >(
1287 this: *mut ffi::GtkScaleButton,
1288 value: std::ffi::c_double,
1289 f: glib::ffi::gpointer,
1290 ) {
1291 let f: &F = &*(f as *const F);
1292 f(ScaleButton::from_glib_borrow(this).unsafe_cast_ref(), value)
1293 }
1294 unsafe {
1295 let f: Box_<F> = Box_::new(f);
1296 connect_raw(
1297 self.as_ptr() as *mut _,
1298 b"value-changed\0".as_ptr() as *const _,
1299 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1300 value_changed_trampoline::<Self, F> as *const (),
1301 )),
1302 Box_::into_raw(f),
1303 )
1304 }
1305 }
1306
1307 #[cfg(feature = "v4_10")]
1308 #[cfg_attr(docsrs, doc(cfg(feature = "v4_10")))]
1309 #[doc(alias = "active")]
1310 fn connect_active_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1311 unsafe extern "C" fn notify_active_trampoline<P: IsA<ScaleButton>, F: Fn(&P) + 'static>(
1312 this: *mut ffi::GtkScaleButton,
1313 _param_spec: glib::ffi::gpointer,
1314 f: glib::ffi::gpointer,
1315 ) {
1316 let f: &F = &*(f as *const F);
1317 f(ScaleButton::from_glib_borrow(this).unsafe_cast_ref())
1318 }
1319 unsafe {
1320 let f: Box_<F> = Box_::new(f);
1321 connect_raw(
1322 self.as_ptr() as *mut _,
1323 b"notify::active\0".as_ptr() as *const _,
1324 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1325 notify_active_trampoline::<Self, F> as *const (),
1326 )),
1327 Box_::into_raw(f),
1328 )
1329 }
1330 }
1331
1332 #[doc(alias = "adjustment")]
1333 fn connect_adjustment_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1334 unsafe extern "C" fn notify_adjustment_trampoline<
1335 P: IsA<ScaleButton>,
1336 F: Fn(&P) + 'static,
1337 >(
1338 this: *mut ffi::GtkScaleButton,
1339 _param_spec: glib::ffi::gpointer,
1340 f: glib::ffi::gpointer,
1341 ) {
1342 let f: &F = &*(f as *const F);
1343 f(ScaleButton::from_glib_borrow(this).unsafe_cast_ref())
1344 }
1345 unsafe {
1346 let f: Box_<F> = Box_::new(f);
1347 connect_raw(
1348 self.as_ptr() as *mut _,
1349 b"notify::adjustment\0".as_ptr() as *const _,
1350 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1351 notify_adjustment_trampoline::<Self, F> as *const (),
1352 )),
1353 Box_::into_raw(f),
1354 )
1355 }
1356 }
1357
1358 #[cfg(feature = "v4_14")]
1359 #[cfg_attr(docsrs, doc(cfg(feature = "v4_14")))]
1360 #[doc(alias = "has-frame")]
1361 fn connect_has_frame_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1362 unsafe extern "C" fn notify_has_frame_trampoline<
1363 P: IsA<ScaleButton>,
1364 F: Fn(&P) + 'static,
1365 >(
1366 this: *mut ffi::GtkScaleButton,
1367 _param_spec: glib::ffi::gpointer,
1368 f: glib::ffi::gpointer,
1369 ) {
1370 let f: &F = &*(f as *const F);
1371 f(ScaleButton::from_glib_borrow(this).unsafe_cast_ref())
1372 }
1373 unsafe {
1374 let f: Box_<F> = Box_::new(f);
1375 connect_raw(
1376 self.as_ptr() as *mut _,
1377 b"notify::has-frame\0".as_ptr() as *const _,
1378 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1379 notify_has_frame_trampoline::<Self, F> as *const (),
1380 )),
1381 Box_::into_raw(f),
1382 )
1383 }
1384 }
1385
1386 #[doc(alias = "icons")]
1387 fn connect_icons_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1388 unsafe extern "C" fn notify_icons_trampoline<P: IsA<ScaleButton>, F: Fn(&P) + 'static>(
1389 this: *mut ffi::GtkScaleButton,
1390 _param_spec: glib::ffi::gpointer,
1391 f: glib::ffi::gpointer,
1392 ) {
1393 let f: &F = &*(f as *const F);
1394 f(ScaleButton::from_glib_borrow(this).unsafe_cast_ref())
1395 }
1396 unsafe {
1397 let f: Box_<F> = Box_::new(f);
1398 connect_raw(
1399 self.as_ptr() as *mut _,
1400 b"notify::icons\0".as_ptr() as *const _,
1401 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1402 notify_icons_trampoline::<Self, F> as *const (),
1403 )),
1404 Box_::into_raw(f),
1405 )
1406 }
1407 }
1408
1409 #[doc(alias = "value")]
1410 fn connect_value_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1411 unsafe extern "C" fn notify_value_trampoline<P: IsA<ScaleButton>, F: Fn(&P) + 'static>(
1412 this: *mut ffi::GtkScaleButton,
1413 _param_spec: glib::ffi::gpointer,
1414 f: glib::ffi::gpointer,
1415 ) {
1416 let f: &F = &*(f as *const F);
1417 f(ScaleButton::from_glib_borrow(this).unsafe_cast_ref())
1418 }
1419 unsafe {
1420 let f: Box_<F> = Box_::new(f);
1421 connect_raw(
1422 self.as_ptr() as *mut _,
1423 b"notify::value\0".as_ptr() as *const _,
1424 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1425 notify_value_trampoline::<Self, F> as *const (),
1426 )),
1427 Box_::into_raw(f),
1428 )
1429 }
1430 }
1431}
1432
1433impl<O: IsA<ScaleButton>> ScaleButtonExt for O {}