gtk4/auto/
cell_renderer_spin.rs

1// This file was generated by gir (https://github.com/gtk-rs/gir)
2// from gir-files (https://github.com/gtk-rs/gir-files)
3// DO NOT EDIT
4#![allow(deprecated)]
5
6use crate::{ffi, Adjustment, CellRenderer, CellRendererMode, CellRendererText};
7use glib::{
8    prelude::*,
9    signal::{connect_raw, SignalHandlerId},
10    translate::*,
11};
12use std::boxed::Box as Box_;
13
14glib::wrapper! {
15    /// List views use widgets to display their contents.
16    ///   You should use [`SpinButton`][crate::SpinButton] instead
17    /// Renders a spin button in a cell
18    ///
19    /// [`CellRendererSpin`][crate::CellRendererSpin] renders text in a cell like [`CellRendererText`][crate::CellRendererText] from
20    /// which it is derived. But while [`CellRendererText`][crate::CellRendererText] offers a simple entry to
21    /// edit the text, [`CellRendererSpin`][crate::CellRendererSpin] offers a [`SpinButton`][crate::SpinButton] widget. Of course,
22    /// that means that the text has to be parseable as a floating point number.
23    ///
24    /// The range of the spinbutton is taken from the adjustment property of the
25    /// cell renderer, which can be set explicitly or mapped to a column in the
26    /// tree model, like all properties of cell renders. [`CellRendererSpin`][crate::CellRendererSpin]
27    /// also has properties for the `GtkCellRendererSpin:climb-rate` and the number
28    /// of `GtkCellRendererSpin:digits` to display. Other [`SpinButton`][crate::SpinButton] properties
29    /// can be set in a handler for the `GtkCellRenderer::editing-started` signal.
30    ///
31    /// ## Properties
32    ///
33    ///
34    /// #### `adjustment`
35    ///  The adjustment that holds the value of the spinbutton.
36    /// This must be non-[`None`] for the cell renderer to be editable.
37    ///
38    /// Readable | Writeable
39    ///
40    ///
41    /// #### `climb-rate`
42    ///  The acceleration rate when you hold down a button.
43    ///
44    /// Readable | Writeable
45    ///
46    ///
47    /// #### `digits`
48    ///  The number of decimal places to display.
49    ///
50    /// Readable | Writeable
51    /// <details><summary><h4>CellRendererText</h4></summary>
52    ///
53    ///
54    /// #### `align-set`
55    ///  Readable | Writeable
56    ///
57    ///
58    /// #### `alignment`
59    ///  Specifies how to align the lines of text with respect to each other.
60    ///
61    /// Note that this property describes how to align the lines of text in
62    /// case there are several of them. The "xalign" property of [`CellRenderer`][crate::CellRenderer],
63    /// on the other hand, sets the horizontal alignment of the whole text.
64    ///
65    /// Readable | Writeable
66    ///
67    ///
68    /// #### `attributes`
69    ///  Readable | Writeable
70    ///
71    ///
72    /// #### `background`
73    ///  Writeable
74    ///
75    ///
76    /// #### `background-rgba`
77    ///  Background color as a [`gdk::RGBA`][crate::gdk::RGBA]
78    ///
79    /// Readable | Writeable
80    ///
81    ///
82    /// #### `background-set`
83    ///  Readable | Writeable
84    ///
85    ///
86    /// #### `editable`
87    ///  Readable | Writeable
88    ///
89    ///
90    /// #### `editable-set`
91    ///  Readable | Writeable
92    ///
93    ///
94    /// #### `ellipsize`
95    ///  Specifies the preferred place to ellipsize the string, if the cell renderer
96    /// does not have enough room to display the entire string. Setting it to
97    /// [`pango::EllipsizeMode::None`][crate::pango::EllipsizeMode::None] turns off ellipsizing. See the wrap-width property
98    /// for another way of making the text fit into a given width.
99    ///
100    /// Readable | Writeable
101    ///
102    ///
103    /// #### `ellipsize-set`
104    ///  Readable | Writeable
105    ///
106    ///
107    /// #### `family`
108    ///  Readable | Writeable
109    ///
110    ///
111    /// #### `family-set`
112    ///  Readable | Writeable
113    ///
114    ///
115    /// #### `font`
116    ///  Readable | Writeable
117    ///
118    ///
119    /// #### `font-desc`
120    ///  Readable | Writeable
121    ///
122    ///
123    /// #### `foreground`
124    ///  Writeable
125    ///
126    ///
127    /// #### `foreground-rgba`
128    ///  Foreground color as a [`gdk::RGBA`][crate::gdk::RGBA]
129    ///
130    /// Readable | Writeable
131    ///
132    ///
133    /// #### `foreground-set`
134    ///  Readable | Writeable
135    ///
136    ///
137    /// #### `language`
138    ///  Readable | Writeable
139    ///
140    ///
141    /// #### `language-set`
142    ///  Readable | Writeable
143    ///
144    ///
145    /// #### `markup`
146    ///  Writeable
147    ///
148    ///
149    /// #### `max-width-chars`
150    ///  The desired maximum width of the cell, in characters. If this property
151    /// is set to -1, the width will be calculated automatically.
152    ///
153    /// For cell renderers that ellipsize or wrap text; this property
154    /// controls the maximum reported width of the cell. The
155    /// cell should not receive any greater allocation unless it is
156    /// set to expand in its [`CellLayout`][crate::CellLayout] and all of the cell's siblings
157    /// have received their natural width.
158    ///
159    /// Readable | Writeable
160    ///
161    ///
162    /// #### `placeholder-text`
163    ///  The text that will be displayed in the [`CellRenderer`][crate::CellRenderer] if
164    /// `GtkCellRendererText:editable` is [`true`] and the cell is empty.
165    ///
166    /// Readable | Writeable
167    ///
168    ///
169    /// #### `rise`
170    ///  Readable | Writeable
171    ///
172    ///
173    /// #### `rise-set`
174    ///  Readable | Writeable
175    ///
176    ///
177    /// #### `scale`
178    ///  Readable | Writeable
179    ///
180    ///
181    /// #### `scale-set`
182    ///  Readable | Writeable
183    ///
184    ///
185    /// #### `single-paragraph-mode`
186    ///  Readable | Writeable
187    ///
188    ///
189    /// #### `size`
190    ///  Readable | Writeable
191    ///
192    ///
193    /// #### `size-points`
194    ///  Readable | Writeable
195    ///
196    ///
197    /// #### `size-set`
198    ///  Readable | Writeable
199    ///
200    ///
201    /// #### `stretch`
202    ///  Readable | Writeable
203    ///
204    ///
205    /// #### `stretch-set`
206    ///  Readable | Writeable
207    ///
208    ///
209    /// #### `strikethrough`
210    ///  Readable | Writeable
211    ///
212    ///
213    /// #### `strikethrough-set`
214    ///  Readable | Writeable
215    ///
216    ///
217    /// #### `style`
218    ///  Readable | Writeable
219    ///
220    ///
221    /// #### `style-set`
222    ///  Readable | Writeable
223    ///
224    ///
225    /// #### `text`
226    ///  Readable | Writeable
227    ///
228    ///
229    /// #### `underline`
230    ///  Readable | Writeable
231    ///
232    ///
233    /// #### `underline-set`
234    ///  Readable | Writeable
235    ///
236    ///
237    /// #### `variant`
238    ///  Readable | Writeable
239    ///
240    ///
241    /// #### `variant-set`
242    ///  Readable | Writeable
243    ///
244    ///
245    /// #### `weight`
246    ///  Readable | Writeable
247    ///
248    ///
249    /// #### `weight-set`
250    ///  Readable | Writeable
251    ///
252    ///
253    /// #### `width-chars`
254    ///  The desired width of the cell, in characters. If this property is set to
255    /// -1, the width will be calculated automatically, otherwise the cell will
256    /// request either 3 characters or the property value, whichever is greater.
257    ///
258    /// Readable | Writeable
259    ///
260    ///
261    /// #### `wrap-mode`
262    ///  Specifies how to break the string into multiple lines, if the cell
263    /// renderer does not have enough room to display the entire string.
264    /// This property has no effect unless the wrap-width property is set.
265    ///
266    /// Readable | Writeable
267    ///
268    ///
269    /// #### `wrap-width`
270    ///  Specifies the minimum width at which the text is wrapped. The wrap-mode property can
271    /// be used to influence at what character positions the line breaks can be placed.
272    /// Setting wrap-width to -1 turns wrapping off.
273    ///
274    /// Readable | Writeable
275    /// </details>
276    /// <details><summary><h4>CellRenderer</h4></summary>
277    ///
278    ///
279    /// #### `cell-background`
280    ///  Writeable
281    ///
282    ///
283    /// #### `cell-background-rgba`
284    ///  Cell background as a [`gdk::RGBA`][crate::gdk::RGBA]
285    ///
286    /// Readable | Writeable
287    ///
288    ///
289    /// #### `cell-background-set`
290    ///  Readable | Writeable
291    ///
292    ///
293    /// #### `editing`
294    ///  Readable
295    ///
296    ///
297    /// #### `height`
298    ///  Readable | Writeable
299    ///
300    ///
301    /// #### `is-expanded`
302    ///  Readable | Writeable
303    ///
304    ///
305    /// #### `is-expander`
306    ///  Readable | Writeable
307    ///
308    ///
309    /// #### `mode`
310    ///  Readable | Writeable
311    ///
312    ///
313    /// #### `sensitive`
314    ///  Readable | Writeable
315    ///
316    ///
317    /// #### `visible`
318    ///  Readable | Writeable
319    ///
320    ///
321    /// #### `width`
322    ///  Readable | Writeable
323    ///
324    ///
325    /// #### `xalign`
326    ///  Readable | Writeable
327    ///
328    ///
329    /// #### `xpad`
330    ///  Readable | Writeable
331    ///
332    ///
333    /// #### `yalign`
334    ///  Readable | Writeable
335    ///
336    ///
337    /// #### `ypad`
338    ///  Readable | Writeable
339    /// </details>
340    ///
341    /// # Implements
342    ///
343    /// [`CellRendererTextExt`][trait@crate::prelude::CellRendererTextExt], [`CellRendererExt`][trait@crate::prelude::CellRendererExt], [`trait@glib::ObjectExt`], [`CellRendererExtManual`][trait@crate::prelude::CellRendererExtManual]
344    #[doc(alias = "GtkCellRendererSpin")]
345    pub struct CellRendererSpin(Object<ffi::GtkCellRendererSpin>) @extends CellRendererText, CellRenderer;
346
347    match fn {
348        type_ => || ffi::gtk_cell_renderer_spin_get_type(),
349    }
350}
351
352impl CellRendererSpin {
353    /// Creates a new [`CellRendererSpin`][crate::CellRendererSpin].
354    ///
355    /// # Deprecated since 4.10
356    ///
357    ///
358    /// # Returns
359    ///
360    /// a new [`CellRendererSpin`][crate::CellRendererSpin]
361    #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
362    #[allow(deprecated)]
363    #[doc(alias = "gtk_cell_renderer_spin_new")]
364    pub fn new() -> CellRendererSpin {
365        assert_initialized_main_thread!();
366        unsafe { CellRenderer::from_glib_none(ffi::gtk_cell_renderer_spin_new()).unsafe_cast() }
367    }
368
369    // rustdoc-stripper-ignore-next
370    /// Creates a new builder-pattern struct instance to construct [`CellRendererSpin`] objects.
371    ///
372    /// This method returns an instance of [`CellRendererSpinBuilder`](crate::builders::CellRendererSpinBuilder) which can be used to create [`CellRendererSpin`] objects.
373    pub fn builder() -> CellRendererSpinBuilder {
374        CellRendererSpinBuilder::new()
375    }
376
377    /// The adjustment that holds the value of the spinbutton.
378    /// This must be non-[`None`] for the cell renderer to be editable.
379    pub fn adjustment(&self) -> Option<Adjustment> {
380        ObjectExt::property(self, "adjustment")
381    }
382
383    /// The adjustment that holds the value of the spinbutton.
384    /// This must be non-[`None`] for the cell renderer to be editable.
385    pub fn set_adjustment<P: IsA<Adjustment>>(&self, adjustment: Option<&P>) {
386        ObjectExt::set_property(self, "adjustment", adjustment)
387    }
388
389    /// The acceleration rate when you hold down a button.
390    #[doc(alias = "climb-rate")]
391    pub fn climb_rate(&self) -> f64 {
392        ObjectExt::property(self, "climb-rate")
393    }
394
395    /// The acceleration rate when you hold down a button.
396    #[doc(alias = "climb-rate")]
397    pub fn set_climb_rate(&self, climb_rate: f64) {
398        ObjectExt::set_property(self, "climb-rate", climb_rate)
399    }
400
401    /// The number of decimal places to display.
402    pub fn digits(&self) -> u32 {
403        ObjectExt::property(self, "digits")
404    }
405
406    /// The number of decimal places to display.
407    pub fn set_digits(&self, digits: u32) {
408        ObjectExt::set_property(self, "digits", digits)
409    }
410
411    #[doc(alias = "adjustment")]
412    pub fn connect_adjustment_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
413        unsafe extern "C" fn notify_adjustment_trampoline<F: Fn(&CellRendererSpin) + 'static>(
414            this: *mut ffi::GtkCellRendererSpin,
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                b"notify::adjustment\0".as_ptr() as *const _,
426                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
427                    notify_adjustment_trampoline::<F> as *const (),
428                )),
429                Box_::into_raw(f),
430            )
431        }
432    }
433
434    #[doc(alias = "climb-rate")]
435    pub fn connect_climb_rate_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
436        unsafe extern "C" fn notify_climb_rate_trampoline<F: Fn(&CellRendererSpin) + 'static>(
437            this: *mut ffi::GtkCellRendererSpin,
438            _param_spec: glib::ffi::gpointer,
439            f: glib::ffi::gpointer,
440        ) {
441            let f: &F = &*(f as *const F);
442            f(&from_glib_borrow(this))
443        }
444        unsafe {
445            let f: Box_<F> = Box_::new(f);
446            connect_raw(
447                self.as_ptr() as *mut _,
448                b"notify::climb-rate\0".as_ptr() as *const _,
449                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
450                    notify_climb_rate_trampoline::<F> as *const (),
451                )),
452                Box_::into_raw(f),
453            )
454        }
455    }
456
457    #[doc(alias = "digits")]
458    pub fn connect_digits_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
459        unsafe extern "C" fn notify_digits_trampoline<F: Fn(&CellRendererSpin) + 'static>(
460            this: *mut ffi::GtkCellRendererSpin,
461            _param_spec: glib::ffi::gpointer,
462            f: glib::ffi::gpointer,
463        ) {
464            let f: &F = &*(f as *const F);
465            f(&from_glib_borrow(this))
466        }
467        unsafe {
468            let f: Box_<F> = Box_::new(f);
469            connect_raw(
470                self.as_ptr() as *mut _,
471                b"notify::digits\0".as_ptr() as *const _,
472                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
473                    notify_digits_trampoline::<F> as *const (),
474                )),
475                Box_::into_raw(f),
476            )
477        }
478    }
479}
480
481impl Default for CellRendererSpin {
482    fn default() -> Self {
483        Self::new()
484    }
485}
486
487// rustdoc-stripper-ignore-next
488/// A [builder-pattern] type to construct [`CellRendererSpin`] objects.
489///
490/// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html
491#[must_use = "The builder must be built to be used"]
492pub struct CellRendererSpinBuilder {
493    builder: glib::object::ObjectBuilder<'static, CellRendererSpin>,
494}
495
496impl CellRendererSpinBuilder {
497    fn new() -> Self {
498        Self {
499            builder: glib::object::Object::builder(),
500        }
501    }
502
503    /// The adjustment that holds the value of the spinbutton.
504    /// This must be non-[`None`] for the cell renderer to be editable.
505    pub fn adjustment(self, adjustment: &impl IsA<Adjustment>) -> Self {
506        Self {
507            builder: self
508                .builder
509                .property("adjustment", adjustment.clone().upcast()),
510        }
511    }
512
513    /// The acceleration rate when you hold down a button.
514    pub fn climb_rate(self, climb_rate: f64) -> Self {
515        Self {
516            builder: self.builder.property("climb-rate", climb_rate),
517        }
518    }
519
520    /// The number of decimal places to display.
521    pub fn digits(self, digits: u32) -> Self {
522        Self {
523            builder: self.builder.property("digits", digits),
524        }
525    }
526
527    pub fn align_set(self, align_set: bool) -> Self {
528        Self {
529            builder: self.builder.property("align-set", align_set),
530        }
531    }
532
533    /// Specifies how to align the lines of text with respect to each other.
534    ///
535    /// Note that this property describes how to align the lines of text in
536    /// case there are several of them. The "xalign" property of [`CellRenderer`][crate::CellRenderer],
537    /// on the other hand, sets the horizontal alignment of the whole text.
538    pub fn alignment(self, alignment: pango::Alignment) -> Self {
539        Self {
540            builder: self.builder.property("alignment", alignment),
541        }
542    }
543
544    pub fn attributes(self, attributes: &pango::AttrList) -> Self {
545        Self {
546            builder: self.builder.property("attributes", attributes.clone()),
547        }
548    }
549
550    pub fn background(self, background: impl Into<glib::GString>) -> Self {
551        Self {
552            builder: self.builder.property("background", background.into()),
553        }
554    }
555
556    /// Background color as a [`gdk::RGBA`][crate::gdk::RGBA]
557    pub fn background_rgba(self, background_rgba: &gdk::RGBA) -> Self {
558        Self {
559            builder: self.builder.property("background-rgba", background_rgba),
560        }
561    }
562
563    pub fn background_set(self, background_set: bool) -> Self {
564        Self {
565            builder: self.builder.property("background-set", background_set),
566        }
567    }
568
569    pub fn editable(self, editable: bool) -> Self {
570        Self {
571            builder: self.builder.property("editable", editable),
572        }
573    }
574
575    pub fn editable_set(self, editable_set: bool) -> Self {
576        Self {
577            builder: self.builder.property("editable-set", editable_set),
578        }
579    }
580
581    /// Specifies the preferred place to ellipsize the string, if the cell renderer
582    /// does not have enough room to display the entire string. Setting it to
583    /// [`pango::EllipsizeMode::None`][crate::pango::EllipsizeMode::None] turns off ellipsizing. See the wrap-width property
584    /// for another way of making the text fit into a given width.
585    pub fn ellipsize(self, ellipsize: pango::EllipsizeMode) -> Self {
586        Self {
587            builder: self.builder.property("ellipsize", ellipsize),
588        }
589    }
590
591    pub fn ellipsize_set(self, ellipsize_set: bool) -> Self {
592        Self {
593            builder: self.builder.property("ellipsize-set", ellipsize_set),
594        }
595    }
596
597    pub fn family(self, family: impl Into<glib::GString>) -> Self {
598        Self {
599            builder: self.builder.property("family", family.into()),
600        }
601    }
602
603    pub fn family_set(self, family_set: bool) -> Self {
604        Self {
605            builder: self.builder.property("family-set", family_set),
606        }
607    }
608
609    pub fn font(self, font: impl Into<glib::GString>) -> Self {
610        Self {
611            builder: self.builder.property("font", font.into()),
612        }
613    }
614
615    pub fn font_desc(self, font_desc: &pango::FontDescription) -> Self {
616        Self {
617            builder: self.builder.property("font-desc", font_desc),
618        }
619    }
620
621    pub fn foreground(self, foreground: impl Into<glib::GString>) -> Self {
622        Self {
623            builder: self.builder.property("foreground", foreground.into()),
624        }
625    }
626
627    /// Foreground color as a [`gdk::RGBA`][crate::gdk::RGBA]
628    pub fn foreground_rgba(self, foreground_rgba: &gdk::RGBA) -> Self {
629        Self {
630            builder: self.builder.property("foreground-rgba", foreground_rgba),
631        }
632    }
633
634    pub fn foreground_set(self, foreground_set: bool) -> Self {
635        Self {
636            builder: self.builder.property("foreground-set", foreground_set),
637        }
638    }
639
640    pub fn language(self, language: impl Into<glib::GString>) -> Self {
641        Self {
642            builder: self.builder.property("language", language.into()),
643        }
644    }
645
646    pub fn language_set(self, language_set: bool) -> Self {
647        Self {
648            builder: self.builder.property("language-set", language_set),
649        }
650    }
651
652    pub fn markup(self, markup: impl Into<glib::GString>) -> Self {
653        Self {
654            builder: self.builder.property("markup", markup.into()),
655        }
656    }
657
658    /// The desired maximum width of the cell, in characters. If this property
659    /// is set to -1, the width will be calculated automatically.
660    ///
661    /// For cell renderers that ellipsize or wrap text; this property
662    /// controls the maximum reported width of the cell. The
663    /// cell should not receive any greater allocation unless it is
664    /// set to expand in its [`CellLayout`][crate::CellLayout] and all of the cell's siblings
665    /// have received their natural width.
666    pub fn max_width_chars(self, max_width_chars: i32) -> Self {
667        Self {
668            builder: self.builder.property("max-width-chars", max_width_chars),
669        }
670    }
671
672    /// The text that will be displayed in the [`CellRenderer`][crate::CellRenderer] if
673    /// `GtkCellRendererText:editable` is [`true`] and the cell is empty.
674    pub fn placeholder_text(self, placeholder_text: impl Into<glib::GString>) -> Self {
675        Self {
676            builder: self
677                .builder
678                .property("placeholder-text", placeholder_text.into()),
679        }
680    }
681
682    pub fn rise(self, rise: i32) -> Self {
683        Self {
684            builder: self.builder.property("rise", rise),
685        }
686    }
687
688    pub fn rise_set(self, rise_set: bool) -> Self {
689        Self {
690            builder: self.builder.property("rise-set", rise_set),
691        }
692    }
693
694    pub fn scale(self, scale: f64) -> Self {
695        Self {
696            builder: self.builder.property("scale", scale),
697        }
698    }
699
700    pub fn scale_set(self, scale_set: bool) -> Self {
701        Self {
702            builder: self.builder.property("scale-set", scale_set),
703        }
704    }
705
706    pub fn single_paragraph_mode(self, single_paragraph_mode: bool) -> Self {
707        Self {
708            builder: self
709                .builder
710                .property("single-paragraph-mode", single_paragraph_mode),
711        }
712    }
713
714    pub fn size(self, size: i32) -> Self {
715        Self {
716            builder: self.builder.property("size", size),
717        }
718    }
719
720    pub fn size_points(self, size_points: f64) -> Self {
721        Self {
722            builder: self.builder.property("size-points", size_points),
723        }
724    }
725
726    pub fn size_set(self, size_set: bool) -> Self {
727        Self {
728            builder: self.builder.property("size-set", size_set),
729        }
730    }
731
732    pub fn stretch(self, stretch: pango::Stretch) -> Self {
733        Self {
734            builder: self.builder.property("stretch", stretch),
735        }
736    }
737
738    pub fn stretch_set(self, stretch_set: bool) -> Self {
739        Self {
740            builder: self.builder.property("stretch-set", stretch_set),
741        }
742    }
743
744    pub fn strikethrough(self, strikethrough: bool) -> Self {
745        Self {
746            builder: self.builder.property("strikethrough", strikethrough),
747        }
748    }
749
750    pub fn strikethrough_set(self, strikethrough_set: bool) -> Self {
751        Self {
752            builder: self
753                .builder
754                .property("strikethrough-set", strikethrough_set),
755        }
756    }
757
758    pub fn style(self, style: pango::Style) -> Self {
759        Self {
760            builder: self.builder.property("style", style),
761        }
762    }
763
764    pub fn style_set(self, style_set: bool) -> Self {
765        Self {
766            builder: self.builder.property("style-set", style_set),
767        }
768    }
769
770    pub fn text(self, text: impl Into<glib::GString>) -> Self {
771        Self {
772            builder: self.builder.property("text", text.into()),
773        }
774    }
775
776    pub fn underline(self, underline: pango::Underline) -> Self {
777        Self {
778            builder: self.builder.property("underline", underline),
779        }
780    }
781
782    pub fn underline_set(self, underline_set: bool) -> Self {
783        Self {
784            builder: self.builder.property("underline-set", underline_set),
785        }
786    }
787
788    pub fn variant(self, variant: pango::Variant) -> Self {
789        Self {
790            builder: self.builder.property("variant", variant),
791        }
792    }
793
794    pub fn variant_set(self, variant_set: bool) -> Self {
795        Self {
796            builder: self.builder.property("variant-set", variant_set),
797        }
798    }
799
800    pub fn weight(self, weight: i32) -> Self {
801        Self {
802            builder: self.builder.property("weight", weight),
803        }
804    }
805
806    pub fn weight_set(self, weight_set: bool) -> Self {
807        Self {
808            builder: self.builder.property("weight-set", weight_set),
809        }
810    }
811
812    /// The desired width of the cell, in characters. If this property is set to
813    /// -1, the width will be calculated automatically, otherwise the cell will
814    /// request either 3 characters or the property value, whichever is greater.
815    pub fn width_chars(self, width_chars: i32) -> Self {
816        Self {
817            builder: self.builder.property("width-chars", width_chars),
818        }
819    }
820
821    /// Specifies how to break the string into multiple lines, if the cell
822    /// renderer does not have enough room to display the entire string.
823    /// This property has no effect unless the wrap-width property is set.
824    pub fn wrap_mode(self, wrap_mode: pango::WrapMode) -> Self {
825        Self {
826            builder: self.builder.property("wrap-mode", wrap_mode),
827        }
828    }
829
830    /// Specifies the minimum width at which the text is wrapped. The wrap-mode property can
831    /// be used to influence at what character positions the line breaks can be placed.
832    /// Setting wrap-width to -1 turns wrapping off.
833    pub fn wrap_width(self, wrap_width: i32) -> Self {
834        Self {
835            builder: self.builder.property("wrap-width", wrap_width),
836        }
837    }
838
839    pub fn cell_background(self, cell_background: impl Into<glib::GString>) -> Self {
840        Self {
841            builder: self
842                .builder
843                .property("cell-background", cell_background.into()),
844        }
845    }
846
847    /// Cell background as a [`gdk::RGBA`][crate::gdk::RGBA]
848    pub fn cell_background_rgba(self, cell_background_rgba: &gdk::RGBA) -> Self {
849        Self {
850            builder: self
851                .builder
852                .property("cell-background-rgba", cell_background_rgba),
853        }
854    }
855
856    pub fn cell_background_set(self, cell_background_set: bool) -> Self {
857        Self {
858            builder: self
859                .builder
860                .property("cell-background-set", cell_background_set),
861        }
862    }
863
864    pub fn height(self, height: i32) -> Self {
865        Self {
866            builder: self.builder.property("height", height),
867        }
868    }
869
870    pub fn is_expanded(self, is_expanded: bool) -> Self {
871        Self {
872            builder: self.builder.property("is-expanded", is_expanded),
873        }
874    }
875
876    pub fn is_expander(self, is_expander: bool) -> Self {
877        Self {
878            builder: self.builder.property("is-expander", is_expander),
879        }
880    }
881
882    pub fn mode(self, mode: CellRendererMode) -> Self {
883        Self {
884            builder: self.builder.property("mode", mode),
885        }
886    }
887
888    pub fn sensitive(self, sensitive: bool) -> Self {
889        Self {
890            builder: self.builder.property("sensitive", sensitive),
891        }
892    }
893
894    pub fn visible(self, visible: bool) -> Self {
895        Self {
896            builder: self.builder.property("visible", visible),
897        }
898    }
899
900    pub fn width(self, width: i32) -> Self {
901        Self {
902            builder: self.builder.property("width", width),
903        }
904    }
905
906    pub fn xalign(self, xalign: f32) -> Self {
907        Self {
908            builder: self.builder.property("xalign", xalign),
909        }
910    }
911
912    pub fn xpad(self, xpad: u32) -> Self {
913        Self {
914            builder: self.builder.property("xpad", xpad),
915        }
916    }
917
918    pub fn yalign(self, yalign: f32) -> Self {
919        Self {
920            builder: self.builder.property("yalign", yalign),
921        }
922    }
923
924    pub fn ypad(self, ypad: u32) -> Self {
925        Self {
926            builder: self.builder.property("ypad", ypad),
927        }
928    }
929
930    // rustdoc-stripper-ignore-next
931    /// Build the [`CellRendererSpin`].
932    #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"]
933    pub fn build(self) -> CellRendererSpin {
934        assert_initialized_main_thread!();
935        self.builder.build()
936    }
937}