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