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::{Adjustment, CellRenderer, CellRendererMode, CellRendererText, ffi};
7use glib::{
8 prelude::*,
9 signal::{SignalHandlerId, connect_raw},
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 unsafe {
419 let f: &F = &*(f as *const F);
420 f(&from_glib_borrow(this))
421 }
422 }
423 unsafe {
424 let f: Box_<F> = Box_::new(f);
425 connect_raw(
426 self.as_ptr() as *mut _,
427 c"notify::adjustment".as_ptr() as *const _,
428 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
429 notify_adjustment_trampoline::<F> as *const (),
430 )),
431 Box_::into_raw(f),
432 )
433 }
434 }
435
436 #[doc(alias = "climb-rate")]
437 pub fn connect_climb_rate_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
438 unsafe extern "C" fn notify_climb_rate_trampoline<F: Fn(&CellRendererSpin) + 'static>(
439 this: *mut ffi::GtkCellRendererSpin,
440 _param_spec: glib::ffi::gpointer,
441 f: glib::ffi::gpointer,
442 ) {
443 unsafe {
444 let f: &F = &*(f as *const F);
445 f(&from_glib_borrow(this))
446 }
447 }
448 unsafe {
449 let f: Box_<F> = Box_::new(f);
450 connect_raw(
451 self.as_ptr() as *mut _,
452 c"notify::climb-rate".as_ptr() as *const _,
453 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
454 notify_climb_rate_trampoline::<F> as *const (),
455 )),
456 Box_::into_raw(f),
457 )
458 }
459 }
460
461 #[doc(alias = "digits")]
462 pub fn connect_digits_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
463 unsafe extern "C" fn notify_digits_trampoline<F: Fn(&CellRendererSpin) + 'static>(
464 this: *mut ffi::GtkCellRendererSpin,
465 _param_spec: glib::ffi::gpointer,
466 f: glib::ffi::gpointer,
467 ) {
468 unsafe {
469 let f: &F = &*(f as *const F);
470 f(&from_glib_borrow(this))
471 }
472 }
473 unsafe {
474 let f: Box_<F> = Box_::new(f);
475 connect_raw(
476 self.as_ptr() as *mut _,
477 c"notify::digits".as_ptr() as *const _,
478 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
479 notify_digits_trampoline::<F> as *const (),
480 )),
481 Box_::into_raw(f),
482 )
483 }
484 }
485}
486
487impl Default for CellRendererSpin {
488 fn default() -> Self {
489 Self::new()
490 }
491}
492
493// rustdoc-stripper-ignore-next
494/// A [builder-pattern] type to construct [`CellRendererSpin`] objects.
495///
496/// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html
497#[must_use = "The builder must be built to be used"]
498pub struct CellRendererSpinBuilder {
499 builder: glib::object::ObjectBuilder<'static, CellRendererSpin>,
500}
501
502impl CellRendererSpinBuilder {
503 fn new() -> Self {
504 Self {
505 builder: glib::object::Object::builder(),
506 }
507 }
508
509 /// The adjustment that holds the value of the spinbutton.
510 /// This must be non-[`None`] for the cell renderer to be editable.
511 pub fn adjustment(self, adjustment: &impl IsA<Adjustment>) -> Self {
512 Self {
513 builder: self
514 .builder
515 .property("adjustment", adjustment.clone().upcast()),
516 }
517 }
518
519 /// The acceleration rate when you hold down a button.
520 pub fn climb_rate(self, climb_rate: f64) -> Self {
521 Self {
522 builder: self.builder.property("climb-rate", climb_rate),
523 }
524 }
525
526 /// The number of decimal places to display.
527 pub fn digits(self, digits: u32) -> Self {
528 Self {
529 builder: self.builder.property("digits", digits),
530 }
531 }
532
533 pub fn align_set(self, align_set: bool) -> Self {
534 Self {
535 builder: self.builder.property("align-set", align_set),
536 }
537 }
538
539 /// Specifies how to align the lines of text with respect to each other.
540 ///
541 /// Note that this property describes how to align the lines of text in
542 /// case there are several of them. The "xalign" property of [`CellRenderer`][crate::CellRenderer],
543 /// on the other hand, sets the horizontal alignment of the whole text.
544 pub fn alignment(self, alignment: pango::Alignment) -> Self {
545 Self {
546 builder: self.builder.property("alignment", alignment),
547 }
548 }
549
550 pub fn attributes(self, attributes: &pango::AttrList) -> Self {
551 Self {
552 builder: self.builder.property("attributes", attributes.clone()),
553 }
554 }
555
556 pub fn background(self, background: impl Into<glib::GString>) -> Self {
557 Self {
558 builder: self.builder.property("background", background.into()),
559 }
560 }
561
562 /// Background color as a [`gdk::RGBA`][crate::gdk::RGBA]
563 pub fn background_rgba(self, background_rgba: &gdk::RGBA) -> Self {
564 Self {
565 builder: self.builder.property("background-rgba", background_rgba),
566 }
567 }
568
569 pub fn background_set(self, background_set: bool) -> Self {
570 Self {
571 builder: self.builder.property("background-set", background_set),
572 }
573 }
574
575 pub fn editable(self, editable: bool) -> Self {
576 Self {
577 builder: self.builder.property("editable", editable),
578 }
579 }
580
581 pub fn editable_set(self, editable_set: bool) -> Self {
582 Self {
583 builder: self.builder.property("editable-set", editable_set),
584 }
585 }
586
587 /// Specifies the preferred place to ellipsize the string, if the cell renderer
588 /// does not have enough room to display the entire string. Setting it to
589 /// [`pango::EllipsizeMode::None`][crate::pango::EllipsizeMode::None] turns off ellipsizing. See the wrap-width property
590 /// for another way of making the text fit into a given width.
591 pub fn ellipsize(self, ellipsize: pango::EllipsizeMode) -> Self {
592 Self {
593 builder: self.builder.property("ellipsize", ellipsize),
594 }
595 }
596
597 pub fn ellipsize_set(self, ellipsize_set: bool) -> Self {
598 Self {
599 builder: self.builder.property("ellipsize-set", ellipsize_set),
600 }
601 }
602
603 pub fn family(self, family: impl Into<glib::GString>) -> Self {
604 Self {
605 builder: self.builder.property("family", family.into()),
606 }
607 }
608
609 pub fn family_set(self, family_set: bool) -> Self {
610 Self {
611 builder: self.builder.property("family-set", family_set),
612 }
613 }
614
615 pub fn font(self, font: impl Into<glib::GString>) -> Self {
616 Self {
617 builder: self.builder.property("font", font.into()),
618 }
619 }
620
621 pub fn font_desc(self, font_desc: &pango::FontDescription) -> Self {
622 Self {
623 builder: self.builder.property("font-desc", font_desc),
624 }
625 }
626
627 pub fn foreground(self, foreground: impl Into<glib::GString>) -> Self {
628 Self {
629 builder: self.builder.property("foreground", foreground.into()),
630 }
631 }
632
633 /// Foreground color as a [`gdk::RGBA`][crate::gdk::RGBA]
634 pub fn foreground_rgba(self, foreground_rgba: &gdk::RGBA) -> Self {
635 Self {
636 builder: self.builder.property("foreground-rgba", foreground_rgba),
637 }
638 }
639
640 pub fn foreground_set(self, foreground_set: bool) -> Self {
641 Self {
642 builder: self.builder.property("foreground-set", foreground_set),
643 }
644 }
645
646 pub fn language(self, language: impl Into<glib::GString>) -> Self {
647 Self {
648 builder: self.builder.property("language", language.into()),
649 }
650 }
651
652 pub fn language_set(self, language_set: bool) -> Self {
653 Self {
654 builder: self.builder.property("language-set", language_set),
655 }
656 }
657
658 pub fn markup(self, markup: impl Into<glib::GString>) -> Self {
659 Self {
660 builder: self.builder.property("markup", markup.into()),
661 }
662 }
663
664 /// The desired maximum width of the cell, in characters. If this property
665 /// is set to -1, the width will be calculated automatically.
666 ///
667 /// For cell renderers that ellipsize or wrap text; this property
668 /// controls the maximum reported width of the cell. The
669 /// cell should not receive any greater allocation unless it is
670 /// set to expand in its [`CellLayout`][crate::CellLayout] and all of the cell's siblings
671 /// have received their natural width.
672 pub fn max_width_chars(self, max_width_chars: i32) -> Self {
673 Self {
674 builder: self.builder.property("max-width-chars", max_width_chars),
675 }
676 }
677
678 /// The text that will be displayed in the [`CellRenderer`][crate::CellRenderer] if
679 /// `GtkCellRendererText:editable` is [`true`] and the cell is empty.
680 pub fn placeholder_text(self, placeholder_text: impl Into<glib::GString>) -> Self {
681 Self {
682 builder: self
683 .builder
684 .property("placeholder-text", placeholder_text.into()),
685 }
686 }
687
688 pub fn rise(self, rise: i32) -> Self {
689 Self {
690 builder: self.builder.property("rise", rise),
691 }
692 }
693
694 pub fn rise_set(self, rise_set: bool) -> Self {
695 Self {
696 builder: self.builder.property("rise-set", rise_set),
697 }
698 }
699
700 pub fn scale(self, scale: f64) -> Self {
701 Self {
702 builder: self.builder.property("scale", scale),
703 }
704 }
705
706 pub fn scale_set(self, scale_set: bool) -> Self {
707 Self {
708 builder: self.builder.property("scale-set", scale_set),
709 }
710 }
711
712 pub fn single_paragraph_mode(self, single_paragraph_mode: bool) -> Self {
713 Self {
714 builder: self
715 .builder
716 .property("single-paragraph-mode", single_paragraph_mode),
717 }
718 }
719
720 pub fn size(self, size: i32) -> Self {
721 Self {
722 builder: self.builder.property("size", size),
723 }
724 }
725
726 pub fn size_points(self, size_points: f64) -> Self {
727 Self {
728 builder: self.builder.property("size-points", size_points),
729 }
730 }
731
732 pub fn size_set(self, size_set: bool) -> Self {
733 Self {
734 builder: self.builder.property("size-set", size_set),
735 }
736 }
737
738 pub fn stretch(self, stretch: pango::Stretch) -> Self {
739 Self {
740 builder: self.builder.property("stretch", stretch),
741 }
742 }
743
744 pub fn stretch_set(self, stretch_set: bool) -> Self {
745 Self {
746 builder: self.builder.property("stretch-set", stretch_set),
747 }
748 }
749
750 pub fn strikethrough(self, strikethrough: bool) -> Self {
751 Self {
752 builder: self.builder.property("strikethrough", strikethrough),
753 }
754 }
755
756 pub fn strikethrough_set(self, strikethrough_set: bool) -> Self {
757 Self {
758 builder: self
759 .builder
760 .property("strikethrough-set", strikethrough_set),
761 }
762 }
763
764 pub fn style(self, style: pango::Style) -> Self {
765 Self {
766 builder: self.builder.property("style", style),
767 }
768 }
769
770 pub fn style_set(self, style_set: bool) -> Self {
771 Self {
772 builder: self.builder.property("style-set", style_set),
773 }
774 }
775
776 pub fn text(self, text: impl Into<glib::GString>) -> Self {
777 Self {
778 builder: self.builder.property("text", text.into()),
779 }
780 }
781
782 pub fn underline(self, underline: pango::Underline) -> Self {
783 Self {
784 builder: self.builder.property("underline", underline),
785 }
786 }
787
788 pub fn underline_set(self, underline_set: bool) -> Self {
789 Self {
790 builder: self.builder.property("underline-set", underline_set),
791 }
792 }
793
794 pub fn variant(self, variant: pango::Variant) -> Self {
795 Self {
796 builder: self.builder.property("variant", variant),
797 }
798 }
799
800 pub fn variant_set(self, variant_set: bool) -> Self {
801 Self {
802 builder: self.builder.property("variant-set", variant_set),
803 }
804 }
805
806 pub fn weight(self, weight: i32) -> Self {
807 Self {
808 builder: self.builder.property("weight", weight),
809 }
810 }
811
812 pub fn weight_set(self, weight_set: bool) -> Self {
813 Self {
814 builder: self.builder.property("weight-set", weight_set),
815 }
816 }
817
818 /// The desired width of the cell, in characters. If this property is set to
819 /// -1, the width will be calculated automatically, otherwise the cell will
820 /// request either 3 characters or the property value, whichever is greater.
821 pub fn width_chars(self, width_chars: i32) -> Self {
822 Self {
823 builder: self.builder.property("width-chars", width_chars),
824 }
825 }
826
827 /// Specifies how to break the string into multiple lines, if the cell
828 /// renderer does not have enough room to display the entire string.
829 /// This property has no effect unless the wrap-width property is set.
830 pub fn wrap_mode(self, wrap_mode: pango::WrapMode) -> Self {
831 Self {
832 builder: self.builder.property("wrap-mode", wrap_mode),
833 }
834 }
835
836 /// Specifies the minimum width at which the text is wrapped. The wrap-mode property can
837 /// be used to influence at what character positions the line breaks can be placed.
838 /// Setting wrap-width to -1 turns wrapping off.
839 pub fn wrap_width(self, wrap_width: i32) -> Self {
840 Self {
841 builder: self.builder.property("wrap-width", wrap_width),
842 }
843 }
844
845 pub fn cell_background(self, cell_background: impl Into<glib::GString>) -> Self {
846 Self {
847 builder: self
848 .builder
849 .property("cell-background", cell_background.into()),
850 }
851 }
852
853 /// Cell background as a [`gdk::RGBA`][crate::gdk::RGBA]
854 pub fn cell_background_rgba(self, cell_background_rgba: &gdk::RGBA) -> Self {
855 Self {
856 builder: self
857 .builder
858 .property("cell-background-rgba", cell_background_rgba),
859 }
860 }
861
862 pub fn cell_background_set(self, cell_background_set: bool) -> Self {
863 Self {
864 builder: self
865 .builder
866 .property("cell-background-set", cell_background_set),
867 }
868 }
869
870 pub fn height(self, height: i32) -> Self {
871 Self {
872 builder: self.builder.property("height", height),
873 }
874 }
875
876 pub fn is_expanded(self, is_expanded: bool) -> Self {
877 Self {
878 builder: self.builder.property("is-expanded", is_expanded),
879 }
880 }
881
882 pub fn is_expander(self, is_expander: bool) -> Self {
883 Self {
884 builder: self.builder.property("is-expander", is_expander),
885 }
886 }
887
888 pub fn mode(self, mode: CellRendererMode) -> Self {
889 Self {
890 builder: self.builder.property("mode", mode),
891 }
892 }
893
894 pub fn sensitive(self, sensitive: bool) -> Self {
895 Self {
896 builder: self.builder.property("sensitive", sensitive),
897 }
898 }
899
900 pub fn visible(self, visible: bool) -> Self {
901 Self {
902 builder: self.builder.property("visible", visible),
903 }
904 }
905
906 pub fn width(self, width: i32) -> Self {
907 Self {
908 builder: self.builder.property("width", width),
909 }
910 }
911
912 pub fn xalign(self, xalign: f32) -> Self {
913 Self {
914 builder: self.builder.property("xalign", xalign),
915 }
916 }
917
918 pub fn xpad(self, xpad: u32) -> Self {
919 Self {
920 builder: self.builder.property("xpad", xpad),
921 }
922 }
923
924 pub fn yalign(self, yalign: f32) -> Self {
925 Self {
926 builder: self.builder.property("yalign", yalign),
927 }
928 }
929
930 pub fn ypad(self, ypad: u32) -> Self {
931 Self {
932 builder: self.builder.property("ypad", ypad),
933 }
934 }
935
936 // rustdoc-stripper-ignore-next
937 /// Build the [`CellRendererSpin`].
938 #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"]
939 pub fn build(self) -> CellRendererSpin {
940 assert_initialized_main_thread!();
941 self.builder.build()
942 }
943}