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