gtk/auto/spin_button.rs
1// This file was generated by gir (https://github.com/gtk-rs/gir)
2// from gir-files (https://github.com/gtk-rs/gir-files)
3// DO NOT EDIT
4
5use crate::{
6 Adjustment, Align, Buildable, CellEditable, Container, Editable, Entry, EntryBuffer,
7 EntryCompletion, InputHints, InputPurpose, Orientable, Orientation, SpinButtonUpdatePolicy,
8 SpinType, Widget,
9};
10use glib::{
11 prelude::*,
12 signal::{connect_raw, SignalHandlerId},
13 translate::*,
14};
15use std::{boxed::Box as Box_, fmt, mem, mem::transmute};
16
17glib::wrapper! {
18 /// 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 | Writeable
147 ///
148 ///
149 /// #### `climb-rate`
150 /// Readable | Writeable
151 ///
152 ///
153 /// #### `digits`
154 /// Readable | Writeable
155 ///
156 ///
157 /// #### `numeric`
158 /// Readable | Writeable
159 ///
160 ///
161 /// #### `snap-to-ticks`
162 /// Readable | Writeable
163 ///
164 ///
165 /// #### `update-policy`
166 /// Readable | Writeable
167 ///
168 ///
169 /// #### `value`
170 /// Readable | Writeable
171 ///
172 ///
173 /// #### `wrap`
174 /// Readable | Writeable
175 /// <details><summary><h4>Entry</h4></summary>
176 ///
177 ///
178 /// #### `activates-default`
179 /// Readable | Writeable
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 | Writeable
191 ///
192 ///
193 /// #### `buffer`
194 /// Readable | Writeable | 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 | Writeable
205 ///
206 ///
207 /// #### `completion`
208 /// The auxiliary completion object to use with the entry.
209 ///
210 /// Readable | Writeable
211 ///
212 ///
213 /// #### `cursor-position`
214 /// Readable
215 ///
216 ///
217 /// #### `editable`
218 /// Readable | Writeable
219 ///
220 ///
221 /// #### `enable-emoji-completion`
222 /// Readable | Writeable
223 ///
224 ///
225 /// #### `has-frame`
226 /// Readable | Writeable
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 | Writeable
238 ///
239 ///
240 /// #### `inner-border`
241 /// Sets the text area's border between the text and the frame.
242 ///
243 /// Readable | Writeable
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 | Writeable
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 | Writeable
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 | Writeable
277 ///
278 ///
279 /// #### `invisible-char-set`
280 /// Whether the invisible char has been set for the [`Entry`][crate::Entry].
281 ///
282 /// Readable | Writeable
283 ///
284 ///
285 /// #### `max-length`
286 /// Readable | Writeable
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 | Writeable
295 ///
296 ///
297 /// #### `overwrite-mode`
298 /// If text is overwritten when typing in the [`Entry`][crate::Entry].
299 ///
300 /// Readable | Writeable
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 | Writeable
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 | Writeable
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 | Writeable
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 | Writeable
333 ///
334 ///
335 /// #### `primary-icon-name`
336 /// The icon name to use for the primary icon for the entry.
337 ///
338 /// Readable | Writeable
339 ///
340 ///
341 /// #### `primary-icon-pixbuf`
342 /// A pixbuf to use as the primary icon for the entry.
343 ///
344 /// Readable | Writeable
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 | Writeable
358 ///
359 ///
360 /// #### `primary-icon-stock`
361 /// The stock id to use for the primary icon for the entry.
362 ///
363 /// Readable | Writeable
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 | Writeable
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 | Writeable
387 ///
388 ///
389 /// #### `progress-fraction`
390 /// The current fraction of the task that's been completed.
391 ///
392 /// Readable | Writeable
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 | Writeable
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 | Writeable
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 | Writeable
422 ///
423 ///
424 /// #### `secondary-icon-name`
425 /// The icon name to use for the secondary icon for the entry.
426 ///
427 /// Readable | Writeable
428 ///
429 ///
430 /// #### `secondary-icon-pixbuf`
431 /// An pixbuf to use as the secondary icon for the entry.
432 ///
433 /// Readable | Writeable
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 | Writeable
447 ///
448 ///
449 /// #### `secondary-icon-stock`
450 /// The stock id to use for the secondary icon for the entry.
451 ///
452 /// Readable | Writeable
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 | Writeable
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 | Writeable
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 | Writeable
487 ///
488 ///
489 /// #### `show-emoji-icon`
490 /// Readable | Writeable
491 ///
492 ///
493 /// #### `tabs`
494 /// Readable | Writeable
495 ///
496 ///
497 /// #### `text`
498 /// Readable | Writeable
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 | Writeable
511 ///
512 ///
513 /// #### `visibility`
514 /// Readable | Writeable
515 ///
516 ///
517 /// #### `width-chars`
518 /// Readable | Writeable
519 ///
520 ///
521 /// #### `xalign`
522 /// The horizontal alignment, from 0 (left) to 1 (right).
523 /// Reversed for RTL layouts.
524 ///
525 /// Readable | Writeable
526 /// </details>
527 /// <details><summary><h4>Widget</h4></summary>
528 ///
529 ///
530 /// #### `app-paintable`
531 /// Readable | Writeable
532 ///
533 ///
534 /// #### `can-default`
535 /// Readable | Writeable
536 ///
537 ///
538 /// #### `can-focus`
539 /// Readable | Writeable
540 ///
541 ///
542 /// #### `composite-child`
543 /// Readable
544 ///
545 ///
546 /// #### `double-buffered`
547 /// Whether the widget is double buffered.
548 ///
549 /// Readable | Writeable
550 ///
551 ///
552 /// #### `events`
553 /// Readable | Writeable
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 | Writeable
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 | Writeable
571 ///
572 ///
573 /// #### `halign`
574 /// How to distribute horizontal space if widget gets extra space, see [`Align`][crate::Align]
575 ///
576 /// Readable | Writeable
577 ///
578 ///
579 /// #### `has-default`
580 /// Readable | Writeable
581 ///
582 ///
583 /// #### `has-focus`
584 /// Readable | Writeable
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 | Writeable
599 ///
600 ///
601 /// #### `height-request`
602 /// Readable | Writeable
603 ///
604 ///
605 /// #### `hexpand`
606 /// Whether to expand horizontally. See [`WidgetExt::set_hexpand()`][crate::prelude::WidgetExt::set_hexpand()].
607 ///
608 /// Readable | Writeable
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 | Writeable
615 ///
616 ///
617 /// #### `is-focus`
618 /// Readable | Writeable
619 ///
620 ///
621 /// #### `margin`
622 /// Sets all four sides' margin at once. If read, returns max
623 /// margin on any side.
624 ///
625 /// Readable | Writeable
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 | Writeable
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 | Writeable
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 | Writeable
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 | Writeable
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 | Writeable
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 | Writeable
688 ///
689 ///
690 /// #### `name`
691 /// Readable | Writeable
692 ///
693 ///
694 /// #### `no-show-all`
695 /// Readable | Writeable
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 | Writeable
705 ///
706 ///
707 /// #### `parent`
708 /// Readable | Writeable
709 ///
710 ///
711 /// #### `receives-default`
712 /// Readable | Writeable
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 | Writeable
724 ///
725 ///
726 /// #### `style`
727 /// The style of the widget, which contains information about how it will look (colors, etc).
728 ///
729 /// Readable | Writeable
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 | Writeable
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 | Writeable
762 ///
763 ///
764 /// #### `valign`
765 /// How to distribute vertical space if widget gets extra space, see [`Align`][crate::Align]
766 ///
767 /// Readable | Writeable
768 ///
769 ///
770 /// #### `vexpand`
771 /// Whether to expand vertically. See [`WidgetExt::set_vexpand()`][crate::prelude::WidgetExt::set_vexpand()].
772 ///
773 /// Readable | Writeable
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 | Writeable
780 ///
781 ///
782 /// #### `visible`
783 /// Readable | Writeable
784 ///
785 ///
786 /// #### `width-request`
787 /// Readable | Writeable
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 | Writeable
802 /// </details>
803 /// <details><summary><h4>Orientable</h4></summary>
804 ///
805 ///
806 /// #### `orientation`
807 /// The orientation of the orientable.
808 ///
809 /// Readable | Writeable
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-overwrite`
1042 /// The ::toggle-overwrite signal is a
1043 /// [keybinding signal][GtkBindingSignal]
1044 /// which gets emitted to toggle the overwrite mode of the entry.
1045 ///
1046 /// The default bindings for this signal is Insert.
1047 ///
1048 /// Action
1049 /// </details>
1050 /// <details><summary><h4>Widget</h4></summary>
1051 ///
1052 ///
1053 /// #### `accel-closures-changed`
1054 ///
1055 ///
1056 ///
1057 /// #### `button-press-event`
1058 /// The ::button-press-event signal will be emitted when a button
1059 /// (typically from a mouse) is pressed.
1060 ///
1061 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the
1062 /// widget needs to enable the [`gdk::EventMask::BUTTON_PRESS_MASK`][crate::gdk::EventMask::BUTTON_PRESS_MASK] mask.
1063 ///
1064 /// This signal will be sent to the grab widget if there is one.
1065 ///
1066 ///
1067 ///
1068 ///
1069 /// #### `button-release-event`
1070 /// The ::button-release-event signal will be emitted when a button
1071 /// (typically from a mouse) is released.
1072 ///
1073 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the
1074 /// widget needs to enable the [`gdk::EventMask::BUTTON_RELEASE_MASK`][crate::gdk::EventMask::BUTTON_RELEASE_MASK] mask.
1075 ///
1076 /// This signal will be sent to the grab widget if there is one.
1077 ///
1078 ///
1079 ///
1080 ///
1081 /// #### `can-activate-accel`
1082 /// Determines whether an accelerator that activates the signal
1083 /// identified by `signal_id` can currently be activated.
1084 /// This signal is present to allow applications and derived
1085 /// widgets to override the default [`Widget`][crate::Widget] handling
1086 /// for determining whether an accelerator can be activated.
1087 ///
1088 ///
1089 ///
1090 ///
1091 /// #### `child-notify`
1092 /// The ::child-notify signal is emitted for each
1093 /// [child property][child-properties] that has
1094 /// changed on an object. The signal's detail holds the property name.
1095 ///
1096 /// Detailed
1097 ///
1098 ///
1099 /// #### `composited-changed`
1100 /// The ::composited-changed signal is emitted when the composited
1101 /// status of `widgets` screen changes.
1102 /// See [`Screen::is_composited()`][crate::gdk::Screen::is_composited()].
1103 ///
1104 /// Action
1105 ///
1106 ///
1107 /// #### `configure-event`
1108 /// The ::configure-event signal will be emitted when the size, position or
1109 /// stacking of the `widget`'s window has changed.
1110 ///
1111 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
1112 /// to enable the [`gdk::EventMask::STRUCTURE_MASK`][crate::gdk::EventMask::STRUCTURE_MASK] mask. GDK will enable this mask
1113 /// automatically for all new windows.
1114 ///
1115 ///
1116 ///
1117 ///
1118 /// #### `damage-event`
1119 /// Emitted when a redirected window belonging to `widget` gets drawn into.
1120 /// The region/area members of the event shows what area of the redirected
1121 /// drawable was drawn into.
1122 ///
1123 ///
1124 ///
1125 ///
1126 /// #### `delete-event`
1127 /// The ::delete-event signal is emitted if a user requests that
1128 /// a toplevel window is closed. The default handler for this signal
1129 /// destroys the window. Connecting [`WidgetExtManual::hide_on_delete()`][crate::prelude::WidgetExtManual::hide_on_delete()] to
1130 /// this signal will cause the window to be hidden instead, so that
1131 /// it can later be shown again without reconstructing it.
1132 ///
1133 ///
1134 ///
1135 ///
1136 /// #### `destroy`
1137 /// Signals that all holders of a reference to the widget should release
1138 /// the reference that they hold. May result in finalization of the widget
1139 /// if all references are released.
1140 ///
1141 /// This signal is not suitable for saving widget state.
1142 ///
1143 ///
1144 ///
1145 ///
1146 /// #### `destroy-event`
1147 /// The ::destroy-event signal is emitted when a [`gdk::Window`][crate::gdk::Window] is destroyed.
1148 /// You rarely get this signal, because most widgets disconnect themselves
1149 /// from their window before they destroy it, so no widget owns the
1150 /// window at destroy time.
1151 ///
1152 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
1153 /// to enable the [`gdk::EventMask::STRUCTURE_MASK`][crate::gdk::EventMask::STRUCTURE_MASK] mask. GDK will enable this mask
1154 /// automatically for all new windows.
1155 ///
1156 ///
1157 ///
1158 ///
1159 /// #### `direction-changed`
1160 /// The ::direction-changed signal is emitted when the text direction
1161 /// of a widget changes.
1162 ///
1163 ///
1164 ///
1165 ///
1166 /// #### `drag-begin`
1167 /// The ::drag-begin signal is emitted on the drag source when a drag is
1168 /// started. A typical reason to connect to this signal is to set up a
1169 /// custom drag icon with e.g. [`WidgetExt::drag_source_set_icon_pixbuf()`][crate::prelude::WidgetExt::drag_source_set_icon_pixbuf()].
1170 ///
1171 /// Note that some widgets set up a drag icon in the default handler of
1172 /// this signal, so you may have to use `g_signal_connect_after()` to
1173 /// override what the default handler did.
1174 ///
1175 ///
1176 ///
1177 ///
1178 /// #### `drag-data-delete`
1179 /// The ::drag-data-delete signal is emitted on the drag source when a drag
1180 /// with the action [`gdk::DragAction::MOVE`][crate::gdk::DragAction::MOVE] is successfully completed. The signal
1181 /// handler is responsible for deleting the data that has been dropped. What
1182 /// "delete" means depends on the context of the drag operation.
1183 ///
1184 ///
1185 ///
1186 ///
1187 /// #### `drag-data-get`
1188 /// The ::drag-data-get signal is emitted on the drag source when the drop
1189 /// site requests the data which is dragged. It is the responsibility of
1190 /// the signal handler to fill `data` with the data in the format which
1191 /// is indicated by `info`. See [`SelectionData::set()`][crate::SelectionData::set()] and
1192 /// [`SelectionData::set_text()`][crate::SelectionData::set_text()].
1193 ///
1194 ///
1195 ///
1196 ///
1197 /// #### `drag-data-received`
1198 /// The ::drag-data-received signal is emitted on the drop site when the
1199 /// dragged data has been received. If the data was received in order to
1200 /// determine whether the drop will be accepted, the handler is expected
1201 /// to call `gdk_drag_status()` and not finish the drag.
1202 /// If the data was received in response to a [`drag-drop`][struct@crate::Widget#drag-drop] signal
1203 /// (and this is the last target to be received), the handler for this
1204 /// signal is expected to process the received data and then call
1205 /// `gtk_drag_finish()`, setting the `success` parameter depending on
1206 /// whether the data was processed successfully.
1207 ///
1208 /// Applications must create some means to determine why the signal was emitted
1209 /// and therefore whether to call `gdk_drag_status()` or `gtk_drag_finish()`.
1210 ///
1211 /// The handler may inspect the selected action with
1212 /// [`DragContext::selected_action()`][crate::gdk::DragContext::selected_action()] before calling
1213 /// `gtk_drag_finish()`, e.g. to implement [`gdk::DragAction::ASK`][crate::gdk::DragAction::ASK] as
1214 /// shown in the following example:
1215 ///
1216 ///
1217 /// **⚠️ The following code is in C ⚠️**
1218 ///
1219 /// ```C
1220 /// void
1221 /// drag_data_received (GtkWidget *widget,
1222 /// GdkDragContext *context,
1223 /// gint x,
1224 /// gint y,
1225 /// GtkSelectionData *data,
1226 /// guint info,
1227 /// guint time)
1228 /// {
1229 /// if ((data->length >= 0) && (data->format == 8))
1230 /// {
1231 /// GdkDragAction action;
1232 ///
1233 /// // handle data here
1234 ///
1235 /// action = gdk_drag_context_get_selected_action (context);
1236 /// if (action == GDK_ACTION_ASK)
1237 /// {
1238 /// GtkWidget *dialog;
1239 /// gint response;
1240 ///
1241 /// dialog = gtk_message_dialog_new (NULL,
1242 /// GTK_DIALOG_MODAL |
1243 /// GTK_DIALOG_DESTROY_WITH_PARENT,
1244 /// GTK_MESSAGE_INFO,
1245 /// GTK_BUTTONS_YES_NO,
1246 /// "Move the data ?\n");
1247 /// response = gtk_dialog_run (GTK_DIALOG (dialog));
1248 /// gtk_widget_destroy (dialog);
1249 ///
1250 /// if (response == GTK_RESPONSE_YES)
1251 /// action = GDK_ACTION_MOVE;
1252 /// else
1253 /// action = GDK_ACTION_COPY;
1254 /// }
1255 ///
1256 /// gtk_drag_finish (context, TRUE, action == GDK_ACTION_MOVE, time);
1257 /// }
1258 /// else
1259 /// gtk_drag_finish (context, FALSE, FALSE, time);
1260 /// }
1261 /// ```
1262 ///
1263 ///
1264 ///
1265 ///
1266 /// #### `drag-drop`
1267 /// The ::drag-drop signal is emitted on the drop site when the user drops
1268 /// the data onto the widget. The signal handler must determine whether
1269 /// the cursor position is in a drop zone or not. If it is not in a drop
1270 /// zone, it returns [`false`] and no further processing is necessary.
1271 /// Otherwise, the handler returns [`true`]. In this case, the handler must
1272 /// ensure that `gtk_drag_finish()` is called to let the source know that
1273 /// the drop is done. The call to `gtk_drag_finish()` can be done either
1274 /// directly or in a [`drag-data-received`][struct@crate::Widget#drag-data-received] handler which gets
1275 /// triggered by calling [`WidgetExt::drag_get_data()`][crate::prelude::WidgetExt::drag_get_data()] to receive the data for one
1276 /// or more of the supported targets.
1277 ///
1278 ///
1279 ///
1280 ///
1281 /// #### `drag-end`
1282 /// The ::drag-end signal is emitted on the drag source when a drag is
1283 /// finished. A typical reason to connect to this signal is to undo
1284 /// things done in [`drag-begin`][struct@crate::Widget#drag-begin].
1285 ///
1286 ///
1287 ///
1288 ///
1289 /// #### `drag-failed`
1290 /// The ::drag-failed signal is emitted on the drag source when a drag has
1291 /// failed. The signal handler may hook custom code to handle a failed DnD
1292 /// operation based on the type of error, it returns [`true`] is the failure has
1293 /// been already handled (not showing the default "drag operation failed"
1294 /// animation), otherwise it returns [`false`].
1295 ///
1296 ///
1297 ///
1298 ///
1299 /// #### `drag-leave`
1300 /// The ::drag-leave signal is emitted on the drop site when the cursor
1301 /// leaves the widget. A typical reason to connect to this signal is to
1302 /// undo things done in [`drag-motion`][struct@crate::Widget#drag-motion], e.g. undo highlighting
1303 /// with [`WidgetExt::drag_unhighlight()`][crate::prelude::WidgetExt::drag_unhighlight()].
1304 ///
1305 ///
1306 /// Likewise, the [`drag-leave`][struct@crate::Widget#drag-leave] signal is also emitted before the
1307 /// ::drag-drop signal, for instance to allow cleaning up of a preview item
1308 /// created in the [`drag-motion`][struct@crate::Widget#drag-motion] signal handler.
1309 ///
1310 ///
1311 ///
1312 ///
1313 /// #### `drag-motion`
1314 /// The ::drag-motion signal is emitted on the drop site when the user
1315 /// moves the cursor over the widget during a drag. The signal handler
1316 /// must determine whether the cursor position is in a drop zone or not.
1317 /// If it is not in a drop zone, it returns [`false`] and no further processing
1318 /// is necessary. Otherwise, the handler returns [`true`]. In this case, the
1319 /// handler is responsible for providing the necessary information for
1320 /// displaying feedback to the user, by calling `gdk_drag_status()`.
1321 ///
1322 /// If the decision whether the drop will be accepted or rejected can't be
1323 /// made based solely on the cursor position and the type of the data, the
1324 /// handler may inspect the dragged data by calling [`WidgetExt::drag_get_data()`][crate::prelude::WidgetExt::drag_get_data()] and
1325 /// defer the `gdk_drag_status()` call to the [`drag-data-received`][struct@crate::Widget#drag-data-received]
1326 /// handler. Note that you must pass [`DestDefaults::DROP`][crate::DestDefaults::DROP],
1327 /// [`DestDefaults::MOTION`][crate::DestDefaults::MOTION] or [`DestDefaults::ALL`][crate::DestDefaults::ALL] to [`WidgetExtManual::drag_dest_set()`][crate::prelude::WidgetExtManual::drag_dest_set()]
1328 /// when using the drag-motion signal that way.
1329 ///
1330 /// Also note that there is no drag-enter signal. The drag receiver has to
1331 /// keep track of whether he has received any drag-motion signals since the
1332 /// last [`drag-leave`][struct@crate::Widget#drag-leave] and if not, treat the drag-motion signal as
1333 /// an "enter" signal. Upon an "enter", the handler will typically highlight
1334 /// the drop site with [`WidgetExt::drag_highlight()`][crate::prelude::WidgetExt::drag_highlight()].
1335 ///
1336 ///
1337 /// **⚠️ The following code is in C ⚠️**
1338 ///
1339 /// ```C
1340 /// static void
1341 /// drag_motion (GtkWidget *widget,
1342 /// GdkDragContext *context,
1343 /// gint x,
1344 /// gint y,
1345 /// guint time)
1346 /// {
1347 /// GdkAtom target;
1348 ///
1349 /// PrivateData *private_data = GET_PRIVATE_DATA (widget);
1350 ///
1351 /// if (!private_data->drag_highlight)
1352 /// {
1353 /// private_data->drag_highlight = 1;
1354 /// gtk_drag_highlight (widget);
1355 /// }
1356 ///
1357 /// target = gtk_drag_dest_find_target (widget, context, NULL);
1358 /// if (target == GDK_NONE)
1359 /// gdk_drag_status (context, 0, time);
1360 /// else
1361 /// {
1362 /// private_data->pending_status
1363 /// = gdk_drag_context_get_suggested_action (context);
1364 /// gtk_drag_get_data (widget, context, target, time);
1365 /// }
1366 ///
1367 /// return TRUE;
1368 /// }
1369 ///
1370 /// static void
1371 /// drag_data_received (GtkWidget *widget,
1372 /// GdkDragContext *context,
1373 /// gint x,
1374 /// gint y,
1375 /// GtkSelectionData *selection_data,
1376 /// guint info,
1377 /// guint time)
1378 /// {
1379 /// PrivateData *private_data = GET_PRIVATE_DATA (widget);
1380 ///
1381 /// if (private_data->suggested_action)
1382 /// {
1383 /// private_data->suggested_action = 0;
1384 ///
1385 /// // We are getting this data due to a request in drag_motion,
1386 /// // rather than due to a request in drag_drop, so we are just
1387 /// // supposed to call gdk_drag_status(), not actually paste in
1388 /// // the data.
1389 ///
1390 /// str = gtk_selection_data_get_text (selection_data);
1391 /// if (!data_is_acceptable (str))
1392 /// gdk_drag_status (context, 0, time);
1393 /// else
1394 /// gdk_drag_status (context,
1395 /// private_data->suggested_action,
1396 /// time);
1397 /// }
1398 /// else
1399 /// {
1400 /// // accept the drop
1401 /// }
1402 /// }
1403 /// ```
1404 ///
1405 ///
1406 ///
1407 ///
1408 /// #### `draw`
1409 /// This signal is emitted when a widget is supposed to render itself.
1410 /// The `widget`'s top left corner must be painted at the origin of
1411 /// the passed in context and be sized to the values returned by
1412 /// [`WidgetExt::allocated_width()`][crate::prelude::WidgetExt::allocated_width()] and
1413 /// [`WidgetExt::allocated_height()`][crate::prelude::WidgetExt::allocated_height()].
1414 ///
1415 /// Signal handlers connected to this signal can modify the cairo
1416 /// context passed as `cr` in any way they like and don't need to
1417 /// restore it. The signal emission takes care of calling `cairo_save()`
1418 /// before and `cairo_restore()` after invoking the handler.
1419 ///
1420 /// The signal handler will get a `cr` with a clip region already set to the
1421 /// widget's dirty region, i.e. to the area that needs repainting. Complicated
1422 /// widgets that want to avoid redrawing themselves completely can get the full
1423 /// extents of the clip region with `gdk_cairo_get_clip_rectangle()`, or they can
1424 /// get a finer-grained representation of the dirty region with
1425 /// `cairo_copy_clip_rectangle_list()`.
1426 ///
1427 ///
1428 ///
1429 ///
1430 /// #### `enter-notify-event`
1431 /// The ::enter-notify-event will be emitted when the pointer enters
1432 /// the `widget`'s window.
1433 ///
1434 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
1435 /// to enable the [`gdk::EventMask::ENTER_NOTIFY_MASK`][crate::gdk::EventMask::ENTER_NOTIFY_MASK] mask.
1436 ///
1437 /// This signal will be sent to the grab widget if there is one.
1438 ///
1439 ///
1440 ///
1441 ///
1442 /// #### `event`
1443 /// The GTK+ main loop will emit three signals for each GDK event delivered
1444 /// to a widget: one generic ::event signal, another, more specific,
1445 /// signal that matches the type of event delivered (e.g.
1446 /// [`key-press-event`][struct@crate::Widget#key-press-event]) and finally a generic
1447 /// [`event-after`][struct@crate::Widget#event-after] signal.
1448 ///
1449 ///
1450 ///
1451 ///
1452 /// #### `event-after`
1453 /// After the emission of the [`event`][struct@crate::Widget#event] signal and (optionally)
1454 /// the second more specific signal, ::event-after will be emitted
1455 /// regardless of the previous two signals handlers return values.
1456 ///
1457 ///
1458 ///
1459 ///
1460 /// #### `focus`
1461 ///
1462 ///
1463 ///
1464 /// #### `focus-in-event`
1465 /// The ::focus-in-event signal will be emitted when the keyboard focus
1466 /// enters the `widget`'s window.
1467 ///
1468 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
1469 /// to enable the [`gdk::EventMask::FOCUS_CHANGE_MASK`][crate::gdk::EventMask::FOCUS_CHANGE_MASK] mask.
1470 ///
1471 ///
1472 ///
1473 ///
1474 /// #### `focus-out-event`
1475 /// The ::focus-out-event signal will be emitted when the keyboard focus
1476 /// leaves the `widget`'s window.
1477 ///
1478 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
1479 /// to enable the [`gdk::EventMask::FOCUS_CHANGE_MASK`][crate::gdk::EventMask::FOCUS_CHANGE_MASK] mask.
1480 ///
1481 ///
1482 ///
1483 ///
1484 /// #### `grab-broken-event`
1485 /// Emitted when a pointer or keyboard grab on a window belonging
1486 /// to `widget` gets broken.
1487 ///
1488 /// On X11, this happens when the grab window becomes unviewable
1489 /// (i.e. it or one of its ancestors is unmapped), or if the same
1490 /// application grabs the pointer or keyboard again.
1491 ///
1492 ///
1493 ///
1494 ///
1495 /// #### `grab-focus`
1496 /// Action
1497 ///
1498 ///
1499 /// #### `grab-notify`
1500 /// The ::grab-notify signal is emitted when a widget becomes
1501 /// shadowed by a GTK+ grab (not a pointer or keyboard grab) on
1502 /// another widget, or when it becomes unshadowed due to a grab
1503 /// being removed.
1504 ///
1505 /// A widget is shadowed by a [`WidgetExt::grab_add()`][crate::prelude::WidgetExt::grab_add()] when the topmost
1506 /// grab widget in the grab stack of its window group is not
1507 /// its ancestor.
1508 ///
1509 ///
1510 ///
1511 ///
1512 /// #### `hide`
1513 /// The ::hide signal is emitted when `widget` is hidden, for example with
1514 /// [`WidgetExt::hide()`][crate::prelude::WidgetExt::hide()].
1515 ///
1516 ///
1517 ///
1518 ///
1519 /// #### `hierarchy-changed`
1520 /// The ::hierarchy-changed signal is emitted when the
1521 /// anchored state of a widget changes. A widget is
1522 /// “anchored” when its toplevel
1523 /// ancestor is a [`Window`][crate::Window]. This signal is emitted when
1524 /// a widget changes from un-anchored to anchored or vice-versa.
1525 ///
1526 ///
1527 ///
1528 ///
1529 /// #### `key-press-event`
1530 /// The ::key-press-event signal is emitted when a key is pressed. The signal
1531 /// emission will reoccur at the key-repeat rate when the key is kept pressed.
1532 ///
1533 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
1534 /// to enable the [`gdk::EventMask::KEY_PRESS_MASK`][crate::gdk::EventMask::KEY_PRESS_MASK] mask.
1535 ///
1536 /// This signal will be sent to the grab widget if there is one.
1537 ///
1538 ///
1539 ///
1540 ///
1541 /// #### `key-release-event`
1542 /// The ::key-release-event signal is emitted when a key is released.
1543 ///
1544 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
1545 /// to enable the [`gdk::EventMask::KEY_RELEASE_MASK`][crate::gdk::EventMask::KEY_RELEASE_MASK] mask.
1546 ///
1547 /// This signal will be sent to the grab widget if there is one.
1548 ///
1549 ///
1550 ///
1551 ///
1552 /// #### `keynav-failed`
1553 /// Gets emitted if keyboard navigation fails.
1554 /// See [`WidgetExt::keynav_failed()`][crate::prelude::WidgetExt::keynav_failed()] for details.
1555 ///
1556 ///
1557 ///
1558 ///
1559 /// #### `leave-notify-event`
1560 /// The ::leave-notify-event will be emitted when the pointer leaves
1561 /// the `widget`'s window.
1562 ///
1563 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
1564 /// to enable the [`gdk::EventMask::LEAVE_NOTIFY_MASK`][crate::gdk::EventMask::LEAVE_NOTIFY_MASK] mask.
1565 ///
1566 /// This signal will be sent to the grab widget if there is one.
1567 ///
1568 ///
1569 ///
1570 ///
1571 /// #### `map`
1572 /// The ::map signal is emitted when `widget` is going to be mapped, that is
1573 /// when the widget is visible (which is controlled with
1574 /// [`WidgetExt::set_visible()`][crate::prelude::WidgetExt::set_visible()]) and all its parents up to the toplevel widget
1575 /// are also visible. Once the map has occurred, [`map-event`][struct@crate::Widget#map-event] will
1576 /// be emitted.
1577 ///
1578 /// The ::map signal can be used to determine whether a widget will be drawn,
1579 /// for instance it can resume an animation that was stopped during the
1580 /// emission of [`unmap`][struct@crate::Widget#unmap].
1581 ///
1582 ///
1583 ///
1584 ///
1585 /// #### `map-event`
1586 /// The ::map-event signal will be emitted when the `widget`'s window is
1587 /// mapped. A window is mapped when it becomes visible on the screen.
1588 ///
1589 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
1590 /// to enable the [`gdk::EventMask::STRUCTURE_MASK`][crate::gdk::EventMask::STRUCTURE_MASK] mask. GDK will enable this mask
1591 /// automatically for all new windows.
1592 ///
1593 ///
1594 ///
1595 ///
1596 /// #### `mnemonic-activate`
1597 /// The default handler for this signal activates `widget` if `group_cycling`
1598 /// is [`false`], or just makes `widget` grab focus if `group_cycling` is [`true`].
1599 ///
1600 ///
1601 ///
1602 ///
1603 /// #### `motion-notify-event`
1604 /// The ::motion-notify-event signal is emitted when the pointer moves
1605 /// over the widget's [`gdk::Window`][crate::gdk::Window].
1606 ///
1607 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget
1608 /// needs to enable the [`gdk::EventMask::POINTER_MOTION_MASK`][crate::gdk::EventMask::POINTER_MOTION_MASK] mask.
1609 ///
1610 /// This signal will be sent to the grab widget if there is one.
1611 ///
1612 ///
1613 ///
1614 ///
1615 /// #### `move-focus`
1616 /// Action
1617 ///
1618 ///
1619 /// #### `parent-set`
1620 /// The ::parent-set signal is emitted when a new parent
1621 /// has been set on a widget.
1622 ///
1623 ///
1624 ///
1625 ///
1626 /// #### `popup-menu`
1627 /// This signal gets emitted whenever a widget should pop up a context
1628 /// menu. This usually happens through the standard key binding mechanism;
1629 /// by pressing a certain key while a widget is focused, the user can cause
1630 /// the widget to pop up a menu. For example, the [`Entry`][crate::Entry] widget creates
1631 /// a menu with clipboard commands. See the
1632 /// [Popup Menu Migration Checklist][checklist-popup-menu]
1633 /// for an example of how to use this signal.
1634 ///
1635 /// Action
1636 ///
1637 ///
1638 /// #### `property-notify-event`
1639 /// The ::property-notify-event signal will be emitted when a property on
1640 /// the `widget`'s window has been changed or deleted.
1641 ///
1642 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
1643 /// to enable the [`gdk::EventMask::PROPERTY_CHANGE_MASK`][crate::gdk::EventMask::PROPERTY_CHANGE_MASK] mask.
1644 ///
1645 ///
1646 ///
1647 ///
1648 /// #### `proximity-in-event`
1649 /// To receive this signal the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
1650 /// to enable the [`gdk::EventMask::PROXIMITY_IN_MASK`][crate::gdk::EventMask::PROXIMITY_IN_MASK] mask.
1651 ///
1652 /// This signal will be sent to the grab widget if there is one.
1653 ///
1654 ///
1655 ///
1656 ///
1657 /// #### `proximity-out-event`
1658 /// To receive this signal the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
1659 /// to enable the [`gdk::EventMask::PROXIMITY_OUT_MASK`][crate::gdk::EventMask::PROXIMITY_OUT_MASK] mask.
1660 ///
1661 /// This signal will be sent to the grab widget if there is one.
1662 ///
1663 ///
1664 ///
1665 ///
1666 /// #### `query-tooltip`
1667 /// Emitted when [`has-tooltip`][struct@crate::Widget#has-tooltip] is [`true`] and the hover timeout
1668 /// has expired with the cursor hovering "above" `widget`; or emitted when `widget` got
1669 /// focus in keyboard mode.
1670 ///
1671 /// Using the given coordinates, the signal handler should determine
1672 /// whether a tooltip should be shown for `widget`. If this is the case
1673 /// [`true`] should be returned, [`false`] otherwise. Note that if
1674 /// `keyboard_mode` is [`true`], the values of `x` and `y` are undefined and
1675 /// should not be used.
1676 ///
1677 /// The signal handler is free to manipulate `tooltip` with the therefore
1678 /// destined function calls.
1679 ///
1680 ///
1681 ///
1682 ///
1683 /// #### `realize`
1684 /// The ::realize signal is emitted when `widget` is associated with a
1685 /// [`gdk::Window`][crate::gdk::Window], which means that [`WidgetExt::realize()`][crate::prelude::WidgetExt::realize()] has been called or the
1686 /// widget has been mapped (that is, it is going to be drawn).
1687 ///
1688 ///
1689 ///
1690 ///
1691 /// #### `screen-changed`
1692 /// The ::screen-changed signal gets emitted when the
1693 /// screen of a widget has changed.
1694 ///
1695 ///
1696 ///
1697 ///
1698 /// #### `scroll-event`
1699 /// The ::scroll-event signal is emitted when a button in the 4 to 7
1700 /// range is pressed. Wheel mice are usually configured to generate
1701 /// button press events for buttons 4 and 5 when the wheel is turned.
1702 ///
1703 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
1704 /// to enable the [`gdk::EventMask::SCROLL_MASK`][crate::gdk::EventMask::SCROLL_MASK] mask.
1705 ///
1706 /// This signal will be sent to the grab widget if there is one.
1707 ///
1708 ///
1709 ///
1710 ///
1711 /// #### `selection-clear-event`
1712 /// The ::selection-clear-event signal will be emitted when the
1713 /// the `widget`'s window has lost ownership of a selection.
1714 ///
1715 ///
1716 ///
1717 ///
1718 /// #### `selection-get`
1719 ///
1720 ///
1721 ///
1722 /// #### `selection-notify-event`
1723 ///
1724 ///
1725 ///
1726 /// #### `selection-received`
1727 ///
1728 ///
1729 ///
1730 /// #### `selection-request-event`
1731 /// The ::selection-request-event signal will be emitted when
1732 /// another client requests ownership of the selection owned by
1733 /// the `widget`'s window.
1734 ///
1735 ///
1736 ///
1737 ///
1738 /// #### `show`
1739 /// The ::show signal is emitted when `widget` is shown, for example with
1740 /// [`WidgetExt::show()`][crate::prelude::WidgetExt::show()].
1741 ///
1742 ///
1743 ///
1744 ///
1745 /// #### `show-help`
1746 /// Action
1747 ///
1748 ///
1749 /// #### `size-allocate`
1750 ///
1751 ///
1752 ///
1753 /// #### `state-changed`
1754 /// The ::state-changed signal is emitted when the widget state changes.
1755 /// See `gtk_widget_get_state()`.
1756 ///
1757 ///
1758 ///
1759 ///
1760 /// #### `state-flags-changed`
1761 /// The ::state-flags-changed signal is emitted when the widget state
1762 /// changes, see [`WidgetExt::state_flags()`][crate::prelude::WidgetExt::state_flags()].
1763 ///
1764 ///
1765 ///
1766 ///
1767 /// #### `style-set`
1768 /// The ::style-set signal is emitted when a new style has been set
1769 /// on a widget. Note that style-modifying functions like
1770 /// `gtk_widget_modify_base()` also cause this signal to be emitted.
1771 ///
1772 /// Note that this signal is emitted for changes to the deprecated
1773 /// `GtkStyle`. To track changes to the [`StyleContext`][crate::StyleContext] associated
1774 /// with a widget, use the [`style-updated`][struct@crate::Widget#style-updated] signal.
1775 ///
1776 ///
1777 ///
1778 ///
1779 /// #### `style-updated`
1780 /// The ::style-updated signal is a convenience signal that is emitted when the
1781 /// [`changed`][struct@crate::StyleContext#changed] signal is emitted on the `widget`'s associated
1782 /// [`StyleContext`][crate::StyleContext] as returned by [`WidgetExt::style_context()`][crate::prelude::WidgetExt::style_context()].
1783 ///
1784 /// Note that style-modifying functions like `gtk_widget_override_color()` also
1785 /// cause this signal to be emitted.
1786 ///
1787 ///
1788 ///
1789 ///
1790 /// #### `touch-event`
1791 ///
1792 ///
1793 ///
1794 /// #### `unmap`
1795 /// The ::unmap signal is emitted when `widget` is going to be unmapped, which
1796 /// means that either it or any of its parents up to the toplevel widget have
1797 /// been set as hidden.
1798 ///
1799 /// As ::unmap indicates that a widget will not be shown any longer, it can be
1800 /// used to, for example, stop an animation on the widget.
1801 ///
1802 ///
1803 ///
1804 ///
1805 /// #### `unmap-event`
1806 /// The ::unmap-event signal will be emitted when the `widget`'s window is
1807 /// unmapped. A window is unmapped when it becomes invisible on the screen.
1808 ///
1809 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
1810 /// to enable the [`gdk::EventMask::STRUCTURE_MASK`][crate::gdk::EventMask::STRUCTURE_MASK] mask. GDK will enable this mask
1811 /// automatically for all new windows.
1812 ///
1813 ///
1814 ///
1815 ///
1816 /// #### `unrealize`
1817 /// The ::unrealize signal is emitted when the [`gdk::Window`][crate::gdk::Window] associated with
1818 /// `widget` is destroyed, which means that [`WidgetExt::unrealize()`][crate::prelude::WidgetExt::unrealize()] has been
1819 /// called or the widget has been unmapped (that is, it is going to be
1820 /// hidden).
1821 ///
1822 ///
1823 ///
1824 ///
1825 /// #### `visibility-notify-event`
1826 /// The ::visibility-notify-event will be emitted when the `widget`'s
1827 /// window is obscured or unobscured.
1828 ///
1829 /// To receive this signal the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
1830 /// to enable the [`gdk::EventMask::VISIBILITY_NOTIFY_MASK`][crate::gdk::EventMask::VISIBILITY_NOTIFY_MASK] mask.
1831 ///
1832 ///
1833 ///
1834 ///
1835 /// #### `window-state-event`
1836 /// The ::window-state-event will be emitted when the state of the
1837 /// toplevel window associated to the `widget` changes.
1838 ///
1839 /// To receive this signal the [`gdk::Window`][crate::gdk::Window] associated to the widget
1840 /// needs to enable the [`gdk::EventMask::STRUCTURE_MASK`][crate::gdk::EventMask::STRUCTURE_MASK] mask. GDK will enable
1841 /// this mask automatically for all new windows.
1842 ///
1843 ///
1844 /// </details>
1845 /// <details><summary><h4>CellEditable</h4></summary>
1846 ///
1847 ///
1848 /// #### `editing-done`
1849 /// This signal is a sign for the cell renderer to update its
1850 /// value from the `cell_editable`.
1851 ///
1852 /// Implementations of [`CellEditable`][crate::CellEditable] are responsible for
1853 /// emitting this signal when they are done editing, e.g.
1854 /// [`Entry`][crate::Entry] emits this signal when the user presses Enter. Typical things to
1855 /// do in a handler for ::editing-done are to capture the edited value,
1856 /// disconnect the `cell_editable` from signals on the [`CellRenderer`][crate::CellRenderer], etc.
1857 ///
1858 /// [`CellEditableExt::editing_done()`][crate::prelude::CellEditableExt::editing_done()] is a convenience method
1859 /// for emitting [`editing-done`][struct@crate::CellEditable#editing-done].
1860 ///
1861 ///
1862 ///
1863 ///
1864 /// #### `remove-widget`
1865 /// This signal is meant to indicate that the cell is finished
1866 /// editing, and the `cell_editable` widget is being removed and may
1867 /// subsequently be destroyed.
1868 ///
1869 /// Implementations of [`CellEditable`][crate::CellEditable] are responsible for
1870 /// emitting this signal when they are done editing. It must
1871 /// be emitted after the [`editing-done`][struct@crate::CellEditable#editing-done] signal,
1872 /// to give the cell renderer a chance to update the cell's value
1873 /// before the widget is removed.
1874 ///
1875 /// [`CellEditableExt::remove_widget()`][crate::prelude::CellEditableExt::remove_widget()] is a convenience method
1876 /// for emitting [`remove-widget`][struct@crate::CellEditable#remove-widget].
1877 ///
1878 ///
1879 /// </details>
1880 /// <details><summary><h4>Editable</h4></summary>
1881 ///
1882 ///
1883 /// #### `changed`
1884 /// The ::changed signal is emitted at the end of a single
1885 /// user-visible operation on the contents of the [`Editable`][crate::Editable].
1886 ///
1887 /// E.g., a paste operation that replaces the contents of the
1888 /// selection will cause only one signal emission (even though it
1889 /// is implemented by first deleting the selection, then inserting
1890 /// the new content, and may cause multiple ::notify::text signals
1891 /// to be emitted).
1892 ///
1893 ///
1894 ///
1895 ///
1896 /// #### `delete-text`
1897 /// This signal is emitted when text is deleted from
1898 /// the widget by the user. The default handler for
1899 /// this signal will normally be responsible for deleting
1900 /// the text, so by connecting to this signal and then
1901 /// stopping the signal with `g_signal_stop_emission()`, it
1902 /// is possible to modify the range of deleted text, or
1903 /// prevent it from being deleted entirely. The `start_pos`
1904 /// and `end_pos` parameters are interpreted as for
1905 /// [`EditableExt::delete_text()`][crate::prelude::EditableExt::delete_text()].
1906 ///
1907 ///
1908 ///
1909 ///
1910 /// #### `insert-text`
1911 /// This signal is emitted when text is inserted into
1912 /// the widget by the user. The default handler for
1913 /// this signal will normally be responsible for inserting
1914 /// the text, so by connecting to this signal and then
1915 /// stopping the signal with `g_signal_stop_emission()`, it
1916 /// is possible to modify the inserted text, or prevent
1917 /// it from being inserted entirely.
1918 ///
1919 ///
1920 /// </details>
1921 ///
1922 /// # Implements
1923 ///
1924 /// [`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]
1925 #[doc(alias = "GtkSpinButton")]
1926 pub struct SpinButton(Object<ffi::GtkSpinButton, ffi::GtkSpinButtonClass>) @extends Entry, Widget, @implements Buildable, CellEditable, Editable, Orientable;
1927
1928 match fn {
1929 type_ => || ffi::gtk_spin_button_get_type(),
1930 }
1931}
1932
1933impl SpinButton {
1934 pub const NONE: Option<&'static SpinButton> = None;
1935
1936 /// Creates a new [`SpinButton`][crate::SpinButton].
1937 /// ## `adjustment`
1938 /// the [`Adjustment`][crate::Adjustment] object that this spin
1939 /// button should use, or [`None`]
1940 /// ## `climb_rate`
1941 /// specifies by how much the rate of change in the value will
1942 /// accelerate if you continue to hold down an up/down button or arrow key
1943 /// ## `digits`
1944 /// the number of decimal places to display
1945 ///
1946 /// # Returns
1947 ///
1948 /// The new spin button as a [`Widget`][crate::Widget]
1949 #[doc(alias = "gtk_spin_button_new")]
1950 pub fn new(
1951 adjustment: Option<&impl IsA<Adjustment>>,
1952 climb_rate: f64,
1953 digits: u32,
1954 ) -> SpinButton {
1955 assert_initialized_main_thread!();
1956 unsafe {
1957 Widget::from_glib_none(ffi::gtk_spin_button_new(
1958 adjustment.map(|p| p.as_ref()).to_glib_none().0,
1959 climb_rate,
1960 digits,
1961 ))
1962 .unsafe_cast()
1963 }
1964 }
1965
1966 /// This is a convenience constructor that allows creation of a numeric
1967 /// [`SpinButton`][crate::SpinButton] without manually creating an adjustment. The value is
1968 /// initially set to the minimum value and a page increment of 10 * `step`
1969 /// is the default. The precision of the spin button is equivalent to the
1970 /// precision of `step`.
1971 ///
1972 /// Note that the way in which the precision is derived works best if `step`
1973 /// is a power of ten. If the resulting precision is not suitable for your
1974 /// needs, use [`SpinButtonExt::set_digits()`][crate::prelude::SpinButtonExt::set_digits()] to correct it.
1975 /// ## `min`
1976 /// Minimum allowable value
1977 /// ## `max`
1978 /// Maximum allowable value
1979 /// ## `step`
1980 /// Increment added or subtracted by spinning the widget
1981 ///
1982 /// # Returns
1983 ///
1984 /// The new spin button as a [`Widget`][crate::Widget]
1985 #[doc(alias = "gtk_spin_button_new_with_range")]
1986 #[doc(alias = "new_with_range")]
1987 pub fn with_range(min: f64, max: f64, step: f64) -> SpinButton {
1988 assert_initialized_main_thread!();
1989 unsafe {
1990 Widget::from_glib_none(ffi::gtk_spin_button_new_with_range(min, max, step))
1991 .unsafe_cast()
1992 }
1993 }
1994
1995 // rustdoc-stripper-ignore-next
1996 /// Creates a new builder-pattern struct instance to construct [`SpinButton`] objects.
1997 ///
1998 /// This method returns an instance of [`SpinButtonBuilder`](crate::builders::SpinButtonBuilder) which can be used to create [`SpinButton`] objects.
1999 pub fn builder() -> SpinButtonBuilder {
2000 SpinButtonBuilder::new()
2001 }
2002}
2003
2004impl Default for SpinButton {
2005 fn default() -> Self {
2006 glib::object::Object::new::<Self>()
2007 }
2008}
2009
2010// rustdoc-stripper-ignore-next
2011/// A [builder-pattern] type to construct [`SpinButton`] objects.
2012///
2013/// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html
2014#[must_use = "The builder must be built to be used"]
2015pub struct SpinButtonBuilder {
2016 builder: glib::object::ObjectBuilder<'static, SpinButton>,
2017}
2018
2019impl SpinButtonBuilder {
2020 fn new() -> Self {
2021 Self {
2022 builder: glib::object::Object::builder(),
2023 }
2024 }
2025
2026 pub fn adjustment(self, adjustment: &impl IsA<Adjustment>) -> Self {
2027 Self {
2028 builder: self
2029 .builder
2030 .property("adjustment", adjustment.clone().upcast()),
2031 }
2032 }
2033
2034 pub fn climb_rate(self, climb_rate: f64) -> Self {
2035 Self {
2036 builder: self.builder.property("climb-rate", climb_rate),
2037 }
2038 }
2039
2040 pub fn digits(self, digits: u32) -> Self {
2041 Self {
2042 builder: self.builder.property("digits", digits),
2043 }
2044 }
2045
2046 pub fn numeric(self, numeric: bool) -> Self {
2047 Self {
2048 builder: self.builder.property("numeric", numeric),
2049 }
2050 }
2051
2052 pub fn snap_to_ticks(self, snap_to_ticks: bool) -> Self {
2053 Self {
2054 builder: self.builder.property("snap-to-ticks", snap_to_ticks),
2055 }
2056 }
2057
2058 pub fn update_policy(self, update_policy: SpinButtonUpdatePolicy) -> Self {
2059 Self {
2060 builder: self.builder.property("update-policy", update_policy),
2061 }
2062 }
2063
2064 pub fn value(self, value: f64) -> Self {
2065 Self {
2066 builder: self.builder.property("value", value),
2067 }
2068 }
2069
2070 pub fn wrap(self, wrap: bool) -> Self {
2071 Self {
2072 builder: self.builder.property("wrap", wrap),
2073 }
2074 }
2075
2076 pub fn activates_default(self, activates_default: bool) -> Self {
2077 Self {
2078 builder: self
2079 .builder
2080 .property("activates-default", activates_default),
2081 }
2082 }
2083
2084 /// A list of Pango attributes to apply to the text of the entry.
2085 ///
2086 /// This is mainly useful to change the size or weight of the text.
2087 ///
2088 /// The `PangoAttribute`'s `start_index` and `end_index` must refer to the
2089 /// [`EntryBuffer`][crate::EntryBuffer] text, i.e. without the preedit string.
2090 pub fn attributes(self, attributes: &pango::AttrList) -> Self {
2091 Self {
2092 builder: self.builder.property("attributes", attributes.clone()),
2093 }
2094 }
2095
2096 pub fn buffer(self, buffer: &impl IsA<EntryBuffer>) -> Self {
2097 Self {
2098 builder: self.builder.property("buffer", buffer.clone().upcast()),
2099 }
2100 }
2101
2102 /// Whether password entries will show a warning when Caps Lock is on.
2103 ///
2104 /// Note that the warning is shown using a secondary icon, and thus
2105 /// does not work if you are using the secondary icon position for some
2106 /// other purpose.
2107 pub fn caps_lock_warning(self, caps_lock_warning: bool) -> Self {
2108 Self {
2109 builder: self
2110 .builder
2111 .property("caps-lock-warning", caps_lock_warning),
2112 }
2113 }
2114
2115 /// The auxiliary completion object to use with the entry.
2116 pub fn completion(self, completion: &impl IsA<EntryCompletion>) -> Self {
2117 Self {
2118 builder: self
2119 .builder
2120 .property("completion", completion.clone().upcast()),
2121 }
2122 }
2123
2124 pub fn editable(self, editable: bool) -> Self {
2125 Self {
2126 builder: self.builder.property("editable", editable),
2127 }
2128 }
2129
2130 pub fn enable_emoji_completion(self, enable_emoji_completion: bool) -> Self {
2131 Self {
2132 builder: self
2133 .builder
2134 .property("enable-emoji-completion", enable_emoji_completion),
2135 }
2136 }
2137
2138 pub fn has_frame(self, has_frame: bool) -> Self {
2139 Self {
2140 builder: self.builder.property("has-frame", has_frame),
2141 }
2142 }
2143
2144 /// Which IM (input method) module should be used for this entry.
2145 /// See [`IMContext`][crate::IMContext].
2146 ///
2147 /// Setting this to a non-[`None`] value overrides the
2148 /// system-wide IM module setting. See the GtkSettings
2149 /// [`gtk-im-module`][struct@crate::Settings#gtk-im-module] property.
2150 pub fn im_module(self, im_module: impl Into<glib::GString>) -> Self {
2151 Self {
2152 builder: self.builder.property("im-module", im_module.into()),
2153 }
2154 }
2155
2156 /// Additional hints (beyond [`input-purpose`][struct@crate::Entry#input-purpose]) that
2157 /// allow input methods to fine-tune their behaviour.
2158 pub fn input_hints(self, input_hints: InputHints) -> Self {
2159 Self {
2160 builder: self.builder.property("input-hints", input_hints),
2161 }
2162 }
2163
2164 /// The purpose of this text field.
2165 ///
2166 /// This property can be used by on-screen keyboards and other input
2167 /// methods to adjust their behaviour.
2168 ///
2169 /// Note that setting the purpose to [`InputPurpose::Password`][crate::InputPurpose::Password] or
2170 /// [`InputPurpose::Pin`][crate::InputPurpose::Pin] is independent from setting
2171 /// [`visibility`][struct@crate::Entry#visibility].
2172 pub fn input_purpose(self, input_purpose: InputPurpose) -> Self {
2173 Self {
2174 builder: self.builder.property("input-purpose", input_purpose),
2175 }
2176 }
2177
2178 /// The invisible character is used when masking entry contents (in
2179 /// \"password mode\")"). When it is not explicitly set with the
2180 /// [`invisible-char`][struct@crate::Entry#invisible-char] property, GTK+ determines the character
2181 /// to use from a list of possible candidates, depending on availability
2182 /// in the current font.
2183 ///
2184 /// This style property allows the theme to prepend a character
2185 /// to the list of candidates.
2186 pub fn invisible_char(self, invisible_char: u32) -> Self {
2187 Self {
2188 builder: self.builder.property("invisible-char", invisible_char),
2189 }
2190 }
2191
2192 /// Whether the invisible char has been set for the [`Entry`][crate::Entry].
2193 pub fn invisible_char_set(self, invisible_char_set: bool) -> Self {
2194 Self {
2195 builder: self
2196 .builder
2197 .property("invisible-char-set", invisible_char_set),
2198 }
2199 }
2200
2201 pub fn max_length(self, max_length: i32) -> Self {
2202 Self {
2203 builder: self.builder.property("max-length", max_length),
2204 }
2205 }
2206
2207 /// The desired maximum width of the entry, in characters.
2208 /// If this property is set to -1, the width will be calculated
2209 /// automatically.
2210 pub fn max_width_chars(self, max_width_chars: i32) -> Self {
2211 Self {
2212 builder: self.builder.property("max-width-chars", max_width_chars),
2213 }
2214 }
2215
2216 /// If text is overwritten when typing in the [`Entry`][crate::Entry].
2217 pub fn overwrite_mode(self, overwrite_mode: bool) -> Self {
2218 Self {
2219 builder: self.builder.property("overwrite-mode", overwrite_mode),
2220 }
2221 }
2222
2223 /// The text that will be displayed in the [`Entry`][crate::Entry] when it is empty
2224 /// and unfocused.
2225 pub fn placeholder_text(self, placeholder_text: impl Into<glib::GString>) -> Self {
2226 Self {
2227 builder: self
2228 .builder
2229 .property("placeholder-text", placeholder_text.into()),
2230 }
2231 }
2232
2233 /// If :populate-all is [`true`], the [`populate-popup`][struct@crate::Entry#populate-popup]
2234 /// signal is also emitted for touch popups.
2235 pub fn populate_all(self, populate_all: bool) -> Self {
2236 Self {
2237 builder: self.builder.property("populate-all", populate_all),
2238 }
2239 }
2240
2241 /// Whether the primary icon is activatable.
2242 ///
2243 /// GTK+ emits the [`icon-press`][struct@crate::Entry#icon-press] and [`icon-release`][struct@crate::Entry#icon-release]
2244 /// signals only on sensitive, activatable icons.
2245 ///
2246 /// Sensitive, but non-activatable icons can be used for purely
2247 /// informational purposes.
2248 pub fn primary_icon_activatable(self, primary_icon_activatable: bool) -> Self {
2249 Self {
2250 builder: self
2251 .builder
2252 .property("primary-icon-activatable", primary_icon_activatable),
2253 }
2254 }
2255
2256 /// The [`gio::Icon`][crate::gio::Icon] to use for the primary icon for the entry.
2257 pub fn primary_icon_gicon(self, primary_icon_gicon: &impl IsA<gio::Icon>) -> Self {
2258 Self {
2259 builder: self
2260 .builder
2261 .property("primary-icon-gicon", primary_icon_gicon.clone().upcast()),
2262 }
2263 }
2264
2265 /// The icon name to use for the primary icon for the entry.
2266 pub fn primary_icon_name(self, primary_icon_name: impl Into<glib::GString>) -> Self {
2267 Self {
2268 builder: self
2269 .builder
2270 .property("primary-icon-name", primary_icon_name.into()),
2271 }
2272 }
2273
2274 /// A pixbuf to use as the primary icon for the entry.
2275 pub fn primary_icon_pixbuf(self, primary_icon_pixbuf: &gdk_pixbuf::Pixbuf) -> Self {
2276 Self {
2277 builder: self
2278 .builder
2279 .property("primary-icon-pixbuf", primary_icon_pixbuf.clone()),
2280 }
2281 }
2282
2283 /// Whether the primary icon is sensitive.
2284 ///
2285 /// An insensitive icon appears grayed out. GTK+ does not emit the
2286 /// [`icon-press`][struct@crate::Entry#icon-press] and [`icon-release`][struct@crate::Entry#icon-release] signals and
2287 /// does not allow DND from insensitive icons.
2288 ///
2289 /// An icon should be set insensitive if the action that would trigger
2290 /// when clicked is currently not available.
2291 pub fn primary_icon_sensitive(self, primary_icon_sensitive: bool) -> Self {
2292 Self {
2293 builder: self
2294 .builder
2295 .property("primary-icon-sensitive", primary_icon_sensitive),
2296 }
2297 }
2298
2299 /// The contents of the tooltip on the primary icon, which is marked up
2300 /// with the [Pango text markup language][PangoMarkupFormat].
2301 ///
2302 /// Also see [`EntryExt::set_icon_tooltip_markup()`][crate::prelude::EntryExt::set_icon_tooltip_markup()].
2303 pub fn primary_icon_tooltip_markup(
2304 self,
2305 primary_icon_tooltip_markup: impl Into<glib::GString>,
2306 ) -> Self {
2307 Self {
2308 builder: self.builder.property(
2309 "primary-icon-tooltip-markup",
2310 primary_icon_tooltip_markup.into(),
2311 ),
2312 }
2313 }
2314
2315 /// The contents of the tooltip on the primary icon.
2316 ///
2317 /// Also see [`EntryExt::set_icon_tooltip_text()`][crate::prelude::EntryExt::set_icon_tooltip_text()].
2318 pub fn primary_icon_tooltip_text(
2319 self,
2320 primary_icon_tooltip_text: impl Into<glib::GString>,
2321 ) -> Self {
2322 Self {
2323 builder: self.builder.property(
2324 "primary-icon-tooltip-text",
2325 primary_icon_tooltip_text.into(),
2326 ),
2327 }
2328 }
2329
2330 /// The current fraction of the task that's been completed.
2331 pub fn progress_fraction(self, progress_fraction: f64) -> Self {
2332 Self {
2333 builder: self
2334 .builder
2335 .property("progress-fraction", progress_fraction),
2336 }
2337 }
2338
2339 /// The fraction of total entry width to move the progress
2340 /// bouncing block for each call to [`EntryExt::progress_pulse()`][crate::prelude::EntryExt::progress_pulse()].
2341 pub fn progress_pulse_step(self, progress_pulse_step: f64) -> Self {
2342 Self {
2343 builder: self
2344 .builder
2345 .property("progress-pulse-step", progress_pulse_step),
2346 }
2347 }
2348
2349 /// Whether the secondary icon is activatable.
2350 ///
2351 /// GTK+ emits the [`icon-press`][struct@crate::Entry#icon-press] and [`icon-release`][struct@crate::Entry#icon-release]
2352 /// signals only on sensitive, activatable icons.
2353 ///
2354 /// Sensitive, but non-activatable icons can be used for purely
2355 /// informational purposes.
2356 pub fn secondary_icon_activatable(self, secondary_icon_activatable: bool) -> Self {
2357 Self {
2358 builder: self
2359 .builder
2360 .property("secondary-icon-activatable", secondary_icon_activatable),
2361 }
2362 }
2363
2364 /// The [`gio::Icon`][crate::gio::Icon] to use for the secondary icon for the entry.
2365 pub fn secondary_icon_gicon(self, secondary_icon_gicon: &impl IsA<gio::Icon>) -> Self {
2366 Self {
2367 builder: self.builder.property(
2368 "secondary-icon-gicon",
2369 secondary_icon_gicon.clone().upcast(),
2370 ),
2371 }
2372 }
2373
2374 /// The icon name to use for the secondary icon for the entry.
2375 pub fn secondary_icon_name(self, secondary_icon_name: impl Into<glib::GString>) -> Self {
2376 Self {
2377 builder: self
2378 .builder
2379 .property("secondary-icon-name", secondary_icon_name.into()),
2380 }
2381 }
2382
2383 /// An pixbuf to use as the secondary icon for the entry.
2384 pub fn secondary_icon_pixbuf(self, secondary_icon_pixbuf: &gdk_pixbuf::Pixbuf) -> Self {
2385 Self {
2386 builder: self
2387 .builder
2388 .property("secondary-icon-pixbuf", secondary_icon_pixbuf.clone()),
2389 }
2390 }
2391
2392 /// Whether the secondary icon is sensitive.
2393 ///
2394 /// An insensitive icon appears grayed out. GTK+ does not emit the
2395 /// [`icon-press`][struct@crate::Entry#icon-press] and [`icon-release`][struct@crate::Entry#icon-release] signals and
2396 /// does not allow DND from insensitive icons.
2397 ///
2398 /// An icon should be set insensitive if the action that would trigger
2399 /// when clicked is currently not available.
2400 pub fn secondary_icon_sensitive(self, secondary_icon_sensitive: bool) -> Self {
2401 Self {
2402 builder: self
2403 .builder
2404 .property("secondary-icon-sensitive", secondary_icon_sensitive),
2405 }
2406 }
2407
2408 /// The contents of the tooltip on the secondary icon, which is marked up
2409 /// with the [Pango text markup language][PangoMarkupFormat].
2410 ///
2411 /// Also see [`EntryExt::set_icon_tooltip_markup()`][crate::prelude::EntryExt::set_icon_tooltip_markup()].
2412 pub fn secondary_icon_tooltip_markup(
2413 self,
2414 secondary_icon_tooltip_markup: impl Into<glib::GString>,
2415 ) -> Self {
2416 Self {
2417 builder: self.builder.property(
2418 "secondary-icon-tooltip-markup",
2419 secondary_icon_tooltip_markup.into(),
2420 ),
2421 }
2422 }
2423
2424 /// The contents of the tooltip on the secondary icon.
2425 ///
2426 /// Also see [`EntryExt::set_icon_tooltip_text()`][crate::prelude::EntryExt::set_icon_tooltip_text()].
2427 pub fn secondary_icon_tooltip_text(
2428 self,
2429 secondary_icon_tooltip_text: impl Into<glib::GString>,
2430 ) -> Self {
2431 Self {
2432 builder: self.builder.property(
2433 "secondary-icon-tooltip-text",
2434 secondary_icon_tooltip_text.into(),
2435 ),
2436 }
2437 }
2438
2439 pub fn show_emoji_icon(self, show_emoji_icon: bool) -> Self {
2440 Self {
2441 builder: self.builder.property("show-emoji-icon", show_emoji_icon),
2442 }
2443 }
2444
2445 pub fn tabs(self, tabs: &pango::TabArray) -> Self {
2446 Self {
2447 builder: self.builder.property("tabs", tabs),
2448 }
2449 }
2450
2451 pub fn text(self, text: impl Into<glib::GString>) -> Self {
2452 Self {
2453 builder: self.builder.property("text", text.into()),
2454 }
2455 }
2456
2457 /// When [`true`], pasted multi-line text is truncated to the first line.
2458 pub fn truncate_multiline(self, truncate_multiline: bool) -> Self {
2459 Self {
2460 builder: self
2461 .builder
2462 .property("truncate-multiline", truncate_multiline),
2463 }
2464 }
2465
2466 pub fn visibility(self, visibility: bool) -> Self {
2467 Self {
2468 builder: self.builder.property("visibility", visibility),
2469 }
2470 }
2471
2472 pub fn width_chars(self, width_chars: i32) -> Self {
2473 Self {
2474 builder: self.builder.property("width-chars", width_chars),
2475 }
2476 }
2477
2478 /// The horizontal alignment, from 0 (left) to 1 (right).
2479 /// Reversed for RTL layouts.
2480 pub fn xalign(self, xalign: f32) -> Self {
2481 Self {
2482 builder: self.builder.property("xalign", xalign),
2483 }
2484 }
2485
2486 pub fn app_paintable(self, app_paintable: bool) -> Self {
2487 Self {
2488 builder: self.builder.property("app-paintable", app_paintable),
2489 }
2490 }
2491
2492 pub fn can_default(self, can_default: bool) -> Self {
2493 Self {
2494 builder: self.builder.property("can-default", can_default),
2495 }
2496 }
2497
2498 pub fn can_focus(self, can_focus: bool) -> Self {
2499 Self {
2500 builder: self.builder.property("can-focus", can_focus),
2501 }
2502 }
2503
2504 pub fn events(self, events: gdk::EventMask) -> Self {
2505 Self {
2506 builder: self.builder.property("events", events),
2507 }
2508 }
2509
2510 /// Whether to expand in both directions. Setting this sets both [`hexpand`][struct@crate::Widget#hexpand] and [`vexpand`][struct@crate::Widget#vexpand]
2511 pub fn expand(self, expand: bool) -> Self {
2512 Self {
2513 builder: self.builder.property("expand", expand),
2514 }
2515 }
2516
2517 /// Whether the widget should grab focus when it is clicked with the mouse.
2518 ///
2519 /// This property is only relevant for widgets that can take focus.
2520 ///
2521 /// Before 3.20, several widgets (GtkButton, GtkFileChooserButton,
2522 /// GtkComboBox) implemented this property individually.
2523 pub fn focus_on_click(self, focus_on_click: bool) -> Self {
2524 Self {
2525 builder: self.builder.property("focus-on-click", focus_on_click),
2526 }
2527 }
2528
2529 /// How to distribute horizontal space if widget gets extra space, see [`Align`][crate::Align]
2530 pub fn halign(self, halign: Align) -> Self {
2531 Self {
2532 builder: self.builder.property("halign", halign),
2533 }
2534 }
2535
2536 pub fn has_default(self, has_default: bool) -> Self {
2537 Self {
2538 builder: self.builder.property("has-default", has_default),
2539 }
2540 }
2541
2542 pub fn has_focus(self, has_focus: bool) -> Self {
2543 Self {
2544 builder: self.builder.property("has-focus", has_focus),
2545 }
2546 }
2547
2548 /// Enables or disables the emission of [`query-tooltip`][struct@crate::Widget#query-tooltip] on `widget`.
2549 /// A value of [`true`] indicates that `widget` can have a tooltip, in this case
2550 /// the widget will be queried using [`query-tooltip`][struct@crate::Widget#query-tooltip] to determine
2551 /// whether it will provide a tooltip or not.
2552 ///
2553 /// Note that setting this property to [`true`] for the first time will change
2554 /// the event masks of the GdkWindows of this widget to include leave-notify
2555 /// and motion-notify events. This cannot and will not be undone when the
2556 /// property is set to [`false`] again.
2557 pub fn has_tooltip(self, has_tooltip: bool) -> Self {
2558 Self {
2559 builder: self.builder.property("has-tooltip", has_tooltip),
2560 }
2561 }
2562
2563 pub fn height_request(self, height_request: i32) -> Self {
2564 Self {
2565 builder: self.builder.property("height-request", height_request),
2566 }
2567 }
2568
2569 /// Whether to expand horizontally. See [`WidgetExt::set_hexpand()`][crate::prelude::WidgetExt::set_hexpand()].
2570 pub fn hexpand(self, hexpand: bool) -> Self {
2571 Self {
2572 builder: self.builder.property("hexpand", hexpand),
2573 }
2574 }
2575
2576 /// Whether to use the [`hexpand`][struct@crate::Widget#hexpand] property. See [`WidgetExt::is_hexpand_set()`][crate::prelude::WidgetExt::is_hexpand_set()].
2577 pub fn hexpand_set(self, hexpand_set: bool) -> Self {
2578 Self {
2579 builder: self.builder.property("hexpand-set", hexpand_set),
2580 }
2581 }
2582
2583 pub fn is_focus(self, is_focus: bool) -> Self {
2584 Self {
2585 builder: self.builder.property("is-focus", is_focus),
2586 }
2587 }
2588
2589 /// Sets all four sides' margin at once. If read, returns max
2590 /// margin on any side.
2591 pub fn margin(self, margin: i32) -> Self {
2592 Self {
2593 builder: self.builder.property("margin", margin),
2594 }
2595 }
2596
2597 /// Margin on bottom side of widget.
2598 ///
2599 /// This property adds margin outside of the widget's normal size
2600 /// request, the margin will be added in addition to the size from
2601 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
2602 pub fn margin_bottom(self, margin_bottom: i32) -> Self {
2603 Self {
2604 builder: self.builder.property("margin-bottom", margin_bottom),
2605 }
2606 }
2607
2608 /// Margin on end of widget, horizontally. This property supports
2609 /// left-to-right and right-to-left text directions.
2610 ///
2611 /// This property adds margin outside of the widget's normal size
2612 /// request, the margin will be added in addition to the size from
2613 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
2614 pub fn margin_end(self, margin_end: i32) -> Self {
2615 Self {
2616 builder: self.builder.property("margin-end", margin_end),
2617 }
2618 }
2619
2620 /// Margin on start of widget, horizontally. This property supports
2621 /// left-to-right and right-to-left text directions.
2622 ///
2623 /// This property adds margin outside of the widget's normal size
2624 /// request, the margin will be added in addition to the size from
2625 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
2626 pub fn margin_start(self, margin_start: i32) -> Self {
2627 Self {
2628 builder: self.builder.property("margin-start", margin_start),
2629 }
2630 }
2631
2632 /// Margin on top side of widget.
2633 ///
2634 /// This property adds margin outside of the widget's normal size
2635 /// request, the margin will be added in addition to the size from
2636 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
2637 pub fn margin_top(self, margin_top: i32) -> Self {
2638 Self {
2639 builder: self.builder.property("margin-top", margin_top),
2640 }
2641 }
2642
2643 pub fn name(self, name: impl Into<glib::GString>) -> Self {
2644 Self {
2645 builder: self.builder.property("name", name.into()),
2646 }
2647 }
2648
2649 pub fn no_show_all(self, no_show_all: bool) -> Self {
2650 Self {
2651 builder: self.builder.property("no-show-all", no_show_all),
2652 }
2653 }
2654
2655 /// The requested opacity of the widget. See [`WidgetExt::set_opacity()`][crate::prelude::WidgetExt::set_opacity()] for
2656 /// more details about window opacity.
2657 ///
2658 /// Before 3.8 this was only available in GtkWindow
2659 pub fn opacity(self, opacity: f64) -> Self {
2660 Self {
2661 builder: self.builder.property("opacity", opacity),
2662 }
2663 }
2664
2665 pub fn parent(self, parent: &impl IsA<Container>) -> Self {
2666 Self {
2667 builder: self.builder.property("parent", parent.clone().upcast()),
2668 }
2669 }
2670
2671 pub fn receives_default(self, receives_default: bool) -> Self {
2672 Self {
2673 builder: self.builder.property("receives-default", receives_default),
2674 }
2675 }
2676
2677 pub fn sensitive(self, sensitive: bool) -> Self {
2678 Self {
2679 builder: self.builder.property("sensitive", sensitive),
2680 }
2681 }
2682
2683 /// Sets the text of tooltip to be the given string, which is marked up
2684 /// with the [Pango text markup language][PangoMarkupFormat].
2685 /// Also see [`Tooltip::set_markup()`][crate::Tooltip::set_markup()].
2686 ///
2687 /// This is a convenience property which will take care of getting the
2688 /// tooltip shown if the given string is not [`None`]: [`has-tooltip`][struct@crate::Widget#has-tooltip]
2689 /// will automatically be set to [`true`] and there will be taken care of
2690 /// [`query-tooltip`][struct@crate::Widget#query-tooltip] in the default signal handler.
2691 ///
2692 /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and [`tooltip-markup`][struct@crate::Widget#tooltip-markup]
2693 /// are set, the last one wins.
2694 pub fn tooltip_markup(self, tooltip_markup: impl Into<glib::GString>) -> Self {
2695 Self {
2696 builder: self
2697 .builder
2698 .property("tooltip-markup", tooltip_markup.into()),
2699 }
2700 }
2701
2702 /// Sets the text of tooltip to be the given string.
2703 ///
2704 /// Also see [`Tooltip::set_text()`][crate::Tooltip::set_text()].
2705 ///
2706 /// This is a convenience property which will take care of getting the
2707 /// tooltip shown if the given string is not [`None`]: [`has-tooltip`][struct@crate::Widget#has-tooltip]
2708 /// will automatically be set to [`true`] and there will be taken care of
2709 /// [`query-tooltip`][struct@crate::Widget#query-tooltip] in the default signal handler.
2710 ///
2711 /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and [`tooltip-markup`][struct@crate::Widget#tooltip-markup]
2712 /// are set, the last one wins.
2713 pub fn tooltip_text(self, tooltip_text: impl Into<glib::GString>) -> Self {
2714 Self {
2715 builder: self.builder.property("tooltip-text", tooltip_text.into()),
2716 }
2717 }
2718
2719 /// How to distribute vertical space if widget gets extra space, see [`Align`][crate::Align]
2720 pub fn valign(self, valign: Align) -> Self {
2721 Self {
2722 builder: self.builder.property("valign", valign),
2723 }
2724 }
2725
2726 /// Whether to expand vertically. See [`WidgetExt::set_vexpand()`][crate::prelude::WidgetExt::set_vexpand()].
2727 pub fn vexpand(self, vexpand: bool) -> Self {
2728 Self {
2729 builder: self.builder.property("vexpand", vexpand),
2730 }
2731 }
2732
2733 /// Whether to use the [`vexpand`][struct@crate::Widget#vexpand] property. See [`WidgetExt::is_vexpand_set()`][crate::prelude::WidgetExt::is_vexpand_set()].
2734 pub fn vexpand_set(self, vexpand_set: bool) -> Self {
2735 Self {
2736 builder: self.builder.property("vexpand-set", vexpand_set),
2737 }
2738 }
2739
2740 pub fn visible(self, visible: bool) -> Self {
2741 Self {
2742 builder: self.builder.property("visible", visible),
2743 }
2744 }
2745
2746 pub fn width_request(self, width_request: i32) -> Self {
2747 Self {
2748 builder: self.builder.property("width-request", width_request),
2749 }
2750 }
2751
2752 /// Indicates whether editing on the cell has been canceled.
2753 pub fn editing_canceled(self, editing_canceled: bool) -> Self {
2754 Self {
2755 builder: self.builder.property("editing-canceled", editing_canceled),
2756 }
2757 }
2758
2759 /// The orientation of the orientable.
2760 pub fn orientation(self, orientation: Orientation) -> Self {
2761 Self {
2762 builder: self.builder.property("orientation", orientation),
2763 }
2764 }
2765
2766 // rustdoc-stripper-ignore-next
2767 /// Build the [`SpinButton`].
2768 #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"]
2769 pub fn build(self) -> SpinButton {
2770 self.builder.build()
2771 }
2772}
2773
2774mod sealed {
2775 pub trait Sealed {}
2776 impl<T: super::IsA<super::SpinButton>> Sealed for T {}
2777}
2778
2779/// Trait containing all [`struct@SpinButton`] methods.
2780///
2781/// # Implementors
2782///
2783/// [`SpinButton`][struct@crate::SpinButton]
2784pub trait SpinButtonExt: IsA<SpinButton> + sealed::Sealed + '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 = mem::MaybeUninit::uninit();
2848 let mut page = 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 fn is_numeric(&self) -> bool {
2867 unsafe {
2868 from_glib(ffi::gtk_spin_button_get_numeric(
2869 self.as_ref().to_glib_none().0,
2870 ))
2871 }
2872 }
2873
2874 /// Gets the range allowed for `self`.
2875 /// See [`set_range()`][Self::set_range()].
2876 ///
2877 /// # Returns
2878 ///
2879 ///
2880 /// ## `min`
2881 /// location to store minimum allowed value, or [`None`]
2882 ///
2883 /// ## `max`
2884 /// location to store maximum allowed value, or [`None`]
2885 #[doc(alias = "gtk_spin_button_get_range")]
2886 #[doc(alias = "get_range")]
2887 fn range(&self) -> (f64, f64) {
2888 unsafe {
2889 let mut min = mem::MaybeUninit::uninit();
2890 let mut max = mem::MaybeUninit::uninit();
2891 ffi::gtk_spin_button_get_range(
2892 self.as_ref().to_glib_none().0,
2893 min.as_mut_ptr(),
2894 max.as_mut_ptr(),
2895 );
2896 (min.assume_init(), max.assume_init())
2897 }
2898 }
2899
2900 /// Returns whether the values are corrected to the nearest step.
2901 /// See [`set_snap_to_ticks()`][Self::set_snap_to_ticks()].
2902 ///
2903 /// # Returns
2904 ///
2905 /// [`true`] if values are snapped to the nearest step
2906 #[doc(alias = "gtk_spin_button_get_snap_to_ticks")]
2907 #[doc(alias = "get_snap_to_ticks")]
2908 fn snaps_to_ticks(&self) -> bool {
2909 unsafe {
2910 from_glib(ffi::gtk_spin_button_get_snap_to_ticks(
2911 self.as_ref().to_glib_none().0,
2912 ))
2913 }
2914 }
2915
2916 /// Gets the update behavior of a spin button.
2917 /// See [`set_update_policy()`][Self::set_update_policy()].
2918 ///
2919 /// # Returns
2920 ///
2921 /// the current update policy
2922 #[doc(alias = "gtk_spin_button_get_update_policy")]
2923 #[doc(alias = "get_update_policy")]
2924 fn update_policy(&self) -> SpinButtonUpdatePolicy {
2925 unsafe {
2926 from_glib(ffi::gtk_spin_button_get_update_policy(
2927 self.as_ref().to_glib_none().0,
2928 ))
2929 }
2930 }
2931
2932 /// Get the value in the `self`.
2933 ///
2934 /// # Returns
2935 ///
2936 /// the value of `self`
2937 #[doc(alias = "gtk_spin_button_get_value")]
2938 #[doc(alias = "get_value")]
2939 fn value(&self) -> f64 {
2940 unsafe { ffi::gtk_spin_button_get_value(self.as_ref().to_glib_none().0) }
2941 }
2942
2943 /// Get the value `self` represented as an integer.
2944 ///
2945 /// # Returns
2946 ///
2947 /// the value of `self`
2948 #[doc(alias = "gtk_spin_button_get_value_as_int")]
2949 #[doc(alias = "get_value_as_int")]
2950 fn value_as_int(&self) -> i32 {
2951 unsafe { ffi::gtk_spin_button_get_value_as_int(self.as_ref().to_glib_none().0) }
2952 }
2953
2954 /// Returns whether the spin button’s value wraps around to the
2955 /// opposite limit when the upper or lower limit of the range is
2956 /// exceeded. See [`set_wrap()`][Self::set_wrap()].
2957 ///
2958 /// # Returns
2959 ///
2960 /// [`true`] if the spin button wraps around
2961 #[doc(alias = "gtk_spin_button_get_wrap")]
2962 #[doc(alias = "get_wrap")]
2963 fn wraps(&self) -> bool {
2964 unsafe {
2965 from_glib(ffi::gtk_spin_button_get_wrap(
2966 self.as_ref().to_glib_none().0,
2967 ))
2968 }
2969 }
2970
2971 /// Replaces the [`Adjustment`][crate::Adjustment] associated with `self`.
2972 /// ## `adjustment`
2973 /// a [`Adjustment`][crate::Adjustment] to replace the existing adjustment
2974 #[doc(alias = "gtk_spin_button_set_adjustment")]
2975 fn set_adjustment(&self, adjustment: &impl IsA<Adjustment>) {
2976 unsafe {
2977 ffi::gtk_spin_button_set_adjustment(
2978 self.as_ref().to_glib_none().0,
2979 adjustment.as_ref().to_glib_none().0,
2980 );
2981 }
2982 }
2983
2984 /// Set the precision to be displayed by `self`. Up to 20 digit precision
2985 /// is allowed.
2986 /// ## `digits`
2987 /// the number of digits after the decimal point to be displayed for the spin button’s value
2988 #[doc(alias = "gtk_spin_button_set_digits")]
2989 fn set_digits(&self, digits: u32) {
2990 unsafe {
2991 ffi::gtk_spin_button_set_digits(self.as_ref().to_glib_none().0, digits);
2992 }
2993 }
2994
2995 /// Sets the step and page increments for spin_button. This affects how
2996 /// quickly the value changes when the spin button’s arrows are activated.
2997 /// ## `step`
2998 /// increment applied for a button 1 press.
2999 /// ## `page`
3000 /// increment applied for a button 2 press.
3001 #[doc(alias = "gtk_spin_button_set_increments")]
3002 fn set_increments(&self, step: f64, page: f64) {
3003 unsafe {
3004 ffi::gtk_spin_button_set_increments(self.as_ref().to_glib_none().0, step, page);
3005 }
3006 }
3007
3008 /// Sets the flag that determines if non-numeric text can be typed
3009 /// into the spin button.
3010 /// ## `numeric`
3011 /// flag indicating if only numeric entry is allowed
3012 #[doc(alias = "gtk_spin_button_set_numeric")]
3013 fn set_numeric(&self, numeric: bool) {
3014 unsafe {
3015 ffi::gtk_spin_button_set_numeric(self.as_ref().to_glib_none().0, numeric.into_glib());
3016 }
3017 }
3018
3019 /// Sets the minimum and maximum allowable values for `self`.
3020 ///
3021 /// If the current value is outside this range, it will be adjusted
3022 /// to fit within the range, otherwise it will remain unchanged.
3023 /// ## `min`
3024 /// minimum allowable value
3025 /// ## `max`
3026 /// maximum allowable value
3027 #[doc(alias = "gtk_spin_button_set_range")]
3028 fn set_range(&self, min: f64, max: f64) {
3029 unsafe {
3030 ffi::gtk_spin_button_set_range(self.as_ref().to_glib_none().0, min, max);
3031 }
3032 }
3033
3034 /// Sets the policy as to whether values are corrected to the
3035 /// nearest step increment when a spin button is activated after
3036 /// providing an invalid value.
3037 /// ## `snap_to_ticks`
3038 /// a flag indicating if invalid values should be corrected
3039 #[doc(alias = "gtk_spin_button_set_snap_to_ticks")]
3040 fn set_snap_to_ticks(&self, snap_to_ticks: bool) {
3041 unsafe {
3042 ffi::gtk_spin_button_set_snap_to_ticks(
3043 self.as_ref().to_glib_none().0,
3044 snap_to_ticks.into_glib(),
3045 );
3046 }
3047 }
3048
3049 /// Sets the update behavior of a spin button.
3050 /// This determines whether the spin button is always updated
3051 /// or only when a valid value is set.
3052 /// ## `policy`
3053 /// a [`SpinButtonUpdatePolicy`][crate::SpinButtonUpdatePolicy] value
3054 #[doc(alias = "gtk_spin_button_set_update_policy")]
3055 fn set_update_policy(&self, policy: SpinButtonUpdatePolicy) {
3056 unsafe {
3057 ffi::gtk_spin_button_set_update_policy(
3058 self.as_ref().to_glib_none().0,
3059 policy.into_glib(),
3060 );
3061 }
3062 }
3063
3064 /// Sets the value of `self`.
3065 /// ## `value`
3066 /// the new value
3067 #[doc(alias = "gtk_spin_button_set_value")]
3068 fn set_value(&self, value: f64) {
3069 unsafe {
3070 ffi::gtk_spin_button_set_value(self.as_ref().to_glib_none().0, value);
3071 }
3072 }
3073
3074 /// Sets the flag that determines if a spin button value wraps
3075 /// around to the opposite limit when the upper or lower limit
3076 /// of the range is exceeded.
3077 /// ## `wrap`
3078 /// a flag indicating if wrapping behavior is performed
3079 #[doc(alias = "gtk_spin_button_set_wrap")]
3080 fn set_wrap(&self, wrap: bool) {
3081 unsafe {
3082 ffi::gtk_spin_button_set_wrap(self.as_ref().to_glib_none().0, wrap.into_glib());
3083 }
3084 }
3085
3086 /// Increment or decrement a spin button’s value in a specified
3087 /// direction by a specified amount.
3088 /// ## `direction`
3089 /// a [`SpinType`][crate::SpinType] indicating the direction to spin
3090 /// ## `increment`
3091 /// step increment to apply in the specified direction
3092 #[doc(alias = "gtk_spin_button_spin")]
3093 fn spin(&self, direction: SpinType, increment: f64) {
3094 unsafe {
3095 ffi::gtk_spin_button_spin(
3096 self.as_ref().to_glib_none().0,
3097 direction.into_glib(),
3098 increment,
3099 );
3100 }
3101 }
3102
3103 /// Manually force an update of the spin button.
3104 #[doc(alias = "gtk_spin_button_update")]
3105 fn update(&self) {
3106 unsafe {
3107 ffi::gtk_spin_button_update(self.as_ref().to_glib_none().0);
3108 }
3109 }
3110
3111 #[doc(alias = "climb-rate")]
3112 fn climb_rate(&self) -> f64 {
3113 ObjectExt::property(self.as_ref(), "climb-rate")
3114 }
3115
3116 #[doc(alias = "climb-rate")]
3117 fn set_climb_rate(&self, climb_rate: f64) {
3118 ObjectExt::set_property(self.as_ref(), "climb-rate", climb_rate)
3119 }
3120
3121 #[doc(alias = "adjustment")]
3122 fn connect_adjustment_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
3123 unsafe extern "C" fn notify_adjustment_trampoline<
3124 P: IsA<SpinButton>,
3125 F: Fn(&P) + 'static,
3126 >(
3127 this: *mut ffi::GtkSpinButton,
3128 _param_spec: glib::ffi::gpointer,
3129 f: glib::ffi::gpointer,
3130 ) {
3131 let f: &F = &*(f as *const F);
3132 f(SpinButton::from_glib_borrow(this).unsafe_cast_ref())
3133 }
3134 unsafe {
3135 let f: Box_<F> = Box_::new(f);
3136 connect_raw(
3137 self.as_ptr() as *mut _,
3138 b"notify::adjustment\0".as_ptr() as *const _,
3139 Some(transmute::<_, unsafe extern "C" fn()>(
3140 notify_adjustment_trampoline::<Self, F> as *const (),
3141 )),
3142 Box_::into_raw(f),
3143 )
3144 }
3145 }
3146
3147 #[doc(alias = "climb-rate")]
3148 fn connect_climb_rate_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
3149 unsafe extern "C" fn notify_climb_rate_trampoline<
3150 P: IsA<SpinButton>,
3151 F: Fn(&P) + 'static,
3152 >(
3153 this: *mut ffi::GtkSpinButton,
3154 _param_spec: glib::ffi::gpointer,
3155 f: glib::ffi::gpointer,
3156 ) {
3157 let f: &F = &*(f as *const F);
3158 f(SpinButton::from_glib_borrow(this).unsafe_cast_ref())
3159 }
3160 unsafe {
3161 let f: Box_<F> = Box_::new(f);
3162 connect_raw(
3163 self.as_ptr() as *mut _,
3164 b"notify::climb-rate\0".as_ptr() as *const _,
3165 Some(transmute::<_, unsafe extern "C" fn()>(
3166 notify_climb_rate_trampoline::<Self, F> as *const (),
3167 )),
3168 Box_::into_raw(f),
3169 )
3170 }
3171 }
3172
3173 #[doc(alias = "digits")]
3174 fn connect_digits_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
3175 unsafe extern "C" fn notify_digits_trampoline<P: IsA<SpinButton>, F: Fn(&P) + 'static>(
3176 this: *mut ffi::GtkSpinButton,
3177 _param_spec: glib::ffi::gpointer,
3178 f: glib::ffi::gpointer,
3179 ) {
3180 let f: &F = &*(f as *const F);
3181 f(SpinButton::from_glib_borrow(this).unsafe_cast_ref())
3182 }
3183 unsafe {
3184 let f: Box_<F> = Box_::new(f);
3185 connect_raw(
3186 self.as_ptr() as *mut _,
3187 b"notify::digits\0".as_ptr() as *const _,
3188 Some(transmute::<_, unsafe extern "C" fn()>(
3189 notify_digits_trampoline::<Self, F> as *const (),
3190 )),
3191 Box_::into_raw(f),
3192 )
3193 }
3194 }
3195
3196 #[doc(alias = "numeric")]
3197 fn connect_numeric_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
3198 unsafe extern "C" fn notify_numeric_trampoline<P: IsA<SpinButton>, F: Fn(&P) + 'static>(
3199 this: *mut ffi::GtkSpinButton,
3200 _param_spec: glib::ffi::gpointer,
3201 f: glib::ffi::gpointer,
3202 ) {
3203 let f: &F = &*(f as *const F);
3204 f(SpinButton::from_glib_borrow(this).unsafe_cast_ref())
3205 }
3206 unsafe {
3207 let f: Box_<F> = Box_::new(f);
3208 connect_raw(
3209 self.as_ptr() as *mut _,
3210 b"notify::numeric\0".as_ptr() as *const _,
3211 Some(transmute::<_, unsafe extern "C" fn()>(
3212 notify_numeric_trampoline::<Self, F> as *const (),
3213 )),
3214 Box_::into_raw(f),
3215 )
3216 }
3217 }
3218
3219 #[doc(alias = "snap-to-ticks")]
3220 fn connect_snap_to_ticks_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
3221 unsafe extern "C" fn notify_snap_to_ticks_trampoline<
3222 P: IsA<SpinButton>,
3223 F: Fn(&P) + 'static,
3224 >(
3225 this: *mut ffi::GtkSpinButton,
3226 _param_spec: glib::ffi::gpointer,
3227 f: glib::ffi::gpointer,
3228 ) {
3229 let f: &F = &*(f as *const F);
3230 f(SpinButton::from_glib_borrow(this).unsafe_cast_ref())
3231 }
3232 unsafe {
3233 let f: Box_<F> = Box_::new(f);
3234 connect_raw(
3235 self.as_ptr() as *mut _,
3236 b"notify::snap-to-ticks\0".as_ptr() as *const _,
3237 Some(transmute::<_, unsafe extern "C" fn()>(
3238 notify_snap_to_ticks_trampoline::<Self, F> as *const (),
3239 )),
3240 Box_::into_raw(f),
3241 )
3242 }
3243 }
3244
3245 #[doc(alias = "update-policy")]
3246 fn connect_update_policy_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
3247 unsafe extern "C" fn notify_update_policy_trampoline<
3248 P: IsA<SpinButton>,
3249 F: Fn(&P) + 'static,
3250 >(
3251 this: *mut ffi::GtkSpinButton,
3252 _param_spec: glib::ffi::gpointer,
3253 f: glib::ffi::gpointer,
3254 ) {
3255 let f: &F = &*(f as *const F);
3256 f(SpinButton::from_glib_borrow(this).unsafe_cast_ref())
3257 }
3258 unsafe {
3259 let f: Box_<F> = Box_::new(f);
3260 connect_raw(
3261 self.as_ptr() as *mut _,
3262 b"notify::update-policy\0".as_ptr() as *const _,
3263 Some(transmute::<_, unsafe extern "C" fn()>(
3264 notify_update_policy_trampoline::<Self, F> as *const (),
3265 )),
3266 Box_::into_raw(f),
3267 )
3268 }
3269 }
3270
3271 #[doc(alias = "value")]
3272 fn connect_value_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
3273 unsafe extern "C" fn notify_value_trampoline<P: IsA<SpinButton>, F: Fn(&P) + 'static>(
3274 this: *mut ffi::GtkSpinButton,
3275 _param_spec: glib::ffi::gpointer,
3276 f: glib::ffi::gpointer,
3277 ) {
3278 let f: &F = &*(f as *const F);
3279 f(SpinButton::from_glib_borrow(this).unsafe_cast_ref())
3280 }
3281 unsafe {
3282 let f: Box_<F> = Box_::new(f);
3283 connect_raw(
3284 self.as_ptr() as *mut _,
3285 b"notify::value\0".as_ptr() as *const _,
3286 Some(transmute::<_, unsafe extern "C" fn()>(
3287 notify_value_trampoline::<Self, F> as *const (),
3288 )),
3289 Box_::into_raw(f),
3290 )
3291 }
3292 }
3293
3294 #[doc(alias = "wrap")]
3295 fn connect_wrap_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
3296 unsafe extern "C" fn notify_wrap_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 let f: &F = &*(f as *const F);
3302 f(SpinButton::from_glib_borrow(this).unsafe_cast_ref())
3303 }
3304 unsafe {
3305 let f: Box_<F> = Box_::new(f);
3306 connect_raw(
3307 self.as_ptr() as *mut _,
3308 b"notify::wrap\0".as_ptr() as *const _,
3309 Some(transmute::<_, unsafe extern "C" fn()>(
3310 notify_wrap_trampoline::<Self, F> as *const (),
3311 )),
3312 Box_::into_raw(f),
3313 )
3314 }
3315 }
3316}
3317
3318impl<O: IsA<SpinButton>> SpinButtonExt for O {}
3319
3320impl fmt::Display for SpinButton {
3321 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
3322 f.write_str("SpinButton")
3323 }
3324}