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