Skip to main content

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