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, ffi,
9};
10use glib::{
11 prelude::*,
12 signal::{SignalHandlerId, connect_raw},
13 translate::*,
14};
15use std::boxed::Box as Box_;
16
17glib::wrapper! {
18 /// A [`SpinButton`][crate::SpinButton] is an ideal way to allow the user to set the value of
19 /// some attribute. Rather than having to directly type a number into a
20 /// [`Entry`][crate::Entry], GtkSpinButton allows the user to click on one of two arrows
21 /// to increment or decrement the displayed value. A value can still be
22 /// typed in, with the bonus that it can be checked to ensure it is in a
23 /// given range.
24 ///
25 /// The main properties of a GtkSpinButton are through an adjustment.
26 /// See the [`Adjustment`][crate::Adjustment] section for more details about an adjustment's
27 /// properties. Note that GtkSpinButton will by default make its entry
28 /// large enough to accomodate the lower and upper bounds of the adjustment,
29 /// which can lead to surprising results. Best practice is to set both
30 /// the [`width-chars`][struct@crate::Entry#width-chars] and [`max-width-chars`][struct@crate::Entry#max-width-chars] poperties
31 /// to the desired number of characters to display in the entry.
32 ///
33 /// # CSS nodes
34 ///
35 ///
36 ///
37 /// **⚠️ The following code is in plain ⚠️**
38 ///
39 /// ```plain
40 /// spinbutton.horizontal
41 /// ├── undershoot.left
42 /// ├── undershoot.right
43 /// ├── entry
44 /// │ ╰── ...
45 /// ├── button.down
46 /// ╰── button.up
47 /// ```
48 ///
49 ///
50 ///
51 /// **⚠️ The following code is in plain ⚠️**
52 ///
53 /// ```plain
54 /// spinbutton.vertical
55 /// ├── undershoot.left
56 /// ├── undershoot.right
57 /// ├── button.up
58 /// ├── entry
59 /// │ ╰── ...
60 /// ╰── button.down
61 /// ```
62 ///
63 /// GtkSpinButtons main CSS node has the name spinbutton. It creates subnodes
64 /// for the entry and the two buttons, with these names. The button nodes have
65 /// the style classes .up and .down. The GtkEntry subnodes (if present) are put
66 /// below the entry node. The orientation of the spin button is reflected in
67 /// the .vertical or .horizontal style class on the main node.
68 ///
69 /// ## Using a GtkSpinButton to get an integer
70 ///
71 ///
72 ///
73 /// **⚠️ The following code is in C ⚠️**
74 ///
75 /// ```C
76 /// // Provides a function to retrieve an integer value from a GtkSpinButton
77 /// // and creates a spin button to model percentage values.
78 ///
79 /// gint
80 /// grab_int_value (GtkSpinButton *button,
81 /// gpointer user_data)
82 /// {
83 /// return gtk_spin_button_get_value_as_int (button);
84 /// }
85 ///
86 /// void
87 /// create_integer_spin_button (void)
88 /// {
89 ///
90 /// GtkWidget *window, *button;
91 /// GtkAdjustment *adjustment;
92 ///
93 /// adjustment = gtk_adjustment_new (50.0, 0.0, 100.0, 1.0, 5.0, 0.0);
94 ///
95 /// window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
96 /// gtk_container_set_border_width (GTK_CONTAINER (window), 5);
97 ///
98 /// // creates the spinbutton, with no decimal places
99 /// button = gtk_spin_button_new (adjustment, 1.0, 0);
100 /// gtk_container_add (GTK_CONTAINER (window), button);
101 ///
102 /// gtk_widget_show_all (window);
103 /// }
104 /// ```
105 ///
106 /// ## Using a GtkSpinButton to get a floating point value
107 ///
108 ///
109 ///
110 /// **⚠️ The following code is in C ⚠️**
111 ///
112 /// ```C
113 /// // Provides a function to retrieve a floating point value from a
114 /// // GtkSpinButton, and creates a high precision spin button.
115 ///
116 /// gfloat
117 /// grab_float_value (GtkSpinButton *button,
118 /// gpointer user_data)
119 /// {
120 /// return gtk_spin_button_get_value (button);
121 /// }
122 ///
123 /// void
124 /// create_floating_spin_button (void)
125 /// {
126 /// GtkWidget *window, *button;
127 /// GtkAdjustment *adjustment;
128 ///
129 /// adjustment = gtk_adjustment_new (2.500, 0.0, 5.0, 0.001, 0.1, 0.0);
130 ///
131 /// window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
132 /// gtk_container_set_border_width (GTK_CONTAINER (window), 5);
133 ///
134 /// // creates the spinbutton, with three decimal places
135 /// button = gtk_spin_button_new (adjustment, 0.001, 3);
136 /// gtk_container_add (GTK_CONTAINER (window), button);
137 ///
138 /// gtk_widget_show_all (window);
139 /// }
140 /// ```
141 ///
142 /// ## Properties
143 ///
144 ///
145 /// #### `adjustment`
146 /// Readable | Writable
147 ///
148 ///
149 /// #### `climb-rate`
150 /// Readable | Writable
151 ///
152 ///
153 /// #### `digits`
154 /// Readable | Writable
155 ///
156 ///
157 /// #### `numeric`
158 /// Readable | Writable
159 ///
160 ///
161 /// #### `snap-to-ticks`
162 /// Readable | Writable
163 ///
164 ///
165 /// #### `update-policy`
166 /// Readable | Writable
167 ///
168 ///
169 /// #### `value`
170 /// Readable | Writable
171 ///
172 ///
173 /// #### `wrap`
174 /// Readable | Writable
175 /// <details><summary><h4>Entry</h4></summary>
176 ///
177 ///
178 /// #### `activates-default`
179 /// Readable | Writable
180 ///
181 ///
182 /// #### `attributes`
183 /// A list of Pango attributes to apply to the text of the entry.
184 ///
185 /// This is mainly useful to change the size or weight of the text.
186 ///
187 /// The `PangoAttribute`'s `start_index` and `end_index` must refer to the
188 /// [`EntryBuffer`][crate::EntryBuffer] text, i.e. without the preedit string.
189 ///
190 /// Readable | Writable
191 ///
192 ///
193 /// #### `buffer`
194 /// Readable | Writable | Construct
195 ///
196 ///
197 /// #### `caps-lock-warning`
198 /// Whether password entries will show a warning when Caps Lock is on.
199 ///
200 /// Note that the warning is shown using a secondary icon, and thus
201 /// does not work if you are using the secondary icon position for some
202 /// other purpose.
203 ///
204 /// Readable | Writable
205 ///
206 ///
207 /// #### `completion`
208 /// The auxiliary completion object to use with the entry.
209 ///
210 /// Readable | Writable
211 ///
212 ///
213 /// #### `cursor-position`
214 /// Readable
215 ///
216 ///
217 /// #### `editable`
218 /// Readable | Writable
219 ///
220 ///
221 /// #### `enable-emoji-completion`
222 /// Readable | Writable
223 ///
224 ///
225 /// #### `has-frame`
226 /// Readable | Writable
227 ///
228 ///
229 /// #### `im-module`
230 /// Which IM (input method) module should be used for this entry.
231 /// See [`IMContext`][crate::IMContext].
232 ///
233 /// Setting this to a non-[`None`] value overrides the
234 /// system-wide IM module setting. See the GtkSettings
235 /// [`gtk-im-module`][struct@crate::Settings#gtk-im-module] property.
236 ///
237 /// Readable | Writable
238 ///
239 ///
240 /// #### `inner-border`
241 /// Sets the text area's border between the text and the frame.
242 ///
243 /// Readable | Writable
244 ///
245 ///
246 /// #### `input-hints`
247 /// Additional hints (beyond [`input-purpose`][struct@crate::Entry#input-purpose]) that
248 /// allow input methods to fine-tune their behaviour.
249 ///
250 /// Readable | Writable
251 ///
252 ///
253 /// #### `input-purpose`
254 /// The purpose of this text field.
255 ///
256 /// This property can be used by on-screen keyboards and other input
257 /// methods to adjust their behaviour.
258 ///
259 /// Note that setting the purpose to [`InputPurpose::Password`][crate::InputPurpose::Password] or
260 /// [`InputPurpose::Pin`][crate::InputPurpose::Pin] is independent from setting
261 /// [`visibility`][struct@crate::Entry#visibility].
262 ///
263 /// Readable | Writable
264 ///
265 ///
266 /// #### `invisible-char`
267 /// The invisible character is used when masking entry contents (in
268 /// \"password mode\")"). When it is not explicitly set with the
269 /// [`invisible-char`][struct@crate::Entry#invisible-char] property, GTK+ determines the character
270 /// to use from a list of possible candidates, depending on availability
271 /// in the current font.
272 ///
273 /// This style property allows the theme to prepend a character
274 /// to the list of candidates.
275 ///
276 /// Readable | Writable
277 ///
278 ///
279 /// #### `invisible-char-set`
280 /// Whether the invisible char has been set for the [`Entry`][crate::Entry].
281 ///
282 /// Readable | Writable
283 ///
284 ///
285 /// #### `max-length`
286 /// Readable | Writable
287 ///
288 ///
289 /// #### `max-width-chars`
290 /// The desired maximum width of the entry, in characters.
291 /// If this property is set to -1, the width will be calculated
292 /// automatically.
293 ///
294 /// Readable | Writable
295 ///
296 ///
297 /// #### `overwrite-mode`
298 /// If text is overwritten when typing in the [`Entry`][crate::Entry].
299 ///
300 /// Readable | Writable
301 ///
302 ///
303 /// #### `placeholder-text`
304 /// The text that will be displayed in the [`Entry`][crate::Entry] when it is empty
305 /// and unfocused.
306 ///
307 /// Readable | Writable
308 ///
309 ///
310 /// #### `populate-all`
311 /// If :populate-all is [`true`], the [`populate-popup`][struct@crate::Entry#populate-popup]
312 /// signal is also emitted for touch popups.
313 ///
314 /// Readable | Writable
315 ///
316 ///
317 /// #### `primary-icon-activatable`
318 /// Whether the primary icon is activatable.
319 ///
320 /// GTK+ emits the [`icon-press`][struct@crate::Entry#icon-press] and [`icon-release`][struct@crate::Entry#icon-release]
321 /// signals only on sensitive, activatable icons.
322 ///
323 /// Sensitive, but non-activatable icons can be used for purely
324 /// informational purposes.
325 ///
326 /// Readable | Writable
327 ///
328 ///
329 /// #### `primary-icon-gicon`
330 /// The [`gio::Icon`][crate::gio::Icon] to use for the primary icon for the entry.
331 ///
332 /// Readable | Writable
333 ///
334 ///
335 /// #### `primary-icon-name`
336 /// The icon name to use for the primary icon for the entry.
337 ///
338 /// Readable | Writable
339 ///
340 ///
341 /// #### `primary-icon-pixbuf`
342 /// A pixbuf to use as the primary icon for the entry.
343 ///
344 /// Readable | Writable
345 ///
346 ///
347 /// #### `primary-icon-sensitive`
348 /// Whether the primary icon is sensitive.
349 ///
350 /// An insensitive icon appears grayed out. GTK+ does not emit the
351 /// [`icon-press`][struct@crate::Entry#icon-press] and [`icon-release`][struct@crate::Entry#icon-release] signals and
352 /// does not allow DND from insensitive icons.
353 ///
354 /// An icon should be set insensitive if the action that would trigger
355 /// when clicked is currently not available.
356 ///
357 /// Readable | Writable
358 ///
359 ///
360 /// #### `primary-icon-stock`
361 /// The stock id to use for the primary icon for the entry.
362 ///
363 /// Readable | Writable
364 ///
365 ///
366 /// #### `primary-icon-storage-type`
367 /// The representation which is used for the primary icon of the entry.
368 ///
369 /// Readable
370 ///
371 ///
372 /// #### `primary-icon-tooltip-markup`
373 /// The contents of the tooltip on the primary icon, which is marked up
374 /// with the [Pango text markup language][PangoMarkupFormat].
375 ///
376 /// Also see [`EntryExt::set_icon_tooltip_markup()`][crate::prelude::EntryExt::set_icon_tooltip_markup()].
377 ///
378 /// Readable | Writable
379 ///
380 ///
381 /// #### `primary-icon-tooltip-text`
382 /// The contents of the tooltip on the primary icon.
383 ///
384 /// Also see [`EntryExt::set_icon_tooltip_text()`][crate::prelude::EntryExt::set_icon_tooltip_text()].
385 ///
386 /// Readable | Writable
387 ///
388 ///
389 /// #### `progress-fraction`
390 /// The current fraction of the task that's been completed.
391 ///
392 /// Readable | Writable
393 ///
394 ///
395 /// #### `progress-pulse-step`
396 /// The fraction of total entry width to move the progress
397 /// bouncing block for each call to [`EntryExt::progress_pulse()`][crate::prelude::EntryExt::progress_pulse()].
398 ///
399 /// Readable | Writable
400 ///
401 ///
402 /// #### `scroll-offset`
403 /// Readable
404 ///
405 ///
406 /// #### `secondary-icon-activatable`
407 /// Whether the secondary icon is activatable.
408 ///
409 /// GTK+ emits the [`icon-press`][struct@crate::Entry#icon-press] and [`icon-release`][struct@crate::Entry#icon-release]
410 /// signals only on sensitive, activatable icons.
411 ///
412 /// Sensitive, but non-activatable icons can be used for purely
413 /// informational purposes.
414 ///
415 /// Readable | Writable
416 ///
417 ///
418 /// #### `secondary-icon-gicon`
419 /// The [`gio::Icon`][crate::gio::Icon] to use for the secondary icon for the entry.
420 ///
421 /// Readable | Writable
422 ///
423 ///
424 /// #### `secondary-icon-name`
425 /// The icon name to use for the secondary icon for the entry.
426 ///
427 /// Readable | Writable
428 ///
429 ///
430 /// #### `secondary-icon-pixbuf`
431 /// An pixbuf to use as the secondary icon for the entry.
432 ///
433 /// Readable | Writable
434 ///
435 ///
436 /// #### `secondary-icon-sensitive`
437 /// Whether the secondary icon is sensitive.
438 ///
439 /// An insensitive icon appears grayed out. GTK+ does not emit the
440 /// [`icon-press`][struct@crate::Entry#icon-press] and [`icon-release`][struct@crate::Entry#icon-release] signals and
441 /// does not allow DND from insensitive icons.
442 ///
443 /// An icon should be set insensitive if the action that would trigger
444 /// when clicked is currently not available.
445 ///
446 /// Readable | Writable
447 ///
448 ///
449 /// #### `secondary-icon-stock`
450 /// The stock id to use for the secondary icon for the entry.
451 ///
452 /// Readable | Writable
453 ///
454 ///
455 /// #### `secondary-icon-storage-type`
456 /// The representation which is used for the secondary icon of the entry.
457 ///
458 /// Readable
459 ///
460 ///
461 /// #### `secondary-icon-tooltip-markup`
462 /// The contents of the tooltip on the secondary icon, which is marked up
463 /// with the [Pango text markup language][PangoMarkupFormat].
464 ///
465 /// Also see [`EntryExt::set_icon_tooltip_markup()`][crate::prelude::EntryExt::set_icon_tooltip_markup()].
466 ///
467 /// Readable | Writable
468 ///
469 ///
470 /// #### `secondary-icon-tooltip-text`
471 /// The contents of the tooltip on the secondary icon.
472 ///
473 /// Also see [`EntryExt::set_icon_tooltip_text()`][crate::prelude::EntryExt::set_icon_tooltip_text()].
474 ///
475 /// Readable | Writable
476 ///
477 ///
478 /// #### `selection-bound`
479 /// Readable
480 ///
481 ///
482 /// #### `shadow-type`
483 /// Which kind of shadow to draw around the entry when
484 /// [`has-frame`][struct@crate::Entry#has-frame] is set to [`true`].
485 ///
486 /// Readable | Writable
487 ///
488 ///
489 /// #### `show-emoji-icon`
490 /// Readable | Writable
491 ///
492 ///
493 /// #### `tabs`
494 /// Readable | Writable
495 ///
496 ///
497 /// #### `text`
498 /// Readable | Writable
499 ///
500 ///
501 /// #### `text-length`
502 /// The length of the text in the [`Entry`][crate::Entry].
503 ///
504 /// Readable
505 ///
506 ///
507 /// #### `truncate-multiline`
508 /// When [`true`], pasted multi-line text is truncated to the first line.
509 ///
510 /// Readable | Writable
511 ///
512 ///
513 /// #### `visibility`
514 /// Readable | Writable
515 ///
516 ///
517 /// #### `width-chars`
518 /// Readable | Writable
519 ///
520 ///
521 /// #### `xalign`
522 /// The horizontal alignment, from 0 (left) to 1 (right).
523 /// Reversed for RTL layouts.
524 ///
525 /// Readable | Writable
526 /// </details>
527 /// <details><summary><h4>Widget</h4></summary>
528 ///
529 ///
530 /// #### `app-paintable`
531 /// Readable | Writable
532 ///
533 ///
534 /// #### `can-default`
535 /// Readable | Writable
536 ///
537 ///
538 /// #### `can-focus`
539 /// Readable | Writable
540 ///
541 ///
542 /// #### `composite-child`
543 /// Readable
544 ///
545 ///
546 /// #### `double-buffered`
547 /// Whether the widget is double buffered.
548 ///
549 /// Readable | Writable
550 ///
551 ///
552 /// #### `events`
553 /// Readable | Writable
554 ///
555 ///
556 /// #### `expand`
557 /// Whether to expand in both directions. Setting this sets both [`hexpand`][struct@crate::Widget#hexpand] and [`vexpand`][struct@crate::Widget#vexpand]
558 ///
559 /// Readable | Writable
560 ///
561 ///
562 /// #### `focus-on-click`
563 /// Whether the widget should grab focus when it is clicked with the mouse.
564 ///
565 /// This property is only relevant for widgets that can take focus.
566 ///
567 /// Before 3.20, several widgets (GtkButton, GtkFileChooserButton,
568 /// GtkComboBox) implemented this property individually.
569 ///
570 /// Readable | Writable
571 ///
572 ///
573 /// #### `halign`
574 /// How to distribute horizontal space if widget gets extra space, see [`Align`][crate::Align]
575 ///
576 /// Readable | Writable
577 ///
578 ///
579 /// #### `has-default`
580 /// Readable | Writable
581 ///
582 ///
583 /// #### `has-focus`
584 /// Readable | Writable
585 ///
586 ///
587 /// #### `has-tooltip`
588 /// Enables or disables the emission of [`query-tooltip`][struct@crate::Widget#query-tooltip] on `widget`.
589 /// A value of [`true`] indicates that `widget` can have a tooltip, in this case
590 /// the widget will be queried using [`query-tooltip`][struct@crate::Widget#query-tooltip] to determine
591 /// whether it will provide a tooltip or not.
592 ///
593 /// Note that setting this property to [`true`] for the first time will change
594 /// the event masks of the GdkWindows of this widget to include leave-notify
595 /// and motion-notify events. This cannot and will not be undone when the
596 /// property is set to [`false`] again.
597 ///
598 /// Readable | Writable
599 ///
600 ///
601 /// #### `height-request`
602 /// Readable | Writable
603 ///
604 ///
605 /// #### `hexpand`
606 /// Whether to expand horizontally. See [`WidgetExt::set_hexpand()`][crate::prelude::WidgetExt::set_hexpand()].
607 ///
608 /// Readable | Writable
609 ///
610 ///
611 /// #### `hexpand-set`
612 /// Whether to use the [`hexpand`][struct@crate::Widget#hexpand] property. See [`WidgetExt::is_hexpand_set()`][crate::prelude::WidgetExt::is_hexpand_set()].
613 ///
614 /// Readable | Writable
615 ///
616 ///
617 /// #### `is-focus`
618 /// Readable | Writable
619 ///
620 ///
621 /// #### `margin`
622 /// Sets all four sides' margin at once. If read, returns max
623 /// margin on any side.
624 ///
625 /// Readable | Writable
626 ///
627 ///
628 /// #### `margin-bottom`
629 /// Margin on bottom side of widget.
630 ///
631 /// This property adds margin outside of the widget's normal size
632 /// request, the margin will be added in addition to the size from
633 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
634 ///
635 /// Readable | Writable
636 ///
637 ///
638 /// #### `margin-end`
639 /// Margin on end of widget, horizontally. This property supports
640 /// left-to-right and right-to-left text directions.
641 ///
642 /// This property adds margin outside of the widget's normal size
643 /// request, the margin will be added in addition to the size from
644 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
645 ///
646 /// Readable | Writable
647 ///
648 ///
649 /// #### `margin-left`
650 /// Margin on left side of widget.
651 ///
652 /// This property adds margin outside of the widget's normal size
653 /// request, the margin will be added in addition to the size from
654 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
655 ///
656 /// Readable | Writable
657 ///
658 ///
659 /// #### `margin-right`
660 /// Margin on right side of widget.
661 ///
662 /// This property adds margin outside of the widget's normal size
663 /// request, the margin will be added in addition to the size from
664 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
665 ///
666 /// Readable | Writable
667 ///
668 ///
669 /// #### `margin-start`
670 /// Margin on start of widget, horizontally. This property supports
671 /// left-to-right and right-to-left text directions.
672 ///
673 /// This property adds margin outside of the widget's normal size
674 /// request, the margin will be added in addition to the size from
675 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
676 ///
677 /// Readable | Writable
678 ///
679 ///
680 /// #### `margin-top`
681 /// Margin on top side of widget.
682 ///
683 /// This property adds margin outside of the widget's normal size
684 /// request, the margin will be added in addition to the size from
685 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
686 ///
687 /// Readable | Writable
688 ///
689 ///
690 /// #### `name`
691 /// Readable | Writable
692 ///
693 ///
694 /// #### `no-show-all`
695 /// Readable | Writable
696 ///
697 ///
698 /// #### `opacity`
699 /// The requested opacity of the widget. See [`WidgetExt::set_opacity()`][crate::prelude::WidgetExt::set_opacity()] for
700 /// more details about window opacity.
701 ///
702 /// Before 3.8 this was only available in GtkWindow
703 ///
704 /// Readable | Writable
705 ///
706 ///
707 /// #### `parent`
708 /// Readable | Writable
709 ///
710 ///
711 /// #### `receives-default`
712 /// Readable | Writable
713 ///
714 ///
715 /// #### `scale-factor`
716 /// The scale factor of the widget. See [`WidgetExt::scale_factor()`][crate::prelude::WidgetExt::scale_factor()] for
717 /// more details about widget scaling.
718 ///
719 /// Readable
720 ///
721 ///
722 /// #### `sensitive`
723 /// Readable | Writable
724 ///
725 ///
726 /// #### `style`
727 /// The style of the widget, which contains information about how it will look (colors, etc).
728 ///
729 /// Readable | Writable
730 ///
731 ///
732 /// #### `tooltip-markup`
733 /// Sets the text of tooltip to be the given string, which is marked up
734 /// with the [Pango text markup language][PangoMarkupFormat].
735 /// Also see [`Tooltip::set_markup()`][crate::Tooltip::set_markup()].
736 ///
737 /// This is a convenience property which will take care of getting the
738 /// tooltip shown if the given string is not [`None`]: [`has-tooltip`][struct@crate::Widget#has-tooltip]
739 /// will automatically be set to [`true`] and there will be taken care of
740 /// [`query-tooltip`][struct@crate::Widget#query-tooltip] in the default signal handler.
741 ///
742 /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and [`tooltip-markup`][struct@crate::Widget#tooltip-markup]
743 /// are set, the last one wins.
744 ///
745 /// Readable | Writable
746 ///
747 ///
748 /// #### `tooltip-text`
749 /// Sets the text of tooltip to be the given string.
750 ///
751 /// Also see [`Tooltip::set_text()`][crate::Tooltip::set_text()].
752 ///
753 /// This is a convenience property which will take care of getting the
754 /// tooltip shown if the given string is not [`None`]: [`has-tooltip`][struct@crate::Widget#has-tooltip]
755 /// will automatically be set to [`true`] and there will be taken care of
756 /// [`query-tooltip`][struct@crate::Widget#query-tooltip] in the default signal handler.
757 ///
758 /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and [`tooltip-markup`][struct@crate::Widget#tooltip-markup]
759 /// are set, the last one wins.
760 ///
761 /// Readable | Writable
762 ///
763 ///
764 /// #### `valign`
765 /// How to distribute vertical space if widget gets extra space, see [`Align`][crate::Align]
766 ///
767 /// Readable | Writable
768 ///
769 ///
770 /// #### `vexpand`
771 /// Whether to expand vertically. See [`WidgetExt::set_vexpand()`][crate::prelude::WidgetExt::set_vexpand()].
772 ///
773 /// Readable | Writable
774 ///
775 ///
776 /// #### `vexpand-set`
777 /// Whether to use the [`vexpand`][struct@crate::Widget#vexpand] property. See [`WidgetExt::is_vexpand_set()`][crate::prelude::WidgetExt::is_vexpand_set()].
778 ///
779 /// Readable | Writable
780 ///
781 ///
782 /// #### `visible`
783 /// Readable | Writable
784 ///
785 ///
786 /// #### `width-request`
787 /// Readable | Writable
788 ///
789 ///
790 /// #### `window`
791 /// The widget's window if it is realized, [`None`] otherwise.
792 ///
793 /// Readable
794 /// </details>
795 /// <details><summary><h4>CellEditable</h4></summary>
796 ///
797 ///
798 /// #### `editing-canceled`
799 /// Indicates whether editing on the cell has been canceled.
800 ///
801 /// Readable | Writable
802 /// </details>
803 /// <details><summary><h4>Orientable</h4></summary>
804 ///
805 ///
806 /// #### `orientation`
807 /// The orientation of the orientable.
808 ///
809 /// Readable | Writable
810 /// </details>
811 ///
812 /// ## Signals
813 ///
814 ///
815 /// #### `change-value`
816 /// The ::change-value signal is a [keybinding signal][GtkBindingSignal]
817 /// which gets emitted when the user initiates a value change.
818 ///
819 /// Applications should not connect to it, but may emit it with
820 /// `g_signal_emit_by_name()` if they need to control the cursor
821 /// programmatically.
822 ///
823 /// The default bindings for this signal are Up/Down and PageUp and/PageDown.
824 ///
825 /// Action
826 ///
827 ///
828 /// #### `input`
829 /// The ::input signal can be used to influence the conversion of
830 /// the users input into a double value. The signal handler is
831 /// expected to use [`EntryExt::text()`][crate::prelude::EntryExt::text()] to retrieve the text of
832 /// the entry and set `new_value` to the new value.
833 ///
834 /// The default conversion uses `g_strtod()`.
835 ///
836 ///
837 ///
838 ///
839 /// #### `output`
840 /// The ::output signal can be used to change to formatting
841 /// of the value that is displayed in the spin buttons entry.
842 ///
843 ///
844 /// **⚠️ The following code is in C ⚠️**
845 ///
846 /// ```C
847 /// // show leading zeros
848 /// static gboolean
849 /// on_output (GtkSpinButton *spin,
850 /// gpointer data)
851 /// {
852 /// GtkAdjustment *adjustment;
853 /// gchar *text;
854 /// int value;
855 ///
856 /// adjustment = gtk_spin_button_get_adjustment (spin);
857 /// value = (int)gtk_adjustment_get_value (adjustment);
858 /// text = g_strdup_printf ("%02d", value);
859 /// gtk_entry_set_text (GTK_ENTRY (spin), text);
860 /// g_free (text);
861 ///
862 /// return TRUE;
863 /// }
864 /// ```
865 ///
866 ///
867 ///
868 ///
869 /// #### `value-changed`
870 /// The ::value-changed signal is emitted when the value represented by
871 /// `spinbutton` changes. Also see the [`output`][struct@crate::SpinButton#output] signal.
872 ///
873 ///
874 ///
875 ///
876 /// #### `wrapped`
877 /// The ::wrapped signal is emitted right after the spinbutton wraps
878 /// from its maximum to minimum value or vice-versa.
879 ///
880 ///
881 /// <details><summary><h4>Entry</h4></summary>
882 ///
883 ///
884 /// #### `activate`
885 /// The ::activate signal is emitted when the user hits
886 /// the Enter key.
887 ///
888 /// While this signal is used as a
889 /// [keybinding signal][GtkBindingSignal],
890 /// it is also commonly used by applications to intercept
891 /// activation of entries.
892 ///
893 /// The default bindings for this signal are all forms of the Enter key.
894 ///
895 /// Action
896 ///
897 ///
898 /// #### `backspace`
899 /// The ::backspace signal is a
900 /// [keybinding signal][GtkBindingSignal]
901 /// which gets emitted when the user asks for it.
902 ///
903 /// The default bindings for this signal are
904 /// Backspace and Shift-Backspace.
905 ///
906 /// Action
907 ///
908 ///
909 /// #### `copy-clipboard`
910 /// The ::copy-clipboard signal is a
911 /// [keybinding signal][GtkBindingSignal]
912 /// which gets emitted to copy the selection to the clipboard.
913 ///
914 /// The default bindings for this signal are
915 /// Ctrl-c and Ctrl-Insert.
916 ///
917 /// Action
918 ///
919 ///
920 /// #### `cut-clipboard`
921 /// The ::cut-clipboard signal is a
922 /// [keybinding signal][GtkBindingSignal]
923 /// which gets emitted to cut the selection to the clipboard.
924 ///
925 /// The default bindings for this signal are
926 /// Ctrl-x and Shift-Delete.
927 ///
928 /// Action
929 ///
930 ///
931 /// #### `delete-from-cursor`
932 /// The ::delete-from-cursor signal is a
933 /// [keybinding signal][GtkBindingSignal]
934 /// which gets emitted when the user initiates a text deletion.
935 ///
936 /// If the `type_` is [`DeleteType::Chars`][crate::DeleteType::Chars], GTK+ deletes the selection
937 /// if there is one, otherwise it deletes the requested number
938 /// of characters.
939 ///
940 /// The default bindings for this signal are
941 /// Delete for deleting a character and Ctrl-Delete for
942 /// deleting a word.
943 ///
944 /// Action
945 ///
946 ///
947 /// #### `icon-press`
948 /// The ::icon-press signal is emitted when an activatable icon
949 /// is clicked.
950 ///
951 ///
952 ///
953 ///
954 /// #### `icon-release`
955 /// The ::icon-release signal is emitted on the button release from a
956 /// mouse click over an activatable icon.
957 ///
958 ///
959 ///
960 ///
961 /// #### `insert-at-cursor`
962 /// The ::insert-at-cursor signal is a
963 /// [keybinding signal][GtkBindingSignal]
964 /// which gets emitted when the user initiates the insertion of a
965 /// fixed string at the cursor.
966 ///
967 /// This signal has no default bindings.
968 ///
969 /// Action
970 ///
971 ///
972 /// #### `insert-emoji`
973 /// The ::insert-emoji signal is a
974 /// [keybinding signal][GtkBindingSignal]
975 /// which gets emitted to present the Emoji chooser for the `entry`.
976 ///
977 /// The default bindings for this signal are Ctrl-. and Ctrl-;
978 ///
979 /// Action
980 ///
981 ///
982 /// #### `move-cursor`
983 /// The ::move-cursor signal is a
984 /// [keybinding signal][GtkBindingSignal]
985 /// which gets emitted when the user initiates a cursor movement.
986 /// If the cursor is not visible in `entry`, this signal causes
987 /// the viewport to be moved instead.
988 ///
989 /// Applications should not connect to it, but may emit it with
990 /// `g_signal_emit_by_name()` if they need to control the cursor
991 /// programmatically.
992 ///
993 /// The default bindings for this signal come in two variants,
994 /// the variant with the Shift modifier extends the selection,
995 /// the variant without the Shift modifer does not.
996 /// There are too many key combinations to list them all here.
997 /// - Arrow keys move by individual characters/lines
998 /// - Ctrl-arrow key combinations move by words/paragraphs
999 /// - Home/End keys move to the ends of the buffer
1000 ///
1001 /// Action
1002 ///
1003 ///
1004 /// #### `paste-clipboard`
1005 /// The ::paste-clipboard signal is a
1006 /// [keybinding signal][GtkBindingSignal]
1007 /// which gets emitted to paste the contents of the clipboard
1008 /// into the text view.
1009 ///
1010 /// The default bindings for this signal are
1011 /// Ctrl-v and Shift-Insert.
1012 ///
1013 /// Action
1014 ///
1015 ///
1016 /// #### `populate-popup`
1017 /// The ::populate-popup signal gets emitted before showing the
1018 /// context menu of the entry.
1019 ///
1020 /// If you need to add items to the context menu, connect
1021 /// to this signal and append your items to the `widget`, which
1022 /// will be a [`Menu`][crate::Menu] in this case.
1023 ///
1024 /// If [`populate-all`][struct@crate::Entry#populate-all] is [`true`], this signal will
1025 /// also be emitted to populate touch popups. In this case,
1026 /// `widget` will be a different container, e.g. a [`Toolbar`][crate::Toolbar].
1027 /// The signal handler should not make assumptions about the
1028 /// type of `widget`.
1029 ///
1030 ///
1031 ///
1032 ///
1033 /// #### `preedit-changed`
1034 /// If an input method is used, the typed text will not immediately
1035 /// be committed to the buffer. So if you are interested in the text,
1036 /// connect to this signal.
1037 ///
1038 /// Action
1039 ///
1040 ///
1041 /// #### `toggle-direction`
1042 /// Action
1043 ///
1044 ///
1045 /// #### `toggle-overwrite`
1046 /// The ::toggle-overwrite signal is a
1047 /// [keybinding signal][GtkBindingSignal]
1048 /// which gets emitted to toggle the overwrite mode of the entry.
1049 ///
1050 /// The default bindings for this signal is Insert.
1051 ///
1052 /// Action
1053 /// </details>
1054 /// <details><summary><h4>Widget</h4></summary>
1055 ///
1056 ///
1057 /// #### `accel-closures-changed`
1058 ///
1059 ///
1060 ///
1061 /// #### `button-press-event`
1062 /// The ::button-press-event signal will be emitted when a button
1063 /// (typically from a mouse) is pressed.
1064 ///
1065 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the
1066 /// widget needs to enable the [`gdk::EventMask::BUTTON_PRESS_MASK`][crate::gdk::EventMask::BUTTON_PRESS_MASK] mask.
1067 ///
1068 /// This signal will be sent to the grab widget if there is one.
1069 ///
1070 ///
1071 ///
1072 ///
1073 /// #### `button-release-event`
1074 /// The ::button-release-event signal will be emitted when a button
1075 /// (typically from a mouse) is released.
1076 ///
1077 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the
1078 /// widget needs to enable the [`gdk::EventMask::BUTTON_RELEASE_MASK`][crate::gdk::EventMask::BUTTON_RELEASE_MASK] mask.
1079 ///
1080 /// This signal will be sent to the grab widget if there is one.
1081 ///
1082 ///
1083 ///
1084 ///
1085 /// #### `can-activate-accel`
1086 /// Determines whether an accelerator that activates the signal
1087 /// identified by `signal_id` can currently be activated.
1088 /// This signal is present to allow applications and derived
1089 /// widgets to override the default [`Widget`][crate::Widget] handling
1090 /// for determining whether an accelerator can be activated.
1091 ///
1092 ///
1093 ///
1094 ///
1095 /// #### `child-notify`
1096 /// The ::child-notify signal is emitted for each
1097 /// [child property][child-properties] that has
1098 /// changed on an object. The signal's detail holds the property name.
1099 ///
1100 /// Detailed
1101 ///
1102 ///
1103 /// #### `composited-changed`
1104 /// The ::composited-changed signal is emitted when the composited
1105 /// status of `widgets` screen changes.
1106 /// See [`Screen::is_composited()`][crate::gdk::Screen::is_composited()].
1107 ///
1108 /// Action
1109 ///
1110 ///
1111 /// #### `configure-event`
1112 /// The ::configure-event signal will be emitted when the size, position or
1113 /// stacking of the `widget`'s window has changed.
1114 ///
1115 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
1116 /// to enable the [`gdk::EventMask::STRUCTURE_MASK`][crate::gdk::EventMask::STRUCTURE_MASK] mask. GDK will enable this mask
1117 /// automatically for all new windows.
1118 ///
1119 ///
1120 ///
1121 ///
1122 /// #### `damage-event`
1123 /// Emitted when a redirected window belonging to `widget` gets drawn into.
1124 /// The region/area members of the event shows what area of the redirected
1125 /// drawable was drawn into.
1126 ///
1127 ///
1128 ///
1129 ///
1130 /// #### `delete-event`
1131 /// The ::delete-event signal is emitted if a user requests that
1132 /// a toplevel window is closed. The default handler for this signal
1133 /// destroys the window. Connecting [`WidgetExtManual::hide_on_delete()`][crate::prelude::WidgetExtManual::hide_on_delete()] to
1134 /// this signal will cause the window to be hidden instead, so that
1135 /// it can later be shown again without reconstructing it.
1136 ///
1137 ///
1138 ///
1139 ///
1140 /// #### `destroy`
1141 /// Signals that all holders of a reference to the widget should release
1142 /// the reference that they hold. May result in finalization of the widget
1143 /// if all references are released.
1144 ///
1145 /// This signal is not suitable for saving widget state.
1146 ///
1147 ///
1148 ///
1149 ///
1150 /// #### `destroy-event`
1151 /// The ::destroy-event signal is emitted when a [`gdk::Window`][crate::gdk::Window] is destroyed.
1152 /// You rarely get this signal, because most widgets disconnect themselves
1153 /// from their window before they destroy it, so no widget owns the
1154 /// window at destroy time.
1155 ///
1156 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
1157 /// to enable the [`gdk::EventMask::STRUCTURE_MASK`][crate::gdk::EventMask::STRUCTURE_MASK] mask. GDK will enable this mask
1158 /// automatically for all new windows.
1159 ///
1160 ///
1161 ///
1162 ///
1163 /// #### `direction-changed`
1164 /// The ::direction-changed signal is emitted when the text direction
1165 /// of a widget changes.
1166 ///
1167 ///
1168 ///
1169 ///
1170 /// #### `drag-begin`
1171 /// The ::drag-begin signal is emitted on the drag source when a drag is
1172 /// started. A typical reason to connect to this signal is to set up a
1173 /// custom drag icon with e.g. [`WidgetExt::drag_source_set_icon_pixbuf()`][crate::prelude::WidgetExt::drag_source_set_icon_pixbuf()].
1174 ///
1175 /// Note that some widgets set up a drag icon in the default handler of
1176 /// this signal, so you may have to use `g_signal_connect_after()` to
1177 /// override what the default handler did.
1178 ///
1179 ///
1180 ///
1181 ///
1182 /// #### `drag-data-delete`
1183 /// The ::drag-data-delete signal is emitted on the drag source when a drag
1184 /// with the action [`gdk::DragAction::MOVE`][crate::gdk::DragAction::MOVE] is successfully completed. The signal
1185 /// handler is responsible for deleting the data that has been dropped. What
1186 /// "delete" means depends on the context of the drag operation.
1187 ///
1188 ///
1189 ///
1190 ///
1191 /// #### `drag-data-get`
1192 /// The ::drag-data-get signal is emitted on the drag source when the drop
1193 /// site requests the data which is dragged. It is the responsibility of
1194 /// the signal handler to fill `data` with the data in the format which
1195 /// is indicated by `info`. See [`SelectionData::set()`][crate::SelectionData::set()] and
1196 /// [`SelectionData::set_text()`][crate::SelectionData::set_text()].
1197 ///
1198 ///
1199 ///
1200 ///
1201 /// #### `drag-data-received`
1202 /// The ::drag-data-received signal is emitted on the drop site when the
1203 /// dragged data has been received. If the data was received in order to
1204 /// determine whether the drop will be accepted, the handler is expected
1205 /// to call `gdk_drag_status()` and not finish the drag.
1206 /// If the data was received in response to a [`drag-drop`][struct@crate::Widget#drag-drop] signal
1207 /// (and this is the last target to be received), the handler for this
1208 /// signal is expected to process the received data and then call
1209 /// `gtk_drag_finish()`, setting the `success` parameter depending on
1210 /// whether the data was processed successfully.
1211 ///
1212 /// Applications must create some means to determine why the signal was emitted
1213 /// and therefore whether to call `gdk_drag_status()` or `gtk_drag_finish()`.
1214 ///
1215 /// The handler may inspect the selected action with
1216 /// [`DragContext::selected_action()`][crate::gdk::DragContext::selected_action()] before calling
1217 /// `gtk_drag_finish()`, e.g. to implement [`gdk::DragAction::ASK`][crate::gdk::DragAction::ASK] as
1218 /// shown in the following example:
1219 ///
1220 ///
1221 /// **⚠️ The following code is in C ⚠️**
1222 ///
1223 /// ```C
1224 /// void
1225 /// drag_data_received (GtkWidget *widget,
1226 /// GdkDragContext *context,
1227 /// gint x,
1228 /// gint y,
1229 /// GtkSelectionData *data,
1230 /// guint info,
1231 /// guint time)
1232 /// {
1233 /// if ((data->length >= 0) && (data->format == 8))
1234 /// {
1235 /// GdkDragAction action;
1236 ///
1237 /// // handle data here
1238 ///
1239 /// action = gdk_drag_context_get_selected_action (context);
1240 /// if (action == GDK_ACTION_ASK)
1241 /// {
1242 /// GtkWidget *dialog;
1243 /// gint response;
1244 ///
1245 /// dialog = gtk_message_dialog_new (NULL,
1246 /// GTK_DIALOG_MODAL |
1247 /// GTK_DIALOG_DESTROY_WITH_PARENT,
1248 /// GTK_MESSAGE_INFO,
1249 /// GTK_BUTTONS_YES_NO,
1250 /// "Move the data ?\n");
1251 /// response = gtk_dialog_run (GTK_DIALOG (dialog));
1252 /// gtk_widget_destroy (dialog);
1253 ///
1254 /// if (response == GTK_RESPONSE_YES)
1255 /// action = GDK_ACTION_MOVE;
1256 /// else
1257 /// action = GDK_ACTION_COPY;
1258 /// }
1259 ///
1260 /// gtk_drag_finish (context, TRUE, action == GDK_ACTION_MOVE, time);
1261 /// }
1262 /// else
1263 /// gtk_drag_finish (context, FALSE, FALSE, time);
1264 /// }
1265 /// ```
1266 ///
1267 ///
1268 ///
1269 ///
1270 /// #### `drag-drop`
1271 /// The ::drag-drop signal is emitted on the drop site when the user drops
1272 /// the data onto the widget. The signal handler must determine whether
1273 /// the cursor position is in a drop zone or not. If it is not in a drop
1274 /// zone, it returns [`false`] and no further processing is necessary.
1275 /// Otherwise, the handler returns [`true`]. In this case, the handler must
1276 /// ensure that `gtk_drag_finish()` is called to let the source know that
1277 /// the drop is done. The call to `gtk_drag_finish()` can be done either
1278 /// directly or in a [`drag-data-received`][struct@crate::Widget#drag-data-received] handler which gets
1279 /// triggered by calling [`WidgetExt::drag_get_data()`][crate::prelude::WidgetExt::drag_get_data()] to receive the data for one
1280 /// or more of the supported targets.
1281 ///
1282 ///
1283 ///
1284 ///
1285 /// #### `drag-end`
1286 /// The ::drag-end signal is emitted on the drag source when a drag is
1287 /// finished. A typical reason to connect to this signal is to undo
1288 /// things done in [`drag-begin`][struct@crate::Widget#drag-begin].
1289 ///
1290 ///
1291 ///
1292 ///
1293 /// #### `drag-failed`
1294 /// The ::drag-failed signal is emitted on the drag source when a drag has
1295 /// failed. The signal handler may hook custom code to handle a failed DnD
1296 /// operation based on the type of error, it returns [`true`] is the failure has
1297 /// been already handled (not showing the default "drag operation failed"
1298 /// animation), otherwise it returns [`false`].
1299 ///
1300 ///
1301 ///
1302 ///
1303 /// #### `drag-leave`
1304 /// The ::drag-leave signal is emitted on the drop site when the cursor
1305 /// leaves the widget. A typical reason to connect to this signal is to
1306 /// undo things done in [`drag-motion`][struct@crate::Widget#drag-motion], e.g. undo highlighting
1307 /// with [`WidgetExt::drag_unhighlight()`][crate::prelude::WidgetExt::drag_unhighlight()].
1308 ///
1309 ///
1310 /// Likewise, the [`drag-leave`][struct@crate::Widget#drag-leave] signal is also emitted before the
1311 /// ::drag-drop signal, for instance to allow cleaning up of a preview item
1312 /// created in the [`drag-motion`][struct@crate::Widget#drag-motion] signal handler.
1313 ///
1314 ///
1315 ///
1316 ///
1317 /// #### `drag-motion`
1318 /// The ::drag-motion signal is emitted on the drop site when the user
1319 /// moves the cursor over the widget during a drag. The signal handler
1320 /// must determine whether the cursor position is in a drop zone or not.
1321 /// If it is not in a drop zone, it returns [`false`] and no further processing
1322 /// is necessary. Otherwise, the handler returns [`true`]. In this case, the
1323 /// handler is responsible for providing the necessary information for
1324 /// displaying feedback to the user, by calling `gdk_drag_status()`.
1325 ///
1326 /// If the decision whether the drop will be accepted or rejected can't be
1327 /// made based solely on the cursor position and the type of the data, the
1328 /// handler may inspect the dragged data by calling [`WidgetExt::drag_get_data()`][crate::prelude::WidgetExt::drag_get_data()] and
1329 /// defer the `gdk_drag_status()` call to the [`drag-data-received`][struct@crate::Widget#drag-data-received]
1330 /// handler. Note that you must pass [`DestDefaults::DROP`][crate::DestDefaults::DROP],
1331 /// [`DestDefaults::MOTION`][crate::DestDefaults::MOTION] or [`DestDefaults::ALL`][crate::DestDefaults::ALL] to [`WidgetExtManual::drag_dest_set()`][crate::prelude::WidgetExtManual::drag_dest_set()]
1332 /// when using the drag-motion signal that way.
1333 ///
1334 /// Also note that there is no drag-enter signal. The drag receiver has to
1335 /// keep track of whether he has received any drag-motion signals since the
1336 /// last [`drag-leave`][struct@crate::Widget#drag-leave] and if not, treat the drag-motion signal as
1337 /// an "enter" signal. Upon an "enter", the handler will typically highlight
1338 /// the drop site with [`WidgetExt::drag_highlight()`][crate::prelude::WidgetExt::drag_highlight()].
1339 ///
1340 ///
1341 /// **⚠️ The following code is in C ⚠️**
1342 ///
1343 /// ```C
1344 /// static void
1345 /// drag_motion (GtkWidget *widget,
1346 /// GdkDragContext *context,
1347 /// gint x,
1348 /// gint y,
1349 /// guint time)
1350 /// {
1351 /// GdkAtom target;
1352 ///
1353 /// PrivateData *private_data = GET_PRIVATE_DATA (widget);
1354 ///
1355 /// if (!private_data->drag_highlight)
1356 /// {
1357 /// private_data->drag_highlight = 1;
1358 /// gtk_drag_highlight (widget);
1359 /// }
1360 ///
1361 /// target = gtk_drag_dest_find_target (widget, context, NULL);
1362 /// if (target == GDK_NONE)
1363 /// gdk_drag_status (context, 0, time);
1364 /// else
1365 /// {
1366 /// private_data->pending_status
1367 /// = gdk_drag_context_get_suggested_action (context);
1368 /// gtk_drag_get_data (widget, context, target, time);
1369 /// }
1370 ///
1371 /// return TRUE;
1372 /// }
1373 ///
1374 /// static void
1375 /// drag_data_received (GtkWidget *widget,
1376 /// GdkDragContext *context,
1377 /// gint x,
1378 /// gint y,
1379 /// GtkSelectionData *selection_data,
1380 /// guint info,
1381 /// guint time)
1382 /// {
1383 /// PrivateData *private_data = GET_PRIVATE_DATA (widget);
1384 ///
1385 /// if (private_data->suggested_action)
1386 /// {
1387 /// private_data->suggested_action = 0;
1388 ///
1389 /// // We are getting this data due to a request in drag_motion,
1390 /// // rather than due to a request in drag_drop, so we are just
1391 /// // supposed to call gdk_drag_status(), not actually paste in
1392 /// // the data.
1393 ///
1394 /// str = gtk_selection_data_get_text (selection_data);
1395 /// if (!data_is_acceptable (str))
1396 /// gdk_drag_status (context, 0, time);
1397 /// else
1398 /// gdk_drag_status (context,
1399 /// private_data->suggested_action,
1400 /// time);
1401 /// }
1402 /// else
1403 /// {
1404 /// // accept the drop
1405 /// }
1406 /// }
1407 /// ```
1408 ///
1409 ///
1410 ///
1411 ///
1412 /// #### `draw`
1413 /// This signal is emitted when a widget is supposed to render itself.
1414 /// The `widget`'s top left corner must be painted at the origin of
1415 /// the passed in context and be sized to the values returned by
1416 /// [`WidgetExt::allocated_width()`][crate::prelude::WidgetExt::allocated_width()] and
1417 /// [`WidgetExt::allocated_height()`][crate::prelude::WidgetExt::allocated_height()].
1418 ///
1419 /// Signal handlers connected to this signal can modify the cairo
1420 /// context passed as `cr` in any way they like and don't need to
1421 /// restore it. The signal emission takes care of calling `cairo_save()`
1422 /// before and `cairo_restore()` after invoking the handler.
1423 ///
1424 /// The signal handler will get a `cr` with a clip region already set to the
1425 /// widget's dirty region, i.e. to the area that needs repainting. Complicated
1426 /// widgets that want to avoid redrawing themselves completely can get the full
1427 /// extents of the clip region with `gdk_cairo_get_clip_rectangle()`, or they can
1428 /// get a finer-grained representation of the dirty region with
1429 /// `cairo_copy_clip_rectangle_list()`.
1430 ///
1431 ///
1432 ///
1433 ///
1434 /// #### `enter-notify-event`
1435 /// The ::enter-notify-event will be emitted when the pointer enters
1436 /// the `widget`'s window.
1437 ///
1438 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
1439 /// to enable the [`gdk::EventMask::ENTER_NOTIFY_MASK`][crate::gdk::EventMask::ENTER_NOTIFY_MASK] mask.
1440 ///
1441 /// This signal will be sent to the grab widget if there is one.
1442 ///
1443 ///
1444 ///
1445 ///
1446 /// #### `event`
1447 /// The GTK+ main loop will emit three signals for each GDK event delivered
1448 /// to a widget: one generic ::event signal, another, more specific,
1449 /// signal that matches the type of event delivered (e.g.
1450 /// [`key-press-event`][struct@crate::Widget#key-press-event]) and finally a generic
1451 /// [`event-after`][struct@crate::Widget#event-after] signal.
1452 ///
1453 ///
1454 ///
1455 ///
1456 /// #### `event-after`
1457 /// After the emission of the [`event`][struct@crate::Widget#event] signal and (optionally)
1458 /// the second more specific signal, ::event-after will be emitted
1459 /// regardless of the previous two signals handlers return values.
1460 ///
1461 ///
1462 ///
1463 ///
1464 /// #### `focus`
1465 ///
1466 ///
1467 ///
1468 /// #### `focus-in-event`
1469 /// The ::focus-in-event signal will be emitted when the keyboard focus
1470 /// enters the `widget`'s window.
1471 ///
1472 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
1473 /// to enable the [`gdk::EventMask::FOCUS_CHANGE_MASK`][crate::gdk::EventMask::FOCUS_CHANGE_MASK] mask.
1474 ///
1475 ///
1476 ///
1477 ///
1478 /// #### `focus-out-event`
1479 /// The ::focus-out-event signal will be emitted when the keyboard focus
1480 /// leaves the `widget`'s window.
1481 ///
1482 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
1483 /// to enable the [`gdk::EventMask::FOCUS_CHANGE_MASK`][crate::gdk::EventMask::FOCUS_CHANGE_MASK] mask.
1484 ///
1485 ///
1486 ///
1487 ///
1488 /// #### `grab-broken-event`
1489 /// Emitted when a pointer or keyboard grab on a window belonging
1490 /// to `widget` gets broken.
1491 ///
1492 /// On X11, this happens when the grab window becomes unviewable
1493 /// (i.e. it or one of its ancestors is unmapped), or if the same
1494 /// application grabs the pointer or keyboard again.
1495 ///
1496 ///
1497 ///
1498 ///
1499 /// #### `grab-focus`
1500 /// Action
1501 ///
1502 ///
1503 /// #### `grab-notify`
1504 /// The ::grab-notify signal is emitted when a widget becomes
1505 /// shadowed by a GTK+ grab (not a pointer or keyboard grab) on
1506 /// another widget, or when it becomes unshadowed due to a grab
1507 /// being removed.
1508 ///
1509 /// A widget is shadowed by a [`WidgetExt::grab_add()`][crate::prelude::WidgetExt::grab_add()] when the topmost
1510 /// grab widget in the grab stack of its window group is not
1511 /// its ancestor.
1512 ///
1513 ///
1514 ///
1515 ///
1516 /// #### `hide`
1517 /// The ::hide signal is emitted when `widget` is hidden, for example with
1518 /// [`WidgetExt::hide()`][crate::prelude::WidgetExt::hide()].
1519 ///
1520 ///
1521 ///
1522 ///
1523 /// #### `hierarchy-changed`
1524 /// The ::hierarchy-changed signal is emitted when the
1525 /// anchored state of a widget changes. A widget is
1526 /// “anchored” when its toplevel
1527 /// ancestor is a [`Window`][crate::Window]. This signal is emitted when
1528 /// a widget changes from un-anchored to anchored or vice-versa.
1529 ///
1530 ///
1531 ///
1532 ///
1533 /// #### `key-press-event`
1534 /// The ::key-press-event signal is emitted when a key is pressed. The signal
1535 /// emission will reoccur at the key-repeat rate when the key is kept pressed.
1536 ///
1537 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
1538 /// to enable the [`gdk::EventMask::KEY_PRESS_MASK`][crate::gdk::EventMask::KEY_PRESS_MASK] mask.
1539 ///
1540 /// This signal will be sent to the grab widget if there is one.
1541 ///
1542 ///
1543 ///
1544 ///
1545 /// #### `key-release-event`
1546 /// The ::key-release-event signal is emitted when a key is released.
1547 ///
1548 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
1549 /// to enable the [`gdk::EventMask::KEY_RELEASE_MASK`][crate::gdk::EventMask::KEY_RELEASE_MASK] mask.
1550 ///
1551 /// This signal will be sent to the grab widget if there is one.
1552 ///
1553 ///
1554 ///
1555 ///
1556 /// #### `keynav-failed`
1557 /// Gets emitted if keyboard navigation fails.
1558 /// See [`WidgetExt::keynav_failed()`][crate::prelude::WidgetExt::keynav_failed()] for details.
1559 ///
1560 ///
1561 ///
1562 ///
1563 /// #### `leave-notify-event`
1564 /// The ::leave-notify-event will be emitted when the pointer leaves
1565 /// the `widget`'s window.
1566 ///
1567 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
1568 /// to enable the [`gdk::EventMask::LEAVE_NOTIFY_MASK`][crate::gdk::EventMask::LEAVE_NOTIFY_MASK] mask.
1569 ///
1570 /// This signal will be sent to the grab widget if there is one.
1571 ///
1572 ///
1573 ///
1574 ///
1575 /// #### `map`
1576 /// The ::map signal is emitted when `widget` is going to be mapped, that is
1577 /// when the widget is visible (which is controlled with
1578 /// [`WidgetExt::set_visible()`][crate::prelude::WidgetExt::set_visible()]) and all its parents up to the toplevel widget
1579 /// are also visible. Once the map has occurred, [`map-event`][struct@crate::Widget#map-event] will
1580 /// be emitted.
1581 ///
1582 /// The ::map signal can be used to determine whether a widget will be drawn,
1583 /// for instance it can resume an animation that was stopped during the
1584 /// emission of [`unmap`][struct@crate::Widget#unmap].
1585 ///
1586 ///
1587 ///
1588 ///
1589 /// #### `map-event`
1590 /// The ::map-event signal will be emitted when the `widget`'s window is
1591 /// mapped. A window is mapped when it becomes visible on the screen.
1592 ///
1593 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
1594 /// to enable the [`gdk::EventMask::STRUCTURE_MASK`][crate::gdk::EventMask::STRUCTURE_MASK] mask. GDK will enable this mask
1595 /// automatically for all new windows.
1596 ///
1597 ///
1598 ///
1599 ///
1600 /// #### `mnemonic-activate`
1601 /// The default handler for this signal activates `widget` if `group_cycling`
1602 /// is [`false`], or just makes `widget` grab focus if `group_cycling` is [`true`].
1603 ///
1604 ///
1605 ///
1606 ///
1607 /// #### `motion-notify-event`
1608 /// The ::motion-notify-event signal is emitted when the pointer moves
1609 /// over the widget's [`gdk::Window`][crate::gdk::Window].
1610 ///
1611 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget
1612 /// needs to enable the [`gdk::EventMask::POINTER_MOTION_MASK`][crate::gdk::EventMask::POINTER_MOTION_MASK] mask.
1613 ///
1614 /// This signal will be sent to the grab widget if there is one.
1615 ///
1616 ///
1617 ///
1618 ///
1619 /// #### `move-focus`
1620 /// Action
1621 ///
1622 ///
1623 /// #### `parent-set`
1624 /// The ::parent-set signal is emitted when a new parent
1625 /// has been set on a widget.
1626 ///
1627 ///
1628 ///
1629 ///
1630 /// #### `popup-menu`
1631 /// This signal gets emitted whenever a widget should pop up a context
1632 /// menu. This usually happens through the standard key binding mechanism;
1633 /// by pressing a certain key while a widget is focused, the user can cause
1634 /// the widget to pop up a menu. For example, the [`Entry`][crate::Entry] widget creates
1635 /// a menu with clipboard commands. See the
1636 /// [Popup Menu Migration Checklist][checklist-popup-menu]
1637 /// for an example of how to use this signal.
1638 ///
1639 /// Action
1640 ///
1641 ///
1642 /// #### `property-notify-event`
1643 /// The ::property-notify-event signal will be emitted when a property on
1644 /// the `widget`'s window has been changed or deleted.
1645 ///
1646 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
1647 /// to enable the [`gdk::EventMask::PROPERTY_CHANGE_MASK`][crate::gdk::EventMask::PROPERTY_CHANGE_MASK] mask.
1648 ///
1649 ///
1650 ///
1651 ///
1652 /// #### `proximity-in-event`
1653 /// To receive this signal the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
1654 /// to enable the [`gdk::EventMask::PROXIMITY_IN_MASK`][crate::gdk::EventMask::PROXIMITY_IN_MASK] mask.
1655 ///
1656 /// This signal will be sent to the grab widget if there is one.
1657 ///
1658 ///
1659 ///
1660 ///
1661 /// #### `proximity-out-event`
1662 /// To receive this signal the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
1663 /// to enable the [`gdk::EventMask::PROXIMITY_OUT_MASK`][crate::gdk::EventMask::PROXIMITY_OUT_MASK] mask.
1664 ///
1665 /// This signal will be sent to the grab widget if there is one.
1666 ///
1667 ///
1668 ///
1669 ///
1670 /// #### `query-tooltip`
1671 /// Emitted when [`has-tooltip`][struct@crate::Widget#has-tooltip] is [`true`] and the hover timeout
1672 /// has expired with the cursor hovering "above" `widget`; or emitted when `widget` got
1673 /// focus in keyboard mode.
1674 ///
1675 /// Using the given coordinates, the signal handler should determine
1676 /// whether a tooltip should be shown for `widget`. If this is the case
1677 /// [`true`] should be returned, [`false`] otherwise. Note that if
1678 /// `keyboard_mode` is [`true`], the values of `x` and `y` are undefined and
1679 /// should not be used.
1680 ///
1681 /// The signal handler is free to manipulate `tooltip` with the therefore
1682 /// destined function calls.
1683 ///
1684 ///
1685 ///
1686 ///
1687 /// #### `realize`
1688 /// The ::realize signal is emitted when `widget` is associated with a
1689 /// [`gdk::Window`][crate::gdk::Window], which means that [`WidgetExt::realize()`][crate::prelude::WidgetExt::realize()] has been called or the
1690 /// widget has been mapped (that is, it is going to be drawn).
1691 ///
1692 ///
1693 ///
1694 ///
1695 /// #### `screen-changed`
1696 /// The ::screen-changed signal gets emitted when the
1697 /// screen of a widget has changed.
1698 ///
1699 ///
1700 ///
1701 ///
1702 /// #### `scroll-event`
1703 /// The ::scroll-event signal is emitted when a button in the 4 to 7
1704 /// range is pressed. Wheel mice are usually configured to generate
1705 /// button press events for buttons 4 and 5 when the wheel is turned.
1706 ///
1707 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
1708 /// to enable the [`gdk::EventMask::SCROLL_MASK`][crate::gdk::EventMask::SCROLL_MASK] mask.
1709 ///
1710 /// This signal will be sent to the grab widget if there is one.
1711 ///
1712 ///
1713 ///
1714 ///
1715 /// #### `selection-clear-event`
1716 /// The ::selection-clear-event signal will be emitted when the
1717 /// the `widget`'s window has lost ownership of a selection.
1718 ///
1719 ///
1720 ///
1721 ///
1722 /// #### `selection-get`
1723 ///
1724 ///
1725 ///
1726 /// #### `selection-notify-event`
1727 ///
1728 ///
1729 ///
1730 /// #### `selection-received`
1731 ///
1732 ///
1733 ///
1734 /// #### `selection-request-event`
1735 /// The ::selection-request-event signal will be emitted when
1736 /// another client requests ownership of the selection owned by
1737 /// the `widget`'s window.
1738 ///
1739 ///
1740 ///
1741 ///
1742 /// #### `show`
1743 /// The ::show signal is emitted when `widget` is shown, for example with
1744 /// [`WidgetExt::show()`][crate::prelude::WidgetExt::show()].
1745 ///
1746 ///
1747 ///
1748 ///
1749 /// #### `show-help`
1750 /// Action
1751 ///
1752 ///
1753 /// #### `size-allocate`
1754 ///
1755 ///
1756 ///
1757 /// #### `state-changed`
1758 /// The ::state-changed signal is emitted when the widget state changes.
1759 /// See `gtk_widget_get_state()`.
1760 ///
1761 ///
1762 ///
1763 ///
1764 /// #### `state-flags-changed`
1765 /// The ::state-flags-changed signal is emitted when the widget state
1766 /// changes, see [`WidgetExt::state_flags()`][crate::prelude::WidgetExt::state_flags()].
1767 ///
1768 ///
1769 ///
1770 ///
1771 /// #### `style-set`
1772 /// The ::style-set signal is emitted when a new style has been set
1773 /// on a widget. Note that style-modifying functions like
1774 /// `gtk_widget_modify_base()` also cause this signal to be emitted.
1775 ///
1776 /// Note that this signal is emitted for changes to the deprecated
1777 /// `GtkStyle`. To track changes to the [`StyleContext`][crate::StyleContext] associated
1778 /// with a widget, use the [`style-updated`][struct@crate::Widget#style-updated] signal.
1779 ///
1780 ///
1781 ///
1782 ///
1783 /// #### `style-updated`
1784 /// The ::style-updated signal is a convenience signal that is emitted when the
1785 /// [`changed`][struct@crate::StyleContext#changed] signal is emitted on the `widget`'s associated
1786 /// [`StyleContext`][crate::StyleContext] as returned by [`WidgetExt::style_context()`][crate::prelude::WidgetExt::style_context()].
1787 ///
1788 /// Note that style-modifying functions like `gtk_widget_override_color()` also
1789 /// cause this signal to be emitted.
1790 ///
1791 ///
1792 ///
1793 ///
1794 /// #### `touch-event`
1795 ///
1796 ///
1797 ///
1798 /// #### `unmap`
1799 /// The ::unmap signal is emitted when `widget` is going to be unmapped, which
1800 /// means that either it or any of its parents up to the toplevel widget have
1801 /// been set as hidden.
1802 ///
1803 /// As ::unmap indicates that a widget will not be shown any longer, it can be
1804 /// used to, for example, stop an animation on the widget.
1805 ///
1806 ///
1807 ///
1808 ///
1809 /// #### `unmap-event`
1810 /// The ::unmap-event signal will be emitted when the `widget`'s window is
1811 /// unmapped. A window is unmapped when it becomes invisible on the screen.
1812 ///
1813 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
1814 /// to enable the [`gdk::EventMask::STRUCTURE_MASK`][crate::gdk::EventMask::STRUCTURE_MASK] mask. GDK will enable this mask
1815 /// automatically for all new windows.
1816 ///
1817 ///
1818 ///
1819 ///
1820 /// #### `unrealize`
1821 /// The ::unrealize signal is emitted when the [`gdk::Window`][crate::gdk::Window] associated with
1822 /// `widget` is destroyed, which means that [`WidgetExt::unrealize()`][crate::prelude::WidgetExt::unrealize()] has been
1823 /// called or the widget has been unmapped (that is, it is going to be
1824 /// hidden).
1825 ///
1826 ///
1827 ///
1828 ///
1829 /// #### `visibility-notify-event`
1830 /// The ::visibility-notify-event will be emitted when the `widget`'s
1831 /// window is obscured or unobscured.
1832 ///
1833 /// To receive this signal the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
1834 /// to enable the [`gdk::EventMask::VISIBILITY_NOTIFY_MASK`][crate::gdk::EventMask::VISIBILITY_NOTIFY_MASK] mask.
1835 ///
1836 ///
1837 ///
1838 ///
1839 /// #### `window-state-event`
1840 /// The ::window-state-event will be emitted when the state of the
1841 /// toplevel window associated to the `widget` changes.
1842 ///
1843 /// To receive this signal the [`gdk::Window`][crate::gdk::Window] associated to the widget
1844 /// needs to enable the [`gdk::EventMask::STRUCTURE_MASK`][crate::gdk::EventMask::STRUCTURE_MASK] mask. GDK will enable
1845 /// this mask automatically for all new windows.
1846 ///
1847 ///
1848 /// </details>
1849 /// <details><summary><h4>CellEditable</h4></summary>
1850 ///
1851 ///
1852 /// #### `editing-done`
1853 /// This signal is a sign for the cell renderer to update its
1854 /// value from the `cell_editable`.
1855 ///
1856 /// Implementations of [`CellEditable`][crate::CellEditable] are responsible for
1857 /// emitting this signal when they are done editing, e.g.
1858 /// [`Entry`][crate::Entry] emits this signal when the user presses Enter. Typical things to
1859 /// do in a handler for ::editing-done are to capture the edited value,
1860 /// disconnect the `cell_editable` from signals on the [`CellRenderer`][crate::CellRenderer], etc.
1861 ///
1862 /// [`CellEditableExt::editing_done()`][crate::prelude::CellEditableExt::editing_done()] is a convenience method
1863 /// for emitting [`editing-done`][struct@crate::CellEditable#editing-done].
1864 ///
1865 ///
1866 ///
1867 ///
1868 /// #### `remove-widget`
1869 /// This signal is meant to indicate that the cell is finished
1870 /// editing, and the `cell_editable` widget is being removed and may
1871 /// subsequently be destroyed.
1872 ///
1873 /// Implementations of [`CellEditable`][crate::CellEditable] are responsible for
1874 /// emitting this signal when they are done editing. It must
1875 /// be emitted after the [`editing-done`][struct@crate::CellEditable#editing-done] signal,
1876 /// to give the cell renderer a chance to update the cell's value
1877 /// before the widget is removed.
1878 ///
1879 /// [`CellEditableExt::remove_widget()`][crate::prelude::CellEditableExt::remove_widget()] is a convenience method
1880 /// for emitting [`remove-widget`][struct@crate::CellEditable#remove-widget].
1881 ///
1882 ///
1883 /// </details>
1884 /// <details><summary><h4>Editable</h4></summary>
1885 ///
1886 ///
1887 /// #### `changed`
1888 /// The ::changed signal is emitted at the end of a single
1889 /// user-visible operation on the contents of the [`Editable`][crate::Editable].
1890 ///
1891 /// E.g., a paste operation that replaces the contents of the
1892 /// selection will cause only one signal emission (even though it
1893 /// is implemented by first deleting the selection, then inserting
1894 /// the new content, and may cause multiple ::notify::text signals
1895 /// to be emitted).
1896 ///
1897 ///
1898 ///
1899 ///
1900 /// #### `delete-text`
1901 /// This signal is emitted when text is deleted from
1902 /// the widget by the user. The default handler for
1903 /// this signal will normally be responsible for deleting
1904 /// the text, so by connecting to this signal and then
1905 /// stopping the signal with `g_signal_stop_emission()`, it
1906 /// is possible to modify the range of deleted text, or
1907 /// prevent it from being deleted entirely. The `start_pos`
1908 /// and `end_pos` parameters are interpreted as for
1909 /// [`EditableExt::delete_text()`][crate::prelude::EditableExt::delete_text()].
1910 ///
1911 ///
1912 ///
1913 ///
1914 /// #### `insert-text`
1915 /// This signal is emitted when text is inserted into
1916 /// the widget by the user. The default handler for
1917 /// this signal will normally be responsible for inserting
1918 /// the text, so by connecting to this signal and then
1919 /// stopping the signal with `g_signal_stop_emission()`, it
1920 /// is possible to modify the inserted text, or prevent
1921 /// it from being inserted entirely.
1922 ///
1923 ///
1924 /// </details>
1925 ///
1926 /// # Implements
1927 ///
1928 /// [`SpinButtonExt`][trait@crate::prelude::SpinButtonExt], [`EntryExt`][trait@crate::prelude::EntryExt], [`WidgetExt`][trait@crate::prelude::WidgetExt], [`trait@glib::ObjectExt`], [`BuildableExt`][trait@crate::prelude::BuildableExt], [`CellEditableExt`][trait@crate::prelude::CellEditableExt], [`EditableExt`][trait@crate::prelude::EditableExt], [`OrientableExt`][trait@crate::prelude::OrientableExt], [`SpinButtonSignals`][trait@crate::prelude::SpinButtonSignals], [`EntryExtManual`][trait@crate::prelude::EntryExtManual], [`WidgetExtManual`][trait@crate::prelude::WidgetExtManual], [`BuildableExtManual`][trait@crate::prelude::BuildableExtManual], [`EditableSignals`][trait@crate::prelude::EditableSignals]
1929 #[doc(alias = "GtkSpinButton")]
1930 pub struct SpinButton(Object<ffi::GtkSpinButton, ffi::GtkSpinButtonClass>) @extends Entry, Widget, @implements Buildable, CellEditable, Editable, Orientable;
1931
1932 match fn {
1933 type_ => || ffi::gtk_spin_button_get_type(),
1934 }
1935}
1936
1937impl SpinButton {
1938 pub const NONE: Option<&'static SpinButton> = None;
1939
1940 /// Creates a new [`SpinButton`][crate::SpinButton].
1941 /// ## `adjustment`
1942 /// the [`Adjustment`][crate::Adjustment] object that this spin
1943 /// button should use, or [`None`]
1944 /// ## `climb_rate`
1945 /// specifies by how much the rate of change in the value will
1946 /// accelerate if you continue to hold down an up/down button or arrow key
1947 /// ## `digits`
1948 /// the number of decimal places to display
1949 ///
1950 /// # Returns
1951 ///
1952 /// The new spin button as a [`Widget`][crate::Widget]
1953 #[doc(alias = "gtk_spin_button_new")]
1954 pub fn new(
1955 adjustment: Option<&impl IsA<Adjustment>>,
1956 climb_rate: f64,
1957 digits: u32,
1958 ) -> SpinButton {
1959 assert_initialized_main_thread!();
1960 unsafe {
1961 Widget::from_glib_none(ffi::gtk_spin_button_new(
1962 adjustment.map(|p| p.as_ref()).to_glib_none().0,
1963 climb_rate,
1964 digits,
1965 ))
1966 .unsafe_cast()
1967 }
1968 }
1969
1970 /// This is a convenience constructor that allows creation of a numeric
1971 /// [`SpinButton`][crate::SpinButton] without manually creating an adjustment. The value is
1972 /// initially set to the minimum value and a page increment of 10 * `step`
1973 /// is the default. The precision of the spin button is equivalent to the
1974 /// precision of `step`.
1975 ///
1976 /// Note that the way in which the precision is derived works best if `step`
1977 /// is a power of ten. If the resulting precision is not suitable for your
1978 /// needs, use [`SpinButtonExt::set_digits()`][crate::prelude::SpinButtonExt::set_digits()] to correct it.
1979 /// ## `min`
1980 /// Minimum allowable value
1981 /// ## `max`
1982 /// Maximum allowable value
1983 /// ## `step`
1984 /// Increment added or subtracted by spinning the widget
1985 ///
1986 /// # Returns
1987 ///
1988 /// The new spin button as a [`Widget`][crate::Widget]
1989 #[doc(alias = "gtk_spin_button_new_with_range")]
1990 #[doc(alias = "new_with_range")]
1991 pub fn with_range(min: f64, max: f64, step: f64) -> SpinButton {
1992 assert_initialized_main_thread!();
1993 unsafe {
1994 Widget::from_glib_none(ffi::gtk_spin_button_new_with_range(min, max, step))
1995 .unsafe_cast()
1996 }
1997 }
1998
1999 // rustdoc-stripper-ignore-next
2000 /// Creates a new builder-pattern struct instance to construct [`SpinButton`] objects.
2001 ///
2002 /// This method returns an instance of [`SpinButtonBuilder`](crate::builders::SpinButtonBuilder) which can be used to create [`SpinButton`] objects.
2003 pub fn builder() -> SpinButtonBuilder {
2004 SpinButtonBuilder::new()
2005 }
2006}
2007
2008impl Default for SpinButton {
2009 fn default() -> Self {
2010 glib::object::Object::new::<Self>()
2011 }
2012}
2013
2014// rustdoc-stripper-ignore-next
2015/// A [builder-pattern] type to construct [`SpinButton`] objects.
2016///
2017/// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html
2018#[must_use = "The builder must be built to be used"]
2019pub struct SpinButtonBuilder {
2020 builder: glib::object::ObjectBuilder<'static, SpinButton>,
2021}
2022
2023impl SpinButtonBuilder {
2024 fn new() -> Self {
2025 Self {
2026 builder: glib::object::Object::builder(),
2027 }
2028 }
2029
2030 pub fn adjustment(self, adjustment: &impl IsA<Adjustment>) -> Self {
2031 Self {
2032 builder: self
2033 .builder
2034 .property("adjustment", adjustment.clone().upcast()),
2035 }
2036 }
2037
2038 pub fn climb_rate(self, climb_rate: f64) -> Self {
2039 Self {
2040 builder: self.builder.property("climb-rate", climb_rate),
2041 }
2042 }
2043
2044 pub fn digits(self, digits: u32) -> Self {
2045 Self {
2046 builder: self.builder.property("digits", digits),
2047 }
2048 }
2049
2050 pub fn numeric(self, numeric: bool) -> Self {
2051 Self {
2052 builder: self.builder.property("numeric", numeric),
2053 }
2054 }
2055
2056 pub fn snap_to_ticks(self, snap_to_ticks: bool) -> Self {
2057 Self {
2058 builder: self.builder.property("snap-to-ticks", snap_to_ticks),
2059 }
2060 }
2061
2062 pub fn update_policy(self, update_policy: SpinButtonUpdatePolicy) -> Self {
2063 Self {
2064 builder: self.builder.property("update-policy", update_policy),
2065 }
2066 }
2067
2068 pub fn value(self, value: f64) -> Self {
2069 Self {
2070 builder: self.builder.property("value", value),
2071 }
2072 }
2073
2074 pub fn wrap(self, wrap: bool) -> Self {
2075 Self {
2076 builder: self.builder.property("wrap", wrap),
2077 }
2078 }
2079
2080 pub fn activates_default(self, activates_default: bool) -> Self {
2081 Self {
2082 builder: self
2083 .builder
2084 .property("activates-default", activates_default),
2085 }
2086 }
2087
2088 /// A list of Pango attributes to apply to the text of the entry.
2089 ///
2090 /// This is mainly useful to change the size or weight of the text.
2091 ///
2092 /// The `PangoAttribute`'s `start_index` and `end_index` must refer to the
2093 /// [`EntryBuffer`][crate::EntryBuffer] text, i.e. without the preedit string.
2094 pub fn attributes(self, attributes: &pango::AttrList) -> Self {
2095 Self {
2096 builder: self.builder.property("attributes", attributes.clone()),
2097 }
2098 }
2099
2100 pub fn buffer(self, buffer: &impl IsA<EntryBuffer>) -> Self {
2101 Self {
2102 builder: self.builder.property("buffer", buffer.clone().upcast()),
2103 }
2104 }
2105
2106 /// Whether password entries will show a warning when Caps Lock is on.
2107 ///
2108 /// Note that the warning is shown using a secondary icon, and thus
2109 /// does not work if you are using the secondary icon position for some
2110 /// other purpose.
2111 pub fn caps_lock_warning(self, caps_lock_warning: bool) -> Self {
2112 Self {
2113 builder: self
2114 .builder
2115 .property("caps-lock-warning", caps_lock_warning),
2116 }
2117 }
2118
2119 /// The auxiliary completion object to use with the entry.
2120 pub fn completion(self, completion: &impl IsA<EntryCompletion>) -> Self {
2121 Self {
2122 builder: self
2123 .builder
2124 .property("completion", completion.clone().upcast()),
2125 }
2126 }
2127
2128 pub fn editable(self, editable: bool) -> Self {
2129 Self {
2130 builder: self.builder.property("editable", editable),
2131 }
2132 }
2133
2134 pub fn enable_emoji_completion(self, enable_emoji_completion: bool) -> Self {
2135 Self {
2136 builder: self
2137 .builder
2138 .property("enable-emoji-completion", enable_emoji_completion),
2139 }
2140 }
2141
2142 pub fn has_frame(self, has_frame: bool) -> Self {
2143 Self {
2144 builder: self.builder.property("has-frame", has_frame),
2145 }
2146 }
2147
2148 /// Which IM (input method) module should be used for this entry.
2149 /// See [`IMContext`][crate::IMContext].
2150 ///
2151 /// Setting this to a non-[`None`] value overrides the
2152 /// system-wide IM module setting. See the GtkSettings
2153 /// [`gtk-im-module`][struct@crate::Settings#gtk-im-module] property.
2154 pub fn im_module(self, im_module: impl Into<glib::GString>) -> Self {
2155 Self {
2156 builder: self.builder.property("im-module", im_module.into()),
2157 }
2158 }
2159
2160 /// Additional hints (beyond [`input-purpose`][struct@crate::Entry#input-purpose]) that
2161 /// allow input methods to fine-tune their behaviour.
2162 pub fn input_hints(self, input_hints: InputHints) -> Self {
2163 Self {
2164 builder: self.builder.property("input-hints", input_hints),
2165 }
2166 }
2167
2168 /// The purpose of this text field.
2169 ///
2170 /// This property can be used by on-screen keyboards and other input
2171 /// methods to adjust their behaviour.
2172 ///
2173 /// Note that setting the purpose to [`InputPurpose::Password`][crate::InputPurpose::Password] or
2174 /// [`InputPurpose::Pin`][crate::InputPurpose::Pin] is independent from setting
2175 /// [`visibility`][struct@crate::Entry#visibility].
2176 pub fn input_purpose(self, input_purpose: InputPurpose) -> Self {
2177 Self {
2178 builder: self.builder.property("input-purpose", input_purpose),
2179 }
2180 }
2181
2182 /// The invisible character is used when masking entry contents (in
2183 /// \"password mode\")"). When it is not explicitly set with the
2184 /// [`invisible-char`][struct@crate::Entry#invisible-char] property, GTK+ determines the character
2185 /// to use from a list of possible candidates, depending on availability
2186 /// in the current font.
2187 ///
2188 /// This style property allows the theme to prepend a character
2189 /// to the list of candidates.
2190 pub fn invisible_char(self, invisible_char: u32) -> Self {
2191 Self {
2192 builder: self.builder.property("invisible-char", invisible_char),
2193 }
2194 }
2195
2196 /// Whether the invisible char has been set for the [`Entry`][crate::Entry].
2197 pub fn invisible_char_set(self, invisible_char_set: bool) -> Self {
2198 Self {
2199 builder: self
2200 .builder
2201 .property("invisible-char-set", invisible_char_set),
2202 }
2203 }
2204
2205 pub fn max_length(self, max_length: i32) -> Self {
2206 Self {
2207 builder: self.builder.property("max-length", max_length),
2208 }
2209 }
2210
2211 /// The desired maximum width of the entry, in characters.
2212 /// If this property is set to -1, the width will be calculated
2213 /// automatically.
2214 pub fn max_width_chars(self, max_width_chars: i32) -> Self {
2215 Self {
2216 builder: self.builder.property("max-width-chars", max_width_chars),
2217 }
2218 }
2219
2220 /// If text is overwritten when typing in the [`Entry`][crate::Entry].
2221 pub fn overwrite_mode(self, overwrite_mode: bool) -> Self {
2222 Self {
2223 builder: self.builder.property("overwrite-mode", overwrite_mode),
2224 }
2225 }
2226
2227 /// The text that will be displayed in the [`Entry`][crate::Entry] when it is empty
2228 /// and unfocused.
2229 pub fn placeholder_text(self, placeholder_text: impl Into<glib::GString>) -> Self {
2230 Self {
2231 builder: self
2232 .builder
2233 .property("placeholder-text", placeholder_text.into()),
2234 }
2235 }
2236
2237 /// If :populate-all is [`true`], the [`populate-popup`][struct@crate::Entry#populate-popup]
2238 /// signal is also emitted for touch popups.
2239 pub fn populate_all(self, populate_all: bool) -> Self {
2240 Self {
2241 builder: self.builder.property("populate-all", populate_all),
2242 }
2243 }
2244
2245 /// Whether the primary icon is activatable.
2246 ///
2247 /// GTK+ emits the [`icon-press`][struct@crate::Entry#icon-press] and [`icon-release`][struct@crate::Entry#icon-release]
2248 /// signals only on sensitive, activatable icons.
2249 ///
2250 /// Sensitive, but non-activatable icons can be used for purely
2251 /// informational purposes.
2252 pub fn primary_icon_activatable(self, primary_icon_activatable: bool) -> Self {
2253 Self {
2254 builder: self
2255 .builder
2256 .property("primary-icon-activatable", primary_icon_activatable),
2257 }
2258 }
2259
2260 /// The [`gio::Icon`][crate::gio::Icon] to use for the primary icon for the entry.
2261 pub fn primary_icon_gicon(self, primary_icon_gicon: &impl IsA<gio::Icon>) -> Self {
2262 Self {
2263 builder: self
2264 .builder
2265 .property("primary-icon-gicon", primary_icon_gicon.clone().upcast()),
2266 }
2267 }
2268
2269 /// The icon name to use for the primary icon for the entry.
2270 pub fn primary_icon_name(self, primary_icon_name: impl Into<glib::GString>) -> Self {
2271 Self {
2272 builder: self
2273 .builder
2274 .property("primary-icon-name", primary_icon_name.into()),
2275 }
2276 }
2277
2278 /// A pixbuf to use as the primary icon for the entry.
2279 pub fn primary_icon_pixbuf(self, primary_icon_pixbuf: &gdk_pixbuf::Pixbuf) -> Self {
2280 Self {
2281 builder: self
2282 .builder
2283 .property("primary-icon-pixbuf", primary_icon_pixbuf.clone()),
2284 }
2285 }
2286
2287 /// Whether the primary icon is sensitive.
2288 ///
2289 /// An insensitive icon appears grayed out. GTK+ does not emit the
2290 /// [`icon-press`][struct@crate::Entry#icon-press] and [`icon-release`][struct@crate::Entry#icon-release] signals and
2291 /// does not allow DND from insensitive icons.
2292 ///
2293 /// An icon should be set insensitive if the action that would trigger
2294 /// when clicked is currently not available.
2295 pub fn primary_icon_sensitive(self, primary_icon_sensitive: bool) -> Self {
2296 Self {
2297 builder: self
2298 .builder
2299 .property("primary-icon-sensitive", primary_icon_sensitive),
2300 }
2301 }
2302
2303 /// The contents of the tooltip on the primary icon, which is marked up
2304 /// with the [Pango text markup language][PangoMarkupFormat].
2305 ///
2306 /// Also see [`EntryExt::set_icon_tooltip_markup()`][crate::prelude::EntryExt::set_icon_tooltip_markup()].
2307 pub fn primary_icon_tooltip_markup(
2308 self,
2309 primary_icon_tooltip_markup: impl Into<glib::GString>,
2310 ) -> Self {
2311 Self {
2312 builder: self.builder.property(
2313 "primary-icon-tooltip-markup",
2314 primary_icon_tooltip_markup.into(),
2315 ),
2316 }
2317 }
2318
2319 /// The contents of the tooltip on the primary icon.
2320 ///
2321 /// Also see [`EntryExt::set_icon_tooltip_text()`][crate::prelude::EntryExt::set_icon_tooltip_text()].
2322 pub fn primary_icon_tooltip_text(
2323 self,
2324 primary_icon_tooltip_text: impl Into<glib::GString>,
2325 ) -> Self {
2326 Self {
2327 builder: self.builder.property(
2328 "primary-icon-tooltip-text",
2329 primary_icon_tooltip_text.into(),
2330 ),
2331 }
2332 }
2333
2334 /// The current fraction of the task that's been completed.
2335 pub fn progress_fraction(self, progress_fraction: f64) -> Self {
2336 Self {
2337 builder: self
2338 .builder
2339 .property("progress-fraction", progress_fraction),
2340 }
2341 }
2342
2343 /// The fraction of total entry width to move the progress
2344 /// bouncing block for each call to [`EntryExt::progress_pulse()`][crate::prelude::EntryExt::progress_pulse()].
2345 pub fn progress_pulse_step(self, progress_pulse_step: f64) -> Self {
2346 Self {
2347 builder: self
2348 .builder
2349 .property("progress-pulse-step", progress_pulse_step),
2350 }
2351 }
2352
2353 /// Whether the secondary icon is activatable.
2354 ///
2355 /// GTK+ emits the [`icon-press`][struct@crate::Entry#icon-press] and [`icon-release`][struct@crate::Entry#icon-release]
2356 /// signals only on sensitive, activatable icons.
2357 ///
2358 /// Sensitive, but non-activatable icons can be used for purely
2359 /// informational purposes.
2360 pub fn secondary_icon_activatable(self, secondary_icon_activatable: bool) -> Self {
2361 Self {
2362 builder: self
2363 .builder
2364 .property("secondary-icon-activatable", secondary_icon_activatable),
2365 }
2366 }
2367
2368 /// The [`gio::Icon`][crate::gio::Icon] to use for the secondary icon for the entry.
2369 pub fn secondary_icon_gicon(self, secondary_icon_gicon: &impl IsA<gio::Icon>) -> Self {
2370 Self {
2371 builder: self.builder.property(
2372 "secondary-icon-gicon",
2373 secondary_icon_gicon.clone().upcast(),
2374 ),
2375 }
2376 }
2377
2378 /// The icon name to use for the secondary icon for the entry.
2379 pub fn secondary_icon_name(self, secondary_icon_name: impl Into<glib::GString>) -> Self {
2380 Self {
2381 builder: self
2382 .builder
2383 .property("secondary-icon-name", secondary_icon_name.into()),
2384 }
2385 }
2386
2387 /// An pixbuf to use as the secondary icon for the entry.
2388 pub fn secondary_icon_pixbuf(self, secondary_icon_pixbuf: &gdk_pixbuf::Pixbuf) -> Self {
2389 Self {
2390 builder: self
2391 .builder
2392 .property("secondary-icon-pixbuf", secondary_icon_pixbuf.clone()),
2393 }
2394 }
2395
2396 /// Whether the secondary icon is sensitive.
2397 ///
2398 /// An insensitive icon appears grayed out. GTK+ does not emit the
2399 /// [`icon-press`][struct@crate::Entry#icon-press] and [`icon-release`][struct@crate::Entry#icon-release] signals and
2400 /// does not allow DND from insensitive icons.
2401 ///
2402 /// An icon should be set insensitive if the action that would trigger
2403 /// when clicked is currently not available.
2404 pub fn secondary_icon_sensitive(self, secondary_icon_sensitive: bool) -> Self {
2405 Self {
2406 builder: self
2407 .builder
2408 .property("secondary-icon-sensitive", secondary_icon_sensitive),
2409 }
2410 }
2411
2412 /// The contents of the tooltip on the secondary icon, which is marked up
2413 /// with the [Pango text markup language][PangoMarkupFormat].
2414 ///
2415 /// Also see [`EntryExt::set_icon_tooltip_markup()`][crate::prelude::EntryExt::set_icon_tooltip_markup()].
2416 pub fn secondary_icon_tooltip_markup(
2417 self,
2418 secondary_icon_tooltip_markup: impl Into<glib::GString>,
2419 ) -> Self {
2420 Self {
2421 builder: self.builder.property(
2422 "secondary-icon-tooltip-markup",
2423 secondary_icon_tooltip_markup.into(),
2424 ),
2425 }
2426 }
2427
2428 /// The contents of the tooltip on the secondary icon.
2429 ///
2430 /// Also see [`EntryExt::set_icon_tooltip_text()`][crate::prelude::EntryExt::set_icon_tooltip_text()].
2431 pub fn secondary_icon_tooltip_text(
2432 self,
2433 secondary_icon_tooltip_text: impl Into<glib::GString>,
2434 ) -> Self {
2435 Self {
2436 builder: self.builder.property(
2437 "secondary-icon-tooltip-text",
2438 secondary_icon_tooltip_text.into(),
2439 ),
2440 }
2441 }
2442
2443 pub fn show_emoji_icon(self, show_emoji_icon: bool) -> Self {
2444 Self {
2445 builder: self.builder.property("show-emoji-icon", show_emoji_icon),
2446 }
2447 }
2448
2449 pub fn tabs(self, tabs: &pango::TabArray) -> Self {
2450 Self {
2451 builder: self.builder.property("tabs", tabs),
2452 }
2453 }
2454
2455 pub fn text(self, text: impl Into<glib::GString>) -> Self {
2456 Self {
2457 builder: self.builder.property("text", text.into()),
2458 }
2459 }
2460
2461 /// When [`true`], pasted multi-line text is truncated to the first line.
2462 pub fn truncate_multiline(self, truncate_multiline: bool) -> Self {
2463 Self {
2464 builder: self
2465 .builder
2466 .property("truncate-multiline", truncate_multiline),
2467 }
2468 }
2469
2470 pub fn visibility(self, visibility: bool) -> Self {
2471 Self {
2472 builder: self.builder.property("visibility", visibility),
2473 }
2474 }
2475
2476 pub fn width_chars(self, width_chars: i32) -> Self {
2477 Self {
2478 builder: self.builder.property("width-chars", width_chars),
2479 }
2480 }
2481
2482 /// The horizontal alignment, from 0 (left) to 1 (right).
2483 /// Reversed for RTL layouts.
2484 pub fn xalign(self, xalign: f32) -> Self {
2485 Self {
2486 builder: self.builder.property("xalign", xalign),
2487 }
2488 }
2489
2490 pub fn app_paintable(self, app_paintable: bool) -> Self {
2491 Self {
2492 builder: self.builder.property("app-paintable", app_paintable),
2493 }
2494 }
2495
2496 pub fn can_default(self, can_default: bool) -> Self {
2497 Self {
2498 builder: self.builder.property("can-default", can_default),
2499 }
2500 }
2501
2502 pub fn can_focus(self, can_focus: bool) -> Self {
2503 Self {
2504 builder: self.builder.property("can-focus", can_focus),
2505 }
2506 }
2507
2508 pub fn events(self, events: gdk::EventMask) -> Self {
2509 Self {
2510 builder: self.builder.property("events", events),
2511 }
2512 }
2513
2514 /// Whether to expand in both directions. Setting this sets both [`hexpand`][struct@crate::Widget#hexpand] and [`vexpand`][struct@crate::Widget#vexpand]
2515 pub fn expand(self, expand: bool) -> Self {
2516 Self {
2517 builder: self.builder.property("expand", expand),
2518 }
2519 }
2520
2521 /// Whether the widget should grab focus when it is clicked with the mouse.
2522 ///
2523 /// This property is only relevant for widgets that can take focus.
2524 ///
2525 /// Before 3.20, several widgets (GtkButton, GtkFileChooserButton,
2526 /// GtkComboBox) implemented this property individually.
2527 pub fn focus_on_click(self, focus_on_click: bool) -> Self {
2528 Self {
2529 builder: self.builder.property("focus-on-click", focus_on_click),
2530 }
2531 }
2532
2533 /// How to distribute horizontal space if widget gets extra space, see [`Align`][crate::Align]
2534 pub fn halign(self, halign: Align) -> Self {
2535 Self {
2536 builder: self.builder.property("halign", halign),
2537 }
2538 }
2539
2540 pub fn has_default(self, has_default: bool) -> Self {
2541 Self {
2542 builder: self.builder.property("has-default", has_default),
2543 }
2544 }
2545
2546 pub fn has_focus(self, has_focus: bool) -> Self {
2547 Self {
2548 builder: self.builder.property("has-focus", has_focus),
2549 }
2550 }
2551
2552 /// Enables or disables the emission of [`query-tooltip`][struct@crate::Widget#query-tooltip] on `widget`.
2553 /// A value of [`true`] indicates that `widget` can have a tooltip, in this case
2554 /// the widget will be queried using [`query-tooltip`][struct@crate::Widget#query-tooltip] to determine
2555 /// whether it will provide a tooltip or not.
2556 ///
2557 /// Note that setting this property to [`true`] for the first time will change
2558 /// the event masks of the GdkWindows of this widget to include leave-notify
2559 /// and motion-notify events. This cannot and will not be undone when the
2560 /// property is set to [`false`] again.
2561 pub fn has_tooltip(self, has_tooltip: bool) -> Self {
2562 Self {
2563 builder: self.builder.property("has-tooltip", has_tooltip),
2564 }
2565 }
2566
2567 pub fn height_request(self, height_request: i32) -> Self {
2568 Self {
2569 builder: self.builder.property("height-request", height_request),
2570 }
2571 }
2572
2573 /// Whether to expand horizontally. See [`WidgetExt::set_hexpand()`][crate::prelude::WidgetExt::set_hexpand()].
2574 pub fn hexpand(self, hexpand: bool) -> Self {
2575 Self {
2576 builder: self.builder.property("hexpand", hexpand),
2577 }
2578 }
2579
2580 /// Whether to use the [`hexpand`][struct@crate::Widget#hexpand] property. See [`WidgetExt::is_hexpand_set()`][crate::prelude::WidgetExt::is_hexpand_set()].
2581 pub fn hexpand_set(self, hexpand_set: bool) -> Self {
2582 Self {
2583 builder: self.builder.property("hexpand-set", hexpand_set),
2584 }
2585 }
2586
2587 pub fn is_focus(self, is_focus: bool) -> Self {
2588 Self {
2589 builder: self.builder.property("is-focus", is_focus),
2590 }
2591 }
2592
2593 /// Sets all four sides' margin at once. If read, returns max
2594 /// margin on any side.
2595 pub fn margin(self, margin: i32) -> Self {
2596 Self {
2597 builder: self.builder.property("margin", margin),
2598 }
2599 }
2600
2601 /// Margin on bottom side of widget.
2602 ///
2603 /// This property adds margin outside of the widget's normal size
2604 /// request, the margin will be added in addition to the size from
2605 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
2606 pub fn margin_bottom(self, margin_bottom: i32) -> Self {
2607 Self {
2608 builder: self.builder.property("margin-bottom", margin_bottom),
2609 }
2610 }
2611
2612 /// Margin on end of widget, horizontally. This property supports
2613 /// left-to-right and right-to-left text directions.
2614 ///
2615 /// This property adds margin outside of the widget's normal size
2616 /// request, the margin will be added in addition to the size from
2617 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
2618 pub fn margin_end(self, margin_end: i32) -> Self {
2619 Self {
2620 builder: self.builder.property("margin-end", margin_end),
2621 }
2622 }
2623
2624 /// Margin on start of widget, horizontally. This property supports
2625 /// left-to-right and right-to-left text directions.
2626 ///
2627 /// This property adds margin outside of the widget's normal size
2628 /// request, the margin will be added in addition to the size from
2629 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
2630 pub fn margin_start(self, margin_start: i32) -> Self {
2631 Self {
2632 builder: self.builder.property("margin-start", margin_start),
2633 }
2634 }
2635
2636 /// Margin on top side of widget.
2637 ///
2638 /// This property adds margin outside of the widget's normal size
2639 /// request, the margin will be added in addition to the size from
2640 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
2641 pub fn margin_top(self, margin_top: i32) -> Self {
2642 Self {
2643 builder: self.builder.property("margin-top", margin_top),
2644 }
2645 }
2646
2647 pub fn name(self, name: impl Into<glib::GString>) -> Self {
2648 Self {
2649 builder: self.builder.property("name", name.into()),
2650 }
2651 }
2652
2653 pub fn no_show_all(self, no_show_all: bool) -> Self {
2654 Self {
2655 builder: self.builder.property("no-show-all", no_show_all),
2656 }
2657 }
2658
2659 /// The requested opacity of the widget. See [`WidgetExt::set_opacity()`][crate::prelude::WidgetExt::set_opacity()] for
2660 /// more details about window opacity.
2661 ///
2662 /// Before 3.8 this was only available in GtkWindow
2663 pub fn opacity(self, opacity: f64) -> Self {
2664 Self {
2665 builder: self.builder.property("opacity", opacity),
2666 }
2667 }
2668
2669 pub fn parent(self, parent: &impl IsA<Container>) -> Self {
2670 Self {
2671 builder: self.builder.property("parent", parent.clone().upcast()),
2672 }
2673 }
2674
2675 pub fn receives_default(self, receives_default: bool) -> Self {
2676 Self {
2677 builder: self.builder.property("receives-default", receives_default),
2678 }
2679 }
2680
2681 pub fn sensitive(self, sensitive: bool) -> Self {
2682 Self {
2683 builder: self.builder.property("sensitive", sensitive),
2684 }
2685 }
2686
2687 /// Sets the text of tooltip to be the given string, which is marked up
2688 /// with the [Pango text markup language][PangoMarkupFormat].
2689 /// Also see [`Tooltip::set_markup()`][crate::Tooltip::set_markup()].
2690 ///
2691 /// This is a convenience property which will take care of getting the
2692 /// tooltip shown if the given string is not [`None`]: [`has-tooltip`][struct@crate::Widget#has-tooltip]
2693 /// will automatically be set to [`true`] and there will be taken care of
2694 /// [`query-tooltip`][struct@crate::Widget#query-tooltip] in the default signal handler.
2695 ///
2696 /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and [`tooltip-markup`][struct@crate::Widget#tooltip-markup]
2697 /// are set, the last one wins.
2698 pub fn tooltip_markup(self, tooltip_markup: impl Into<glib::GString>) -> Self {
2699 Self {
2700 builder: self
2701 .builder
2702 .property("tooltip-markup", tooltip_markup.into()),
2703 }
2704 }
2705
2706 /// Sets the text of tooltip to be the given string.
2707 ///
2708 /// Also see [`Tooltip::set_text()`][crate::Tooltip::set_text()].
2709 ///
2710 /// This is a convenience property which will take care of getting the
2711 /// tooltip shown if the given string is not [`None`]: [`has-tooltip`][struct@crate::Widget#has-tooltip]
2712 /// will automatically be set to [`true`] and there will be taken care of
2713 /// [`query-tooltip`][struct@crate::Widget#query-tooltip] in the default signal handler.
2714 ///
2715 /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and [`tooltip-markup`][struct@crate::Widget#tooltip-markup]
2716 /// are set, the last one wins.
2717 pub fn tooltip_text(self, tooltip_text: impl Into<glib::GString>) -> Self {
2718 Self {
2719 builder: self.builder.property("tooltip-text", tooltip_text.into()),
2720 }
2721 }
2722
2723 /// How to distribute vertical space if widget gets extra space, see [`Align`][crate::Align]
2724 pub fn valign(self, valign: Align) -> Self {
2725 Self {
2726 builder: self.builder.property("valign", valign),
2727 }
2728 }
2729
2730 /// Whether to expand vertically. See [`WidgetExt::set_vexpand()`][crate::prelude::WidgetExt::set_vexpand()].
2731 pub fn vexpand(self, vexpand: bool) -> Self {
2732 Self {
2733 builder: self.builder.property("vexpand", vexpand),
2734 }
2735 }
2736
2737 /// Whether to use the [`vexpand`][struct@crate::Widget#vexpand] property. See [`WidgetExt::is_vexpand_set()`][crate::prelude::WidgetExt::is_vexpand_set()].
2738 pub fn vexpand_set(self, vexpand_set: bool) -> Self {
2739 Self {
2740 builder: self.builder.property("vexpand-set", vexpand_set),
2741 }
2742 }
2743
2744 pub fn visible(self, visible: bool) -> Self {
2745 Self {
2746 builder: self.builder.property("visible", visible),
2747 }
2748 }
2749
2750 pub fn width_request(self, width_request: i32) -> Self {
2751 Self {
2752 builder: self.builder.property("width-request", width_request),
2753 }
2754 }
2755
2756 /// Indicates whether editing on the cell has been canceled.
2757 pub fn editing_canceled(self, editing_canceled: bool) -> Self {
2758 Self {
2759 builder: self.builder.property("editing-canceled", editing_canceled),
2760 }
2761 }
2762
2763 /// The orientation of the orientable.
2764 pub fn orientation(self, orientation: Orientation) -> Self {
2765 Self {
2766 builder: self.builder.property("orientation", orientation),
2767 }
2768 }
2769
2770 // rustdoc-stripper-ignore-next
2771 /// Build the [`SpinButton`].
2772 #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"]
2773 pub fn build(self) -> SpinButton {
2774 assert_initialized_main_thread!();
2775 self.builder.build()
2776 }
2777}
2778
2779/// Trait containing all [`struct@SpinButton`] methods.
2780///
2781/// # Implementors
2782///
2783/// [`SpinButton`][struct@crate::SpinButton]
2784pub trait SpinButtonExt: IsA<SpinButton> + 'static {
2785 /// Changes the properties of an existing spin button. The adjustment,
2786 /// climb rate, and number of decimal places are updated accordingly.
2787 /// ## `adjustment`
2788 /// a [`Adjustment`][crate::Adjustment] to replace the spin button’s
2789 /// existing adjustment, or [`None`] to leave its current adjustment unchanged
2790 /// ## `climb_rate`
2791 /// the new climb rate
2792 /// ## `digits`
2793 /// the number of decimal places to display in the spin button
2794 #[doc(alias = "gtk_spin_button_configure")]
2795 fn configure(&self, adjustment: Option<&impl IsA<Adjustment>>, climb_rate: f64, digits: u32) {
2796 unsafe {
2797 ffi::gtk_spin_button_configure(
2798 self.as_ref().to_glib_none().0,
2799 adjustment.map(|p| p.as_ref()).to_glib_none().0,
2800 climb_rate,
2801 digits,
2802 );
2803 }
2804 }
2805
2806 /// Get the adjustment associated with a [`SpinButton`][crate::SpinButton]
2807 ///
2808 /// # Returns
2809 ///
2810 /// the [`Adjustment`][crate::Adjustment] of `self`
2811 #[doc(alias = "gtk_spin_button_get_adjustment")]
2812 #[doc(alias = "get_adjustment")]
2813 fn adjustment(&self) -> Adjustment {
2814 unsafe {
2815 from_glib_none(ffi::gtk_spin_button_get_adjustment(
2816 self.as_ref().to_glib_none().0,
2817 ))
2818 }
2819 }
2820
2821 /// Fetches the precision of `self`. See [`set_digits()`][Self::set_digits()].
2822 ///
2823 /// # Returns
2824 ///
2825 /// the current precision
2826 #[doc(alias = "gtk_spin_button_get_digits")]
2827 #[doc(alias = "get_digits")]
2828 fn digits(&self) -> u32 {
2829 unsafe { ffi::gtk_spin_button_get_digits(self.as_ref().to_glib_none().0) }
2830 }
2831
2832 /// Gets the current step and page the increments used by `self`. See
2833 /// [`set_increments()`][Self::set_increments()].
2834 ///
2835 /// # Returns
2836 ///
2837 ///
2838 /// ## `step`
2839 /// location to store step increment, or [`None`]
2840 ///
2841 /// ## `page`
2842 /// location to store page increment, or [`None`]
2843 #[doc(alias = "gtk_spin_button_get_increments")]
2844 #[doc(alias = "get_increments")]
2845 fn increments(&self) -> (f64, f64) {
2846 unsafe {
2847 let mut step = std::mem::MaybeUninit::uninit();
2848 let mut page = std::mem::MaybeUninit::uninit();
2849 ffi::gtk_spin_button_get_increments(
2850 self.as_ref().to_glib_none().0,
2851 step.as_mut_ptr(),
2852 page.as_mut_ptr(),
2853 );
2854 (step.assume_init(), page.assume_init())
2855 }
2856 }
2857
2858 /// Returns whether non-numeric text can be typed into the spin button.
2859 /// See [`set_numeric()`][Self::set_numeric()].
2860 ///
2861 /// # Returns
2862 ///
2863 /// [`true`] if only numeric text can be entered
2864 #[doc(alias = "gtk_spin_button_get_numeric")]
2865 #[doc(alias = "get_numeric")]
2866 #[doc(alias = "numeric")]
2867 fn is_numeric(&self) -> bool {
2868 unsafe {
2869 from_glib(ffi::gtk_spin_button_get_numeric(
2870 self.as_ref().to_glib_none().0,
2871 ))
2872 }
2873 }
2874
2875 /// Gets the range allowed for `self`.
2876 /// See [`set_range()`][Self::set_range()].
2877 ///
2878 /// # Returns
2879 ///
2880 ///
2881 /// ## `min`
2882 /// location to store minimum allowed value, or [`None`]
2883 ///
2884 /// ## `max`
2885 /// location to store maximum allowed value, or [`None`]
2886 #[doc(alias = "gtk_spin_button_get_range")]
2887 #[doc(alias = "get_range")]
2888 fn range(&self) -> (f64, f64) {
2889 unsafe {
2890 let mut min = std::mem::MaybeUninit::uninit();
2891 let mut max = std::mem::MaybeUninit::uninit();
2892 ffi::gtk_spin_button_get_range(
2893 self.as_ref().to_glib_none().0,
2894 min.as_mut_ptr(),
2895 max.as_mut_ptr(),
2896 );
2897 (min.assume_init(), max.assume_init())
2898 }
2899 }
2900
2901 /// Returns whether the values are corrected to the nearest step.
2902 /// See [`set_snap_to_ticks()`][Self::set_snap_to_ticks()].
2903 ///
2904 /// # Returns
2905 ///
2906 /// [`true`] if values are snapped to the nearest step
2907 #[doc(alias = "gtk_spin_button_get_snap_to_ticks")]
2908 #[doc(alias = "get_snap_to_ticks")]
2909 #[doc(alias = "snap-to-ticks")]
2910 fn snaps_to_ticks(&self) -> bool {
2911 unsafe {
2912 from_glib(ffi::gtk_spin_button_get_snap_to_ticks(
2913 self.as_ref().to_glib_none().0,
2914 ))
2915 }
2916 }
2917
2918 /// Gets the update behavior of a spin button.
2919 /// See [`set_update_policy()`][Self::set_update_policy()].
2920 ///
2921 /// # Returns
2922 ///
2923 /// the current update policy
2924 #[doc(alias = "gtk_spin_button_get_update_policy")]
2925 #[doc(alias = "get_update_policy")]
2926 #[doc(alias = "update-policy")]
2927 fn update_policy(&self) -> SpinButtonUpdatePolicy {
2928 unsafe {
2929 from_glib(ffi::gtk_spin_button_get_update_policy(
2930 self.as_ref().to_glib_none().0,
2931 ))
2932 }
2933 }
2934
2935 /// Get the value in the `self`.
2936 ///
2937 /// # Returns
2938 ///
2939 /// the value of `self`
2940 #[doc(alias = "gtk_spin_button_get_value")]
2941 #[doc(alias = "get_value")]
2942 fn value(&self) -> f64 {
2943 unsafe { ffi::gtk_spin_button_get_value(self.as_ref().to_glib_none().0) }
2944 }
2945
2946 /// Get the value `self` represented as an integer.
2947 ///
2948 /// # Returns
2949 ///
2950 /// the value of `self`
2951 #[doc(alias = "gtk_spin_button_get_value_as_int")]
2952 #[doc(alias = "get_value_as_int")]
2953 fn value_as_int(&self) -> i32 {
2954 unsafe { ffi::gtk_spin_button_get_value_as_int(self.as_ref().to_glib_none().0) }
2955 }
2956
2957 /// Returns whether the spin button’s value wraps around to the
2958 /// opposite limit when the upper or lower limit of the range is
2959 /// exceeded. See [`set_wrap()`][Self::set_wrap()].
2960 ///
2961 /// # Returns
2962 ///
2963 /// [`true`] if the spin button wraps around
2964 #[doc(alias = "gtk_spin_button_get_wrap")]
2965 #[doc(alias = "get_wrap")]
2966 #[doc(alias = "wrap")]
2967 fn wraps(&self) -> bool {
2968 unsafe {
2969 from_glib(ffi::gtk_spin_button_get_wrap(
2970 self.as_ref().to_glib_none().0,
2971 ))
2972 }
2973 }
2974
2975 /// Replaces the [`Adjustment`][crate::Adjustment] associated with `self`.
2976 /// ## `adjustment`
2977 /// a [`Adjustment`][crate::Adjustment] to replace the existing adjustment
2978 #[doc(alias = "gtk_spin_button_set_adjustment")]
2979 #[doc(alias = "adjustment")]
2980 fn set_adjustment(&self, adjustment: &impl IsA<Adjustment>) {
2981 unsafe {
2982 ffi::gtk_spin_button_set_adjustment(
2983 self.as_ref().to_glib_none().0,
2984 adjustment.as_ref().to_glib_none().0,
2985 );
2986 }
2987 }
2988
2989 /// Set the precision to be displayed by `self`. Up to 20 digit precision
2990 /// is allowed.
2991 /// ## `digits`
2992 /// the number of digits after the decimal point to be displayed for the spin button’s value
2993 #[doc(alias = "gtk_spin_button_set_digits")]
2994 #[doc(alias = "digits")]
2995 fn set_digits(&self, digits: u32) {
2996 unsafe {
2997 ffi::gtk_spin_button_set_digits(self.as_ref().to_glib_none().0, digits);
2998 }
2999 }
3000
3001 /// Sets the step and page increments for spin_button. This affects how
3002 /// quickly the value changes when the spin button’s arrows are activated.
3003 /// ## `step`
3004 /// increment applied for a button 1 press.
3005 /// ## `page`
3006 /// increment applied for a button 2 press.
3007 #[doc(alias = "gtk_spin_button_set_increments")]
3008 fn set_increments(&self, step: f64, page: f64) {
3009 unsafe {
3010 ffi::gtk_spin_button_set_increments(self.as_ref().to_glib_none().0, step, page);
3011 }
3012 }
3013
3014 /// Sets the flag that determines if non-numeric text can be typed
3015 /// into the spin button.
3016 /// ## `numeric`
3017 /// flag indicating if only numeric entry is allowed
3018 #[doc(alias = "gtk_spin_button_set_numeric")]
3019 #[doc(alias = "numeric")]
3020 fn set_numeric(&self, numeric: bool) {
3021 unsafe {
3022 ffi::gtk_spin_button_set_numeric(self.as_ref().to_glib_none().0, numeric.into_glib());
3023 }
3024 }
3025
3026 /// Sets the minimum and maximum allowable values for `self`.
3027 ///
3028 /// If the current value is outside this range, it will be adjusted
3029 /// to fit within the range, otherwise it will remain unchanged.
3030 /// ## `min`
3031 /// minimum allowable value
3032 /// ## `max`
3033 /// maximum allowable value
3034 #[doc(alias = "gtk_spin_button_set_range")]
3035 fn set_range(&self, min: f64, max: f64) {
3036 unsafe {
3037 ffi::gtk_spin_button_set_range(self.as_ref().to_glib_none().0, min, max);
3038 }
3039 }
3040
3041 /// Sets the policy as to whether values are corrected to the
3042 /// nearest step increment when a spin button is activated after
3043 /// providing an invalid value.
3044 /// ## `snap_to_ticks`
3045 /// a flag indicating if invalid values should be corrected
3046 #[doc(alias = "gtk_spin_button_set_snap_to_ticks")]
3047 #[doc(alias = "snap-to-ticks")]
3048 fn set_snap_to_ticks(&self, snap_to_ticks: bool) {
3049 unsafe {
3050 ffi::gtk_spin_button_set_snap_to_ticks(
3051 self.as_ref().to_glib_none().0,
3052 snap_to_ticks.into_glib(),
3053 );
3054 }
3055 }
3056
3057 /// Sets the update behavior of a spin button.
3058 /// This determines whether the spin button is always updated
3059 /// or only when a valid value is set.
3060 /// ## `policy`
3061 /// a [`SpinButtonUpdatePolicy`][crate::SpinButtonUpdatePolicy] value
3062 #[doc(alias = "gtk_spin_button_set_update_policy")]
3063 #[doc(alias = "update-policy")]
3064 fn set_update_policy(&self, policy: SpinButtonUpdatePolicy) {
3065 unsafe {
3066 ffi::gtk_spin_button_set_update_policy(
3067 self.as_ref().to_glib_none().0,
3068 policy.into_glib(),
3069 );
3070 }
3071 }
3072
3073 /// Sets the value of `self`.
3074 /// ## `value`
3075 /// the new value
3076 #[doc(alias = "gtk_spin_button_set_value")]
3077 #[doc(alias = "value")]
3078 fn set_value(&self, value: f64) {
3079 unsafe {
3080 ffi::gtk_spin_button_set_value(self.as_ref().to_glib_none().0, value);
3081 }
3082 }
3083
3084 /// Sets the flag that determines if a spin button value wraps
3085 /// around to the opposite limit when the upper or lower limit
3086 /// of the range is exceeded.
3087 /// ## `wrap`
3088 /// a flag indicating if wrapping behavior is performed
3089 #[doc(alias = "gtk_spin_button_set_wrap")]
3090 #[doc(alias = "wrap")]
3091 fn set_wrap(&self, wrap: bool) {
3092 unsafe {
3093 ffi::gtk_spin_button_set_wrap(self.as_ref().to_glib_none().0, wrap.into_glib());
3094 }
3095 }
3096
3097 /// Increment or decrement a spin button’s value in a specified
3098 /// direction by a specified amount.
3099 /// ## `direction`
3100 /// a [`SpinType`][crate::SpinType] indicating the direction to spin
3101 /// ## `increment`
3102 /// step increment to apply in the specified direction
3103 #[doc(alias = "gtk_spin_button_spin")]
3104 fn spin(&self, direction: SpinType, increment: f64) {
3105 unsafe {
3106 ffi::gtk_spin_button_spin(
3107 self.as_ref().to_glib_none().0,
3108 direction.into_glib(),
3109 increment,
3110 );
3111 }
3112 }
3113
3114 /// Manually force an update of the spin button.
3115 #[doc(alias = "gtk_spin_button_update")]
3116 fn update(&self) {
3117 unsafe {
3118 ffi::gtk_spin_button_update(self.as_ref().to_glib_none().0);
3119 }
3120 }
3121
3122 #[doc(alias = "climb-rate")]
3123 fn climb_rate(&self) -> f64 {
3124 ObjectExt::property(self.as_ref(), "climb-rate")
3125 }
3126
3127 #[doc(alias = "climb-rate")]
3128 fn set_climb_rate(&self, climb_rate: f64) {
3129 ObjectExt::set_property(self.as_ref(), "climb-rate", climb_rate)
3130 }
3131
3132 #[doc(alias = "adjustment")]
3133 fn connect_adjustment_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
3134 unsafe extern "C" fn notify_adjustment_trampoline<
3135 P: IsA<SpinButton>,
3136 F: Fn(&P) + 'static,
3137 >(
3138 this: *mut ffi::GtkSpinButton,
3139 _param_spec: glib::ffi::gpointer,
3140 f: glib::ffi::gpointer,
3141 ) {
3142 unsafe {
3143 let f: &F = &*(f as *const F);
3144 f(SpinButton::from_glib_borrow(this).unsafe_cast_ref())
3145 }
3146 }
3147 unsafe {
3148 let f: Box_<F> = Box_::new(f);
3149 connect_raw(
3150 self.as_ptr() as *mut _,
3151 c"notify::adjustment".as_ptr(),
3152 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
3153 notify_adjustment_trampoline::<Self, F> as *const (),
3154 )),
3155 Box_::into_raw(f),
3156 )
3157 }
3158 }
3159
3160 #[doc(alias = "climb-rate")]
3161 fn connect_climb_rate_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
3162 unsafe extern "C" fn notify_climb_rate_trampoline<
3163 P: IsA<SpinButton>,
3164 F: Fn(&P) + 'static,
3165 >(
3166 this: *mut ffi::GtkSpinButton,
3167 _param_spec: glib::ffi::gpointer,
3168 f: glib::ffi::gpointer,
3169 ) {
3170 unsafe {
3171 let f: &F = &*(f as *const F);
3172 f(SpinButton::from_glib_borrow(this).unsafe_cast_ref())
3173 }
3174 }
3175 unsafe {
3176 let f: Box_<F> = Box_::new(f);
3177 connect_raw(
3178 self.as_ptr() as *mut _,
3179 c"notify::climb-rate".as_ptr(),
3180 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
3181 notify_climb_rate_trampoline::<Self, F> as *const (),
3182 )),
3183 Box_::into_raw(f),
3184 )
3185 }
3186 }
3187
3188 #[doc(alias = "digits")]
3189 fn connect_digits_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
3190 unsafe extern "C" fn notify_digits_trampoline<P: IsA<SpinButton>, F: Fn(&P) + 'static>(
3191 this: *mut ffi::GtkSpinButton,
3192 _param_spec: glib::ffi::gpointer,
3193 f: glib::ffi::gpointer,
3194 ) {
3195 unsafe {
3196 let f: &F = &*(f as *const F);
3197 f(SpinButton::from_glib_borrow(this).unsafe_cast_ref())
3198 }
3199 }
3200 unsafe {
3201 let f: Box_<F> = Box_::new(f);
3202 connect_raw(
3203 self.as_ptr() as *mut _,
3204 c"notify::digits".as_ptr(),
3205 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
3206 notify_digits_trampoline::<Self, F> as *const (),
3207 )),
3208 Box_::into_raw(f),
3209 )
3210 }
3211 }
3212
3213 #[doc(alias = "numeric")]
3214 fn connect_numeric_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
3215 unsafe extern "C" fn notify_numeric_trampoline<P: IsA<SpinButton>, F: Fn(&P) + 'static>(
3216 this: *mut ffi::GtkSpinButton,
3217 _param_spec: glib::ffi::gpointer,
3218 f: glib::ffi::gpointer,
3219 ) {
3220 unsafe {
3221 let f: &F = &*(f as *const F);
3222 f(SpinButton::from_glib_borrow(this).unsafe_cast_ref())
3223 }
3224 }
3225 unsafe {
3226 let f: Box_<F> = Box_::new(f);
3227 connect_raw(
3228 self.as_ptr() as *mut _,
3229 c"notify::numeric".as_ptr(),
3230 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
3231 notify_numeric_trampoline::<Self, F> as *const (),
3232 )),
3233 Box_::into_raw(f),
3234 )
3235 }
3236 }
3237
3238 #[doc(alias = "snap-to-ticks")]
3239 fn connect_snap_to_ticks_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
3240 unsafe extern "C" fn notify_snap_to_ticks_trampoline<
3241 P: IsA<SpinButton>,
3242 F: Fn(&P) + 'static,
3243 >(
3244 this: *mut ffi::GtkSpinButton,
3245 _param_spec: glib::ffi::gpointer,
3246 f: glib::ffi::gpointer,
3247 ) {
3248 unsafe {
3249 let f: &F = &*(f as *const F);
3250 f(SpinButton::from_glib_borrow(this).unsafe_cast_ref())
3251 }
3252 }
3253 unsafe {
3254 let f: Box_<F> = Box_::new(f);
3255 connect_raw(
3256 self.as_ptr() as *mut _,
3257 c"notify::snap-to-ticks".as_ptr(),
3258 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
3259 notify_snap_to_ticks_trampoline::<Self, F> as *const (),
3260 )),
3261 Box_::into_raw(f),
3262 )
3263 }
3264 }
3265
3266 #[doc(alias = "update-policy")]
3267 fn connect_update_policy_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
3268 unsafe extern "C" fn notify_update_policy_trampoline<
3269 P: IsA<SpinButton>,
3270 F: Fn(&P) + 'static,
3271 >(
3272 this: *mut ffi::GtkSpinButton,
3273 _param_spec: glib::ffi::gpointer,
3274 f: glib::ffi::gpointer,
3275 ) {
3276 unsafe {
3277 let f: &F = &*(f as *const F);
3278 f(SpinButton::from_glib_borrow(this).unsafe_cast_ref())
3279 }
3280 }
3281 unsafe {
3282 let f: Box_<F> = Box_::new(f);
3283 connect_raw(
3284 self.as_ptr() as *mut _,
3285 c"notify::update-policy".as_ptr(),
3286 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
3287 notify_update_policy_trampoline::<Self, F> as *const (),
3288 )),
3289 Box_::into_raw(f),
3290 )
3291 }
3292 }
3293
3294 #[doc(alias = "value")]
3295 fn connect_value_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
3296 unsafe extern "C" fn notify_value_trampoline<P: IsA<SpinButton>, F: Fn(&P) + 'static>(
3297 this: *mut ffi::GtkSpinButton,
3298 _param_spec: glib::ffi::gpointer,
3299 f: glib::ffi::gpointer,
3300 ) {
3301 unsafe {
3302 let f: &F = &*(f as *const F);
3303 f(SpinButton::from_glib_borrow(this).unsafe_cast_ref())
3304 }
3305 }
3306 unsafe {
3307 let f: Box_<F> = Box_::new(f);
3308 connect_raw(
3309 self.as_ptr() as *mut _,
3310 c"notify::value".as_ptr(),
3311 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
3312 notify_value_trampoline::<Self, F> as *const (),
3313 )),
3314 Box_::into_raw(f),
3315 )
3316 }
3317 }
3318
3319 #[doc(alias = "wrap")]
3320 fn connect_wrap_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
3321 unsafe extern "C" fn notify_wrap_trampoline<P: IsA<SpinButton>, F: Fn(&P) + 'static>(
3322 this: *mut ffi::GtkSpinButton,
3323 _param_spec: glib::ffi::gpointer,
3324 f: glib::ffi::gpointer,
3325 ) {
3326 unsafe {
3327 let f: &F = &*(f as *const F);
3328 f(SpinButton::from_glib_borrow(this).unsafe_cast_ref())
3329 }
3330 }
3331 unsafe {
3332 let f: Box_<F> = Box_::new(f);
3333 connect_raw(
3334 self.as_ptr() as *mut _,
3335 c"notify::wrap".as_ptr(),
3336 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
3337 notify_wrap_trampoline::<Self, F> as *const (),
3338 )),
3339 Box_::into_raw(f),
3340 )
3341 }
3342 }
3343}
3344
3345impl<O: IsA<SpinButton>> SpinButtonExt for O {}