Skip to main content

gtk4/auto/
frame.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::Accessible;
8use crate::{
9    AccessibleRole, Align, Buildable, ConstraintTarget, LayoutManager, Overflow, Widget, ffi,
10};
11use glib::{
12    prelude::*,
13    signal::{SignalHandlerId, connect_raw},
14    translate::*,
15};
16use std::boxed::Box as Box_;
17
18#[cfg(feature = "v4_10")]
19#[cfg_attr(docsrs, doc(cfg(feature = "v4_10")))]
20glib::wrapper! {
21    ///  on this node.
22    ///
23    /// # Accessibility
24    ///
25    /// [`Frame`][crate::Frame] uses the [enum@Gtk.AccessibleRole.group] role.
26    ///
27    /// ## Properties
28    ///
29    ///
30    /// #### `child`
31    ///  The child widget.
32    ///
33    /// Readable | Writable
34    ///
35    ///
36    /// #### `label`
37    ///  Text of the frame's label.
38    ///
39    /// Readable | Writable
40    ///
41    ///
42    /// #### `label-widget`
43    ///  Widget to display in place of the usual frame label.
44    ///
45    /// Readable | Writable
46    ///
47    ///
48    /// #### `label-xalign`
49    ///  The horizontal alignment of the label.
50    ///
51    /// Readable | Writable
52    /// <details><summary><h4>Widget</h4></summary>
53    ///
54    ///
55    /// #### `can-focus`
56    ///  Whether the widget or any of its descendents can accept
57    /// the input focus.
58    ///
59    /// This property is meant to be set by widget implementations,
60    /// typically in their instance init function.
61    ///
62    /// Readable | Writable
63    ///
64    ///
65    /// #### `can-target`
66    ///  Whether the widget can receive pointer events.
67    ///
68    /// Readable | Writable
69    ///
70    ///
71    /// #### `css-classes`
72    ///  A list of css classes applied to this widget.
73    ///
74    /// Readable | Writable
75    ///
76    ///
77    /// #### `css-name`
78    ///  The name of this widget in the CSS tree.
79    ///
80    /// This property is meant to be set by widget implementations,
81    /// typically in their instance init function.
82    ///
83    /// Readable | Writable | Construct Only
84    ///
85    ///
86    /// #### `cursor`
87    ///  The cursor used by @widget.
88    ///
89    /// Readable | Writable
90    ///
91    ///
92    /// #### `focus-on-click`
93    ///  Whether the widget should grab focus when it is clicked with the mouse.
94    ///
95    /// This property is only relevant for widgets that can take focus.
96    ///
97    /// Readable | Writable
98    ///
99    ///
100    /// #### `focusable`
101    ///  Whether this widget itself will accept the input focus.
102    ///
103    /// Readable | Writable
104    ///
105    ///
106    /// #### `halign`
107    ///  How to distribute horizontal space if widget gets extra space.
108    ///
109    /// Readable | Writable
110    ///
111    ///
112    /// #### `has-default`
113    ///  Whether the widget is the default widget.
114    ///
115    /// Readable
116    ///
117    ///
118    /// #### `has-focus`
119    ///  Whether the widget has the input focus.
120    ///
121    /// Readable
122    ///
123    ///
124    /// #### `has-tooltip`
125    ///  Enables or disables the emission of the [`query-tooltip`][struct@crate::Widget#query-tooltip]
126    /// signal on @widget.
127    ///
128    /// A true value indicates that @widget can have a tooltip, in this case
129    /// the widget will be queried using [`query-tooltip`][struct@crate::Widget#query-tooltip] to
130    /// determine whether it will provide a tooltip or not.
131    ///
132    /// Readable | Writable
133    ///
134    ///
135    /// #### `height-request`
136    ///  Overrides for height request of the widget.
137    ///
138    /// If this is -1, the natural request will be used.
139    ///
140    /// Readable | Writable
141    ///
142    ///
143    /// #### `hexpand`
144    ///  Whether to expand horizontally.
145    ///
146    /// Readable | Writable
147    ///
148    ///
149    /// #### `hexpand-set`
150    ///  Whether to use the `hexpand` property.
151    ///
152    /// Readable | Writable
153    ///
154    ///
155    /// #### `layout-manager`
156    ///  The [`LayoutManager`][crate::LayoutManager] instance to use to compute
157    /// the preferred size of the widget, and allocate its children.
158    ///
159    /// This property is meant to be set by widget implementations,
160    /// typically in their instance init function.
161    ///
162    /// Readable | Writable
163    ///
164    ///
165    /// #### `limit-events`
166    ///  Makes this widget act like a modal dialog, with respect to
167    /// event delivery.
168    ///
169    /// Global event controllers will not handle events with targets
170    /// inside the widget, unless they are set up to ignore propagation
171    /// limits. See [`EventControllerExt::set_propagation_limit()`][crate::prelude::EventControllerExt::set_propagation_limit()].
172    ///
173    /// Readable | Writable
174    ///
175    ///
176    /// #### `margin-bottom`
177    ///  Margin on bottom side of widget.
178    ///
179    /// This property adds margin outside of the widget's normal size
180    /// request, the margin will be added in addition to the size from
181    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
182    ///
183    /// Readable | Writable
184    ///
185    ///
186    /// #### `margin-end`
187    ///  Margin on end of widget, horizontally.
188    ///
189    /// This property supports left-to-right and right-to-left text
190    /// directions.
191    ///
192    /// This property adds margin outside of the widget's normal size
193    /// request, the margin will be added in addition to the size from
194    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
195    ///
196    /// Readable | Writable
197    ///
198    ///
199    /// #### `margin-start`
200    ///  Margin on start of widget, horizontally.
201    ///
202    /// This property supports left-to-right and right-to-left text
203    /// directions.
204    ///
205    /// This property adds margin outside of the widget's normal size
206    /// request, the margin will be added in addition to the size from
207    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
208    ///
209    /// Readable | Writable
210    ///
211    ///
212    /// #### `margin-top`
213    ///  Margin on top side of widget.
214    ///
215    /// This property adds margin outside of the widget's normal size
216    /// request, the margin will be added in addition to the size from
217    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
218    ///
219    /// Readable | Writable
220    ///
221    ///
222    /// #### `name`
223    ///  The name of the widget.
224    ///
225    /// Readable | Writable
226    ///
227    ///
228    /// #### `opacity`
229    ///  The requested opacity of the widget.
230    ///
231    /// Readable | Writable
232    ///
233    ///
234    /// #### `overflow`
235    ///  How content outside the widget's content area is treated.
236    ///
237    /// This property is meant to be set by widget implementations,
238    /// typically in their instance init function.
239    ///
240    /// Readable | Writable
241    ///
242    ///
243    /// #### `parent`
244    ///  The parent widget of this widget.
245    ///
246    /// Readable
247    ///
248    ///
249    /// #### `receives-default`
250    ///  Whether the widget will receive the default action when it is focused.
251    ///
252    /// Readable | Writable
253    ///
254    ///
255    /// #### `root`
256    ///  The [`Root`][crate::Root] widget of the widget tree containing this widget.
257    ///
258    /// This will be `NULL` if the widget is not contained in a root widget.
259    ///
260    /// Readable
261    ///
262    ///
263    /// #### `scale-factor`
264    ///  The scale factor of the widget.
265    ///
266    /// Readable
267    ///
268    ///
269    /// #### `sensitive`
270    ///  Whether the widget responds to input.
271    ///
272    /// Readable | Writable
273    ///
274    ///
275    /// #### `tooltip-markup`
276    ///  Sets the text of tooltip to be the given string, which is marked up
277    /// with Pango markup.
278    ///
279    /// Also see [`Tooltip::set_markup()`][crate::Tooltip::set_markup()].
280    ///
281    /// This is a convenience property which will take care of getting the
282    /// tooltip shown if the given string is not `NULL`:
283    /// [`has-tooltip`][struct@crate::Widget#has-tooltip] will automatically be set to true
284    /// and there will be taken care of [`query-tooltip`][struct@crate::Widget#query-tooltip] in
285    /// the default signal handler.
286    ///
287    /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and
288    /// [`tooltip-markup`][struct@crate::Widget#tooltip-markup] are set, the last one wins.
289    ///
290    /// Readable | Writable
291    ///
292    ///
293    /// #### `tooltip-text`
294    ///  Sets the text of tooltip to be the given string.
295    ///
296    /// Also see [`Tooltip::set_text()`][crate::Tooltip::set_text()].
297    ///
298    /// This is a convenience property which will take care of getting the
299    /// tooltip shown if the given string is not `NULL`:
300    /// [`has-tooltip`][struct@crate::Widget#has-tooltip] will automatically be set to true
301    /// and there will be taken care of [`query-tooltip`][struct@crate::Widget#query-tooltip] in
302    /// the default signal handler.
303    ///
304    /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and
305    /// [`tooltip-markup`][struct@crate::Widget#tooltip-markup] are set, the last one wins.
306    ///
307    /// Readable | Writable
308    ///
309    ///
310    /// #### `valign`
311    ///  How to distribute vertical space if widget gets extra space.
312    ///
313    /// Readable | Writable
314    ///
315    ///
316    /// #### `vexpand`
317    ///  Whether to expand vertically.
318    ///
319    /// Readable | Writable
320    ///
321    ///
322    /// #### `vexpand-set`
323    ///  Whether to use the `vexpand` property.
324    ///
325    /// Readable | Writable
326    ///
327    ///
328    /// #### `visible`
329    ///  Whether the widget is visible.
330    ///
331    /// Readable | Writable
332    ///
333    ///
334    /// #### `width-request`
335    ///  Overrides for width request of the widget.
336    ///
337    /// If this is -1, the natural request will be used.
338    ///
339    /// Readable | Writable
340    /// </details>
341    /// <details><summary><h4>Accessible</h4></summary>
342    ///
343    ///
344    /// #### `accessible-role`
345    ///  The accessible role of the given [`Accessible`][crate::Accessible] implementation.
346    ///
347    /// The accessible role cannot be changed once set.
348    ///
349    /// Readable | Writable
350    /// </details>
351    ///
352    /// # Implements
353    ///
354    /// [`FrameExt`][trait@crate::prelude::FrameExt], [`WidgetExt`][trait@crate::prelude::WidgetExt], [`trait@glib::ObjectExt`], [`AccessibleExt`][trait@crate::prelude::AccessibleExt], [`BuildableExt`][trait@crate::prelude::BuildableExt], [`ConstraintTargetExt`][trait@crate::prelude::ConstraintTargetExt], [`WidgetExtManual`][trait@crate::prelude::WidgetExtManual], [`AccessibleExtManual`][trait@crate::prelude::AccessibleExtManual]
355    #[doc(alias = "GtkFrame")]
356    pub struct Frame(Object<ffi::GtkFrame, ffi::GtkFrameClass>) @extends Widget, @implements Accessible, Buildable, ConstraintTarget;
357
358    match fn {
359        type_ => || ffi::gtk_frame_get_type(),
360    }
361}
362
363#[cfg(not(feature = "v4_10"))]
364glib::wrapper! {
365    #[doc(alias = "GtkFrame")]
366    pub struct Frame(Object<ffi::GtkFrame, ffi::GtkFrameClass>) @extends Widget, @implements Buildable, ConstraintTarget;
367
368    match fn {
369        type_ => || ffi::gtk_frame_get_type(),
370    }
371}
372
373impl Frame {
374    pub const NONE: Option<&'static Frame> = None;
375
376    /// Creates a new [`Frame`][crate::Frame], with optional label @label.
377    ///
378    /// If @label is [`None`], the label is omitted.
379    /// ## `label`
380    /// the text to use as the label of the frame
381    ///
382    /// # Returns
383    ///
384    /// a new [`Frame`][crate::Frame] widget
385    #[doc(alias = "gtk_frame_new")]
386    pub fn new(label: Option<&str>) -> Frame {
387        assert_initialized_main_thread!();
388        unsafe { Widget::from_glib_none(ffi::gtk_frame_new(label.to_glib_none().0)).unsafe_cast() }
389    }
390
391    // rustdoc-stripper-ignore-next
392    /// Creates a new builder-pattern struct instance to construct [`Frame`] objects.
393    ///
394    /// This method returns an instance of [`FrameBuilder`](crate::builders::FrameBuilder) which can be used to create [`Frame`] objects.
395    pub fn builder() -> FrameBuilder {
396        FrameBuilder::new()
397    }
398}
399
400impl Default for Frame {
401    fn default() -> Self {
402        glib::object::Object::new::<Self>()
403    }
404}
405
406// rustdoc-stripper-ignore-next
407/// A [builder-pattern] type to construct [`Frame`] objects.
408///
409/// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html
410#[must_use = "The builder must be built to be used"]
411pub struct FrameBuilder {
412    builder: glib::object::ObjectBuilder<'static, Frame>,
413}
414
415impl FrameBuilder {
416    fn new() -> Self {
417        Self {
418            builder: glib::object::Object::builder(),
419        }
420    }
421
422    /// The child widget.
423    pub fn child(self, child: &impl IsA<Widget>) -> Self {
424        Self {
425            builder: self.builder.property("child", child.clone().upcast()),
426        }
427    }
428
429    /// Text of the frame's label.
430    pub fn label(self, label: impl Into<glib::GString>) -> Self {
431        Self {
432            builder: self.builder.property("label", label.into()),
433        }
434    }
435
436    /// Widget to display in place of the usual frame label.
437    pub fn label_widget(self, label_widget: &impl IsA<Widget>) -> Self {
438        Self {
439            builder: self
440                .builder
441                .property("label-widget", label_widget.clone().upcast()),
442        }
443    }
444
445    /// The horizontal alignment of the label.
446    pub fn label_xalign(self, label_xalign: f32) -> Self {
447        Self {
448            builder: self.builder.property("label-xalign", label_xalign),
449        }
450    }
451
452    /// Whether the widget or any of its descendents can accept
453    /// the input focus.
454    ///
455    /// This property is meant to be set by widget implementations,
456    /// typically in their instance init function.
457    pub fn can_focus(self, can_focus: bool) -> Self {
458        Self {
459            builder: self.builder.property("can-focus", can_focus),
460        }
461    }
462
463    /// Whether the widget can receive pointer events.
464    pub fn can_target(self, can_target: bool) -> Self {
465        Self {
466            builder: self.builder.property("can-target", can_target),
467        }
468    }
469
470    /// A list of css classes applied to this widget.
471    pub fn css_classes(self, css_classes: impl Into<glib::StrV>) -> Self {
472        Self {
473            builder: self.builder.property("css-classes", css_classes.into()),
474        }
475    }
476
477    /// The name of this widget in the CSS tree.
478    ///
479    /// This property is meant to be set by widget implementations,
480    /// typically in their instance init function.
481    pub fn css_name(self, css_name: impl Into<glib::GString>) -> Self {
482        Self {
483            builder: self.builder.property("css-name", css_name.into()),
484        }
485    }
486
487    /// The cursor used by @widget.
488    pub fn cursor(self, cursor: &gdk::Cursor) -> Self {
489        Self {
490            builder: self.builder.property("cursor", cursor.clone()),
491        }
492    }
493
494    /// Whether the widget should grab focus when it is clicked with the mouse.
495    ///
496    /// This property is only relevant for widgets that can take focus.
497    pub fn focus_on_click(self, focus_on_click: bool) -> Self {
498        Self {
499            builder: self.builder.property("focus-on-click", focus_on_click),
500        }
501    }
502
503    /// Whether this widget itself will accept the input focus.
504    pub fn focusable(self, focusable: bool) -> Self {
505        Self {
506            builder: self.builder.property("focusable", focusable),
507        }
508    }
509
510    /// How to distribute horizontal space if widget gets extra space.
511    pub fn halign(self, halign: Align) -> Self {
512        Self {
513            builder: self.builder.property("halign", halign),
514        }
515    }
516
517    /// Enables or disables the emission of the [`query-tooltip`][struct@crate::Widget#query-tooltip]
518    /// signal on @widget.
519    ///
520    /// A true value indicates that @widget can have a tooltip, in this case
521    /// the widget will be queried using [`query-tooltip`][struct@crate::Widget#query-tooltip] to
522    /// determine whether it will provide a tooltip or not.
523    pub fn has_tooltip(self, has_tooltip: bool) -> Self {
524        Self {
525            builder: self.builder.property("has-tooltip", has_tooltip),
526        }
527    }
528
529    /// Overrides for height request of the widget.
530    ///
531    /// If this is -1, the natural request will be used.
532    pub fn height_request(self, height_request: i32) -> Self {
533        Self {
534            builder: self.builder.property("height-request", height_request),
535        }
536    }
537
538    /// Whether to expand horizontally.
539    pub fn hexpand(self, hexpand: bool) -> Self {
540        Self {
541            builder: self.builder.property("hexpand", hexpand),
542        }
543    }
544
545    /// Whether to use the `hexpand` property.
546    pub fn hexpand_set(self, hexpand_set: bool) -> Self {
547        Self {
548            builder: self.builder.property("hexpand-set", hexpand_set),
549        }
550    }
551
552    /// The [`LayoutManager`][crate::LayoutManager] instance to use to compute
553    /// the preferred size of the widget, and allocate its children.
554    ///
555    /// This property is meant to be set by widget implementations,
556    /// typically in their instance init function.
557    pub fn layout_manager(self, layout_manager: &impl IsA<LayoutManager>) -> Self {
558        Self {
559            builder: self
560                .builder
561                .property("layout-manager", layout_manager.clone().upcast()),
562        }
563    }
564
565    /// Makes this widget act like a modal dialog, with respect to
566    /// event delivery.
567    ///
568    /// Global event controllers will not handle events with targets
569    /// inside the widget, unless they are set up to ignore propagation
570    /// limits. See [`EventControllerExt::set_propagation_limit()`][crate::prelude::EventControllerExt::set_propagation_limit()].
571    #[cfg(feature = "v4_18")]
572    #[cfg_attr(docsrs, doc(cfg(feature = "v4_18")))]
573    pub fn limit_events(self, limit_events: bool) -> Self {
574        Self {
575            builder: self.builder.property("limit-events", limit_events),
576        }
577    }
578
579    /// Margin on bottom side of widget.
580    ///
581    /// This property adds margin outside of the widget's normal size
582    /// request, the margin will be added in addition to the size from
583    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
584    pub fn margin_bottom(self, margin_bottom: i32) -> Self {
585        Self {
586            builder: self.builder.property("margin-bottom", margin_bottom),
587        }
588    }
589
590    /// Margin on end of widget, horizontally.
591    ///
592    /// This property supports left-to-right and right-to-left text
593    /// directions.
594    ///
595    /// This property adds margin outside of the widget's normal size
596    /// request, the margin will be added in addition to the size from
597    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
598    pub fn margin_end(self, margin_end: i32) -> Self {
599        Self {
600            builder: self.builder.property("margin-end", margin_end),
601        }
602    }
603
604    /// Margin on start of widget, horizontally.
605    ///
606    /// This property supports left-to-right and right-to-left text
607    /// directions.
608    ///
609    /// This property adds margin outside of the widget's normal size
610    /// request, the margin will be added in addition to the size from
611    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
612    pub fn margin_start(self, margin_start: i32) -> Self {
613        Self {
614            builder: self.builder.property("margin-start", margin_start),
615        }
616    }
617
618    /// Margin on top side of widget.
619    ///
620    /// This property adds margin outside of the widget's normal size
621    /// request, the margin will be added in addition to the size from
622    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
623    pub fn margin_top(self, margin_top: i32) -> Self {
624        Self {
625            builder: self.builder.property("margin-top", margin_top),
626        }
627    }
628
629    /// The name of the widget.
630    pub fn name(self, name: impl Into<glib::GString>) -> Self {
631        Self {
632            builder: self.builder.property("name", name.into()),
633        }
634    }
635
636    /// The requested opacity of the widget.
637    pub fn opacity(self, opacity: f64) -> Self {
638        Self {
639            builder: self.builder.property("opacity", opacity),
640        }
641    }
642
643    /// How content outside the widget's content area is treated.
644    ///
645    /// This property is meant to be set by widget implementations,
646    /// typically in their instance init function.
647    pub fn overflow(self, overflow: Overflow) -> Self {
648        Self {
649            builder: self.builder.property("overflow", overflow),
650        }
651    }
652
653    /// Whether the widget will receive the default action when it is focused.
654    pub fn receives_default(self, receives_default: bool) -> Self {
655        Self {
656            builder: self.builder.property("receives-default", receives_default),
657        }
658    }
659
660    /// Whether the widget responds to input.
661    pub fn sensitive(self, sensitive: bool) -> Self {
662        Self {
663            builder: self.builder.property("sensitive", sensitive),
664        }
665    }
666
667    /// Sets the text of tooltip to be the given string, which is marked up
668    /// with Pango markup.
669    ///
670    /// Also see [`Tooltip::set_markup()`][crate::Tooltip::set_markup()].
671    ///
672    /// This is a convenience property which will take care of getting the
673    /// tooltip shown if the given string is not `NULL`:
674    /// [`has-tooltip`][struct@crate::Widget#has-tooltip] will automatically be set to true
675    /// and there will be taken care of [`query-tooltip`][struct@crate::Widget#query-tooltip] in
676    /// the default signal handler.
677    ///
678    /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and
679    /// [`tooltip-markup`][struct@crate::Widget#tooltip-markup] are set, the last one wins.
680    pub fn tooltip_markup(self, tooltip_markup: impl Into<glib::GString>) -> Self {
681        Self {
682            builder: self
683                .builder
684                .property("tooltip-markup", tooltip_markup.into()),
685        }
686    }
687
688    /// Sets the text of tooltip to be the given string.
689    ///
690    /// Also see [`Tooltip::set_text()`][crate::Tooltip::set_text()].
691    ///
692    /// This is a convenience property which will take care of getting the
693    /// tooltip shown if the given string is not `NULL`:
694    /// [`has-tooltip`][struct@crate::Widget#has-tooltip] will automatically be set to true
695    /// and there will be taken care of [`query-tooltip`][struct@crate::Widget#query-tooltip] in
696    /// the default signal handler.
697    ///
698    /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and
699    /// [`tooltip-markup`][struct@crate::Widget#tooltip-markup] are set, the last one wins.
700    pub fn tooltip_text(self, tooltip_text: impl Into<glib::GString>) -> Self {
701        Self {
702            builder: self.builder.property("tooltip-text", tooltip_text.into()),
703        }
704    }
705
706    /// How to distribute vertical space if widget gets extra space.
707    pub fn valign(self, valign: Align) -> Self {
708        Self {
709            builder: self.builder.property("valign", valign),
710        }
711    }
712
713    /// Whether to expand vertically.
714    pub fn vexpand(self, vexpand: bool) -> Self {
715        Self {
716            builder: self.builder.property("vexpand", vexpand),
717        }
718    }
719
720    /// Whether to use the `vexpand` property.
721    pub fn vexpand_set(self, vexpand_set: bool) -> Self {
722        Self {
723            builder: self.builder.property("vexpand-set", vexpand_set),
724        }
725    }
726
727    /// Whether the widget is visible.
728    pub fn visible(self, visible: bool) -> Self {
729        Self {
730            builder: self.builder.property("visible", visible),
731        }
732    }
733
734    /// Overrides for width request of the widget.
735    ///
736    /// If this is -1, the natural request will be used.
737    pub fn width_request(self, width_request: i32) -> Self {
738        Self {
739            builder: self.builder.property("width-request", width_request),
740        }
741    }
742
743    /// The accessible role of the given [`Accessible`][crate::Accessible] implementation.
744    ///
745    /// The accessible role cannot be changed once set.
746    pub fn accessible_role(self, accessible_role: AccessibleRole) -> Self {
747        Self {
748            builder: self.builder.property("accessible-role", accessible_role),
749        }
750    }
751
752    // rustdoc-stripper-ignore-next
753    /// Build the [`Frame`].
754    #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"]
755    pub fn build(self) -> Frame {
756        assert_initialized_main_thread!();
757        self.builder.build()
758    }
759}
760
761/// Trait containing all [`struct@Frame`] methods.
762///
763/// # Implementors
764///
765/// [`Frame`][struct@crate::Frame]
766pub trait FrameExt: IsA<Frame> + 'static {
767    /// Gets the child widget of @self.
768    ///
769    /// # Returns
770    ///
771    /// the child widget of @self
772    #[doc(alias = "gtk_frame_get_child")]
773    #[doc(alias = "get_child")]
774    fn child(&self) -> Option<Widget> {
775        unsafe { from_glib_none(ffi::gtk_frame_get_child(self.as_ref().to_glib_none().0)) }
776    }
777
778    /// Returns the frame labels text.
779    ///
780    /// If the frame's label widget is not a [`Label`][crate::Label], [`None`]
781    /// is returned.
782    ///
783    /// # Returns
784    ///
785    /// the text in the label, or [`None`] if there
786    ///    was no label widget or the label widget was not a [`Label`][crate::Label].
787    ///    This string is owned by GTK and must not be modified or freed.
788    #[doc(alias = "gtk_frame_get_label")]
789    #[doc(alias = "get_label")]
790    fn label(&self) -> Option<glib::GString> {
791        unsafe { from_glib_none(ffi::gtk_frame_get_label(self.as_ref().to_glib_none().0)) }
792    }
793
794    /// s label.
795    ///
796    /// # Returns
797    ///
798    /// the frames X alignment
799    #[doc(alias = "gtk_frame_get_label_align")]
800    #[doc(alias = "get_label_align")]
801    #[doc(alias = "label-xalign")]
802    fn label_align(&self) -> f32 {
803        unsafe { ffi::gtk_frame_get_label_align(self.as_ref().to_glib_none().0) }
804    }
805
806    /// Retrieves the label widget for the frame.
807    ///
808    /// # Returns
809    ///
810    /// the label widget
811    #[doc(alias = "gtk_frame_get_label_widget")]
812    #[doc(alias = "get_label_widget")]
813    #[doc(alias = "label-widget")]
814    fn label_widget(&self) -> Option<Widget> {
815        unsafe {
816            from_glib_none(ffi::gtk_frame_get_label_widget(
817                self.as_ref().to_glib_none().0,
818            ))
819        }
820    }
821
822    /// Sets the child widget of @self.
823    /// ## `child`
824    /// the child widget
825    #[doc(alias = "gtk_frame_set_child")]
826    #[doc(alias = "child")]
827    fn set_child(&self, child: Option<&impl IsA<Widget>>) {
828        unsafe {
829            ffi::gtk_frame_set_child(
830                self.as_ref().to_glib_none().0,
831                child.map(|p| p.as_ref()).to_glib_none().0,
832            );
833        }
834    }
835
836    /// Creates a new [`Label`][crate::Label] with the @label and sets it as the frame's
837    /// label widget.
838    /// ## `label`
839    /// the text to use as the label of the frame
840    #[doc(alias = "gtk_frame_set_label")]
841    #[doc(alias = "label")]
842    fn set_label(&self, label: Option<&str>) {
843        unsafe {
844            ffi::gtk_frame_set_label(self.as_ref().to_glib_none().0, label.to_glib_none().0);
845        }
846    }
847
848    /// s label.
849    ///
850    /// The default value for a newly created frame is 0.0.
851    /// ## `xalign`
852    /// The position of the label along the top edge
853    ///   of the widget. A value of 0.0 represents left alignment;
854    ///   1.0 represents right alignment.
855    #[doc(alias = "gtk_frame_set_label_align")]
856    #[doc(alias = "label-xalign")]
857    fn set_label_align(&self, xalign: f32) {
858        unsafe {
859            ffi::gtk_frame_set_label_align(self.as_ref().to_glib_none().0, xalign);
860        }
861    }
862
863    /// Sets the label widget for the frame.
864    ///
865    /// This is the widget that will appear embedded in the top edge
866    /// of the frame as a title.
867    /// ## `label_widget`
868    /// the new label widget
869    #[doc(alias = "gtk_frame_set_label_widget")]
870    #[doc(alias = "label-widget")]
871    fn set_label_widget(&self, label_widget: Option<&impl IsA<Widget>>) {
872        unsafe {
873            ffi::gtk_frame_set_label_widget(
874                self.as_ref().to_glib_none().0,
875                label_widget.map(|p| p.as_ref()).to_glib_none().0,
876            );
877        }
878    }
879
880    #[doc(alias = "child")]
881    fn connect_child_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
882        unsafe extern "C" fn notify_child_trampoline<P: IsA<Frame>, F: Fn(&P) + 'static>(
883            this: *mut ffi::GtkFrame,
884            _param_spec: glib::ffi::gpointer,
885            f: glib::ffi::gpointer,
886        ) {
887            unsafe {
888                let f: &F = &*(f as *const F);
889                f(Frame::from_glib_borrow(this).unsafe_cast_ref())
890            }
891        }
892        unsafe {
893            let f: Box_<F> = Box_::new(f);
894            connect_raw(
895                self.as_ptr() as *mut _,
896                c"notify::child".as_ptr(),
897                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
898                    notify_child_trampoline::<Self, F> as *const (),
899                )),
900                Box_::into_raw(f),
901            )
902        }
903    }
904
905    #[doc(alias = "label")]
906    fn connect_label_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
907        unsafe extern "C" fn notify_label_trampoline<P: IsA<Frame>, F: Fn(&P) + 'static>(
908            this: *mut ffi::GtkFrame,
909            _param_spec: glib::ffi::gpointer,
910            f: glib::ffi::gpointer,
911        ) {
912            unsafe {
913                let f: &F = &*(f as *const F);
914                f(Frame::from_glib_borrow(this).unsafe_cast_ref())
915            }
916        }
917        unsafe {
918            let f: Box_<F> = Box_::new(f);
919            connect_raw(
920                self.as_ptr() as *mut _,
921                c"notify::label".as_ptr(),
922                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
923                    notify_label_trampoline::<Self, F> as *const (),
924                )),
925                Box_::into_raw(f),
926            )
927        }
928    }
929
930    #[doc(alias = "label-widget")]
931    fn connect_label_widget_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
932        unsafe extern "C" fn notify_label_widget_trampoline<P: IsA<Frame>, F: Fn(&P) + 'static>(
933            this: *mut ffi::GtkFrame,
934            _param_spec: glib::ffi::gpointer,
935            f: glib::ffi::gpointer,
936        ) {
937            unsafe {
938                let f: &F = &*(f as *const F);
939                f(Frame::from_glib_borrow(this).unsafe_cast_ref())
940            }
941        }
942        unsafe {
943            let f: Box_<F> = Box_::new(f);
944            connect_raw(
945                self.as_ptr() as *mut _,
946                c"notify::label-widget".as_ptr(),
947                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
948                    notify_label_widget_trampoline::<Self, F> as *const (),
949                )),
950                Box_::into_raw(f),
951            )
952        }
953    }
954
955    #[doc(alias = "label-xalign")]
956    fn connect_label_xalign_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
957        unsafe extern "C" fn notify_label_xalign_trampoline<P: IsA<Frame>, F: Fn(&P) + 'static>(
958            this: *mut ffi::GtkFrame,
959            _param_spec: glib::ffi::gpointer,
960            f: glib::ffi::gpointer,
961        ) {
962            unsafe {
963                let f: &F = &*(f as *const F);
964                f(Frame::from_glib_borrow(this).unsafe_cast_ref())
965            }
966        }
967        unsafe {
968            let f: Box_<F> = Box_::new(f);
969            connect_raw(
970                self.as_ptr() as *mut _,
971                c"notify::label-xalign".as_ptr(),
972                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
973                    notify_label_xalign_trampoline::<Self, F> as *const (),
974                )),
975                Box_::into_raw(f),
976            )
977        }
978    }
979}
980
981impl<O: IsA<Frame>> FrameExt for O {}