Skip to main content

libadwaita/auto/
spin_row.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::{ActionRow, PreferencesRow, 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    #[doc(alias = "AdwSpinRow")]
17    pub struct SpinRow(Object<ffi::AdwSpinRow, ffi::AdwSpinRowClass>) @extends ActionRow, PreferencesRow, gtk::ListBoxRow, gtk::Widget, @implements gtk::Accessible, gtk::Buildable, gtk::ConstraintTarget, gtk::Actionable, gtk::Editable;
18
19    match fn {
20        type_ => || ffi::adw_spin_row_get_type(),
21    }
22}
23
24impl SpinRow {
25    #[doc(alias = "adw_spin_row_new")]
26    pub fn new(
27        adjustment: Option<&impl IsA<gtk::Adjustment>>,
28        climb_rate: f64,
29        digits: u32,
30    ) -> SpinRow {
31        assert_initialized_main_thread!();
32        unsafe {
33            gtk::Widget::from_glib_none(ffi::adw_spin_row_new(
34                adjustment.map(|p| p.as_ref()).to_glib_none().0,
35                climb_rate,
36                digits,
37            ))
38            .unsafe_cast()
39        }
40    }
41
42    #[doc(alias = "adw_spin_row_new_with_range")]
43    #[doc(alias = "new_with_range")]
44    pub fn with_range(min: f64, max: f64, step: f64) -> SpinRow {
45        assert_initialized_main_thread!();
46        unsafe {
47            gtk::Widget::from_glib_none(ffi::adw_spin_row_new_with_range(min, max, step))
48                .unsafe_cast()
49        }
50    }
51
52    // rustdoc-stripper-ignore-next
53    /// Creates a new builder-pattern struct instance to construct [`SpinRow`] objects.
54    ///
55    /// This method returns an instance of [`SpinRowBuilder`](crate::builders::SpinRowBuilder) which can be used to create [`SpinRow`] objects.
56    pub fn builder() -> SpinRowBuilder {
57        SpinRowBuilder::new()
58    }
59
60    #[doc(alias = "adw_spin_row_configure")]
61    pub fn configure(
62        &self,
63        adjustment: Option<&impl IsA<gtk::Adjustment>>,
64        climb_rate: f64,
65        digits: u32,
66    ) {
67        unsafe {
68            ffi::adw_spin_row_configure(
69                self.to_glib_none().0,
70                adjustment.map(|p| p.as_ref()).to_glib_none().0,
71                climb_rate,
72                digits,
73            );
74        }
75    }
76
77    #[doc(alias = "adw_spin_row_get_adjustment")]
78    #[doc(alias = "get_adjustment")]
79    pub fn adjustment(&self) -> gtk::Adjustment {
80        unsafe { from_glib_none(ffi::adw_spin_row_get_adjustment(self.to_glib_none().0)) }
81    }
82
83    #[doc(alias = "adw_spin_row_get_climb_rate")]
84    #[doc(alias = "get_climb_rate")]
85    #[doc(alias = "climb-rate")]
86    pub fn climb_rate(&self) -> f64 {
87        unsafe { ffi::adw_spin_row_get_climb_rate(self.to_glib_none().0) }
88    }
89
90    #[doc(alias = "adw_spin_row_get_digits")]
91    #[doc(alias = "get_digits")]
92    pub fn digits(&self) -> u32 {
93        unsafe { ffi::adw_spin_row_get_digits(self.to_glib_none().0) }
94    }
95
96    #[doc(alias = "adw_spin_row_get_numeric")]
97    #[doc(alias = "get_numeric")]
98    #[doc(alias = "numeric")]
99    pub fn is_numeric(&self) -> bool {
100        unsafe { from_glib(ffi::adw_spin_row_get_numeric(self.to_glib_none().0)) }
101    }
102
103    #[doc(alias = "adw_spin_row_get_snap_to_ticks")]
104    #[doc(alias = "get_snap_to_ticks")]
105    #[doc(alias = "snap-to-ticks")]
106    pub fn snaps_to_ticks(&self) -> bool {
107        unsafe { from_glib(ffi::adw_spin_row_get_snap_to_ticks(self.to_glib_none().0)) }
108    }
109
110    #[doc(alias = "adw_spin_row_get_update_policy")]
111    #[doc(alias = "get_update_policy")]
112    #[doc(alias = "update-policy")]
113    pub fn update_policy(&self) -> gtk::SpinButtonUpdatePolicy {
114        unsafe { from_glib(ffi::adw_spin_row_get_update_policy(self.to_glib_none().0)) }
115    }
116
117    #[doc(alias = "adw_spin_row_get_value")]
118    #[doc(alias = "get_value")]
119    pub fn value(&self) -> f64 {
120        unsafe { ffi::adw_spin_row_get_value(self.to_glib_none().0) }
121    }
122
123    #[doc(alias = "adw_spin_row_get_wrap")]
124    #[doc(alias = "get_wrap")]
125    #[doc(alias = "wrap")]
126    pub fn wraps(&self) -> bool {
127        unsafe { from_glib(ffi::adw_spin_row_get_wrap(self.to_glib_none().0)) }
128    }
129
130    #[doc(alias = "adw_spin_row_set_adjustment")]
131    #[doc(alias = "adjustment")]
132    pub fn set_adjustment(&self, adjustment: Option<&impl IsA<gtk::Adjustment>>) {
133        unsafe {
134            ffi::adw_spin_row_set_adjustment(
135                self.to_glib_none().0,
136                adjustment.map(|p| p.as_ref()).to_glib_none().0,
137            );
138        }
139    }
140
141    #[doc(alias = "adw_spin_row_set_climb_rate")]
142    #[doc(alias = "climb-rate")]
143    pub fn set_climb_rate(&self, climb_rate: f64) {
144        unsafe {
145            ffi::adw_spin_row_set_climb_rate(self.to_glib_none().0, climb_rate);
146        }
147    }
148
149    #[doc(alias = "adw_spin_row_set_digits")]
150    #[doc(alias = "digits")]
151    pub fn set_digits(&self, digits: u32) {
152        unsafe {
153            ffi::adw_spin_row_set_digits(self.to_glib_none().0, digits);
154        }
155    }
156
157    #[doc(alias = "adw_spin_row_set_numeric")]
158    #[doc(alias = "numeric")]
159    pub fn set_numeric(&self, numeric: bool) {
160        unsafe {
161            ffi::adw_spin_row_set_numeric(self.to_glib_none().0, numeric.into_glib());
162        }
163    }
164
165    #[doc(alias = "adw_spin_row_set_range")]
166    pub fn set_range(&self, min: f64, max: f64) {
167        unsafe {
168            ffi::adw_spin_row_set_range(self.to_glib_none().0, min, max);
169        }
170    }
171
172    #[doc(alias = "adw_spin_row_set_snap_to_ticks")]
173    #[doc(alias = "snap-to-ticks")]
174    pub fn set_snap_to_ticks(&self, snap_to_ticks: bool) {
175        unsafe {
176            ffi::adw_spin_row_set_snap_to_ticks(self.to_glib_none().0, snap_to_ticks.into_glib());
177        }
178    }
179
180    #[doc(alias = "adw_spin_row_set_update_policy")]
181    #[doc(alias = "update-policy")]
182    pub fn set_update_policy(&self, policy: gtk::SpinButtonUpdatePolicy) {
183        unsafe {
184            ffi::adw_spin_row_set_update_policy(self.to_glib_none().0, policy.into_glib());
185        }
186    }
187
188    #[doc(alias = "adw_spin_row_set_value")]
189    #[doc(alias = "value")]
190    pub fn set_value(&self, value: f64) {
191        unsafe {
192            ffi::adw_spin_row_set_value(self.to_glib_none().0, value);
193        }
194    }
195
196    #[doc(alias = "adw_spin_row_set_wrap")]
197    #[doc(alias = "wrap")]
198    pub fn set_wrap(&self, wrap: bool) {
199        unsafe {
200            ffi::adw_spin_row_set_wrap(self.to_glib_none().0, wrap.into_glib());
201        }
202    }
203
204    #[doc(alias = "adw_spin_row_update")]
205    pub fn update(&self) {
206        unsafe {
207            ffi::adw_spin_row_update(self.to_glib_none().0);
208        }
209    }
210
211    #[cfg(feature = "v1_4")]
212    #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))]
213    #[doc(alias = "output")]
214    pub fn connect_output<F: Fn(&Self) -> bool + 'static>(&self, f: F) -> SignalHandlerId {
215        unsafe extern "C" fn output_trampoline<F: Fn(&SpinRow) -> bool + 'static>(
216            this: *mut ffi::AdwSpinRow,
217            f: glib::ffi::gpointer,
218        ) -> glib::ffi::gboolean {
219            unsafe {
220                let f: &F = &*(f as *const F);
221                f(&from_glib_borrow(this)).into_glib()
222            }
223        }
224        unsafe {
225            let f: Box_<F> = Box_::new(f);
226            connect_raw(
227                self.as_ptr() as *mut _,
228                c"output".as_ptr(),
229                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
230                    output_trampoline::<F> as *const (),
231                )),
232                Box_::into_raw(f),
233            )
234        }
235    }
236
237    #[cfg(feature = "v1_4")]
238    #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))]
239    #[doc(alias = "wrapped")]
240    pub fn connect_wrapped<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
241        unsafe extern "C" fn wrapped_trampoline<F: Fn(&SpinRow) + 'static>(
242            this: *mut ffi::AdwSpinRow,
243            f: glib::ffi::gpointer,
244        ) {
245            unsafe {
246                let f: &F = &*(f as *const F);
247                f(&from_glib_borrow(this))
248            }
249        }
250        unsafe {
251            let f: Box_<F> = Box_::new(f);
252            connect_raw(
253                self.as_ptr() as *mut _,
254                c"wrapped".as_ptr(),
255                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
256                    wrapped_trampoline::<F> as *const (),
257                )),
258                Box_::into_raw(f),
259            )
260        }
261    }
262
263    #[cfg(feature = "v1_4")]
264    #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))]
265    #[doc(alias = "adjustment")]
266    pub fn connect_adjustment_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
267        unsafe extern "C" fn notify_adjustment_trampoline<F: Fn(&SpinRow) + 'static>(
268            this: *mut ffi::AdwSpinRow,
269            _param_spec: glib::ffi::gpointer,
270            f: glib::ffi::gpointer,
271        ) {
272            unsafe {
273                let f: &F = &*(f as *const F);
274                f(&from_glib_borrow(this))
275            }
276        }
277        unsafe {
278            let f: Box_<F> = Box_::new(f);
279            connect_raw(
280                self.as_ptr() as *mut _,
281                c"notify::adjustment".as_ptr(),
282                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
283                    notify_adjustment_trampoline::<F> as *const (),
284                )),
285                Box_::into_raw(f),
286            )
287        }
288    }
289
290    #[cfg(feature = "v1_4")]
291    #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))]
292    #[doc(alias = "climb-rate")]
293    pub fn connect_climb_rate_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
294        unsafe extern "C" fn notify_climb_rate_trampoline<F: Fn(&SpinRow) + 'static>(
295            this: *mut ffi::AdwSpinRow,
296            _param_spec: glib::ffi::gpointer,
297            f: glib::ffi::gpointer,
298        ) {
299            unsafe {
300                let f: &F = &*(f as *const F);
301                f(&from_glib_borrow(this))
302            }
303        }
304        unsafe {
305            let f: Box_<F> = Box_::new(f);
306            connect_raw(
307                self.as_ptr() as *mut _,
308                c"notify::climb-rate".as_ptr(),
309                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
310                    notify_climb_rate_trampoline::<F> as *const (),
311                )),
312                Box_::into_raw(f),
313            )
314        }
315    }
316
317    #[cfg(feature = "v1_4")]
318    #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))]
319    #[doc(alias = "digits")]
320    pub fn connect_digits_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
321        unsafe extern "C" fn notify_digits_trampoline<F: Fn(&SpinRow) + 'static>(
322            this: *mut ffi::AdwSpinRow,
323            _param_spec: glib::ffi::gpointer,
324            f: glib::ffi::gpointer,
325        ) {
326            unsafe {
327                let f: &F = &*(f as *const F);
328                f(&from_glib_borrow(this))
329            }
330        }
331        unsafe {
332            let f: Box_<F> = Box_::new(f);
333            connect_raw(
334                self.as_ptr() as *mut _,
335                c"notify::digits".as_ptr(),
336                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
337                    notify_digits_trampoline::<F> as *const (),
338                )),
339                Box_::into_raw(f),
340            )
341        }
342    }
343
344    #[cfg(feature = "v1_4")]
345    #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))]
346    #[doc(alias = "numeric")]
347    pub fn connect_numeric_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
348        unsafe extern "C" fn notify_numeric_trampoline<F: Fn(&SpinRow) + 'static>(
349            this: *mut ffi::AdwSpinRow,
350            _param_spec: glib::ffi::gpointer,
351            f: glib::ffi::gpointer,
352        ) {
353            unsafe {
354                let f: &F = &*(f as *const F);
355                f(&from_glib_borrow(this))
356            }
357        }
358        unsafe {
359            let f: Box_<F> = Box_::new(f);
360            connect_raw(
361                self.as_ptr() as *mut _,
362                c"notify::numeric".as_ptr(),
363                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
364                    notify_numeric_trampoline::<F> as *const (),
365                )),
366                Box_::into_raw(f),
367            )
368        }
369    }
370
371    #[cfg(feature = "v1_4")]
372    #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))]
373    #[doc(alias = "snap-to-ticks")]
374    pub fn connect_snap_to_ticks_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
375        unsafe extern "C" fn notify_snap_to_ticks_trampoline<F: Fn(&SpinRow) + 'static>(
376            this: *mut ffi::AdwSpinRow,
377            _param_spec: glib::ffi::gpointer,
378            f: glib::ffi::gpointer,
379        ) {
380            unsafe {
381                let f: &F = &*(f as *const F);
382                f(&from_glib_borrow(this))
383            }
384        }
385        unsafe {
386            let f: Box_<F> = Box_::new(f);
387            connect_raw(
388                self.as_ptr() as *mut _,
389                c"notify::snap-to-ticks".as_ptr(),
390                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
391                    notify_snap_to_ticks_trampoline::<F> as *const (),
392                )),
393                Box_::into_raw(f),
394            )
395        }
396    }
397
398    #[cfg(feature = "v1_4")]
399    #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))]
400    #[doc(alias = "update-policy")]
401    pub fn connect_update_policy_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
402        unsafe extern "C" fn notify_update_policy_trampoline<F: Fn(&SpinRow) + 'static>(
403            this: *mut ffi::AdwSpinRow,
404            _param_spec: glib::ffi::gpointer,
405            f: glib::ffi::gpointer,
406        ) {
407            unsafe {
408                let f: &F = &*(f as *const F);
409                f(&from_glib_borrow(this))
410            }
411        }
412        unsafe {
413            let f: Box_<F> = Box_::new(f);
414            connect_raw(
415                self.as_ptr() as *mut _,
416                c"notify::update-policy".as_ptr(),
417                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
418                    notify_update_policy_trampoline::<F> as *const (),
419                )),
420                Box_::into_raw(f),
421            )
422        }
423    }
424
425    #[cfg(feature = "v1_4")]
426    #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))]
427    #[doc(alias = "value")]
428    pub fn connect_value_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
429        unsafe extern "C" fn notify_value_trampoline<F: Fn(&SpinRow) + 'static>(
430            this: *mut ffi::AdwSpinRow,
431            _param_spec: glib::ffi::gpointer,
432            f: glib::ffi::gpointer,
433        ) {
434            unsafe {
435                let f: &F = &*(f as *const F);
436                f(&from_glib_borrow(this))
437            }
438        }
439        unsafe {
440            let f: Box_<F> = Box_::new(f);
441            connect_raw(
442                self.as_ptr() as *mut _,
443                c"notify::value".as_ptr(),
444                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
445                    notify_value_trampoline::<F> as *const (),
446                )),
447                Box_::into_raw(f),
448            )
449        }
450    }
451
452    #[cfg(feature = "v1_4")]
453    #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))]
454    #[doc(alias = "wrap")]
455    pub fn connect_wrap_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
456        unsafe extern "C" fn notify_wrap_trampoline<F: Fn(&SpinRow) + 'static>(
457            this: *mut ffi::AdwSpinRow,
458            _param_spec: glib::ffi::gpointer,
459            f: glib::ffi::gpointer,
460        ) {
461            unsafe {
462                let f: &F = &*(f as *const F);
463                f(&from_glib_borrow(this))
464            }
465        }
466        unsafe {
467            let f: Box_<F> = Box_::new(f);
468            connect_raw(
469                self.as_ptr() as *mut _,
470                c"notify::wrap".as_ptr(),
471                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
472                    notify_wrap_trampoline::<F> as *const (),
473                )),
474                Box_::into_raw(f),
475            )
476        }
477    }
478}
479
480#[cfg(feature = "v1_4")]
481#[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))]
482impl Default for SpinRow {
483    fn default() -> Self {
484        glib::object::Object::new::<Self>()
485    }
486}
487
488// rustdoc-stripper-ignore-next
489/// A [builder-pattern] type to construct [`SpinRow`] objects.
490///
491/// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html
492#[must_use = "The builder must be built to be used"]
493pub struct SpinRowBuilder {
494    builder: glib::object::ObjectBuilder<'static, SpinRow>,
495}
496
497impl SpinRowBuilder {
498    fn new() -> Self {
499        Self {
500            builder: glib::object::Object::builder(),
501        }
502    }
503
504    #[cfg(feature = "v1_4")]
505    #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))]
506    pub fn adjustment(self, adjustment: &impl IsA<gtk::Adjustment>) -> Self {
507        Self {
508            builder: self
509                .builder
510                .property("adjustment", adjustment.clone().upcast()),
511        }
512    }
513
514    #[cfg(feature = "v1_4")]
515    #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))]
516    pub fn climb_rate(self, climb_rate: f64) -> Self {
517        Self {
518            builder: self.builder.property("climb-rate", climb_rate),
519        }
520    }
521
522    #[cfg(feature = "v1_4")]
523    #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))]
524    pub fn digits(self, digits: u32) -> Self {
525        Self {
526            builder: self.builder.property("digits", digits),
527        }
528    }
529
530    #[cfg(feature = "v1_4")]
531    #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))]
532    pub fn numeric(self, numeric: bool) -> Self {
533        Self {
534            builder: self.builder.property("numeric", numeric),
535        }
536    }
537
538    #[cfg(feature = "v1_4")]
539    #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))]
540    pub fn snap_to_ticks(self, snap_to_ticks: bool) -> Self {
541        Self {
542            builder: self.builder.property("snap-to-ticks", snap_to_ticks),
543        }
544    }
545
546    #[cfg(feature = "v1_4")]
547    #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))]
548    pub fn update_policy(self, update_policy: gtk::SpinButtonUpdatePolicy) -> Self {
549        Self {
550            builder: self.builder.property("update-policy", update_policy),
551        }
552    }
553
554    #[cfg(feature = "v1_4")]
555    #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))]
556    pub fn value(self, value: f64) -> Self {
557        Self {
558            builder: self.builder.property("value", value),
559        }
560    }
561
562    #[cfg(feature = "v1_4")]
563    #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))]
564    pub fn wrap(self, wrap: bool) -> Self {
565        Self {
566            builder: self.builder.property("wrap", wrap),
567        }
568    }
569
570    pub fn activatable_widget(self, activatable_widget: &impl IsA<gtk::Widget>) -> Self {
571        Self {
572            builder: self
573                .builder
574                .property("activatable-widget", activatable_widget.clone().upcast()),
575        }
576    }
577
578    #[cfg_attr(feature = "v1_3", deprecated = "Since 1.3")]
579    pub fn icon_name(self, icon_name: impl Into<glib::GString>) -> Self {
580        Self {
581            builder: self.builder.property("icon-name", icon_name.into()),
582        }
583    }
584
585    pub fn subtitle(self, subtitle: impl Into<glib::GString>) -> Self {
586        Self {
587            builder: self.builder.property("subtitle", subtitle.into()),
588        }
589    }
590
591    pub fn subtitle_lines(self, subtitle_lines: i32) -> Self {
592        Self {
593            builder: self.builder.property("subtitle-lines", subtitle_lines),
594        }
595    }
596
597    #[cfg(feature = "v1_3")]
598    #[cfg_attr(docsrs, doc(cfg(feature = "v1_3")))]
599    pub fn subtitle_selectable(self, subtitle_selectable: bool) -> Self {
600        Self {
601            builder: self
602                .builder
603                .property("subtitle-selectable", subtitle_selectable),
604        }
605    }
606
607    pub fn title_lines(self, title_lines: i32) -> Self {
608        Self {
609            builder: self.builder.property("title-lines", title_lines),
610        }
611    }
612
613    pub fn title(self, title: impl Into<glib::GString>) -> Self {
614        Self {
615            builder: self.builder.property("title", title.into()),
616        }
617    }
618
619    #[cfg(feature = "v1_1")]
620    #[cfg_attr(docsrs, doc(cfg(feature = "v1_1")))]
621    pub fn title_selectable(self, title_selectable: bool) -> Self {
622        Self {
623            builder: self.builder.property("title-selectable", title_selectable),
624        }
625    }
626
627    #[cfg(feature = "v1_2")]
628    #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))]
629    pub fn use_markup(self, use_markup: bool) -> Self {
630        Self {
631            builder: self.builder.property("use-markup", use_markup),
632        }
633    }
634
635    pub fn use_underline(self, use_underline: bool) -> Self {
636        Self {
637            builder: self.builder.property("use-underline", use_underline),
638        }
639    }
640
641    pub fn activatable(self, activatable: bool) -> Self {
642        Self {
643            builder: self.builder.property("activatable", activatable),
644        }
645    }
646
647    pub fn child(self, child: &impl IsA<gtk::Widget>) -> Self {
648        Self {
649            builder: self.builder.property("child", child.clone().upcast()),
650        }
651    }
652
653    pub fn selectable(self, selectable: bool) -> Self {
654        Self {
655            builder: self.builder.property("selectable", selectable),
656        }
657    }
658
659    pub fn can_focus(self, can_focus: bool) -> Self {
660        Self {
661            builder: self.builder.property("can-focus", can_focus),
662        }
663    }
664
665    pub fn can_target(self, can_target: bool) -> Self {
666        Self {
667            builder: self.builder.property("can-target", can_target),
668        }
669    }
670
671    pub fn css_classes(self, css_classes: impl Into<glib::StrV>) -> Self {
672        Self {
673            builder: self.builder.property("css-classes", css_classes.into()),
674        }
675    }
676
677    pub fn css_name(self, css_name: impl Into<glib::GString>) -> Self {
678        Self {
679            builder: self.builder.property("css-name", css_name.into()),
680        }
681    }
682
683    pub fn cursor(self, cursor: &gdk::Cursor) -> Self {
684        Self {
685            builder: self.builder.property("cursor", cursor.clone()),
686        }
687    }
688
689    pub fn focus_on_click(self, focus_on_click: bool) -> Self {
690        Self {
691            builder: self.builder.property("focus-on-click", focus_on_click),
692        }
693    }
694
695    pub fn focusable(self, focusable: bool) -> Self {
696        Self {
697            builder: self.builder.property("focusable", focusable),
698        }
699    }
700
701    pub fn halign(self, halign: gtk::Align) -> Self {
702        Self {
703            builder: self.builder.property("halign", halign),
704        }
705    }
706
707    pub fn has_tooltip(self, has_tooltip: bool) -> Self {
708        Self {
709            builder: self.builder.property("has-tooltip", has_tooltip),
710        }
711    }
712
713    pub fn height_request(self, height_request: i32) -> Self {
714        Self {
715            builder: self.builder.property("height-request", height_request),
716        }
717    }
718
719    pub fn hexpand(self, hexpand: bool) -> Self {
720        Self {
721            builder: self.builder.property("hexpand", hexpand),
722        }
723    }
724
725    pub fn hexpand_set(self, hexpand_set: bool) -> Self {
726        Self {
727            builder: self.builder.property("hexpand-set", hexpand_set),
728        }
729    }
730
731    pub fn layout_manager(self, layout_manager: &impl IsA<gtk::LayoutManager>) -> Self {
732        Self {
733            builder: self
734                .builder
735                .property("layout-manager", layout_manager.clone().upcast()),
736        }
737    }
738
739    #[cfg(feature = "gtk_v4_18")]
740    #[cfg_attr(docsrs, doc(cfg(feature = "gtk_v4_18")))]
741    pub fn limit_events(self, limit_events: bool) -> Self {
742        Self {
743            builder: self.builder.property("limit-events", limit_events),
744        }
745    }
746
747    pub fn margin_bottom(self, margin_bottom: i32) -> Self {
748        Self {
749            builder: self.builder.property("margin-bottom", margin_bottom),
750        }
751    }
752
753    pub fn margin_end(self, margin_end: i32) -> Self {
754        Self {
755            builder: self.builder.property("margin-end", margin_end),
756        }
757    }
758
759    pub fn margin_start(self, margin_start: i32) -> Self {
760        Self {
761            builder: self.builder.property("margin-start", margin_start),
762        }
763    }
764
765    pub fn margin_top(self, margin_top: i32) -> Self {
766        Self {
767            builder: self.builder.property("margin-top", margin_top),
768        }
769    }
770
771    pub fn name(self, name: impl Into<glib::GString>) -> Self {
772        Self {
773            builder: self.builder.property("name", name.into()),
774        }
775    }
776
777    pub fn opacity(self, opacity: f64) -> Self {
778        Self {
779            builder: self.builder.property("opacity", opacity),
780        }
781    }
782
783    pub fn overflow(self, overflow: gtk::Overflow) -> Self {
784        Self {
785            builder: self.builder.property("overflow", overflow),
786        }
787    }
788
789    pub fn receives_default(self, receives_default: bool) -> Self {
790        Self {
791            builder: self.builder.property("receives-default", receives_default),
792        }
793    }
794
795    pub fn sensitive(self, sensitive: bool) -> Self {
796        Self {
797            builder: self.builder.property("sensitive", sensitive),
798        }
799    }
800
801    pub fn tooltip_markup(self, tooltip_markup: impl Into<glib::GString>) -> Self {
802        Self {
803            builder: self
804                .builder
805                .property("tooltip-markup", tooltip_markup.into()),
806        }
807    }
808
809    pub fn tooltip_text(self, tooltip_text: impl Into<glib::GString>) -> Self {
810        Self {
811            builder: self.builder.property("tooltip-text", tooltip_text.into()),
812        }
813    }
814
815    pub fn valign(self, valign: gtk::Align) -> Self {
816        Self {
817            builder: self.builder.property("valign", valign),
818        }
819    }
820
821    pub fn vexpand(self, vexpand: bool) -> Self {
822        Self {
823            builder: self.builder.property("vexpand", vexpand),
824        }
825    }
826
827    pub fn vexpand_set(self, vexpand_set: bool) -> Self {
828        Self {
829            builder: self.builder.property("vexpand-set", vexpand_set),
830        }
831    }
832
833    pub fn visible(self, visible: bool) -> Self {
834        Self {
835            builder: self.builder.property("visible", visible),
836        }
837    }
838
839    pub fn width_request(self, width_request: i32) -> Self {
840        Self {
841            builder: self.builder.property("width-request", width_request),
842        }
843    }
844
845    pub fn accessible_role(self, accessible_role: gtk::AccessibleRole) -> Self {
846        Self {
847            builder: self.builder.property("accessible-role", accessible_role),
848        }
849    }
850
851    pub fn action_name(self, action_name: impl Into<glib::GString>) -> Self {
852        Self {
853            builder: self.builder.property("action-name", action_name.into()),
854        }
855    }
856
857    pub fn action_target(self, action_target: &glib::Variant) -> Self {
858        Self {
859            builder: self
860                .builder
861                .property("action-target", action_target.clone()),
862        }
863    }
864
865    pub fn editable(self, editable: bool) -> Self {
866        Self {
867            builder: self.builder.property("editable", editable),
868        }
869    }
870
871    pub fn enable_undo(self, enable_undo: bool) -> Self {
872        Self {
873            builder: self.builder.property("enable-undo", enable_undo),
874        }
875    }
876
877    pub fn max_width_chars(self, max_width_chars: i32) -> Self {
878        Self {
879            builder: self.builder.property("max-width-chars", max_width_chars),
880        }
881    }
882
883    pub fn text(self, text: impl Into<glib::GString>) -> Self {
884        Self {
885            builder: self.builder.property("text", text.into()),
886        }
887    }
888
889    pub fn width_chars(self, width_chars: i32) -> Self {
890        Self {
891            builder: self.builder.property("width-chars", width_chars),
892        }
893    }
894
895    pub fn xalign(self, xalign: f32) -> Self {
896        Self {
897            builder: self.builder.property("xalign", xalign),
898        }
899    }
900
901    // rustdoc-stripper-ignore-next
902    /// Build the [`SpinRow`].
903    #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"]
904    pub fn build(self) -> SpinRow {
905        assert_initialized_main_thread!();
906        self.builder.build()
907    }
908}