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