Skip to main content

libadwaita/auto/
carousel.rs

1// This file was generated by gir (https://github.com/gtk-rs/gir)
2// from
3// from gir-files (https://github.com/gtk-rs/gir-files.git)
4// DO NOT EDIT
5
6use crate::{SpringParams, Swipeable, ffi};
7use glib::{
8    object::ObjectType as _,
9    prelude::*,
10    signal::{SignalHandlerId, connect_raw},
11    translate::*,
12};
13use std::boxed::Box as Box_;
14
15glib::wrapper! {
16    /// A paginated scrolling widget.
17    ///
18    /// <picture>
19    ///   <source srcset="carousel-dark.png" media="(prefers-color-scheme: dark)">
20    ///   <img src="carousel.png" alt="carousel">
21    /// </picture>
22    ///
23    /// The [`Carousel`][crate::Carousel] widget can be used to display a set of pages with
24    /// swipe-based navigation between them.
25    ///
26    /// [`CarouselIndicatorDots`][crate::CarouselIndicatorDots] and [`CarouselIndicatorLines`][crate::CarouselIndicatorLines] can be used
27    /// to provide page indicators for [`Carousel`][crate::Carousel].
28    ///
29    /// ## CSS nodes
30    ///
31    /// [`Carousel`][crate::Carousel] has a single CSS node with name `carousel`.
32    ///
33    /// ## Properties
34    ///
35    ///
36    /// #### `allow-long-swipes`
37    ///  Whether to allow swiping for more than one page at a time.
38    ///
39    /// If the value is `FALSE`, each swipe can only move to the adjacent pages.
40    ///
41    /// Readable | Writeable
42    ///
43    ///
44    /// #### `allow-mouse-drag`
45    ///  Sets whether the [`Carousel`][crate::Carousel] can be dragged with mouse pointer.
46    ///
47    /// If the value is `FALSE`, dragging is only available on touch.
48    ///
49    /// Readable | Writeable
50    ///
51    ///
52    /// #### `allow-scroll-wheel`
53    ///  Whether the widget will respond to scroll wheel events.
54    ///
55    /// If the value is `FALSE`, wheel events will be ignored.
56    ///
57    /// Readable | Writeable
58    ///
59    ///
60    /// #### `interactive`
61    ///  Whether the carousel can be navigated.
62    ///
63    /// This can be used to temporarily disable the carousel to only allow
64    /// navigating it in a certain state.
65    ///
66    /// Readable | Writeable
67    ///
68    ///
69    /// #### `n-pages`
70    ///  The number of pages in a [`Carousel`][crate::Carousel].
71    ///
72    /// Readable
73    ///
74    ///
75    /// #### `position`
76    ///  Current scrolling position, unitless.
77    ///
78    /// 1 matches 1 page. Use [`Carousel::scroll_to()`][crate::Carousel::scroll_to()] for changing it.
79    ///
80    /// Readable
81    ///
82    ///
83    /// #### `reveal-duration`
84    ///  Page reveal duration, in milliseconds.
85    ///
86    /// Reveal duration is used when animating adding or removing pages.
87    ///
88    /// Readable | Writeable
89    ///
90    ///
91    /// #### `scroll-params`
92    ///  Scroll animation spring parameters.
93    ///
94    /// The default value is equivalent to:
95    ///
96    /// **⚠️ The following code is in c ⚠️**
97    ///
98    /// ```c
99    /// adw_spring_params_new (1, 0.5, 500)
100    /// ```
101    ///
102    /// Readable | Writeable
103    ///
104    ///
105    /// #### `spacing`
106    ///  Spacing between pages in pixels.
107    ///
108    /// Readable | Writeable
109    /// <details><summary><h4>Widget</h4></summary>
110    ///
111    ///
112    /// #### `can-focus`
113    ///  Whether the widget or any of its descendents can accept
114    /// the input focus.
115    ///
116    /// This property is meant to be set by widget implementations,
117    /// typically in their instance init function.
118    ///
119    /// Readable | Writeable
120    ///
121    ///
122    /// #### `can-target`
123    ///  Whether the widget can receive pointer events.
124    ///
125    /// Readable | Writeable
126    ///
127    ///
128    /// #### `css-classes`
129    ///  A list of css classes applied to this widget.
130    ///
131    /// Readable | Writeable
132    ///
133    ///
134    /// #### `css-name`
135    ///  The name of this widget in the CSS tree.
136    ///
137    /// This property is meant to be set by widget implementations,
138    /// typically in their instance init function.
139    ///
140    /// Readable | Writeable | Construct Only
141    ///
142    ///
143    /// #### `cursor`
144    ///  The cursor used by @widget.
145    ///
146    /// Readable | Writeable
147    ///
148    ///
149    /// #### `focus-on-click`
150    ///  Whether the widget should grab focus when it is clicked with the mouse.
151    ///
152    /// This property is only relevant for widgets that can take focus.
153    ///
154    /// Readable | Writeable
155    ///
156    ///
157    /// #### `focusable`
158    ///  Whether this widget itself will accept the input focus.
159    ///
160    /// Readable | Writeable
161    ///
162    ///
163    /// #### `halign`
164    ///  How to distribute horizontal space if widget gets extra space.
165    ///
166    /// Readable | Writeable
167    ///
168    ///
169    /// #### `has-default`
170    ///  Whether the widget is the default widget.
171    ///
172    /// Readable
173    ///
174    ///
175    /// #### `has-focus`
176    ///  Whether the widget has the input focus.
177    ///
178    /// Readable
179    ///
180    ///
181    /// #### `has-tooltip`
182    ///  Enables or disables the emission of the [`query-tooltip`][struct@crate::gtk::Widget#query-tooltip]
183    /// signal on @widget.
184    ///
185    /// A true value indicates that @widget can have a tooltip, in this case
186    /// the widget will be queried using [`query-tooltip`][struct@crate::gtk::Widget#query-tooltip] to
187    /// determine whether it will provide a tooltip or not.
188    ///
189    /// Readable | Writeable
190    ///
191    ///
192    /// #### `height-request`
193    ///  Overrides for height request of the widget.
194    ///
195    /// If this is -1, the natural request will be used.
196    ///
197    /// Readable | Writeable
198    ///
199    ///
200    /// #### `hexpand`
201    ///  Whether to expand horizontally.
202    ///
203    /// Readable | Writeable
204    ///
205    ///
206    /// #### `hexpand-set`
207    ///  Whether to use the `hexpand` property.
208    ///
209    /// Readable | Writeable
210    ///
211    ///
212    /// #### `layout-manager`
213    ///  The [`gtk::LayoutManager`][crate::gtk::LayoutManager] instance to use to compute
214    /// the preferred size of the widget, and allocate its children.
215    ///
216    /// This property is meant to be set by widget implementations,
217    /// typically in their instance init function.
218    ///
219    /// Readable | Writeable
220    ///
221    ///
222    /// #### `limit-events`
223    ///  Makes this widget act like a modal dialog, with respect to
224    /// event delivery.
225    ///
226    /// Global event controllers will not handle events with targets
227    /// inside the widget, unless they are set up to ignore propagation
228    /// limits. See `Gtk::EventController::set_propagation_limit()`.
229    ///
230    /// Readable | Writeable
231    ///
232    ///
233    /// #### `margin-bottom`
234    ///  Margin on bottom side of widget.
235    ///
236    /// This property adds margin outside of the widget's normal size
237    /// request, the margin will be added in addition to the size from
238    /// [`WidgetExtManual::set_size_request()`][crate::gtk::prelude::WidgetExtManual::set_size_request()] for example.
239    ///
240    /// Readable | Writeable
241    ///
242    ///
243    /// #### `margin-end`
244    ///  Margin on end of widget, horizontally.
245    ///
246    /// This property supports left-to-right and right-to-left text
247    /// directions.
248    ///
249    /// This property adds margin outside of the widget's normal size
250    /// request, the margin will be added in addition to the size from
251    /// [`WidgetExtManual::set_size_request()`][crate::gtk::prelude::WidgetExtManual::set_size_request()] for example.
252    ///
253    /// Readable | Writeable
254    ///
255    ///
256    /// #### `margin-start`
257    ///  Margin on start of widget, horizontally.
258    ///
259    /// This property supports left-to-right and right-to-left text
260    /// directions.
261    ///
262    /// This property adds margin outside of the widget's normal size
263    /// request, the margin will be added in addition to the size from
264    /// [`WidgetExtManual::set_size_request()`][crate::gtk::prelude::WidgetExtManual::set_size_request()] for example.
265    ///
266    /// Readable | Writeable
267    ///
268    ///
269    /// #### `margin-top`
270    ///  Margin on top side of widget.
271    ///
272    /// This property adds margin outside of the widget's normal size
273    /// request, the margin will be added in addition to the size from
274    /// [`WidgetExtManual::set_size_request()`][crate::gtk::prelude::WidgetExtManual::set_size_request()] for example.
275    ///
276    /// Readable | Writeable
277    ///
278    ///
279    /// #### `name`
280    ///  The name of the widget.
281    ///
282    /// Readable | Writeable
283    ///
284    ///
285    /// #### `opacity`
286    ///  The requested opacity of the widget.
287    ///
288    /// Readable | Writeable
289    ///
290    ///
291    /// #### `overflow`
292    ///  How content outside the widget's content area is treated.
293    ///
294    /// This property is meant to be set by widget implementations,
295    /// typically in their instance init function.
296    ///
297    /// Readable | Writeable
298    ///
299    ///
300    /// #### `parent`
301    ///  The parent widget of this widget.
302    ///
303    /// Readable
304    ///
305    ///
306    /// #### `receives-default`
307    ///  Whether the widget will receive the default action when it is focused.
308    ///
309    /// Readable | Writeable
310    ///
311    ///
312    /// #### `root`
313    ///  The [`gtk::Root`][crate::gtk::Root] widget of the widget tree containing this widget.
314    ///
315    /// This will be `NULL` if the widget is not contained in a root widget.
316    ///
317    /// Readable
318    ///
319    ///
320    /// #### `scale-factor`
321    ///  The scale factor of the widget.
322    ///
323    /// Readable
324    ///
325    ///
326    /// #### `sensitive`
327    ///  Whether the widget responds to input.
328    ///
329    /// Readable | Writeable
330    ///
331    ///
332    /// #### `tooltip-markup`
333    ///  Sets the text of tooltip to be the given string, which is marked up
334    /// with Pango markup.
335    ///
336    /// Also see `Gtk::Tooltip::set_markup()`.
337    ///
338    /// This is a convenience property which will take care of getting the
339    /// tooltip shown if the given string is not `NULL`:
340    /// [`has-tooltip`][struct@crate::gtk::Widget#has-tooltip] will automatically be set to true
341    /// and there will be taken care of [`query-tooltip`][struct@crate::gtk::Widget#query-tooltip] in
342    /// the default signal handler.
343    ///
344    /// Note that if both [`tooltip-text`][struct@crate::gtk::Widget#tooltip-text] and
345    /// [`tooltip-markup`][struct@crate::gtk::Widget#tooltip-markup] are set, the last one wins.
346    ///
347    /// Readable | Writeable
348    ///
349    ///
350    /// #### `tooltip-text`
351    ///  Sets the text of tooltip to be the given string.
352    ///
353    /// Also see `Gtk::Tooltip::set_text()`.
354    ///
355    /// This is a convenience property which will take care of getting the
356    /// tooltip shown if the given string is not `NULL`:
357    /// [`has-tooltip`][struct@crate::gtk::Widget#has-tooltip] will automatically be set to true
358    /// and there will be taken care of [`query-tooltip`][struct@crate::gtk::Widget#query-tooltip] in
359    /// the default signal handler.
360    ///
361    /// Note that if both [`tooltip-text`][struct@crate::gtk::Widget#tooltip-text] and
362    /// [`tooltip-markup`][struct@crate::gtk::Widget#tooltip-markup] are set, the last one wins.
363    ///
364    /// Readable | Writeable
365    ///
366    ///
367    /// #### `valign`
368    ///  How to distribute vertical space if widget gets extra space.
369    ///
370    /// Readable | Writeable
371    ///
372    ///
373    /// #### `vexpand`
374    ///  Whether to expand vertically.
375    ///
376    /// Readable | Writeable
377    ///
378    ///
379    /// #### `vexpand-set`
380    ///  Whether to use the `vexpand` property.
381    ///
382    /// Readable | Writeable
383    ///
384    ///
385    /// #### `visible`
386    ///  Whether the widget is visible.
387    ///
388    /// Readable | Writeable
389    ///
390    ///
391    /// #### `width-request`
392    ///  Overrides for width request of the widget.
393    ///
394    /// If this is -1, the natural request will be used.
395    ///
396    /// Readable | Writeable
397    /// </details>
398    /// <details><summary><h4>Accessible</h4></summary>
399    ///
400    ///
401    /// #### `accessible-role`
402    ///  The accessible role of the given [`gtk::Accessible`][crate::gtk::Accessible] implementation.
403    ///
404    /// The accessible role cannot be changed once set.
405    ///
406    /// Readable | Writeable
407    /// </details>
408    /// <details><summary><h4>Orientable</h4></summary>
409    ///
410    ///
411    /// #### `orientation`
412    ///  The orientation of the orientable.
413    ///
414    /// Readable | Writeable
415    /// </details>
416    ///
417    /// ## Signals
418    ///
419    ///
420    /// #### `page-changed`
421    ///  This signal is emitted after a page has been changed.
422    ///
423    /// It can be used to implement "infinite scrolling" by amending the pages
424    /// after every scroll.
425    ///
426    /// ::: note
427    ///     An empty carousel is indicated by `(int)index == -1`.
428    ///
429    ///
430    /// <details><summary><h4>Widget</h4></summary>
431    ///
432    ///
433    /// #### `destroy`
434    ///  Signals that all holders of a reference to the widget should release
435    /// the reference that they hold.
436    ///
437    /// May result in finalization of the widget if all references are released.
438    ///
439    /// This signal is not suitable for saving widget state.
440    ///
441    ///
442    ///
443    ///
444    /// #### `direction-changed`
445    ///  Emitted when the text direction of a widget changes.
446    ///
447    ///
448    ///
449    ///
450    /// #### `hide`
451    ///  Emitted when @widget is hidden.
452    ///
453    ///
454    ///
455    ///
456    /// #### `keynav-failed`
457    ///  Emitted if keyboard navigation fails.
458    ///
459    /// See [`WidgetExtManual::keynav_failed()`][crate::gtk::prelude::WidgetExtManual::keynav_failed()] for details.
460    ///
461    ///
462    ///
463    ///
464    /// #### `map`
465    ///  Emitted when @widget is going to be mapped.
466    ///
467    /// A widget is mapped when the widget is visible (which is controlled with
468    /// [`visible`][struct@crate::gtk::Widget#visible]) and all its parents up to the toplevel widget
469    /// are also visible.
470    ///
471    /// The `::map` signal can be used to determine whether a widget will be drawn,
472    /// for instance it can resume an animation that was stopped during the
473    /// emission of [`unmap`][struct@crate::gtk::Widget#unmap].
474    ///
475    ///
476    ///
477    ///
478    /// #### `mnemonic-activate`
479    ///  Emitted when a widget is activated via a mnemonic.
480    ///
481    /// The default handler for this signal activates @widget if @group_cycling
482    /// is false, or just makes @widget grab focus if @group_cycling is true.
483    ///
484    ///
485    ///
486    ///
487    /// #### `move-focus`
488    ///  Emitted when the focus is moved.
489    ///
490    /// The `::move-focus` signal is a [keybinding signal](class.SignalAction.html).
491    ///
492    /// The default bindings for this signal are <kbd>Tab</kbd> to move forward,
493    /// and <kbd>Shift</kbd>+<kbd>Tab</kbd> to move backward.
494    ///
495    /// Action
496    ///
497    ///
498    /// #### `query-tooltip`
499    ///  Emitted when the widget’s tooltip is about to be shown.
500    ///
501    /// This happens when the [`has-tooltip`][struct@crate::gtk::Widget#has-tooltip] property
502    /// is true and the hover timeout has expired with the cursor hovering
503    /// above @widget; or emitted when @widget got focus in keyboard mode.
504    ///
505    /// Using the given coordinates, the signal handler should determine
506    /// whether a tooltip should be shown for @widget. If this is the case
507    /// true should be returned, false otherwise. Note that if @keyboard_mode
508    /// is true, the values of @x and @y are undefined and should not be used.
509    ///
510    /// The signal handler is free to manipulate @tooltip with the therefore
511    /// destined function calls.
512    ///
513    ///
514    ///
515    ///
516    /// #### `realize`
517    ///  Emitted when @widget is associated with a `GdkSurface`.
518    ///
519    /// This means that [`WidgetExtManual::realize()`][crate::gtk::prelude::WidgetExtManual::realize()] has been called
520    /// or the widget has been mapped (that is, it is going to be drawn).
521    ///
522    ///
523    ///
524    ///
525    /// #### `show`
526    ///  Emitted when @widget is shown.
527    ///
528    ///
529    ///
530    ///
531    /// #### `state-flags-changed`
532    ///  Emitted when the widget state changes.
533    ///
534    /// See [`WidgetExtManual::state_flags()`][crate::gtk::prelude::WidgetExtManual::state_flags()].
535    ///
536    ///
537    ///
538    ///
539    /// #### `unmap`
540    ///  Emitted when @widget is going to be unmapped.
541    ///
542    /// A widget is unmapped when either it or any of its parents up to the
543    /// toplevel widget have been set as hidden.
544    ///
545    /// As `::unmap` indicates that a widget will not be shown any longer,
546    /// it can be used to, for example, stop an animation on the widget.
547    ///
548    ///
549    ///
550    ///
551    /// #### `unrealize`
552    ///  Emitted when the `GdkSurface` associated with @widget is destroyed.
553    ///
554    /// This means that [`WidgetExtManual::unrealize()`][crate::gtk::prelude::WidgetExtManual::unrealize()] has been called
555    /// or the widget has been unmapped (that is, it is going to be hidden).
556    ///
557    ///
558    /// </details>
559    ///
560    /// # Implements
561    ///
562    /// [`trait@gtk::prelude::WidgetExt`], [`trait@glib::ObjectExt`], [`trait@gtk::prelude::AccessibleExt`], [`trait@gtk::prelude::BuildableExt`], [`trait@gtk::prelude::ConstraintTargetExt`], [`SwipeableExt`][trait@crate::prelude::SwipeableExt], [`trait@gtk::prelude::OrientableExt`]
563    #[doc(alias = "AdwCarousel")]
564    pub struct Carousel(Object<ffi::AdwCarousel, ffi::AdwCarouselClass>) @extends gtk::Widget, @implements gtk::Accessible, gtk::Buildable, gtk::ConstraintTarget, Swipeable, gtk::Orientable;
565
566    match fn {
567        type_ => || ffi::adw_carousel_get_type(),
568    }
569}
570
571impl Carousel {
572    /// Creates a new [`Carousel`][crate::Carousel].
573    ///
574    /// # Returns
575    ///
576    /// the newly created [`Carousel`][crate::Carousel]
577    #[doc(alias = "adw_carousel_new")]
578    pub fn new() -> Carousel {
579        assert_initialized_main_thread!();
580        unsafe { gtk::Widget::from_glib_none(ffi::adw_carousel_new()).unsafe_cast() }
581    }
582
583    // rustdoc-stripper-ignore-next
584    /// Creates a new builder-pattern struct instance to construct [`Carousel`] objects.
585    ///
586    /// This method returns an instance of [`CarouselBuilder`](crate::builders::CarouselBuilder) which can be used to create [`Carousel`] objects.
587    pub fn builder() -> CarouselBuilder {
588        CarouselBuilder::new()
589    }
590
591    /// Appends @child to @self.
592    /// ## `child`
593    /// a widget to add
594    #[doc(alias = "adw_carousel_append")]
595    pub fn append(&self, child: &impl IsA<gtk::Widget>) {
596        unsafe {
597            ffi::adw_carousel_append(self.to_glib_none().0, child.as_ref().to_glib_none().0);
598        }
599    }
600
601    /// Gets whether to allow swiping for more than one page at a time.
602    ///
603    /// # Returns
604    ///
605    /// `TRUE` if long swipes are allowed
606    #[doc(alias = "adw_carousel_get_allow_long_swipes")]
607    #[doc(alias = "get_allow_long_swipes")]
608    #[doc(alias = "allow-long-swipes")]
609    pub fn allows_long_swipes(&self) -> bool {
610        unsafe {
611            from_glib(ffi::adw_carousel_get_allow_long_swipes(
612                self.to_glib_none().0,
613            ))
614        }
615    }
616
617    /// Sets whether @self can be dragged with mouse pointer.
618    ///
619    /// # Returns
620    ///
621    /// whether @self can be dragged with mouse pointer
622    #[doc(alias = "adw_carousel_get_allow_mouse_drag")]
623    #[doc(alias = "get_allow_mouse_drag")]
624    #[doc(alias = "allow-mouse-drag")]
625    pub fn allows_mouse_drag(&self) -> bool {
626        unsafe {
627            from_glib(ffi::adw_carousel_get_allow_mouse_drag(
628                self.to_glib_none().0,
629            ))
630        }
631    }
632
633    /// Gets whether @self will respond to scroll wheel events.
634    ///
635    /// # Returns
636    ///
637    /// `TRUE` if @self will respond to scroll wheel events
638    #[doc(alias = "adw_carousel_get_allow_scroll_wheel")]
639    #[doc(alias = "get_allow_scroll_wheel")]
640    #[doc(alias = "allow-scroll-wheel")]
641    pub fn allows_scroll_wheel(&self) -> bool {
642        unsafe {
643            from_glib(ffi::adw_carousel_get_allow_scroll_wheel(
644                self.to_glib_none().0,
645            ))
646        }
647    }
648
649    /// Gets whether @self can be navigated.
650    ///
651    /// # Returns
652    ///
653    /// whether @self can be navigated
654    #[doc(alias = "adw_carousel_get_interactive")]
655    #[doc(alias = "get_interactive")]
656    #[doc(alias = "interactive")]
657    pub fn is_interactive(&self) -> bool {
658        unsafe { from_glib(ffi::adw_carousel_get_interactive(self.to_glib_none().0)) }
659    }
660
661    /// Gets the number of pages in @self.
662    ///
663    /// # Returns
664    ///
665    /// the number of pages in @self
666    #[doc(alias = "adw_carousel_get_n_pages")]
667    #[doc(alias = "get_n_pages")]
668    #[doc(alias = "n-pages")]
669    pub fn n_pages(&self) -> u32 {
670        unsafe { ffi::adw_carousel_get_n_pages(self.to_glib_none().0) }
671    }
672
673    /// Gets current scroll position in @self, unitless.
674    ///
675    /// 1 matches 1 page. Use [`scroll_to()`][Self::scroll_to()] for changing it.
676    ///
677    /// # Returns
678    ///
679    /// the scroll position
680    #[doc(alias = "adw_carousel_get_position")]
681    #[doc(alias = "get_position")]
682    pub fn position(&self) -> f64 {
683        unsafe { ffi::adw_carousel_get_position(self.to_glib_none().0) }
684    }
685
686    /// Gets the page reveal duration, in milliseconds.
687    ///
688    /// # Returns
689    ///
690    /// the duration
691    #[doc(alias = "adw_carousel_get_reveal_duration")]
692    #[doc(alias = "get_reveal_duration")]
693    #[doc(alias = "reveal-duration")]
694    pub fn reveal_duration(&self) -> u32 {
695        unsafe { ffi::adw_carousel_get_reveal_duration(self.to_glib_none().0) }
696    }
697
698    /// Gets the scroll animation spring parameters for @self.
699    ///
700    /// # Returns
701    ///
702    /// the animation parameters
703    #[doc(alias = "adw_carousel_get_scroll_params")]
704    #[doc(alias = "get_scroll_params")]
705    #[doc(alias = "scroll-params")]
706    pub fn scroll_params(&self) -> SpringParams {
707        unsafe { from_glib_full(ffi::adw_carousel_get_scroll_params(self.to_glib_none().0)) }
708    }
709
710    /// Gets spacing between pages in pixels.
711    ///
712    /// # Returns
713    ///
714    /// spacing between pages
715    #[doc(alias = "adw_carousel_get_spacing")]
716    #[doc(alias = "get_spacing")]
717    pub fn spacing(&self) -> u32 {
718        unsafe { ffi::adw_carousel_get_spacing(self.to_glib_none().0) }
719    }
720
721    /// Inserts @child into @self at position @position.
722    ///
723    /// If position is -1, or larger than the number of pages,
724    /// @child will be appended to the end.
725    /// ## `child`
726    /// a widget to add
727    /// ## `position`
728    /// the position to insert @child at
729    #[doc(alias = "adw_carousel_insert")]
730    pub fn insert(&self, child: &impl IsA<gtk::Widget>, position: i32) {
731        unsafe {
732            ffi::adw_carousel_insert(
733                self.to_glib_none().0,
734                child.as_ref().to_glib_none().0,
735                position,
736            );
737        }
738    }
739
740    /// Prepends @child to @self.
741    /// ## `child`
742    /// a widget to add
743    #[doc(alias = "adw_carousel_prepend")]
744    pub fn prepend(&self, child: &impl IsA<gtk::Widget>) {
745        unsafe {
746            ffi::adw_carousel_prepend(self.to_glib_none().0, child.as_ref().to_glib_none().0);
747        }
748    }
749
750    /// Removes @child from @self.
751    /// ## `child`
752    /// a widget to remove
753    #[doc(alias = "adw_carousel_remove")]
754    pub fn remove(&self, child: &impl IsA<gtk::Widget>) {
755        unsafe {
756            ffi::adw_carousel_remove(self.to_glib_none().0, child.as_ref().to_glib_none().0);
757        }
758    }
759
760    /// Moves @child into position @position.
761    ///
762    /// If position is -1, or larger than the number of pages, @child will be moved
763    /// at the end.
764    /// ## `child`
765    /// a widget to add
766    /// ## `position`
767    /// the position to move @child to
768    #[doc(alias = "adw_carousel_reorder")]
769    pub fn reorder(&self, child: &impl IsA<gtk::Widget>, position: i32) {
770        unsafe {
771            ffi::adw_carousel_reorder(
772                self.to_glib_none().0,
773                child.as_ref().to_glib_none().0,
774                position,
775            );
776        }
777    }
778
779    /// Scrolls to @widget.
780    ///
781    /// If @animate is `TRUE`, the transition will be animated.
782    /// ## `widget`
783    /// a child of @self
784    /// ## `animate`
785    /// whether to animate the transition
786    #[doc(alias = "adw_carousel_scroll_to")]
787    pub fn scroll_to(&self, widget: &impl IsA<gtk::Widget>, animate: bool) {
788        unsafe {
789            ffi::adw_carousel_scroll_to(
790                self.to_glib_none().0,
791                widget.as_ref().to_glib_none().0,
792                animate.into_glib(),
793            );
794        }
795    }
796
797    /// Sets whether to allow swiping for more than one page at a time.
798    ///
799    /// If @allow_long_swipes is `FALSE`, each swipe can only move to the adjacent
800    /// pages.
801    /// ## `allow_long_swipes`
802    /// whether to allow long swipes
803    #[doc(alias = "adw_carousel_set_allow_long_swipes")]
804    #[doc(alias = "allow-long-swipes")]
805    pub fn set_allow_long_swipes(&self, allow_long_swipes: bool) {
806        unsafe {
807            ffi::adw_carousel_set_allow_long_swipes(
808                self.to_glib_none().0,
809                allow_long_swipes.into_glib(),
810            );
811        }
812    }
813
814    /// Sets whether @self can be dragged with mouse pointer.
815    ///
816    /// If @allow_mouse_drag is `FALSE`, dragging is only available on touch.
817    /// ## `allow_mouse_drag`
818    /// whether @self can be dragged with mouse pointer
819    #[doc(alias = "adw_carousel_set_allow_mouse_drag")]
820    #[doc(alias = "allow-mouse-drag")]
821    pub fn set_allow_mouse_drag(&self, allow_mouse_drag: bool) {
822        unsafe {
823            ffi::adw_carousel_set_allow_mouse_drag(
824                self.to_glib_none().0,
825                allow_mouse_drag.into_glib(),
826            );
827        }
828    }
829
830    /// Sets whether @self will respond to scroll wheel events.
831    ///
832    /// If @allow_scroll_wheel is `FALSE`, wheel events will be ignored.
833    /// ## `allow_scroll_wheel`
834    /// whether @self will respond to scroll wheel events
835    #[doc(alias = "adw_carousel_set_allow_scroll_wheel")]
836    #[doc(alias = "allow-scroll-wheel")]
837    pub fn set_allow_scroll_wheel(&self, allow_scroll_wheel: bool) {
838        unsafe {
839            ffi::adw_carousel_set_allow_scroll_wheel(
840                self.to_glib_none().0,
841                allow_scroll_wheel.into_glib(),
842            );
843        }
844    }
845
846    /// Sets whether @self can be navigated.
847    ///
848    /// This can be used to temporarily disable the carousel to only allow navigating
849    /// it in a certain state.
850    /// ## `interactive`
851    /// whether @self can be navigated
852    #[doc(alias = "adw_carousel_set_interactive")]
853    #[doc(alias = "interactive")]
854    pub fn set_interactive(&self, interactive: bool) {
855        unsafe {
856            ffi::adw_carousel_set_interactive(self.to_glib_none().0, interactive.into_glib());
857        }
858    }
859
860    /// Sets the page reveal duration, in milliseconds.
861    ///
862    /// Reveal duration is used when animating adding or removing pages.
863    /// ## `reveal_duration`
864    /// the new reveal duration value
865    #[doc(alias = "adw_carousel_set_reveal_duration")]
866    #[doc(alias = "reveal-duration")]
867    pub fn set_reveal_duration(&self, reveal_duration: u32) {
868        unsafe {
869            ffi::adw_carousel_set_reveal_duration(self.to_glib_none().0, reveal_duration);
870        }
871    }
872
873    /// Sets the scroll animation spring parameters for @self.
874    ///
875    /// The default value is equivalent to:
876    ///
877    /// **⚠️ The following code is in c ⚠️**
878    ///
879    /// ```c
880    /// adw_spring_params_new (1, 0.5, 500)
881    /// ```
882    /// ## `params`
883    /// the new parameters
884    #[doc(alias = "adw_carousel_set_scroll_params")]
885    #[doc(alias = "scroll-params")]
886    pub fn set_scroll_params(&self, params: &SpringParams) {
887        unsafe {
888            ffi::adw_carousel_set_scroll_params(self.to_glib_none().0, params.to_glib_none().0);
889        }
890    }
891
892    /// Sets spacing between pages in pixels.
893    /// ## `spacing`
894    /// the new spacing value
895    #[doc(alias = "adw_carousel_set_spacing")]
896    #[doc(alias = "spacing")]
897    pub fn set_spacing(&self, spacing: u32) {
898        unsafe {
899            ffi::adw_carousel_set_spacing(self.to_glib_none().0, spacing);
900        }
901    }
902
903    /// This signal is emitted after a page has been changed.
904    ///
905    /// It can be used to implement "infinite scrolling" by amending the pages
906    /// after every scroll.
907    ///
908    /// ::: note
909    ///     An empty carousel is indicated by `(int)index == -1`.
910    /// ## `index`
911    /// current page
912    #[doc(alias = "page-changed")]
913    pub fn connect_page_changed<F: Fn(&Self, u32) + 'static>(&self, f: F) -> SignalHandlerId {
914        unsafe extern "C" fn page_changed_trampoline<F: Fn(&Carousel, u32) + 'static>(
915            this: *mut ffi::AdwCarousel,
916            index: std::ffi::c_uint,
917            f: glib::ffi::gpointer,
918        ) {
919            unsafe {
920                let f: &F = &*(f as *const F);
921                f(&from_glib_borrow(this), index)
922            }
923        }
924        unsafe {
925            let f: Box_<F> = Box_::new(f);
926            connect_raw(
927                self.as_ptr() as *mut _,
928                c"page-changed".as_ptr(),
929                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
930                    page_changed_trampoline::<F> as *const (),
931                )),
932                Box_::into_raw(f),
933            )
934        }
935    }
936
937    #[doc(alias = "allow-long-swipes")]
938    pub fn connect_allow_long_swipes_notify<F: Fn(&Self) + 'static>(
939        &self,
940        f: F,
941    ) -> SignalHandlerId {
942        unsafe extern "C" fn notify_allow_long_swipes_trampoline<F: Fn(&Carousel) + 'static>(
943            this: *mut ffi::AdwCarousel,
944            _param_spec: glib::ffi::gpointer,
945            f: glib::ffi::gpointer,
946        ) {
947            unsafe {
948                let f: &F = &*(f as *const F);
949                f(&from_glib_borrow(this))
950            }
951        }
952        unsafe {
953            let f: Box_<F> = Box_::new(f);
954            connect_raw(
955                self.as_ptr() as *mut _,
956                c"notify::allow-long-swipes".as_ptr(),
957                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
958                    notify_allow_long_swipes_trampoline::<F> as *const (),
959                )),
960                Box_::into_raw(f),
961            )
962        }
963    }
964
965    #[doc(alias = "allow-mouse-drag")]
966    pub fn connect_allow_mouse_drag_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
967        unsafe extern "C" fn notify_allow_mouse_drag_trampoline<F: Fn(&Carousel) + 'static>(
968            this: *mut ffi::AdwCarousel,
969            _param_spec: glib::ffi::gpointer,
970            f: glib::ffi::gpointer,
971        ) {
972            unsafe {
973                let f: &F = &*(f as *const F);
974                f(&from_glib_borrow(this))
975            }
976        }
977        unsafe {
978            let f: Box_<F> = Box_::new(f);
979            connect_raw(
980                self.as_ptr() as *mut _,
981                c"notify::allow-mouse-drag".as_ptr(),
982                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
983                    notify_allow_mouse_drag_trampoline::<F> as *const (),
984                )),
985                Box_::into_raw(f),
986            )
987        }
988    }
989
990    #[doc(alias = "allow-scroll-wheel")]
991    pub fn connect_allow_scroll_wheel_notify<F: Fn(&Self) + 'static>(
992        &self,
993        f: F,
994    ) -> SignalHandlerId {
995        unsafe extern "C" fn notify_allow_scroll_wheel_trampoline<F: Fn(&Carousel) + 'static>(
996            this: *mut ffi::AdwCarousel,
997            _param_spec: glib::ffi::gpointer,
998            f: glib::ffi::gpointer,
999        ) {
1000            unsafe {
1001                let f: &F = &*(f as *const F);
1002                f(&from_glib_borrow(this))
1003            }
1004        }
1005        unsafe {
1006            let f: Box_<F> = Box_::new(f);
1007            connect_raw(
1008                self.as_ptr() as *mut _,
1009                c"notify::allow-scroll-wheel".as_ptr(),
1010                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1011                    notify_allow_scroll_wheel_trampoline::<F> as *const (),
1012                )),
1013                Box_::into_raw(f),
1014            )
1015        }
1016    }
1017
1018    #[doc(alias = "interactive")]
1019    pub fn connect_interactive_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1020        unsafe extern "C" fn notify_interactive_trampoline<F: Fn(&Carousel) + 'static>(
1021            this: *mut ffi::AdwCarousel,
1022            _param_spec: glib::ffi::gpointer,
1023            f: glib::ffi::gpointer,
1024        ) {
1025            unsafe {
1026                let f: &F = &*(f as *const F);
1027                f(&from_glib_borrow(this))
1028            }
1029        }
1030        unsafe {
1031            let f: Box_<F> = Box_::new(f);
1032            connect_raw(
1033                self.as_ptr() as *mut _,
1034                c"notify::interactive".as_ptr(),
1035                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1036                    notify_interactive_trampoline::<F> as *const (),
1037                )),
1038                Box_::into_raw(f),
1039            )
1040        }
1041    }
1042
1043    #[doc(alias = "n-pages")]
1044    pub fn connect_n_pages_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1045        unsafe extern "C" fn notify_n_pages_trampoline<F: Fn(&Carousel) + 'static>(
1046            this: *mut ffi::AdwCarousel,
1047            _param_spec: glib::ffi::gpointer,
1048            f: glib::ffi::gpointer,
1049        ) {
1050            unsafe {
1051                let f: &F = &*(f as *const F);
1052                f(&from_glib_borrow(this))
1053            }
1054        }
1055        unsafe {
1056            let f: Box_<F> = Box_::new(f);
1057            connect_raw(
1058                self.as_ptr() as *mut _,
1059                c"notify::n-pages".as_ptr(),
1060                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1061                    notify_n_pages_trampoline::<F> as *const (),
1062                )),
1063                Box_::into_raw(f),
1064            )
1065        }
1066    }
1067
1068    #[doc(alias = "position")]
1069    pub fn connect_position_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1070        unsafe extern "C" fn notify_position_trampoline<F: Fn(&Carousel) + 'static>(
1071            this: *mut ffi::AdwCarousel,
1072            _param_spec: glib::ffi::gpointer,
1073            f: glib::ffi::gpointer,
1074        ) {
1075            unsafe {
1076                let f: &F = &*(f as *const F);
1077                f(&from_glib_borrow(this))
1078            }
1079        }
1080        unsafe {
1081            let f: Box_<F> = Box_::new(f);
1082            connect_raw(
1083                self.as_ptr() as *mut _,
1084                c"notify::position".as_ptr(),
1085                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1086                    notify_position_trampoline::<F> as *const (),
1087                )),
1088                Box_::into_raw(f),
1089            )
1090        }
1091    }
1092
1093    #[doc(alias = "reveal-duration")]
1094    pub fn connect_reveal_duration_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1095        unsafe extern "C" fn notify_reveal_duration_trampoline<F: Fn(&Carousel) + 'static>(
1096            this: *mut ffi::AdwCarousel,
1097            _param_spec: glib::ffi::gpointer,
1098            f: glib::ffi::gpointer,
1099        ) {
1100            unsafe {
1101                let f: &F = &*(f as *const F);
1102                f(&from_glib_borrow(this))
1103            }
1104        }
1105        unsafe {
1106            let f: Box_<F> = Box_::new(f);
1107            connect_raw(
1108                self.as_ptr() as *mut _,
1109                c"notify::reveal-duration".as_ptr(),
1110                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1111                    notify_reveal_duration_trampoline::<F> as *const (),
1112                )),
1113                Box_::into_raw(f),
1114            )
1115        }
1116    }
1117
1118    #[doc(alias = "scroll-params")]
1119    pub fn connect_scroll_params_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1120        unsafe extern "C" fn notify_scroll_params_trampoline<F: Fn(&Carousel) + 'static>(
1121            this: *mut ffi::AdwCarousel,
1122            _param_spec: glib::ffi::gpointer,
1123            f: glib::ffi::gpointer,
1124        ) {
1125            unsafe {
1126                let f: &F = &*(f as *const F);
1127                f(&from_glib_borrow(this))
1128            }
1129        }
1130        unsafe {
1131            let f: Box_<F> = Box_::new(f);
1132            connect_raw(
1133                self.as_ptr() as *mut _,
1134                c"notify::scroll-params".as_ptr(),
1135                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1136                    notify_scroll_params_trampoline::<F> as *const (),
1137                )),
1138                Box_::into_raw(f),
1139            )
1140        }
1141    }
1142
1143    #[doc(alias = "spacing")]
1144    pub fn connect_spacing_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1145        unsafe extern "C" fn notify_spacing_trampoline<F: Fn(&Carousel) + 'static>(
1146            this: *mut ffi::AdwCarousel,
1147            _param_spec: glib::ffi::gpointer,
1148            f: glib::ffi::gpointer,
1149        ) {
1150            unsafe {
1151                let f: &F = &*(f as *const F);
1152                f(&from_glib_borrow(this))
1153            }
1154        }
1155        unsafe {
1156            let f: Box_<F> = Box_::new(f);
1157            connect_raw(
1158                self.as_ptr() as *mut _,
1159                c"notify::spacing".as_ptr(),
1160                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1161                    notify_spacing_trampoline::<F> as *const (),
1162                )),
1163                Box_::into_raw(f),
1164            )
1165        }
1166    }
1167}
1168
1169impl Default for Carousel {
1170    fn default() -> Self {
1171        Self::new()
1172    }
1173}
1174
1175// rustdoc-stripper-ignore-next
1176/// A [builder-pattern] type to construct [`Carousel`] objects.
1177///
1178/// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html
1179#[must_use = "The builder must be built to be used"]
1180pub struct CarouselBuilder {
1181    builder: glib::object::ObjectBuilder<'static, Carousel>,
1182}
1183
1184impl CarouselBuilder {
1185    fn new() -> Self {
1186        Self {
1187            builder: glib::object::Object::builder(),
1188        }
1189    }
1190
1191    /// Whether to allow swiping for more than one page at a time.
1192    ///
1193    /// If the value is `FALSE`, each swipe can only move to the adjacent pages.
1194    pub fn allow_long_swipes(self, allow_long_swipes: bool) -> Self {
1195        Self {
1196            builder: self
1197                .builder
1198                .property("allow-long-swipes", allow_long_swipes),
1199        }
1200    }
1201
1202    /// Sets whether the [`Carousel`][crate::Carousel] can be dragged with mouse pointer.
1203    ///
1204    /// If the value is `FALSE`, dragging is only available on touch.
1205    pub fn allow_mouse_drag(self, allow_mouse_drag: bool) -> Self {
1206        Self {
1207            builder: self.builder.property("allow-mouse-drag", allow_mouse_drag),
1208        }
1209    }
1210
1211    /// Whether the widget will respond to scroll wheel events.
1212    ///
1213    /// If the value is `FALSE`, wheel events will be ignored.
1214    pub fn allow_scroll_wheel(self, allow_scroll_wheel: bool) -> Self {
1215        Self {
1216            builder: self
1217                .builder
1218                .property("allow-scroll-wheel", allow_scroll_wheel),
1219        }
1220    }
1221
1222    /// Whether the carousel can be navigated.
1223    ///
1224    /// This can be used to temporarily disable the carousel to only allow
1225    /// navigating it in a certain state.
1226    pub fn interactive(self, interactive: bool) -> Self {
1227        Self {
1228            builder: self.builder.property("interactive", interactive),
1229        }
1230    }
1231
1232    /// Page reveal duration, in milliseconds.
1233    ///
1234    /// Reveal duration is used when animating adding or removing pages.
1235    pub fn reveal_duration(self, reveal_duration: u32) -> Self {
1236        Self {
1237            builder: self.builder.property("reveal-duration", reveal_duration),
1238        }
1239    }
1240
1241    /// Scroll animation spring parameters.
1242    ///
1243    /// The default value is equivalent to:
1244    ///
1245    /// **⚠️ The following code is in c ⚠️**
1246    ///
1247    /// ```c
1248    /// adw_spring_params_new (1, 0.5, 500)
1249    /// ```
1250    pub fn scroll_params(self, scroll_params: &SpringParams) -> Self {
1251        Self {
1252            builder: self
1253                .builder
1254                .property("scroll-params", scroll_params.clone()),
1255        }
1256    }
1257
1258    /// Spacing between pages in pixels.
1259    pub fn spacing(self, spacing: u32) -> Self {
1260        Self {
1261            builder: self.builder.property("spacing", spacing),
1262        }
1263    }
1264
1265    /// Whether the widget or any of its descendents can accept
1266    /// the input focus.
1267    ///
1268    /// This property is meant to be set by widget implementations,
1269    /// typically in their instance init function.
1270    pub fn can_focus(self, can_focus: bool) -> Self {
1271        Self {
1272            builder: self.builder.property("can-focus", can_focus),
1273        }
1274    }
1275
1276    /// Whether the widget can receive pointer events.
1277    pub fn can_target(self, can_target: bool) -> Self {
1278        Self {
1279            builder: self.builder.property("can-target", can_target),
1280        }
1281    }
1282
1283    /// A list of css classes applied to this widget.
1284    pub fn css_classes(self, css_classes: impl Into<glib::StrV>) -> Self {
1285        Self {
1286            builder: self.builder.property("css-classes", css_classes.into()),
1287        }
1288    }
1289
1290    /// The name of this widget in the CSS tree.
1291    ///
1292    /// This property is meant to be set by widget implementations,
1293    /// typically in their instance init function.
1294    pub fn css_name(self, css_name: impl Into<glib::GString>) -> Self {
1295        Self {
1296            builder: self.builder.property("css-name", css_name.into()),
1297        }
1298    }
1299
1300    /// The cursor used by @widget.
1301    pub fn cursor(self, cursor: &gdk::Cursor) -> Self {
1302        Self {
1303            builder: self.builder.property("cursor", cursor.clone()),
1304        }
1305    }
1306
1307    /// Whether the widget should grab focus when it is clicked with the mouse.
1308    ///
1309    /// This property is only relevant for widgets that can take focus.
1310    pub fn focus_on_click(self, focus_on_click: bool) -> Self {
1311        Self {
1312            builder: self.builder.property("focus-on-click", focus_on_click),
1313        }
1314    }
1315
1316    /// Whether this widget itself will accept the input focus.
1317    pub fn focusable(self, focusable: bool) -> Self {
1318        Self {
1319            builder: self.builder.property("focusable", focusable),
1320        }
1321    }
1322
1323    /// How to distribute horizontal space if widget gets extra space.
1324    pub fn halign(self, halign: gtk::Align) -> Self {
1325        Self {
1326            builder: self.builder.property("halign", halign),
1327        }
1328    }
1329
1330    /// Enables or disables the emission of the [`query-tooltip`][struct@crate::gtk::Widget#query-tooltip]
1331    /// signal on @widget.
1332    ///
1333    /// A true value indicates that @widget can have a tooltip, in this case
1334    /// the widget will be queried using [`query-tooltip`][struct@crate::gtk::Widget#query-tooltip] to
1335    /// determine whether it will provide a tooltip or not.
1336    pub fn has_tooltip(self, has_tooltip: bool) -> Self {
1337        Self {
1338            builder: self.builder.property("has-tooltip", has_tooltip),
1339        }
1340    }
1341
1342    /// Overrides for height request of the widget.
1343    ///
1344    /// If this is -1, the natural request will be used.
1345    pub fn height_request(self, height_request: i32) -> Self {
1346        Self {
1347            builder: self.builder.property("height-request", height_request),
1348        }
1349    }
1350
1351    /// Whether to expand horizontally.
1352    pub fn hexpand(self, hexpand: bool) -> Self {
1353        Self {
1354            builder: self.builder.property("hexpand", hexpand),
1355        }
1356    }
1357
1358    /// Whether to use the `hexpand` property.
1359    pub fn hexpand_set(self, hexpand_set: bool) -> Self {
1360        Self {
1361            builder: self.builder.property("hexpand-set", hexpand_set),
1362        }
1363    }
1364
1365    /// The [`gtk::LayoutManager`][crate::gtk::LayoutManager] instance to use to compute
1366    /// the preferred size of the widget, and allocate its children.
1367    ///
1368    /// This property is meant to be set by widget implementations,
1369    /// typically in their instance init function.
1370    pub fn layout_manager(self, layout_manager: &impl IsA<gtk::LayoutManager>) -> Self {
1371        Self {
1372            builder: self
1373                .builder
1374                .property("layout-manager", layout_manager.clone().upcast()),
1375        }
1376    }
1377
1378    /// Makes this widget act like a modal dialog, with respect to
1379    /// event delivery.
1380    ///
1381    /// Global event controllers will not handle events with targets
1382    /// inside the widget, unless they are set up to ignore propagation
1383    /// limits. See `Gtk::EventController::set_propagation_limit()`.
1384    #[cfg(feature = "gtk_v4_18")]
1385    #[cfg_attr(docsrs, doc(cfg(feature = "gtk_v4_18")))]
1386    pub fn limit_events(self, limit_events: bool) -> Self {
1387        Self {
1388            builder: self.builder.property("limit-events", limit_events),
1389        }
1390    }
1391
1392    /// Margin on bottom side of widget.
1393    ///
1394    /// This property adds margin outside of the widget's normal size
1395    /// request, the margin will be added in addition to the size from
1396    /// [`WidgetExtManual::set_size_request()`][crate::gtk::prelude::WidgetExtManual::set_size_request()] for example.
1397    pub fn margin_bottom(self, margin_bottom: i32) -> Self {
1398        Self {
1399            builder: self.builder.property("margin-bottom", margin_bottom),
1400        }
1401    }
1402
1403    /// Margin on end of widget, horizontally.
1404    ///
1405    /// This property supports left-to-right and right-to-left text
1406    /// directions.
1407    ///
1408    /// This property adds margin outside of the widget's normal size
1409    /// request, the margin will be added in addition to the size from
1410    /// [`WidgetExtManual::set_size_request()`][crate::gtk::prelude::WidgetExtManual::set_size_request()] for example.
1411    pub fn margin_end(self, margin_end: i32) -> Self {
1412        Self {
1413            builder: self.builder.property("margin-end", margin_end),
1414        }
1415    }
1416
1417    /// Margin on start of widget, horizontally.
1418    ///
1419    /// This property supports left-to-right and right-to-left text
1420    /// directions.
1421    ///
1422    /// This property adds margin outside of the widget's normal size
1423    /// request, the margin will be added in addition to the size from
1424    /// [`WidgetExtManual::set_size_request()`][crate::gtk::prelude::WidgetExtManual::set_size_request()] for example.
1425    pub fn margin_start(self, margin_start: i32) -> Self {
1426        Self {
1427            builder: self.builder.property("margin-start", margin_start),
1428        }
1429    }
1430
1431    /// Margin on top side of widget.
1432    ///
1433    /// This property adds margin outside of the widget's normal size
1434    /// request, the margin will be added in addition to the size from
1435    /// [`WidgetExtManual::set_size_request()`][crate::gtk::prelude::WidgetExtManual::set_size_request()] for example.
1436    pub fn margin_top(self, margin_top: i32) -> Self {
1437        Self {
1438            builder: self.builder.property("margin-top", margin_top),
1439        }
1440    }
1441
1442    /// The name of the widget.
1443    pub fn name(self, name: impl Into<glib::GString>) -> Self {
1444        Self {
1445            builder: self.builder.property("name", name.into()),
1446        }
1447    }
1448
1449    /// The requested opacity of the widget.
1450    pub fn opacity(self, opacity: f64) -> Self {
1451        Self {
1452            builder: self.builder.property("opacity", opacity),
1453        }
1454    }
1455
1456    /// How content outside the widget's content area is treated.
1457    ///
1458    /// This property is meant to be set by widget implementations,
1459    /// typically in their instance init function.
1460    pub fn overflow(self, overflow: gtk::Overflow) -> Self {
1461        Self {
1462            builder: self.builder.property("overflow", overflow),
1463        }
1464    }
1465
1466    /// Whether the widget will receive the default action when it is focused.
1467    pub fn receives_default(self, receives_default: bool) -> Self {
1468        Self {
1469            builder: self.builder.property("receives-default", receives_default),
1470        }
1471    }
1472
1473    /// Whether the widget responds to input.
1474    pub fn sensitive(self, sensitive: bool) -> Self {
1475        Self {
1476            builder: self.builder.property("sensitive", sensitive),
1477        }
1478    }
1479
1480    /// Sets the text of tooltip to be the given string, which is marked up
1481    /// with Pango markup.
1482    ///
1483    /// Also see `Gtk::Tooltip::set_markup()`.
1484    ///
1485    /// This is a convenience property which will take care of getting the
1486    /// tooltip shown if the given string is not `NULL`:
1487    /// [`has-tooltip`][struct@crate::gtk::Widget#has-tooltip] will automatically be set to true
1488    /// and there will be taken care of [`query-tooltip`][struct@crate::gtk::Widget#query-tooltip] in
1489    /// the default signal handler.
1490    ///
1491    /// Note that if both [`tooltip-text`][struct@crate::gtk::Widget#tooltip-text] and
1492    /// [`tooltip-markup`][struct@crate::gtk::Widget#tooltip-markup] are set, the last one wins.
1493    pub fn tooltip_markup(self, tooltip_markup: impl Into<glib::GString>) -> Self {
1494        Self {
1495            builder: self
1496                .builder
1497                .property("tooltip-markup", tooltip_markup.into()),
1498        }
1499    }
1500
1501    /// Sets the text of tooltip to be the given string.
1502    ///
1503    /// Also see `Gtk::Tooltip::set_text()`.
1504    ///
1505    /// This is a convenience property which will take care of getting the
1506    /// tooltip shown if the given string is not `NULL`:
1507    /// [`has-tooltip`][struct@crate::gtk::Widget#has-tooltip] will automatically be set to true
1508    /// and there will be taken care of [`query-tooltip`][struct@crate::gtk::Widget#query-tooltip] in
1509    /// the default signal handler.
1510    ///
1511    /// Note that if both [`tooltip-text`][struct@crate::gtk::Widget#tooltip-text] and
1512    /// [`tooltip-markup`][struct@crate::gtk::Widget#tooltip-markup] are set, the last one wins.
1513    pub fn tooltip_text(self, tooltip_text: impl Into<glib::GString>) -> Self {
1514        Self {
1515            builder: self.builder.property("tooltip-text", tooltip_text.into()),
1516        }
1517    }
1518
1519    /// How to distribute vertical space if widget gets extra space.
1520    pub fn valign(self, valign: gtk::Align) -> Self {
1521        Self {
1522            builder: self.builder.property("valign", valign),
1523        }
1524    }
1525
1526    /// Whether to expand vertically.
1527    pub fn vexpand(self, vexpand: bool) -> Self {
1528        Self {
1529            builder: self.builder.property("vexpand", vexpand),
1530        }
1531    }
1532
1533    /// Whether to use the `vexpand` property.
1534    pub fn vexpand_set(self, vexpand_set: bool) -> Self {
1535        Self {
1536            builder: self.builder.property("vexpand-set", vexpand_set),
1537        }
1538    }
1539
1540    /// Whether the widget is visible.
1541    pub fn visible(self, visible: bool) -> Self {
1542        Self {
1543            builder: self.builder.property("visible", visible),
1544        }
1545    }
1546
1547    /// Overrides for width request of the widget.
1548    ///
1549    /// If this is -1, the natural request will be used.
1550    pub fn width_request(self, width_request: i32) -> Self {
1551        Self {
1552            builder: self.builder.property("width-request", width_request),
1553        }
1554    }
1555
1556    /// The accessible role of the given [`gtk::Accessible`][crate::gtk::Accessible] implementation.
1557    ///
1558    /// The accessible role cannot be changed once set.
1559    pub fn accessible_role(self, accessible_role: gtk::AccessibleRole) -> Self {
1560        Self {
1561            builder: self.builder.property("accessible-role", accessible_role),
1562        }
1563    }
1564
1565    /// The orientation of the orientable.
1566    pub fn orientation(self, orientation: gtk::Orientation) -> Self {
1567        Self {
1568            builder: self.builder.property("orientation", orientation),
1569        }
1570    }
1571
1572    // rustdoc-stripper-ignore-next
1573    /// Build the [`Carousel`].
1574    #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"]
1575    pub fn build(self) -> Carousel {
1576        assert_initialized_main_thread!();
1577        self.builder.build()
1578    }
1579}