libadwaita/auto/
carousel_indicator_lines.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::{ffi, Carousel};
7use glib::{
8    prelude::*,
9    signal::{connect_raw, SignalHandlerId},
10    translate::*,
11};
12use std::boxed::Box as Box_;
13
14glib::wrapper! {
15    #[doc(alias = "AdwCarouselIndicatorLines")]
16    pub struct CarouselIndicatorLines(Object<ffi::AdwCarouselIndicatorLines, ffi::AdwCarouselIndicatorLinesClass>) @extends gtk::Widget, @implements gtk::Accessible, gtk::Buildable, gtk::ConstraintTarget, gtk::Orientable;
17
18    match fn {
19        type_ => || ffi::adw_carousel_indicator_lines_get_type(),
20    }
21}
22
23impl CarouselIndicatorLines {
24    #[doc(alias = "adw_carousel_indicator_lines_new")]
25    pub fn new() -> CarouselIndicatorLines {
26        assert_initialized_main_thread!();
27        unsafe {
28            gtk::Widget::from_glib_none(ffi::adw_carousel_indicator_lines_new()).unsafe_cast()
29        }
30    }
31
32    // rustdoc-stripper-ignore-next
33    /// Creates a new builder-pattern struct instance to construct [`CarouselIndicatorLines`] objects.
34    ///
35    /// This method returns an instance of [`CarouselIndicatorLinesBuilder`](crate::builders::CarouselIndicatorLinesBuilder) which can be used to create [`CarouselIndicatorLines`] objects.
36    pub fn builder() -> CarouselIndicatorLinesBuilder {
37        CarouselIndicatorLinesBuilder::new()
38    }
39
40    #[doc(alias = "adw_carousel_indicator_lines_get_carousel")]
41    #[doc(alias = "get_carousel")]
42    pub fn carousel(&self) -> Option<Carousel> {
43        unsafe {
44            from_glib_none(ffi::adw_carousel_indicator_lines_get_carousel(
45                self.to_glib_none().0,
46            ))
47        }
48    }
49
50    #[doc(alias = "adw_carousel_indicator_lines_set_carousel")]
51    #[doc(alias = "carousel")]
52    pub fn set_carousel(&self, carousel: Option<&Carousel>) {
53        unsafe {
54            ffi::adw_carousel_indicator_lines_set_carousel(
55                self.to_glib_none().0,
56                carousel.to_glib_none().0,
57            );
58        }
59    }
60
61    #[doc(alias = "carousel")]
62    pub fn connect_carousel_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
63        unsafe extern "C" fn notify_carousel_trampoline<
64            F: Fn(&CarouselIndicatorLines) + 'static,
65        >(
66            this: *mut ffi::AdwCarouselIndicatorLines,
67            _param_spec: glib::ffi::gpointer,
68            f: glib::ffi::gpointer,
69        ) {
70            let f: &F = &*(f as *const F);
71            f(&from_glib_borrow(this))
72        }
73        unsafe {
74            let f: Box_<F> = Box_::new(f);
75            connect_raw(
76                self.as_ptr() as *mut _,
77                c"notify::carousel".as_ptr() as *const _,
78                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
79                    notify_carousel_trampoline::<F> as *const (),
80                )),
81                Box_::into_raw(f),
82            )
83        }
84    }
85}
86
87impl Default for CarouselIndicatorLines {
88    fn default() -> Self {
89        Self::new()
90    }
91}
92
93// rustdoc-stripper-ignore-next
94/// A [builder-pattern] type to construct [`CarouselIndicatorLines`] objects.
95///
96/// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html
97#[must_use = "The builder must be built to be used"]
98pub struct CarouselIndicatorLinesBuilder {
99    builder: glib::object::ObjectBuilder<'static, CarouselIndicatorLines>,
100}
101
102impl CarouselIndicatorLinesBuilder {
103    fn new() -> Self {
104        Self {
105            builder: glib::object::Object::builder(),
106        }
107    }
108
109    pub fn carousel(self, carousel: &Carousel) -> Self {
110        Self {
111            builder: self.builder.property("carousel", carousel.clone()),
112        }
113    }
114
115    pub fn can_focus(self, can_focus: bool) -> Self {
116        Self {
117            builder: self.builder.property("can-focus", can_focus),
118        }
119    }
120
121    pub fn can_target(self, can_target: bool) -> Self {
122        Self {
123            builder: self.builder.property("can-target", can_target),
124        }
125    }
126
127    pub fn css_classes(self, css_classes: impl Into<glib::StrV>) -> Self {
128        Self {
129            builder: self.builder.property("css-classes", css_classes.into()),
130        }
131    }
132
133    pub fn css_name(self, css_name: impl Into<glib::GString>) -> Self {
134        Self {
135            builder: self.builder.property("css-name", css_name.into()),
136        }
137    }
138
139    pub fn cursor(self, cursor: &gdk::Cursor) -> Self {
140        Self {
141            builder: self.builder.property("cursor", cursor.clone()),
142        }
143    }
144
145    pub fn focus_on_click(self, focus_on_click: bool) -> Self {
146        Self {
147            builder: self.builder.property("focus-on-click", focus_on_click),
148        }
149    }
150
151    pub fn focusable(self, focusable: bool) -> Self {
152        Self {
153            builder: self.builder.property("focusable", focusable),
154        }
155    }
156
157    pub fn halign(self, halign: gtk::Align) -> Self {
158        Self {
159            builder: self.builder.property("halign", halign),
160        }
161    }
162
163    pub fn has_tooltip(self, has_tooltip: bool) -> Self {
164        Self {
165            builder: self.builder.property("has-tooltip", has_tooltip),
166        }
167    }
168
169    pub fn height_request(self, height_request: i32) -> Self {
170        Self {
171            builder: self.builder.property("height-request", height_request),
172        }
173    }
174
175    pub fn hexpand(self, hexpand: bool) -> Self {
176        Self {
177            builder: self.builder.property("hexpand", hexpand),
178        }
179    }
180
181    pub fn hexpand_set(self, hexpand_set: bool) -> Self {
182        Self {
183            builder: self.builder.property("hexpand-set", hexpand_set),
184        }
185    }
186
187    pub fn layout_manager(self, layout_manager: &impl IsA<gtk::LayoutManager>) -> Self {
188        Self {
189            builder: self
190                .builder
191                .property("layout-manager", layout_manager.clone().upcast()),
192        }
193    }
194
195    #[cfg(feature = "gtk_v4_18")]
196    #[cfg_attr(docsrs, doc(cfg(feature = "gtk_v4_18")))]
197    pub fn limit_events(self, limit_events: bool) -> Self {
198        Self {
199            builder: self.builder.property("limit-events", limit_events),
200        }
201    }
202
203    pub fn margin_bottom(self, margin_bottom: i32) -> Self {
204        Self {
205            builder: self.builder.property("margin-bottom", margin_bottom),
206        }
207    }
208
209    pub fn margin_end(self, margin_end: i32) -> Self {
210        Self {
211            builder: self.builder.property("margin-end", margin_end),
212        }
213    }
214
215    pub fn margin_start(self, margin_start: i32) -> Self {
216        Self {
217            builder: self.builder.property("margin-start", margin_start),
218        }
219    }
220
221    pub fn margin_top(self, margin_top: i32) -> Self {
222        Self {
223            builder: self.builder.property("margin-top", margin_top),
224        }
225    }
226
227    pub fn name(self, name: impl Into<glib::GString>) -> Self {
228        Self {
229            builder: self.builder.property("name", name.into()),
230        }
231    }
232
233    pub fn opacity(self, opacity: f64) -> Self {
234        Self {
235            builder: self.builder.property("opacity", opacity),
236        }
237    }
238
239    pub fn overflow(self, overflow: gtk::Overflow) -> Self {
240        Self {
241            builder: self.builder.property("overflow", overflow),
242        }
243    }
244
245    pub fn receives_default(self, receives_default: bool) -> Self {
246        Self {
247            builder: self.builder.property("receives-default", receives_default),
248        }
249    }
250
251    pub fn sensitive(self, sensitive: bool) -> Self {
252        Self {
253            builder: self.builder.property("sensitive", sensitive),
254        }
255    }
256
257    pub fn tooltip_markup(self, tooltip_markup: impl Into<glib::GString>) -> Self {
258        Self {
259            builder: self
260                .builder
261                .property("tooltip-markup", tooltip_markup.into()),
262        }
263    }
264
265    pub fn tooltip_text(self, tooltip_text: impl Into<glib::GString>) -> Self {
266        Self {
267            builder: self.builder.property("tooltip-text", tooltip_text.into()),
268        }
269    }
270
271    pub fn valign(self, valign: gtk::Align) -> Self {
272        Self {
273            builder: self.builder.property("valign", valign),
274        }
275    }
276
277    pub fn vexpand(self, vexpand: bool) -> Self {
278        Self {
279            builder: self.builder.property("vexpand", vexpand),
280        }
281    }
282
283    pub fn vexpand_set(self, vexpand_set: bool) -> Self {
284        Self {
285            builder: self.builder.property("vexpand-set", vexpand_set),
286        }
287    }
288
289    pub fn visible(self, visible: bool) -> Self {
290        Self {
291            builder: self.builder.property("visible", visible),
292        }
293    }
294
295    pub fn width_request(self, width_request: i32) -> Self {
296        Self {
297            builder: self.builder.property("width-request", width_request),
298        }
299    }
300
301    pub fn accessible_role(self, accessible_role: gtk::AccessibleRole) -> Self {
302        Self {
303            builder: self.builder.property("accessible-role", accessible_role),
304        }
305    }
306
307    pub fn orientation(self, orientation: gtk::Orientation) -> Self {
308        Self {
309            builder: self.builder.property("orientation", orientation),
310        }
311    }
312
313    // rustdoc-stripper-ignore-next
314    /// Build the [`CarouselIndicatorLines`].
315    #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"]
316    pub fn build(self) -> CarouselIndicatorLines {
317        assert_initialized_main_thread!();
318        self.builder.build()
319    }
320}