gtk/auto/
spin_button.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::{
6    Adjustment, Align, Buildable, CellEditable, Container, Editable, Entry, EntryBuffer,
7    EntryCompletion, InputHints, InputPurpose, Orientable, Orientation, SpinButtonUpdatePolicy,
8    SpinType, Widget,
9};
10use glib::{
11    prelude::*,
12    signal::{connect_raw, SignalHandlerId},
13    translate::*,
14};
15use std::{boxed::Box as Box_, fmt, mem, mem::transmute};
16
17glib::wrapper! {
18    #[doc(alias = "GtkSpinButton")]
19    pub struct SpinButton(Object<ffi::GtkSpinButton, ffi::GtkSpinButtonClass>) @extends Entry, Widget, @implements Buildable, CellEditable, Editable, Orientable;
20
21    match fn {
22        type_ => || ffi::gtk_spin_button_get_type(),
23    }
24}
25
26impl SpinButton {
27    pub const NONE: Option<&'static SpinButton> = None;
28
29    #[doc(alias = "gtk_spin_button_new")]
30    pub fn new(
31        adjustment: Option<&impl IsA<Adjustment>>,
32        climb_rate: f64,
33        digits: u32,
34    ) -> SpinButton {
35        assert_initialized_main_thread!();
36        unsafe {
37            Widget::from_glib_none(ffi::gtk_spin_button_new(
38                adjustment.map(|p| p.as_ref()).to_glib_none().0,
39                climb_rate,
40                digits,
41            ))
42            .unsafe_cast()
43        }
44    }
45
46    #[doc(alias = "gtk_spin_button_new_with_range")]
47    #[doc(alias = "new_with_range")]
48    pub fn with_range(min: f64, max: f64, step: f64) -> SpinButton {
49        assert_initialized_main_thread!();
50        unsafe {
51            Widget::from_glib_none(ffi::gtk_spin_button_new_with_range(min, max, step))
52                .unsafe_cast()
53        }
54    }
55
56    // rustdoc-stripper-ignore-next
57    /// Creates a new builder-pattern struct instance to construct [`SpinButton`] objects.
58    ///
59    /// This method returns an instance of [`SpinButtonBuilder`](crate::builders::SpinButtonBuilder) which can be used to create [`SpinButton`] objects.
60    pub fn builder() -> SpinButtonBuilder {
61        SpinButtonBuilder::new()
62    }
63}
64
65impl Default for SpinButton {
66    fn default() -> Self {
67        glib::object::Object::new::<Self>()
68    }
69}
70
71// rustdoc-stripper-ignore-next
72/// A [builder-pattern] type to construct [`SpinButton`] objects.
73///
74/// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html
75#[must_use = "The builder must be built to be used"]
76pub struct SpinButtonBuilder {
77    builder: glib::object::ObjectBuilder<'static, SpinButton>,
78}
79
80impl SpinButtonBuilder {
81    fn new() -> Self {
82        Self {
83            builder: glib::object::Object::builder(),
84        }
85    }
86
87    pub fn adjustment(self, adjustment: &impl IsA<Adjustment>) -> Self {
88        Self {
89            builder: self
90                .builder
91                .property("adjustment", adjustment.clone().upcast()),
92        }
93    }
94
95    pub fn climb_rate(self, climb_rate: f64) -> Self {
96        Self {
97            builder: self.builder.property("climb-rate", climb_rate),
98        }
99    }
100
101    pub fn digits(self, digits: u32) -> Self {
102        Self {
103            builder: self.builder.property("digits", digits),
104        }
105    }
106
107    pub fn numeric(self, numeric: bool) -> Self {
108        Self {
109            builder: self.builder.property("numeric", numeric),
110        }
111    }
112
113    pub fn snap_to_ticks(self, snap_to_ticks: bool) -> Self {
114        Self {
115            builder: self.builder.property("snap-to-ticks", snap_to_ticks),
116        }
117    }
118
119    pub fn update_policy(self, update_policy: SpinButtonUpdatePolicy) -> Self {
120        Self {
121            builder: self.builder.property("update-policy", update_policy),
122        }
123    }
124
125    pub fn value(self, value: f64) -> Self {
126        Self {
127            builder: self.builder.property("value", value),
128        }
129    }
130
131    pub fn wrap(self, wrap: bool) -> Self {
132        Self {
133            builder: self.builder.property("wrap", wrap),
134        }
135    }
136
137    pub fn activates_default(self, activates_default: bool) -> Self {
138        Self {
139            builder: self
140                .builder
141                .property("activates-default", activates_default),
142        }
143    }
144
145    pub fn attributes(self, attributes: &pango::AttrList) -> Self {
146        Self {
147            builder: self.builder.property("attributes", attributes.clone()),
148        }
149    }
150
151    pub fn buffer(self, buffer: &impl IsA<EntryBuffer>) -> Self {
152        Self {
153            builder: self.builder.property("buffer", buffer.clone().upcast()),
154        }
155    }
156
157    pub fn caps_lock_warning(self, caps_lock_warning: bool) -> Self {
158        Self {
159            builder: self
160                .builder
161                .property("caps-lock-warning", caps_lock_warning),
162        }
163    }
164
165    pub fn completion(self, completion: &impl IsA<EntryCompletion>) -> Self {
166        Self {
167            builder: self
168                .builder
169                .property("completion", completion.clone().upcast()),
170        }
171    }
172
173    pub fn editable(self, editable: bool) -> Self {
174        Self {
175            builder: self.builder.property("editable", editable),
176        }
177    }
178
179    pub fn enable_emoji_completion(self, enable_emoji_completion: bool) -> Self {
180        Self {
181            builder: self
182                .builder
183                .property("enable-emoji-completion", enable_emoji_completion),
184        }
185    }
186
187    pub fn has_frame(self, has_frame: bool) -> Self {
188        Self {
189            builder: self.builder.property("has-frame", has_frame),
190        }
191    }
192
193    pub fn im_module(self, im_module: impl Into<glib::GString>) -> Self {
194        Self {
195            builder: self.builder.property("im-module", im_module.into()),
196        }
197    }
198
199    pub fn input_hints(self, input_hints: InputHints) -> Self {
200        Self {
201            builder: self.builder.property("input-hints", input_hints),
202        }
203    }
204
205    pub fn input_purpose(self, input_purpose: InputPurpose) -> Self {
206        Self {
207            builder: self.builder.property("input-purpose", input_purpose),
208        }
209    }
210
211    pub fn invisible_char(self, invisible_char: u32) -> Self {
212        Self {
213            builder: self.builder.property("invisible-char", invisible_char),
214        }
215    }
216
217    pub fn invisible_char_set(self, invisible_char_set: bool) -> Self {
218        Self {
219            builder: self
220                .builder
221                .property("invisible-char-set", invisible_char_set),
222        }
223    }
224
225    pub fn max_length(self, max_length: i32) -> Self {
226        Self {
227            builder: self.builder.property("max-length", max_length),
228        }
229    }
230
231    pub fn max_width_chars(self, max_width_chars: i32) -> Self {
232        Self {
233            builder: self.builder.property("max-width-chars", max_width_chars),
234        }
235    }
236
237    pub fn overwrite_mode(self, overwrite_mode: bool) -> Self {
238        Self {
239            builder: self.builder.property("overwrite-mode", overwrite_mode),
240        }
241    }
242
243    pub fn placeholder_text(self, placeholder_text: impl Into<glib::GString>) -> Self {
244        Self {
245            builder: self
246                .builder
247                .property("placeholder-text", placeholder_text.into()),
248        }
249    }
250
251    pub fn populate_all(self, populate_all: bool) -> Self {
252        Self {
253            builder: self.builder.property("populate-all", populate_all),
254        }
255    }
256
257    pub fn primary_icon_activatable(self, primary_icon_activatable: bool) -> Self {
258        Self {
259            builder: self
260                .builder
261                .property("primary-icon-activatable", primary_icon_activatable),
262        }
263    }
264
265    pub fn primary_icon_gicon(self, primary_icon_gicon: &impl IsA<gio::Icon>) -> Self {
266        Self {
267            builder: self
268                .builder
269                .property("primary-icon-gicon", primary_icon_gicon.clone().upcast()),
270        }
271    }
272
273    pub fn primary_icon_name(self, primary_icon_name: impl Into<glib::GString>) -> Self {
274        Self {
275            builder: self
276                .builder
277                .property("primary-icon-name", primary_icon_name.into()),
278        }
279    }
280
281    pub fn primary_icon_pixbuf(self, primary_icon_pixbuf: &gdk_pixbuf::Pixbuf) -> Self {
282        Self {
283            builder: self
284                .builder
285                .property("primary-icon-pixbuf", primary_icon_pixbuf.clone()),
286        }
287    }
288
289    pub fn primary_icon_sensitive(self, primary_icon_sensitive: bool) -> Self {
290        Self {
291            builder: self
292                .builder
293                .property("primary-icon-sensitive", primary_icon_sensitive),
294        }
295    }
296
297    pub fn primary_icon_tooltip_markup(
298        self,
299        primary_icon_tooltip_markup: impl Into<glib::GString>,
300    ) -> Self {
301        Self {
302            builder: self.builder.property(
303                "primary-icon-tooltip-markup",
304                primary_icon_tooltip_markup.into(),
305            ),
306        }
307    }
308
309    pub fn primary_icon_tooltip_text(
310        self,
311        primary_icon_tooltip_text: impl Into<glib::GString>,
312    ) -> Self {
313        Self {
314            builder: self.builder.property(
315                "primary-icon-tooltip-text",
316                primary_icon_tooltip_text.into(),
317            ),
318        }
319    }
320
321    pub fn progress_fraction(self, progress_fraction: f64) -> Self {
322        Self {
323            builder: self
324                .builder
325                .property("progress-fraction", progress_fraction),
326        }
327    }
328
329    pub fn progress_pulse_step(self, progress_pulse_step: f64) -> Self {
330        Self {
331            builder: self
332                .builder
333                .property("progress-pulse-step", progress_pulse_step),
334        }
335    }
336
337    pub fn secondary_icon_activatable(self, secondary_icon_activatable: bool) -> Self {
338        Self {
339            builder: self
340                .builder
341                .property("secondary-icon-activatable", secondary_icon_activatable),
342        }
343    }
344
345    pub fn secondary_icon_gicon(self, secondary_icon_gicon: &impl IsA<gio::Icon>) -> Self {
346        Self {
347            builder: self.builder.property(
348                "secondary-icon-gicon",
349                secondary_icon_gicon.clone().upcast(),
350            ),
351        }
352    }
353
354    pub fn secondary_icon_name(self, secondary_icon_name: impl Into<glib::GString>) -> Self {
355        Self {
356            builder: self
357                .builder
358                .property("secondary-icon-name", secondary_icon_name.into()),
359        }
360    }
361
362    pub fn secondary_icon_pixbuf(self, secondary_icon_pixbuf: &gdk_pixbuf::Pixbuf) -> Self {
363        Self {
364            builder: self
365                .builder
366                .property("secondary-icon-pixbuf", secondary_icon_pixbuf.clone()),
367        }
368    }
369
370    pub fn secondary_icon_sensitive(self, secondary_icon_sensitive: bool) -> Self {
371        Self {
372            builder: self
373                .builder
374                .property("secondary-icon-sensitive", secondary_icon_sensitive),
375        }
376    }
377
378    pub fn secondary_icon_tooltip_markup(
379        self,
380        secondary_icon_tooltip_markup: impl Into<glib::GString>,
381    ) -> Self {
382        Self {
383            builder: self.builder.property(
384                "secondary-icon-tooltip-markup",
385                secondary_icon_tooltip_markup.into(),
386            ),
387        }
388    }
389
390    pub fn secondary_icon_tooltip_text(
391        self,
392        secondary_icon_tooltip_text: impl Into<glib::GString>,
393    ) -> Self {
394        Self {
395            builder: self.builder.property(
396                "secondary-icon-tooltip-text",
397                secondary_icon_tooltip_text.into(),
398            ),
399        }
400    }
401
402    pub fn show_emoji_icon(self, show_emoji_icon: bool) -> Self {
403        Self {
404            builder: self.builder.property("show-emoji-icon", show_emoji_icon),
405        }
406    }
407
408    pub fn tabs(self, tabs: &pango::TabArray) -> Self {
409        Self {
410            builder: self.builder.property("tabs", tabs),
411        }
412    }
413
414    pub fn text(self, text: impl Into<glib::GString>) -> Self {
415        Self {
416            builder: self.builder.property("text", text.into()),
417        }
418    }
419
420    pub fn truncate_multiline(self, truncate_multiline: bool) -> Self {
421        Self {
422            builder: self
423                .builder
424                .property("truncate-multiline", truncate_multiline),
425        }
426    }
427
428    pub fn visibility(self, visibility: bool) -> Self {
429        Self {
430            builder: self.builder.property("visibility", visibility),
431        }
432    }
433
434    pub fn width_chars(self, width_chars: i32) -> Self {
435        Self {
436            builder: self.builder.property("width-chars", width_chars),
437        }
438    }
439
440    pub fn xalign(self, xalign: f32) -> Self {
441        Self {
442            builder: self.builder.property("xalign", xalign),
443        }
444    }
445
446    pub fn app_paintable(self, app_paintable: bool) -> Self {
447        Self {
448            builder: self.builder.property("app-paintable", app_paintable),
449        }
450    }
451
452    pub fn can_default(self, can_default: bool) -> Self {
453        Self {
454            builder: self.builder.property("can-default", can_default),
455        }
456    }
457
458    pub fn can_focus(self, can_focus: bool) -> Self {
459        Self {
460            builder: self.builder.property("can-focus", can_focus),
461        }
462    }
463
464    pub fn events(self, events: gdk::EventMask) -> Self {
465        Self {
466            builder: self.builder.property("events", events),
467        }
468    }
469
470    pub fn expand(self, expand: bool) -> Self {
471        Self {
472            builder: self.builder.property("expand", expand),
473        }
474    }
475
476    pub fn focus_on_click(self, focus_on_click: bool) -> Self {
477        Self {
478            builder: self.builder.property("focus-on-click", focus_on_click),
479        }
480    }
481
482    pub fn halign(self, halign: Align) -> Self {
483        Self {
484            builder: self.builder.property("halign", halign),
485        }
486    }
487
488    pub fn has_default(self, has_default: bool) -> Self {
489        Self {
490            builder: self.builder.property("has-default", has_default),
491        }
492    }
493
494    pub fn has_focus(self, has_focus: bool) -> Self {
495        Self {
496            builder: self.builder.property("has-focus", has_focus),
497        }
498    }
499
500    pub fn has_tooltip(self, has_tooltip: bool) -> Self {
501        Self {
502            builder: self.builder.property("has-tooltip", has_tooltip),
503        }
504    }
505
506    pub fn height_request(self, height_request: i32) -> Self {
507        Self {
508            builder: self.builder.property("height-request", height_request),
509        }
510    }
511
512    pub fn hexpand(self, hexpand: bool) -> Self {
513        Self {
514            builder: self.builder.property("hexpand", hexpand),
515        }
516    }
517
518    pub fn hexpand_set(self, hexpand_set: bool) -> Self {
519        Self {
520            builder: self.builder.property("hexpand-set", hexpand_set),
521        }
522    }
523
524    pub fn is_focus(self, is_focus: bool) -> Self {
525        Self {
526            builder: self.builder.property("is-focus", is_focus),
527        }
528    }
529
530    pub fn margin(self, margin: i32) -> Self {
531        Self {
532            builder: self.builder.property("margin", margin),
533        }
534    }
535
536    pub fn margin_bottom(self, margin_bottom: i32) -> Self {
537        Self {
538            builder: self.builder.property("margin-bottom", margin_bottom),
539        }
540    }
541
542    pub fn margin_end(self, margin_end: i32) -> Self {
543        Self {
544            builder: self.builder.property("margin-end", margin_end),
545        }
546    }
547
548    pub fn margin_start(self, margin_start: i32) -> Self {
549        Self {
550            builder: self.builder.property("margin-start", margin_start),
551        }
552    }
553
554    pub fn margin_top(self, margin_top: i32) -> Self {
555        Self {
556            builder: self.builder.property("margin-top", margin_top),
557        }
558    }
559
560    pub fn name(self, name: impl Into<glib::GString>) -> Self {
561        Self {
562            builder: self.builder.property("name", name.into()),
563        }
564    }
565
566    pub fn no_show_all(self, no_show_all: bool) -> Self {
567        Self {
568            builder: self.builder.property("no-show-all", no_show_all),
569        }
570    }
571
572    pub fn opacity(self, opacity: f64) -> Self {
573        Self {
574            builder: self.builder.property("opacity", opacity),
575        }
576    }
577
578    pub fn parent(self, parent: &impl IsA<Container>) -> Self {
579        Self {
580            builder: self.builder.property("parent", parent.clone().upcast()),
581        }
582    }
583
584    pub fn receives_default(self, receives_default: bool) -> Self {
585        Self {
586            builder: self.builder.property("receives-default", receives_default),
587        }
588    }
589
590    pub fn sensitive(self, sensitive: bool) -> Self {
591        Self {
592            builder: self.builder.property("sensitive", sensitive),
593        }
594    }
595
596    pub fn tooltip_markup(self, tooltip_markup: impl Into<glib::GString>) -> Self {
597        Self {
598            builder: self
599                .builder
600                .property("tooltip-markup", tooltip_markup.into()),
601        }
602    }
603
604    pub fn tooltip_text(self, tooltip_text: impl Into<glib::GString>) -> Self {
605        Self {
606            builder: self.builder.property("tooltip-text", tooltip_text.into()),
607        }
608    }
609
610    pub fn valign(self, valign: Align) -> Self {
611        Self {
612            builder: self.builder.property("valign", valign),
613        }
614    }
615
616    pub fn vexpand(self, vexpand: bool) -> Self {
617        Self {
618            builder: self.builder.property("vexpand", vexpand),
619        }
620    }
621
622    pub fn vexpand_set(self, vexpand_set: bool) -> Self {
623        Self {
624            builder: self.builder.property("vexpand-set", vexpand_set),
625        }
626    }
627
628    pub fn visible(self, visible: bool) -> Self {
629        Self {
630            builder: self.builder.property("visible", visible),
631        }
632    }
633
634    pub fn width_request(self, width_request: i32) -> Self {
635        Self {
636            builder: self.builder.property("width-request", width_request),
637        }
638    }
639
640    pub fn editing_canceled(self, editing_canceled: bool) -> Self {
641        Self {
642            builder: self.builder.property("editing-canceled", editing_canceled),
643        }
644    }
645
646    pub fn orientation(self, orientation: Orientation) -> Self {
647        Self {
648            builder: self.builder.property("orientation", orientation),
649        }
650    }
651
652    // rustdoc-stripper-ignore-next
653    /// Build the [`SpinButton`].
654    #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"]
655    pub fn build(self) -> SpinButton {
656        self.builder.build()
657    }
658}
659
660mod sealed {
661    pub trait Sealed {}
662    impl<T: super::IsA<super::SpinButton>> Sealed for T {}
663}
664
665pub trait SpinButtonExt: IsA<SpinButton> + sealed::Sealed + 'static {
666    #[doc(alias = "gtk_spin_button_configure")]
667    fn configure(&self, adjustment: Option<&impl IsA<Adjustment>>, climb_rate: f64, digits: u32) {
668        unsafe {
669            ffi::gtk_spin_button_configure(
670                self.as_ref().to_glib_none().0,
671                adjustment.map(|p| p.as_ref()).to_glib_none().0,
672                climb_rate,
673                digits,
674            );
675        }
676    }
677
678    #[doc(alias = "gtk_spin_button_get_adjustment")]
679    #[doc(alias = "get_adjustment")]
680    fn adjustment(&self) -> Adjustment {
681        unsafe {
682            from_glib_none(ffi::gtk_spin_button_get_adjustment(
683                self.as_ref().to_glib_none().0,
684            ))
685        }
686    }
687
688    #[doc(alias = "gtk_spin_button_get_digits")]
689    #[doc(alias = "get_digits")]
690    fn digits(&self) -> u32 {
691        unsafe { ffi::gtk_spin_button_get_digits(self.as_ref().to_glib_none().0) }
692    }
693
694    #[doc(alias = "gtk_spin_button_get_increments")]
695    #[doc(alias = "get_increments")]
696    fn increments(&self) -> (f64, f64) {
697        unsafe {
698            let mut step = mem::MaybeUninit::uninit();
699            let mut page = mem::MaybeUninit::uninit();
700            ffi::gtk_spin_button_get_increments(
701                self.as_ref().to_glib_none().0,
702                step.as_mut_ptr(),
703                page.as_mut_ptr(),
704            );
705            (step.assume_init(), page.assume_init())
706        }
707    }
708
709    #[doc(alias = "gtk_spin_button_get_numeric")]
710    #[doc(alias = "get_numeric")]
711    fn is_numeric(&self) -> bool {
712        unsafe {
713            from_glib(ffi::gtk_spin_button_get_numeric(
714                self.as_ref().to_glib_none().0,
715            ))
716        }
717    }
718
719    #[doc(alias = "gtk_spin_button_get_range")]
720    #[doc(alias = "get_range")]
721    fn range(&self) -> (f64, f64) {
722        unsafe {
723            let mut min = mem::MaybeUninit::uninit();
724            let mut max = mem::MaybeUninit::uninit();
725            ffi::gtk_spin_button_get_range(
726                self.as_ref().to_glib_none().0,
727                min.as_mut_ptr(),
728                max.as_mut_ptr(),
729            );
730            (min.assume_init(), max.assume_init())
731        }
732    }
733
734    #[doc(alias = "gtk_spin_button_get_snap_to_ticks")]
735    #[doc(alias = "get_snap_to_ticks")]
736    fn snaps_to_ticks(&self) -> bool {
737        unsafe {
738            from_glib(ffi::gtk_spin_button_get_snap_to_ticks(
739                self.as_ref().to_glib_none().0,
740            ))
741        }
742    }
743
744    #[doc(alias = "gtk_spin_button_get_update_policy")]
745    #[doc(alias = "get_update_policy")]
746    fn update_policy(&self) -> SpinButtonUpdatePolicy {
747        unsafe {
748            from_glib(ffi::gtk_spin_button_get_update_policy(
749                self.as_ref().to_glib_none().0,
750            ))
751        }
752    }
753
754    #[doc(alias = "gtk_spin_button_get_value")]
755    #[doc(alias = "get_value")]
756    fn value(&self) -> f64 {
757        unsafe { ffi::gtk_spin_button_get_value(self.as_ref().to_glib_none().0) }
758    }
759
760    #[doc(alias = "gtk_spin_button_get_value_as_int")]
761    #[doc(alias = "get_value_as_int")]
762    fn value_as_int(&self) -> i32 {
763        unsafe { ffi::gtk_spin_button_get_value_as_int(self.as_ref().to_glib_none().0) }
764    }
765
766    #[doc(alias = "gtk_spin_button_get_wrap")]
767    #[doc(alias = "get_wrap")]
768    fn wraps(&self) -> bool {
769        unsafe {
770            from_glib(ffi::gtk_spin_button_get_wrap(
771                self.as_ref().to_glib_none().0,
772            ))
773        }
774    }
775
776    #[doc(alias = "gtk_spin_button_set_adjustment")]
777    fn set_adjustment(&self, adjustment: &impl IsA<Adjustment>) {
778        unsafe {
779            ffi::gtk_spin_button_set_adjustment(
780                self.as_ref().to_glib_none().0,
781                adjustment.as_ref().to_glib_none().0,
782            );
783        }
784    }
785
786    #[doc(alias = "gtk_spin_button_set_digits")]
787    fn set_digits(&self, digits: u32) {
788        unsafe {
789            ffi::gtk_spin_button_set_digits(self.as_ref().to_glib_none().0, digits);
790        }
791    }
792
793    #[doc(alias = "gtk_spin_button_set_increments")]
794    fn set_increments(&self, step: f64, page: f64) {
795        unsafe {
796            ffi::gtk_spin_button_set_increments(self.as_ref().to_glib_none().0, step, page);
797        }
798    }
799
800    #[doc(alias = "gtk_spin_button_set_numeric")]
801    fn set_numeric(&self, numeric: bool) {
802        unsafe {
803            ffi::gtk_spin_button_set_numeric(self.as_ref().to_glib_none().0, numeric.into_glib());
804        }
805    }
806
807    #[doc(alias = "gtk_spin_button_set_range")]
808    fn set_range(&self, min: f64, max: f64) {
809        unsafe {
810            ffi::gtk_spin_button_set_range(self.as_ref().to_glib_none().0, min, max);
811        }
812    }
813
814    #[doc(alias = "gtk_spin_button_set_snap_to_ticks")]
815    fn set_snap_to_ticks(&self, snap_to_ticks: bool) {
816        unsafe {
817            ffi::gtk_spin_button_set_snap_to_ticks(
818                self.as_ref().to_glib_none().0,
819                snap_to_ticks.into_glib(),
820            );
821        }
822    }
823
824    #[doc(alias = "gtk_spin_button_set_update_policy")]
825    fn set_update_policy(&self, policy: SpinButtonUpdatePolicy) {
826        unsafe {
827            ffi::gtk_spin_button_set_update_policy(
828                self.as_ref().to_glib_none().0,
829                policy.into_glib(),
830            );
831        }
832    }
833
834    #[doc(alias = "gtk_spin_button_set_value")]
835    fn set_value(&self, value: f64) {
836        unsafe {
837            ffi::gtk_spin_button_set_value(self.as_ref().to_glib_none().0, value);
838        }
839    }
840
841    #[doc(alias = "gtk_spin_button_set_wrap")]
842    fn set_wrap(&self, wrap: bool) {
843        unsafe {
844            ffi::gtk_spin_button_set_wrap(self.as_ref().to_glib_none().0, wrap.into_glib());
845        }
846    }
847
848    #[doc(alias = "gtk_spin_button_spin")]
849    fn spin(&self, direction: SpinType, increment: f64) {
850        unsafe {
851            ffi::gtk_spin_button_spin(
852                self.as_ref().to_glib_none().0,
853                direction.into_glib(),
854                increment,
855            );
856        }
857    }
858
859    #[doc(alias = "gtk_spin_button_update")]
860    fn update(&self) {
861        unsafe {
862            ffi::gtk_spin_button_update(self.as_ref().to_glib_none().0);
863        }
864    }
865
866    #[doc(alias = "climb-rate")]
867    fn climb_rate(&self) -> f64 {
868        ObjectExt::property(self.as_ref(), "climb-rate")
869    }
870
871    #[doc(alias = "climb-rate")]
872    fn set_climb_rate(&self, climb_rate: f64) {
873        ObjectExt::set_property(self.as_ref(), "climb-rate", climb_rate)
874    }
875
876    #[doc(alias = "adjustment")]
877    fn connect_adjustment_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
878        unsafe extern "C" fn notify_adjustment_trampoline<
879            P: IsA<SpinButton>,
880            F: Fn(&P) + 'static,
881        >(
882            this: *mut ffi::GtkSpinButton,
883            _param_spec: glib::ffi::gpointer,
884            f: glib::ffi::gpointer,
885        ) {
886            let f: &F = &*(f as *const F);
887            f(SpinButton::from_glib_borrow(this).unsafe_cast_ref())
888        }
889        unsafe {
890            let f: Box_<F> = Box_::new(f);
891            connect_raw(
892                self.as_ptr() as *mut _,
893                b"notify::adjustment\0".as_ptr() as *const _,
894                Some(transmute::<_, unsafe extern "C" fn()>(
895                    notify_adjustment_trampoline::<Self, F> as *const (),
896                )),
897                Box_::into_raw(f),
898            )
899        }
900    }
901
902    #[doc(alias = "climb-rate")]
903    fn connect_climb_rate_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
904        unsafe extern "C" fn notify_climb_rate_trampoline<
905            P: IsA<SpinButton>,
906            F: Fn(&P) + 'static,
907        >(
908            this: *mut ffi::GtkSpinButton,
909            _param_spec: glib::ffi::gpointer,
910            f: glib::ffi::gpointer,
911        ) {
912            let f: &F = &*(f as *const F);
913            f(SpinButton::from_glib_borrow(this).unsafe_cast_ref())
914        }
915        unsafe {
916            let f: Box_<F> = Box_::new(f);
917            connect_raw(
918                self.as_ptr() as *mut _,
919                b"notify::climb-rate\0".as_ptr() as *const _,
920                Some(transmute::<_, unsafe extern "C" fn()>(
921                    notify_climb_rate_trampoline::<Self, F> as *const (),
922                )),
923                Box_::into_raw(f),
924            )
925        }
926    }
927
928    #[doc(alias = "digits")]
929    fn connect_digits_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
930        unsafe extern "C" fn notify_digits_trampoline<P: IsA<SpinButton>, F: Fn(&P) + 'static>(
931            this: *mut ffi::GtkSpinButton,
932            _param_spec: glib::ffi::gpointer,
933            f: glib::ffi::gpointer,
934        ) {
935            let f: &F = &*(f as *const F);
936            f(SpinButton::from_glib_borrow(this).unsafe_cast_ref())
937        }
938        unsafe {
939            let f: Box_<F> = Box_::new(f);
940            connect_raw(
941                self.as_ptr() as *mut _,
942                b"notify::digits\0".as_ptr() as *const _,
943                Some(transmute::<_, unsafe extern "C" fn()>(
944                    notify_digits_trampoline::<Self, F> as *const (),
945                )),
946                Box_::into_raw(f),
947            )
948        }
949    }
950
951    #[doc(alias = "numeric")]
952    fn connect_numeric_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
953        unsafe extern "C" fn notify_numeric_trampoline<P: IsA<SpinButton>, F: Fn(&P) + 'static>(
954            this: *mut ffi::GtkSpinButton,
955            _param_spec: glib::ffi::gpointer,
956            f: glib::ffi::gpointer,
957        ) {
958            let f: &F = &*(f as *const F);
959            f(SpinButton::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::numeric\0".as_ptr() as *const _,
966                Some(transmute::<_, unsafe extern "C" fn()>(
967                    notify_numeric_trampoline::<Self, F> as *const (),
968                )),
969                Box_::into_raw(f),
970            )
971        }
972    }
973
974    #[doc(alias = "snap-to-ticks")]
975    fn connect_snap_to_ticks_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
976        unsafe extern "C" fn notify_snap_to_ticks_trampoline<
977            P: IsA<SpinButton>,
978            F: Fn(&P) + 'static,
979        >(
980            this: *mut ffi::GtkSpinButton,
981            _param_spec: glib::ffi::gpointer,
982            f: glib::ffi::gpointer,
983        ) {
984            let f: &F = &*(f as *const F);
985            f(SpinButton::from_glib_borrow(this).unsafe_cast_ref())
986        }
987        unsafe {
988            let f: Box_<F> = Box_::new(f);
989            connect_raw(
990                self.as_ptr() as *mut _,
991                b"notify::snap-to-ticks\0".as_ptr() as *const _,
992                Some(transmute::<_, unsafe extern "C" fn()>(
993                    notify_snap_to_ticks_trampoline::<Self, F> as *const (),
994                )),
995                Box_::into_raw(f),
996            )
997        }
998    }
999
1000    #[doc(alias = "update-policy")]
1001    fn connect_update_policy_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1002        unsafe extern "C" fn notify_update_policy_trampoline<
1003            P: IsA<SpinButton>,
1004            F: Fn(&P) + 'static,
1005        >(
1006            this: *mut ffi::GtkSpinButton,
1007            _param_spec: glib::ffi::gpointer,
1008            f: glib::ffi::gpointer,
1009        ) {
1010            let f: &F = &*(f as *const F);
1011            f(SpinButton::from_glib_borrow(this).unsafe_cast_ref())
1012        }
1013        unsafe {
1014            let f: Box_<F> = Box_::new(f);
1015            connect_raw(
1016                self.as_ptr() as *mut _,
1017                b"notify::update-policy\0".as_ptr() as *const _,
1018                Some(transmute::<_, unsafe extern "C" fn()>(
1019                    notify_update_policy_trampoline::<Self, F> as *const (),
1020                )),
1021                Box_::into_raw(f),
1022            )
1023        }
1024    }
1025
1026    #[doc(alias = "value")]
1027    fn connect_value_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1028        unsafe extern "C" fn notify_value_trampoline<P: IsA<SpinButton>, F: Fn(&P) + 'static>(
1029            this: *mut ffi::GtkSpinButton,
1030            _param_spec: glib::ffi::gpointer,
1031            f: glib::ffi::gpointer,
1032        ) {
1033            let f: &F = &*(f as *const F);
1034            f(SpinButton::from_glib_borrow(this).unsafe_cast_ref())
1035        }
1036        unsafe {
1037            let f: Box_<F> = Box_::new(f);
1038            connect_raw(
1039                self.as_ptr() as *mut _,
1040                b"notify::value\0".as_ptr() as *const _,
1041                Some(transmute::<_, unsafe extern "C" fn()>(
1042                    notify_value_trampoline::<Self, F> as *const (),
1043                )),
1044                Box_::into_raw(f),
1045            )
1046        }
1047    }
1048
1049    #[doc(alias = "wrap")]
1050    fn connect_wrap_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1051        unsafe extern "C" fn notify_wrap_trampoline<P: IsA<SpinButton>, F: Fn(&P) + 'static>(
1052            this: *mut ffi::GtkSpinButton,
1053            _param_spec: glib::ffi::gpointer,
1054            f: glib::ffi::gpointer,
1055        ) {
1056            let f: &F = &*(f as *const F);
1057            f(SpinButton::from_glib_borrow(this).unsafe_cast_ref())
1058        }
1059        unsafe {
1060            let f: Box_<F> = Box_::new(f);
1061            connect_raw(
1062                self.as_ptr() as *mut _,
1063                b"notify::wrap\0".as_ptr() as *const _,
1064                Some(transmute::<_, unsafe extern "C" fn()>(
1065                    notify_wrap_trampoline::<Self, F> as *const (),
1066                )),
1067                Box_::into_raw(f),
1068            )
1069        }
1070    }
1071}
1072
1073impl<O: IsA<SpinButton>> SpinButtonExt for O {}
1074
1075impl fmt::Display for SpinButton {
1076    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
1077        f.write_str("SpinButton")
1078    }
1079}