1use crate::{ffi, ActionRow, PreferencesRow};
7use glib::{
8 object::ObjectType as _,
9 prelude::*,
10 signal::{connect_raw, SignalHandlerId},
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 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 let f: &F = &*(f as *const F);
220 f(&from_glib_borrow(this)).into_glib()
221 }
222 unsafe {
223 let f: Box_<F> = Box_::new(f);
224 connect_raw(
225 self.as_ptr() as *mut _,
226 c"output".as_ptr() as *const _,
227 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
228 output_trampoline::<F> as *const (),
229 )),
230 Box_::into_raw(f),
231 )
232 }
233 }
234
235 #[cfg(feature = "v1_4")]
236 #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))]
237 #[doc(alias = "wrapped")]
238 pub fn connect_wrapped<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
239 unsafe extern "C" fn wrapped_trampoline<F: Fn(&SpinRow) + 'static>(
240 this: *mut ffi::AdwSpinRow,
241 f: glib::ffi::gpointer,
242 ) {
243 let f: &F = &*(f as *const F);
244 f(&from_glib_borrow(this))
245 }
246 unsafe {
247 let f: Box_<F> = Box_::new(f);
248 connect_raw(
249 self.as_ptr() as *mut _,
250 c"wrapped".as_ptr() as *const _,
251 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
252 wrapped_trampoline::<F> as *const (),
253 )),
254 Box_::into_raw(f),
255 )
256 }
257 }
258
259 #[cfg(feature = "v1_4")]
260 #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))]
261 #[doc(alias = "adjustment")]
262 pub fn connect_adjustment_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
263 unsafe extern "C" fn notify_adjustment_trampoline<F: Fn(&SpinRow) + 'static>(
264 this: *mut ffi::AdwSpinRow,
265 _param_spec: glib::ffi::gpointer,
266 f: glib::ffi::gpointer,
267 ) {
268 let f: &F = &*(f as *const F);
269 f(&from_glib_borrow(this))
270 }
271 unsafe {
272 let f: Box_<F> = Box_::new(f);
273 connect_raw(
274 self.as_ptr() as *mut _,
275 c"notify::adjustment".as_ptr() as *const _,
276 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
277 notify_adjustment_trampoline::<F> as *const (),
278 )),
279 Box_::into_raw(f),
280 )
281 }
282 }
283
284 #[cfg(feature = "v1_4")]
285 #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))]
286 #[doc(alias = "climb-rate")]
287 pub fn connect_climb_rate_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
288 unsafe extern "C" fn notify_climb_rate_trampoline<F: Fn(&SpinRow) + 'static>(
289 this: *mut ffi::AdwSpinRow,
290 _param_spec: glib::ffi::gpointer,
291 f: glib::ffi::gpointer,
292 ) {
293 let f: &F = &*(f as *const F);
294 f(&from_glib_borrow(this))
295 }
296 unsafe {
297 let f: Box_<F> = Box_::new(f);
298 connect_raw(
299 self.as_ptr() as *mut _,
300 c"notify::climb-rate".as_ptr() as *const _,
301 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
302 notify_climb_rate_trampoline::<F> as *const (),
303 )),
304 Box_::into_raw(f),
305 )
306 }
307 }
308
309 #[cfg(feature = "v1_4")]
310 #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))]
311 #[doc(alias = "digits")]
312 pub fn connect_digits_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
313 unsafe extern "C" fn notify_digits_trampoline<F: Fn(&SpinRow) + 'static>(
314 this: *mut ffi::AdwSpinRow,
315 _param_spec: glib::ffi::gpointer,
316 f: glib::ffi::gpointer,
317 ) {
318 let f: &F = &*(f as *const F);
319 f(&from_glib_borrow(this))
320 }
321 unsafe {
322 let f: Box_<F> = Box_::new(f);
323 connect_raw(
324 self.as_ptr() as *mut _,
325 c"notify::digits".as_ptr() as *const _,
326 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
327 notify_digits_trampoline::<F> as *const (),
328 )),
329 Box_::into_raw(f),
330 )
331 }
332 }
333
334 #[cfg(feature = "v1_4")]
335 #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))]
336 #[doc(alias = "numeric")]
337 pub fn connect_numeric_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
338 unsafe extern "C" fn notify_numeric_trampoline<F: Fn(&SpinRow) + 'static>(
339 this: *mut ffi::AdwSpinRow,
340 _param_spec: glib::ffi::gpointer,
341 f: glib::ffi::gpointer,
342 ) {
343 let f: &F = &*(f as *const F);
344 f(&from_glib_borrow(this))
345 }
346 unsafe {
347 let f: Box_<F> = Box_::new(f);
348 connect_raw(
349 self.as_ptr() as *mut _,
350 c"notify::numeric".as_ptr() as *const _,
351 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
352 notify_numeric_trampoline::<F> as *const (),
353 )),
354 Box_::into_raw(f),
355 )
356 }
357 }
358
359 #[cfg(feature = "v1_4")]
360 #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))]
361 #[doc(alias = "snap-to-ticks")]
362 pub fn connect_snap_to_ticks_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
363 unsafe extern "C" fn notify_snap_to_ticks_trampoline<F: Fn(&SpinRow) + 'static>(
364 this: *mut ffi::AdwSpinRow,
365 _param_spec: glib::ffi::gpointer,
366 f: glib::ffi::gpointer,
367 ) {
368 let f: &F = &*(f as *const F);
369 f(&from_glib_borrow(this))
370 }
371 unsafe {
372 let f: Box_<F> = Box_::new(f);
373 connect_raw(
374 self.as_ptr() as *mut _,
375 c"notify::snap-to-ticks".as_ptr() as *const _,
376 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
377 notify_snap_to_ticks_trampoline::<F> as *const (),
378 )),
379 Box_::into_raw(f),
380 )
381 }
382 }
383
384 #[cfg(feature = "v1_4")]
385 #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))]
386 #[doc(alias = "update-policy")]
387 pub fn connect_update_policy_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
388 unsafe extern "C" fn notify_update_policy_trampoline<F: Fn(&SpinRow) + 'static>(
389 this: *mut ffi::AdwSpinRow,
390 _param_spec: glib::ffi::gpointer,
391 f: glib::ffi::gpointer,
392 ) {
393 let f: &F = &*(f as *const F);
394 f(&from_glib_borrow(this))
395 }
396 unsafe {
397 let f: Box_<F> = Box_::new(f);
398 connect_raw(
399 self.as_ptr() as *mut _,
400 c"notify::update-policy".as_ptr() as *const _,
401 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
402 notify_update_policy_trampoline::<F> as *const (),
403 )),
404 Box_::into_raw(f),
405 )
406 }
407 }
408
409 #[cfg(feature = "v1_4")]
410 #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))]
411 #[doc(alias = "value")]
412 pub fn connect_value_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
413 unsafe extern "C" fn notify_value_trampoline<F: Fn(&SpinRow) + 'static>(
414 this: *mut ffi::AdwSpinRow,
415 _param_spec: glib::ffi::gpointer,
416 f: glib::ffi::gpointer,
417 ) {
418 let f: &F = &*(f as *const F);
419 f(&from_glib_borrow(this))
420 }
421 unsafe {
422 let f: Box_<F> = Box_::new(f);
423 connect_raw(
424 self.as_ptr() as *mut _,
425 c"notify::value".as_ptr() as *const _,
426 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
427 notify_value_trampoline::<F> as *const (),
428 )),
429 Box_::into_raw(f),
430 )
431 }
432 }
433
434 #[cfg(feature = "v1_4")]
435 #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))]
436 #[doc(alias = "wrap")]
437 pub fn connect_wrap_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
438 unsafe extern "C" fn notify_wrap_trampoline<F: Fn(&SpinRow) + 'static>(
439 this: *mut ffi::AdwSpinRow,
440 _param_spec: glib::ffi::gpointer,
441 f: glib::ffi::gpointer,
442 ) {
443 let f: &F = &*(f as *const F);
444 f(&from_glib_borrow(this))
445 }
446 unsafe {
447 let f: Box_<F> = Box_::new(f);
448 connect_raw(
449 self.as_ptr() as *mut _,
450 c"notify::wrap".as_ptr() as *const _,
451 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
452 notify_wrap_trampoline::<F> as *const (),
453 )),
454 Box_::into_raw(f),
455 )
456 }
457 }
458}
459
460#[cfg(feature = "v1_4")]
461#[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))]
462impl Default for SpinRow {
463 fn default() -> Self {
464 glib::object::Object::new::<Self>()
465 }
466}
467
468#[must_use = "The builder must be built to be used"]
473pub struct SpinRowBuilder {
474 builder: glib::object::ObjectBuilder<'static, SpinRow>,
475}
476
477impl SpinRowBuilder {
478 fn new() -> Self {
479 Self {
480 builder: glib::object::Object::builder(),
481 }
482 }
483
484 #[cfg(feature = "v1_4")]
485 #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))]
486 pub fn adjustment(self, adjustment: &impl IsA<gtk::Adjustment>) -> Self {
487 Self {
488 builder: self
489 .builder
490 .property("adjustment", adjustment.clone().upcast()),
491 }
492 }
493
494 #[cfg(feature = "v1_4")]
495 #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))]
496 pub fn climb_rate(self, climb_rate: f64) -> Self {
497 Self {
498 builder: self.builder.property("climb-rate", climb_rate),
499 }
500 }
501
502 #[cfg(feature = "v1_4")]
503 #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))]
504 pub fn digits(self, digits: u32) -> Self {
505 Self {
506 builder: self.builder.property("digits", digits),
507 }
508 }
509
510 #[cfg(feature = "v1_4")]
511 #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))]
512 pub fn numeric(self, numeric: bool) -> Self {
513 Self {
514 builder: self.builder.property("numeric", numeric),
515 }
516 }
517
518 #[cfg(feature = "v1_4")]
519 #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))]
520 pub fn snap_to_ticks(self, snap_to_ticks: bool) -> Self {
521 Self {
522 builder: self.builder.property("snap-to-ticks", snap_to_ticks),
523 }
524 }
525
526 #[cfg(feature = "v1_4")]
527 #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))]
528 pub fn update_policy(self, update_policy: gtk::SpinButtonUpdatePolicy) -> Self {
529 Self {
530 builder: self.builder.property("update-policy", update_policy),
531 }
532 }
533
534 #[cfg(feature = "v1_4")]
535 #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))]
536 pub fn value(self, value: f64) -> Self {
537 Self {
538 builder: self.builder.property("value", value),
539 }
540 }
541
542 #[cfg(feature = "v1_4")]
543 #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))]
544 pub fn wrap(self, wrap: bool) -> Self {
545 Self {
546 builder: self.builder.property("wrap", wrap),
547 }
548 }
549
550 pub fn activatable_widget(self, activatable_widget: &impl IsA<gtk::Widget>) -> Self {
551 Self {
552 builder: self
553 .builder
554 .property("activatable-widget", activatable_widget.clone().upcast()),
555 }
556 }
557
558 #[cfg_attr(feature = "v1_3", deprecated = "Since 1.3")]
559 pub fn icon_name(self, icon_name: impl Into<glib::GString>) -> Self {
560 Self {
561 builder: self.builder.property("icon-name", icon_name.into()),
562 }
563 }
564
565 pub fn subtitle(self, subtitle: impl Into<glib::GString>) -> Self {
566 Self {
567 builder: self.builder.property("subtitle", subtitle.into()),
568 }
569 }
570
571 pub fn subtitle_lines(self, subtitle_lines: i32) -> Self {
572 Self {
573 builder: self.builder.property("subtitle-lines", subtitle_lines),
574 }
575 }
576
577 #[cfg(feature = "v1_3")]
578 #[cfg_attr(docsrs, doc(cfg(feature = "v1_3")))]
579 pub fn subtitle_selectable(self, subtitle_selectable: bool) -> Self {
580 Self {
581 builder: self
582 .builder
583 .property("subtitle-selectable", subtitle_selectable),
584 }
585 }
586
587 pub fn title_lines(self, title_lines: i32) -> Self {
588 Self {
589 builder: self.builder.property("title-lines", title_lines),
590 }
591 }
592
593 pub fn title(self, title: impl Into<glib::GString>) -> Self {
594 Self {
595 builder: self.builder.property("title", title.into()),
596 }
597 }
598
599 #[cfg(feature = "v1_1")]
600 #[cfg_attr(docsrs, doc(cfg(feature = "v1_1")))]
601 pub fn title_selectable(self, title_selectable: bool) -> Self {
602 Self {
603 builder: self.builder.property("title-selectable", title_selectable),
604 }
605 }
606
607 #[cfg(feature = "v1_2")]
608 #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))]
609 pub fn use_markup(self, use_markup: bool) -> Self {
610 Self {
611 builder: self.builder.property("use-markup", use_markup),
612 }
613 }
614
615 pub fn use_underline(self, use_underline: bool) -> Self {
616 Self {
617 builder: self.builder.property("use-underline", use_underline),
618 }
619 }
620
621 pub fn activatable(self, activatable: bool) -> Self {
622 Self {
623 builder: self.builder.property("activatable", activatable),
624 }
625 }
626
627 pub fn child(self, child: &impl IsA<gtk::Widget>) -> Self {
628 Self {
629 builder: self.builder.property("child", child.clone().upcast()),
630 }
631 }
632
633 pub fn selectable(self, selectable: bool) -> Self {
634 Self {
635 builder: self.builder.property("selectable", selectable),
636 }
637 }
638
639 pub fn can_focus(self, can_focus: bool) -> Self {
640 Self {
641 builder: self.builder.property("can-focus", can_focus),
642 }
643 }
644
645 pub fn can_target(self, can_target: bool) -> Self {
646 Self {
647 builder: self.builder.property("can-target", can_target),
648 }
649 }
650
651 pub fn css_classes(self, css_classes: impl Into<glib::StrV>) -> Self {
652 Self {
653 builder: self.builder.property("css-classes", css_classes.into()),
654 }
655 }
656
657 pub fn css_name(self, css_name: impl Into<glib::GString>) -> Self {
658 Self {
659 builder: self.builder.property("css-name", css_name.into()),
660 }
661 }
662
663 pub fn cursor(self, cursor: &gdk::Cursor) -> Self {
664 Self {
665 builder: self.builder.property("cursor", cursor.clone()),
666 }
667 }
668
669 pub fn focus_on_click(self, focus_on_click: bool) -> Self {
670 Self {
671 builder: self.builder.property("focus-on-click", focus_on_click),
672 }
673 }
674
675 pub fn focusable(self, focusable: bool) -> Self {
676 Self {
677 builder: self.builder.property("focusable", focusable),
678 }
679 }
680
681 pub fn halign(self, halign: gtk::Align) -> Self {
682 Self {
683 builder: self.builder.property("halign", halign),
684 }
685 }
686
687 pub fn has_tooltip(self, has_tooltip: bool) -> Self {
688 Self {
689 builder: self.builder.property("has-tooltip", has_tooltip),
690 }
691 }
692
693 pub fn height_request(self, height_request: i32) -> Self {
694 Self {
695 builder: self.builder.property("height-request", height_request),
696 }
697 }
698
699 pub fn hexpand(self, hexpand: bool) -> Self {
700 Self {
701 builder: self.builder.property("hexpand", hexpand),
702 }
703 }
704
705 pub fn hexpand_set(self, hexpand_set: bool) -> Self {
706 Self {
707 builder: self.builder.property("hexpand-set", hexpand_set),
708 }
709 }
710
711 pub fn layout_manager(self, layout_manager: &impl IsA<gtk::LayoutManager>) -> Self {
712 Self {
713 builder: self
714 .builder
715 .property("layout-manager", layout_manager.clone().upcast()),
716 }
717 }
718
719 #[cfg(feature = "gtk_v4_18")]
720 #[cfg_attr(docsrs, doc(cfg(feature = "gtk_v4_18")))]
721 pub fn limit_events(self, limit_events: bool) -> Self {
722 Self {
723 builder: self.builder.property("limit-events", limit_events),
724 }
725 }
726
727 pub fn margin_bottom(self, margin_bottom: i32) -> Self {
728 Self {
729 builder: self.builder.property("margin-bottom", margin_bottom),
730 }
731 }
732
733 pub fn margin_end(self, margin_end: i32) -> Self {
734 Self {
735 builder: self.builder.property("margin-end", margin_end),
736 }
737 }
738
739 pub fn margin_start(self, margin_start: i32) -> Self {
740 Self {
741 builder: self.builder.property("margin-start", margin_start),
742 }
743 }
744
745 pub fn margin_top(self, margin_top: i32) -> Self {
746 Self {
747 builder: self.builder.property("margin-top", margin_top),
748 }
749 }
750
751 pub fn name(self, name: impl Into<glib::GString>) -> Self {
752 Self {
753 builder: self.builder.property("name", name.into()),
754 }
755 }
756
757 pub fn opacity(self, opacity: f64) -> Self {
758 Self {
759 builder: self.builder.property("opacity", opacity),
760 }
761 }
762
763 pub fn overflow(self, overflow: gtk::Overflow) -> Self {
764 Self {
765 builder: self.builder.property("overflow", overflow),
766 }
767 }
768
769 pub fn receives_default(self, receives_default: bool) -> Self {
770 Self {
771 builder: self.builder.property("receives-default", receives_default),
772 }
773 }
774
775 pub fn sensitive(self, sensitive: bool) -> Self {
776 Self {
777 builder: self.builder.property("sensitive", sensitive),
778 }
779 }
780
781 pub fn tooltip_markup(self, tooltip_markup: impl Into<glib::GString>) -> Self {
782 Self {
783 builder: self
784 .builder
785 .property("tooltip-markup", tooltip_markup.into()),
786 }
787 }
788
789 pub fn tooltip_text(self, tooltip_text: impl Into<glib::GString>) -> Self {
790 Self {
791 builder: self.builder.property("tooltip-text", tooltip_text.into()),
792 }
793 }
794
795 pub fn valign(self, valign: gtk::Align) -> Self {
796 Self {
797 builder: self.builder.property("valign", valign),
798 }
799 }
800
801 pub fn vexpand(self, vexpand: bool) -> Self {
802 Self {
803 builder: self.builder.property("vexpand", vexpand),
804 }
805 }
806
807 pub fn vexpand_set(self, vexpand_set: bool) -> Self {
808 Self {
809 builder: self.builder.property("vexpand-set", vexpand_set),
810 }
811 }
812
813 pub fn visible(self, visible: bool) -> Self {
814 Self {
815 builder: self.builder.property("visible", visible),
816 }
817 }
818
819 pub fn width_request(self, width_request: i32) -> Self {
820 Self {
821 builder: self.builder.property("width-request", width_request),
822 }
823 }
824
825 pub fn accessible_role(self, accessible_role: gtk::AccessibleRole) -> Self {
826 Self {
827 builder: self.builder.property("accessible-role", accessible_role),
828 }
829 }
830
831 pub fn action_name(self, action_name: impl Into<glib::GString>) -> Self {
832 Self {
833 builder: self.builder.property("action-name", action_name.into()),
834 }
835 }
836
837 pub fn action_target(self, action_target: &glib::Variant) -> Self {
838 Self {
839 builder: self
840 .builder
841 .property("action-target", action_target.clone()),
842 }
843 }
844
845 pub fn editable(self, editable: bool) -> Self {
846 Self {
847 builder: self.builder.property("editable", editable),
848 }
849 }
850
851 pub fn enable_undo(self, enable_undo: bool) -> Self {
852 Self {
853 builder: self.builder.property("enable-undo", enable_undo),
854 }
855 }
856
857 pub fn max_width_chars(self, max_width_chars: i32) -> Self {
858 Self {
859 builder: self.builder.property("max-width-chars", max_width_chars),
860 }
861 }
862
863 pub fn text(self, text: impl Into<glib::GString>) -> Self {
864 Self {
865 builder: self.builder.property("text", text.into()),
866 }
867 }
868
869 pub fn width_chars(self, width_chars: i32) -> Self {
870 Self {
871 builder: self.builder.property("width-chars", width_chars),
872 }
873 }
874
875 pub fn xalign(self, xalign: f32) -> Self {
876 Self {
877 builder: self.builder.property("xalign", xalign),
878 }
879 }
880
881 #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"]
884 pub fn build(self) -> SpinRow {
885 assert_initialized_main_thread!();
886 self.builder.build()
887 }
888}