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