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