Skip to main content

libadwaita/auto/
bin.rs

1// This file was generated by gir (https://github.com/gtk-rs/gir)
2// from
3// from gir-files (https://github.com/gtk-rs/gir-files.git)
4// DO NOT EDIT
5
6use crate::ffi;
7use glib::{
8    prelude::*,
9    signal::{SignalHandlerId, connect_raw},
10    translate::*,
11};
12use std::boxed::Box as Box_;
13
14#[cfg(feature = "gtk_v4_10")]
15#[cfg_attr(docsrs, doc(cfg(feature = "gtk_v4_10")))]
16glib::wrapper! {
17    ///
18    ///
19    /// The [`Bin`][crate::Bin] widget has only one child, set with the [`child`][struct@crate::Bin#child]
20    /// property.
21    ///
22    /// It is useful for deriving subclasses, since it provides common code needed
23    /// for handling a single child widget.
24    ///
25    /// ## Properties
26    ///
27    ///
28    /// #### `child`
29    ///  The child widget of the [`Bin`][crate::Bin].
30    ///
31    /// Readable | Writable
32    /// <details><summary><h4>Widget</h4></summary>
33    ///
34    ///
35    /// #### `can-focus`
36    ///  Whether the widget or any of its descendents can accept
37    /// the input focus.
38    ///
39    /// This property is meant to be set by widget implementations,
40    /// typically in their instance init function.
41    ///
42    /// Readable | Writable
43    ///
44    ///
45    /// #### `can-target`
46    ///  Whether the widget can receive pointer events.
47    ///
48    /// Readable | Writable
49    ///
50    ///
51    /// #### `css-classes`
52    ///  A list of css classes applied to this widget.
53    ///
54    /// Readable | Writable
55    ///
56    ///
57    /// #### `css-name`
58    ///  The name of this widget in the CSS tree.
59    ///
60    /// This property is meant to be set by widget implementations,
61    /// typically in their instance init function.
62    ///
63    /// Readable | Writable | Construct Only
64    ///
65    ///
66    /// #### `cursor`
67    ///  The cursor used by @widget.
68    ///
69    /// Readable | Writable
70    ///
71    ///
72    /// #### `focus-on-click`
73    ///  Whether the widget should grab focus when it is clicked with the mouse.
74    ///
75    /// This property is only relevant for widgets that can take focus.
76    ///
77    /// Readable | Writable
78    ///
79    ///
80    /// #### `focusable`
81    ///  Whether this widget itself will accept the input focus.
82    ///
83    /// Readable | Writable
84    ///
85    ///
86    /// #### `halign`
87    ///  How to distribute horizontal space if widget gets extra space.
88    ///
89    /// Readable | Writable
90    ///
91    ///
92    /// #### `has-default`
93    ///  Whether the widget is the default widget.
94    ///
95    /// Readable
96    ///
97    ///
98    /// #### `has-focus`
99    ///  Whether the widget has the input focus.
100    ///
101    /// Readable
102    ///
103    ///
104    /// #### `has-tooltip`
105    ///  Enables or disables the emission of the [`query-tooltip`][struct@crate::gtk::Widget#query-tooltip]
106    /// signal on @widget.
107    ///
108    /// A true value indicates that @widget can have a tooltip, in this case
109    /// the widget will be queried using [`query-tooltip`][struct@crate::gtk::Widget#query-tooltip] to
110    /// determine whether it will provide a tooltip or not.
111    ///
112    /// Readable | Writable
113    ///
114    ///
115    /// #### `height-request`
116    ///  Overrides for height request of the widget.
117    ///
118    /// If this is -1, the natural request will be used.
119    ///
120    /// Readable | Writable
121    ///
122    ///
123    /// #### `hexpand`
124    ///  Whether to expand horizontally.
125    ///
126    /// Readable | Writable
127    ///
128    ///
129    /// #### `hexpand-set`
130    ///  Whether to use the `hexpand` property.
131    ///
132    /// Readable | Writable
133    ///
134    ///
135    /// #### `layout-manager`
136    ///  The [`gtk::LayoutManager`][crate::gtk::LayoutManager] instance to use to compute
137    /// the preferred size of the widget, and allocate its children.
138    ///
139    /// This property is meant to be set by widget implementations,
140    /// typically in their instance init function.
141    ///
142    /// Readable | Writable
143    ///
144    ///
145    /// #### `limit-events`
146    ///  Makes this widget act like a modal dialog, with respect to
147    /// event delivery.
148    ///
149    /// Global event controllers will not handle events with targets
150    /// inside the widget, unless they are set up to ignore propagation
151    /// limits. See `Gtk::EventController::set_propagation_limit()`.
152    ///
153    /// Readable | Writable
154    ///
155    ///
156    /// #### `margin-bottom`
157    ///  Margin on bottom side of widget.
158    ///
159    /// This property adds margin outside of the widget's normal size
160    /// request, the margin will be added in addition to the size from
161    /// [`WidgetExtManual::set_size_request()`][crate::gtk::prelude::WidgetExtManual::set_size_request()] for example.
162    ///
163    /// Readable | Writable
164    ///
165    ///
166    /// #### `margin-end`
167    ///  Margin on end of widget, horizontally.
168    ///
169    /// This property supports left-to-right and right-to-left text
170    /// directions.
171    ///
172    /// This property adds margin outside of the widget's normal size
173    /// request, the margin will be added in addition to the size from
174    /// [`WidgetExtManual::set_size_request()`][crate::gtk::prelude::WidgetExtManual::set_size_request()] for example.
175    ///
176    /// Readable | Writable
177    ///
178    ///
179    /// #### `margin-start`
180    ///  Margin on start of widget, horizontally.
181    ///
182    /// This property supports left-to-right and right-to-left text
183    /// directions.
184    ///
185    /// This property adds margin outside of the widget's normal size
186    /// request, the margin will be added in addition to the size from
187    /// [`WidgetExtManual::set_size_request()`][crate::gtk::prelude::WidgetExtManual::set_size_request()] for example.
188    ///
189    /// Readable | Writable
190    ///
191    ///
192    /// #### `margin-top`
193    ///  Margin on top side of widget.
194    ///
195    /// This property adds margin outside of the widget's normal size
196    /// request, the margin will be added in addition to the size from
197    /// [`WidgetExtManual::set_size_request()`][crate::gtk::prelude::WidgetExtManual::set_size_request()] for example.
198    ///
199    /// Readable | Writable
200    ///
201    ///
202    /// #### `name`
203    ///  The name of the widget.
204    ///
205    /// Readable | Writable
206    ///
207    ///
208    /// #### `opacity`
209    ///  The requested opacity of the widget.
210    ///
211    /// Readable | Writable
212    ///
213    ///
214    /// #### `overflow`
215    ///  How content outside the widget's content area is treated.
216    ///
217    /// This property is meant to be set by widget implementations,
218    /// typically in their instance init function.
219    ///
220    /// Readable | Writable
221    ///
222    ///
223    /// #### `parent`
224    ///  The parent widget of this widget.
225    ///
226    /// Readable
227    ///
228    ///
229    /// #### `receives-default`
230    ///  Whether the widget will receive the default action when it is focused.
231    ///
232    /// Readable | Writable
233    ///
234    ///
235    /// #### `root`
236    ///  The [`gtk::Root`][crate::gtk::Root] widget of the widget tree containing this widget.
237    ///
238    /// This will be `NULL` if the widget is not contained in a root widget.
239    ///
240    /// Readable
241    ///
242    ///
243    /// #### `scale-factor`
244    ///  The scale factor of the widget.
245    ///
246    /// Readable
247    ///
248    ///
249    /// #### `sensitive`
250    ///  Whether the widget responds to input.
251    ///
252    /// Readable | Writable
253    ///
254    ///
255    /// #### `tooltip-markup`
256    ///  Sets the text of tooltip to be the given string, which is marked up
257    /// with Pango markup.
258    ///
259    /// Also see `Gtk::Tooltip::set_markup()`.
260    ///
261    /// This is a convenience property which will take care of getting the
262    /// tooltip shown if the given string is not `NULL`:
263    /// [`has-tooltip`][struct@crate::gtk::Widget#has-tooltip] will automatically be set to true
264    /// and there will be taken care of [`query-tooltip`][struct@crate::gtk::Widget#query-tooltip] in
265    /// the default signal handler.
266    ///
267    /// Note that if both [`tooltip-text`][struct@crate::gtk::Widget#tooltip-text] and
268    /// [`tooltip-markup`][struct@crate::gtk::Widget#tooltip-markup] are set, the last one wins.
269    ///
270    /// Readable | Writable
271    ///
272    ///
273    /// #### `tooltip-text`
274    ///  Sets the text of tooltip to be the given string.
275    ///
276    /// Also see `Gtk::Tooltip::set_text()`.
277    ///
278    /// This is a convenience property which will take care of getting the
279    /// tooltip shown if the given string is not `NULL`:
280    /// [`has-tooltip`][struct@crate::gtk::Widget#has-tooltip] will automatically be set to true
281    /// and there will be taken care of [`query-tooltip`][struct@crate::gtk::Widget#query-tooltip] in
282    /// the default signal handler.
283    ///
284    /// Note that if both [`tooltip-text`][struct@crate::gtk::Widget#tooltip-text] and
285    /// [`tooltip-markup`][struct@crate::gtk::Widget#tooltip-markup] are set, the last one wins.
286    ///
287    /// Readable | Writable
288    ///
289    ///
290    /// #### `valign`
291    ///  How to distribute vertical space if widget gets extra space.
292    ///
293    /// Readable | Writable
294    ///
295    ///
296    /// #### `vexpand`
297    ///  Whether to expand vertically.
298    ///
299    /// Readable | Writable
300    ///
301    ///
302    /// #### `vexpand-set`
303    ///  Whether to use the `vexpand` property.
304    ///
305    /// Readable | Writable
306    ///
307    ///
308    /// #### `visible`
309    ///  Whether the widget is visible.
310    ///
311    /// Readable | Writable
312    ///
313    ///
314    /// #### `width-request`
315    ///  Overrides for width request of the widget.
316    ///
317    /// If this is -1, the natural request will be used.
318    ///
319    /// Readable | Writable
320    /// </details>
321    /// <details><summary><h4>Accessible</h4></summary>
322    ///
323    ///
324    /// #### `accessible-role`
325    ///  The accessible role of the given [`gtk::Accessible`][crate::gtk::Accessible] implementation.
326    ///
327    /// The accessible role cannot be changed once set.
328    ///
329    /// Readable | Writable
330    /// </details>
331    ///
332    /// # Implements
333    ///
334    /// [`BinExt`][trait@crate::prelude::BinExt], [`trait@gtk::prelude::WidgetExt`], [`trait@glib::ObjectExt`], [`trait@gtk::prelude::AccessibleExt`], [`trait@gtk::prelude::BuildableExt`], [`trait@gtk::prelude::ConstraintTargetExt`]
335    #[doc(alias = "AdwBin")]
336    pub struct Bin(Object<ffi::AdwBin, ffi::AdwBinClass>) @extends gtk::Widget, @implements gtk::Accessible, gtk::Buildable, gtk::ConstraintTarget;
337
338    match fn {
339        type_ => || ffi::adw_bin_get_type(),
340    }
341}
342
343#[cfg(not(feature = "gtk_v4_10"))]
344glib::wrapper! {
345    #[doc(alias = "AdwBin")]
346    pub struct Bin(Object<ffi::AdwBin, ffi::AdwBinClass>) @extends gtk::Widget, @implements gtk::Buildable, gtk::ConstraintTarget;
347
348    match fn {
349        type_ => || ffi::adw_bin_get_type(),
350    }
351}
352
353impl Bin {
354    pub const NONE: Option<&'static Bin> = None;
355
356    /// Creates a new [`Bin`][crate::Bin].
357    ///
358    /// # Returns
359    ///
360    /// the new created [`Bin`][crate::Bin]
361    #[doc(alias = "adw_bin_new")]
362    pub fn new() -> Bin {
363        assert_initialized_main_thread!();
364        unsafe { gtk::Widget::from_glib_none(ffi::adw_bin_new()).unsafe_cast() }
365    }
366
367    // rustdoc-stripper-ignore-next
368    /// Creates a new builder-pattern struct instance to construct [`Bin`] objects.
369    ///
370    /// This method returns an instance of [`BinBuilder`](crate::builders::BinBuilder) which can be used to create [`Bin`] objects.
371    pub fn builder() -> BinBuilder {
372        BinBuilder::new()
373    }
374}
375
376impl Default for Bin {
377    fn default() -> Self {
378        Self::new()
379    }
380}
381
382// rustdoc-stripper-ignore-next
383/// A [builder-pattern] type to construct [`Bin`] objects.
384///
385/// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html
386#[must_use = "The builder must be built to be used"]
387pub struct BinBuilder {
388    builder: glib::object::ObjectBuilder<'static, Bin>,
389}
390
391impl BinBuilder {
392    fn new() -> Self {
393        Self {
394            builder: glib::object::Object::builder(),
395        }
396    }
397
398    /// The child widget of the [`Bin`][crate::Bin].
399    pub fn child(self, child: &impl IsA<gtk::Widget>) -> Self {
400        Self {
401            builder: self.builder.property("child", child.clone().upcast()),
402        }
403    }
404
405    /// Whether the widget or any of its descendents can accept
406    /// the input focus.
407    ///
408    /// This property is meant to be set by widget implementations,
409    /// typically in their instance init function.
410    pub fn can_focus(self, can_focus: bool) -> Self {
411        Self {
412            builder: self.builder.property("can-focus", can_focus),
413        }
414    }
415
416    /// Whether the widget can receive pointer events.
417    pub fn can_target(self, can_target: bool) -> Self {
418        Self {
419            builder: self.builder.property("can-target", can_target),
420        }
421    }
422
423    /// A list of css classes applied to this widget.
424    pub fn css_classes(self, css_classes: impl Into<glib::StrV>) -> Self {
425        Self {
426            builder: self.builder.property("css-classes", css_classes.into()),
427        }
428    }
429
430    /// The name of this widget in the CSS tree.
431    ///
432    /// This property is meant to be set by widget implementations,
433    /// typically in their instance init function.
434    pub fn css_name(self, css_name: impl Into<glib::GString>) -> Self {
435        Self {
436            builder: self.builder.property("css-name", css_name.into()),
437        }
438    }
439
440    /// The cursor used by @widget.
441    pub fn cursor(self, cursor: &gdk::Cursor) -> Self {
442        Self {
443            builder: self.builder.property("cursor", cursor.clone()),
444        }
445    }
446
447    /// Whether the widget should grab focus when it is clicked with the mouse.
448    ///
449    /// This property is only relevant for widgets that can take focus.
450    pub fn focus_on_click(self, focus_on_click: bool) -> Self {
451        Self {
452            builder: self.builder.property("focus-on-click", focus_on_click),
453        }
454    }
455
456    /// Whether this widget itself will accept the input focus.
457    pub fn focusable(self, focusable: bool) -> Self {
458        Self {
459            builder: self.builder.property("focusable", focusable),
460        }
461    }
462
463    /// How to distribute horizontal space if widget gets extra space.
464    pub fn halign(self, halign: gtk::Align) -> Self {
465        Self {
466            builder: self.builder.property("halign", halign),
467        }
468    }
469
470    /// Enables or disables the emission of the [`query-tooltip`][struct@crate::gtk::Widget#query-tooltip]
471    /// signal on @widget.
472    ///
473    /// A true value indicates that @widget can have a tooltip, in this case
474    /// the widget will be queried using [`query-tooltip`][struct@crate::gtk::Widget#query-tooltip] to
475    /// determine whether it will provide a tooltip or not.
476    pub fn has_tooltip(self, has_tooltip: bool) -> Self {
477        Self {
478            builder: self.builder.property("has-tooltip", has_tooltip),
479        }
480    }
481
482    /// Overrides for height request of the widget.
483    ///
484    /// If this is -1, the natural request will be used.
485    pub fn height_request(self, height_request: i32) -> Self {
486        Self {
487            builder: self.builder.property("height-request", height_request),
488        }
489    }
490
491    /// Whether to expand horizontally.
492    pub fn hexpand(self, hexpand: bool) -> Self {
493        Self {
494            builder: self.builder.property("hexpand", hexpand),
495        }
496    }
497
498    /// Whether to use the `hexpand` property.
499    pub fn hexpand_set(self, hexpand_set: bool) -> Self {
500        Self {
501            builder: self.builder.property("hexpand-set", hexpand_set),
502        }
503    }
504
505    /// The [`gtk::LayoutManager`][crate::gtk::LayoutManager] instance to use to compute
506    /// the preferred size of the widget, and allocate its children.
507    ///
508    /// This property is meant to be set by widget implementations,
509    /// typically in their instance init function.
510    pub fn layout_manager(self, layout_manager: &impl IsA<gtk::LayoutManager>) -> Self {
511        Self {
512            builder: self
513                .builder
514                .property("layout-manager", layout_manager.clone().upcast()),
515        }
516    }
517
518    /// Makes this widget act like a modal dialog, with respect to
519    /// event delivery.
520    ///
521    /// Global event controllers will not handle events with targets
522    /// inside the widget, unless they are set up to ignore propagation
523    /// limits. See `Gtk::EventController::set_propagation_limit()`.
524    #[cfg(feature = "gtk_v4_18")]
525    #[cfg_attr(docsrs, doc(cfg(feature = "gtk_v4_18")))]
526    pub fn limit_events(self, limit_events: bool) -> Self {
527        Self {
528            builder: self.builder.property("limit-events", limit_events),
529        }
530    }
531
532    /// Margin on bottom side of widget.
533    ///
534    /// This property adds margin outside of the widget's normal size
535    /// request, the margin will be added in addition to the size from
536    /// [`WidgetExtManual::set_size_request()`][crate::gtk::prelude::WidgetExtManual::set_size_request()] for example.
537    pub fn margin_bottom(self, margin_bottom: i32) -> Self {
538        Self {
539            builder: self.builder.property("margin-bottom", margin_bottom),
540        }
541    }
542
543    /// Margin on end of widget, horizontally.
544    ///
545    /// This property supports left-to-right and right-to-left text
546    /// directions.
547    ///
548    /// This property adds margin outside of the widget's normal size
549    /// request, the margin will be added in addition to the size from
550    /// [`WidgetExtManual::set_size_request()`][crate::gtk::prelude::WidgetExtManual::set_size_request()] for example.
551    pub fn margin_end(self, margin_end: i32) -> Self {
552        Self {
553            builder: self.builder.property("margin-end", margin_end),
554        }
555    }
556
557    /// Margin on start of widget, horizontally.
558    ///
559    /// This property supports left-to-right and right-to-left text
560    /// directions.
561    ///
562    /// This property adds margin outside of the widget's normal size
563    /// request, the margin will be added in addition to the size from
564    /// [`WidgetExtManual::set_size_request()`][crate::gtk::prelude::WidgetExtManual::set_size_request()] for example.
565    pub fn margin_start(self, margin_start: i32) -> Self {
566        Self {
567            builder: self.builder.property("margin-start", margin_start),
568        }
569    }
570
571    /// Margin on top side of widget.
572    ///
573    /// This property adds margin outside of the widget's normal size
574    /// request, the margin will be added in addition to the size from
575    /// [`WidgetExtManual::set_size_request()`][crate::gtk::prelude::WidgetExtManual::set_size_request()] for example.
576    pub fn margin_top(self, margin_top: i32) -> Self {
577        Self {
578            builder: self.builder.property("margin-top", margin_top),
579        }
580    }
581
582    /// The name of the widget.
583    pub fn name(self, name: impl Into<glib::GString>) -> Self {
584        Self {
585            builder: self.builder.property("name", name.into()),
586        }
587    }
588
589    /// The requested opacity of the widget.
590    pub fn opacity(self, opacity: f64) -> Self {
591        Self {
592            builder: self.builder.property("opacity", opacity),
593        }
594    }
595
596    /// How content outside the widget's content area is treated.
597    ///
598    /// This property is meant to be set by widget implementations,
599    /// typically in their instance init function.
600    pub fn overflow(self, overflow: gtk::Overflow) -> Self {
601        Self {
602            builder: self.builder.property("overflow", overflow),
603        }
604    }
605
606    /// Whether the widget will receive the default action when it is focused.
607    pub fn receives_default(self, receives_default: bool) -> Self {
608        Self {
609            builder: self.builder.property("receives-default", receives_default),
610        }
611    }
612
613    /// Whether the widget responds to input.
614    pub fn sensitive(self, sensitive: bool) -> Self {
615        Self {
616            builder: self.builder.property("sensitive", sensitive),
617        }
618    }
619
620    /// Sets the text of tooltip to be the given string, which is marked up
621    /// with Pango markup.
622    ///
623    /// Also see `Gtk::Tooltip::set_markup()`.
624    ///
625    /// This is a convenience property which will take care of getting the
626    /// tooltip shown if the given string is not `NULL`:
627    /// [`has-tooltip`][struct@crate::gtk::Widget#has-tooltip] will automatically be set to true
628    /// and there will be taken care of [`query-tooltip`][struct@crate::gtk::Widget#query-tooltip] in
629    /// the default signal handler.
630    ///
631    /// Note that if both [`tooltip-text`][struct@crate::gtk::Widget#tooltip-text] and
632    /// [`tooltip-markup`][struct@crate::gtk::Widget#tooltip-markup] are set, the last one wins.
633    pub fn tooltip_markup(self, tooltip_markup: impl Into<glib::GString>) -> Self {
634        Self {
635            builder: self
636                .builder
637                .property("tooltip-markup", tooltip_markup.into()),
638        }
639    }
640
641    /// Sets the text of tooltip to be the given string.
642    ///
643    /// Also see `Gtk::Tooltip::set_text()`.
644    ///
645    /// This is a convenience property which will take care of getting the
646    /// tooltip shown if the given string is not `NULL`:
647    /// [`has-tooltip`][struct@crate::gtk::Widget#has-tooltip] will automatically be set to true
648    /// and there will be taken care of [`query-tooltip`][struct@crate::gtk::Widget#query-tooltip] in
649    /// the default signal handler.
650    ///
651    /// Note that if both [`tooltip-text`][struct@crate::gtk::Widget#tooltip-text] and
652    /// [`tooltip-markup`][struct@crate::gtk::Widget#tooltip-markup] are set, the last one wins.
653    pub fn tooltip_text(self, tooltip_text: impl Into<glib::GString>) -> Self {
654        Self {
655            builder: self.builder.property("tooltip-text", tooltip_text.into()),
656        }
657    }
658
659    /// How to distribute vertical space if widget gets extra space.
660    pub fn valign(self, valign: gtk::Align) -> Self {
661        Self {
662            builder: self.builder.property("valign", valign),
663        }
664    }
665
666    /// Whether to expand vertically.
667    pub fn vexpand(self, vexpand: bool) -> Self {
668        Self {
669            builder: self.builder.property("vexpand", vexpand),
670        }
671    }
672
673    /// Whether to use the `vexpand` property.
674    pub fn vexpand_set(self, vexpand_set: bool) -> Self {
675        Self {
676            builder: self.builder.property("vexpand-set", vexpand_set),
677        }
678    }
679
680    /// Whether the widget is visible.
681    pub fn visible(self, visible: bool) -> Self {
682        Self {
683            builder: self.builder.property("visible", visible),
684        }
685    }
686
687    /// Overrides for width request of the widget.
688    ///
689    /// If this is -1, the natural request will be used.
690    pub fn width_request(self, width_request: i32) -> Self {
691        Self {
692            builder: self.builder.property("width-request", width_request),
693        }
694    }
695
696    /// The accessible role of the given [`gtk::Accessible`][crate::gtk::Accessible] implementation.
697    ///
698    /// The accessible role cannot be changed once set.
699    pub fn accessible_role(self, accessible_role: gtk::AccessibleRole) -> Self {
700        Self {
701            builder: self.builder.property("accessible-role", accessible_role),
702        }
703    }
704
705    // rustdoc-stripper-ignore-next
706    /// Build the [`Bin`].
707    #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"]
708    pub fn build(self) -> Bin {
709        assert_initialized_main_thread!();
710        self.builder.build()
711    }
712}
713
714/// Trait containing all [`struct@Bin`] methods.
715///
716/// # Implementors
717///
718/// [`Bin`][struct@crate::Bin]
719pub trait BinExt: IsA<Bin> + 'static {
720    /// Gets the child widget of @self.
721    ///
722    /// # Returns
723    ///
724    /// the child widget of @self
725    #[doc(alias = "adw_bin_get_child")]
726    #[doc(alias = "get_child")]
727    fn child(&self) -> Option<gtk::Widget> {
728        unsafe { from_glib_none(ffi::adw_bin_get_child(self.as_ref().to_glib_none().0)) }
729    }
730
731    /// Sets the child widget of @self.
732    /// ## `child`
733    /// the child widget
734    #[doc(alias = "adw_bin_set_child")]
735    #[doc(alias = "child")]
736    fn set_child(&self, child: Option<&impl IsA<gtk::Widget>>) {
737        unsafe {
738            ffi::adw_bin_set_child(
739                self.as_ref().to_glib_none().0,
740                child.map(|p| p.as_ref()).to_glib_none().0,
741            );
742        }
743    }
744
745    #[doc(alias = "child")]
746    fn connect_child_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
747        unsafe extern "C" fn notify_child_trampoline<P: IsA<Bin>, F: Fn(&P) + 'static>(
748            this: *mut ffi::AdwBin,
749            _param_spec: glib::ffi::gpointer,
750            f: glib::ffi::gpointer,
751        ) {
752            unsafe {
753                let f: &F = &*(f as *const F);
754                f(Bin::from_glib_borrow(this).unsafe_cast_ref())
755            }
756        }
757        unsafe {
758            let f: Box_<F> = Box_::new(f);
759            connect_raw(
760                self.as_ptr() as *mut _,
761                c"notify::child".as_ptr(),
762                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
763                    notify_child_trampoline::<Self, F> as *const (),
764                )),
765                Box_::into_raw(f),
766            )
767        }
768    }
769}
770
771impl<O: IsA<Bin>> BinExt for O {}