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