gtk/auto/assistant.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 Align, Application, AssistantPageType, Bin, Buildable, Container, ResizeMode, Widget, Window,
7 WindowPosition, WindowType, ffi,
8};
9use glib::{
10 object::ObjectType as _,
11 prelude::*,
12 signal::{SignalHandlerId, connect_raw},
13 translate::*,
14};
15use std::boxed::Box as Box_;
16
17glib::wrapper! {
18 /// A [`Assistant`][crate::Assistant] is a widget used to represent a generally complex
19 /// operation splitted in several steps, guiding the user through its
20 /// pages and controlling the page flow to collect the necessary data.
21 ///
22 /// The design of GtkAssistant is that it controls what buttons to show
23 /// and to make sensitive, based on what it knows about the page sequence
24 /// and the [type][GtkAssistantPageType] of each page,
25 /// in addition to state information like the page
26 /// [completion][gtk-assistant-set-page-complete]
27 /// and [committed][gtk-assistant-commit] status.
28 ///
29 /// If you have a case that doesn’t quite fit in `GtkAssistants` way of
30 /// handling buttons, you can use the [`AssistantPageType::Custom`][crate::AssistantPageType::Custom] page
31 /// type and handle buttons yourself.
32 ///
33 /// # GtkAssistant as GtkBuildable
34 ///
35 /// The GtkAssistant implementation of the [`Buildable`][crate::Buildable] interface
36 /// exposes the `action_area` as internal children with the name
37 /// “action_area”.
38 ///
39 /// To add pages to an assistant in [`Builder`][crate::Builder], simply add it as a
40 /// child to the GtkAssistant object, and set its child properties
41 /// as necessary.
42 ///
43 /// # CSS nodes
44 ///
45 /// GtkAssistant has a single CSS node with the name assistant.
46 ///
47 /// ## Properties
48 ///
49 ///
50 /// #### `use-header-bar`
51 /// [`true`] if the assistant uses a [`HeaderBar`][crate::HeaderBar] for action buttons
52 /// instead of the action-area.
53 ///
54 /// For technical reasons, this property is declared as an integer
55 /// property, but you should only set it to [`true`] or [`false`].
56 ///
57 /// Readable | Writable | Construct Only
58 /// <details><summary><h4>Window</h4></summary>
59 ///
60 ///
61 /// #### `accept-focus`
62 /// Whether the window should receive the input focus.
63 ///
64 /// Readable | Writable
65 ///
66 ///
67 /// #### `application`
68 /// The [`Application`][crate::Application] associated with the window.
69 ///
70 /// The application will be kept alive for at least as long as it
71 /// has any windows associated with it (see [`ApplicationExtManual::hold()`][crate::gio::prelude::ApplicationExtManual::hold()]
72 /// for a way to keep it alive without windows).
73 ///
74 /// Normally, the connection between the application and the window
75 /// will remain until the window is destroyed, but you can explicitly
76 /// remove it by setting the :application property to [`None`].
77 ///
78 /// Readable | Writable
79 ///
80 ///
81 /// #### `attached-to`
82 /// The widget to which this window is attached.
83 /// See [`GtkWindowExt::set_attached_to()`][crate::prelude::GtkWindowExt::set_attached_to()].
84 ///
85 /// Examples of places where specifying this relation is useful are
86 /// for instance a [`Menu`][crate::Menu] created by a [`ComboBox`][crate::ComboBox], a completion
87 /// popup window created by [`Entry`][crate::Entry] or a typeahead search entry
88 /// created by [`TreeView`][crate::TreeView].
89 ///
90 /// Readable | Writable | Construct
91 ///
92 ///
93 /// #### `decorated`
94 /// Whether the window should be decorated by the window manager.
95 ///
96 /// Readable | Writable
97 ///
98 ///
99 /// #### `default-height`
100 /// Readable | Writable
101 ///
102 ///
103 /// #### `default-width`
104 /// Readable | Writable
105 ///
106 ///
107 /// #### `deletable`
108 /// Whether the window frame should have a close button.
109 ///
110 /// Readable | Writable
111 ///
112 ///
113 /// #### `destroy-with-parent`
114 /// Readable | Writable
115 ///
116 ///
117 /// #### `focus-on-map`
118 /// Whether the window should receive the input focus when mapped.
119 ///
120 /// Readable | Writable
121 ///
122 ///
123 /// #### `focus-visible`
124 /// Whether 'focus rectangles' are currently visible in this window.
125 ///
126 /// This property is maintained by GTK+ based on user input
127 /// and should not be set by applications.
128 ///
129 /// Readable | Writable
130 ///
131 ///
132 /// #### `gravity`
133 /// The window gravity of the window. See [`GtkWindowExt::move_()`][crate::prelude::GtkWindowExt::move_()] and [`gdk::Gravity`][crate::gdk::Gravity] for
134 /// more details about window gravity.
135 ///
136 /// Readable | Writable
137 ///
138 ///
139 /// #### `has-resize-grip`
140 /// Whether the window has a corner resize grip.
141 ///
142 /// Note that the resize grip is only shown if the window is
143 /// actually resizable and not maximized. Use
144 /// [`resize-grip-visible`][struct@crate::Window#resize-grip-visible] to find out if the resize
145 /// grip is currently shown.
146 ///
147 /// Readable | Writable
148 ///
149 ///
150 /// #### `has-toplevel-focus`
151 /// Readable
152 ///
153 ///
154 /// #### `hide-titlebar-when-maximized`
155 /// Whether the titlebar should be hidden during maximization.
156 ///
157 /// Readable | Writable
158 ///
159 ///
160 /// #### `icon`
161 /// Readable | Writable
162 ///
163 ///
164 /// #### `icon-name`
165 /// The :icon-name property specifies the name of the themed icon to
166 /// use as the window icon. See [`IconTheme`][crate::IconTheme] for more details.
167 ///
168 /// Readable | Writable
169 ///
170 ///
171 /// #### `is-active`
172 /// Readable
173 ///
174 ///
175 /// #### `is-maximized`
176 /// Readable
177 ///
178 ///
179 /// #### `mnemonics-visible`
180 /// Whether mnemonics are currently visible in this window.
181 ///
182 /// This property is maintained by GTK+ based on user input,
183 /// and should not be set by applications.
184 ///
185 /// Readable | Writable
186 ///
187 ///
188 /// #### `modal`
189 /// Readable | Writable
190 ///
191 ///
192 /// #### `resizable`
193 /// Readable | Writable
194 ///
195 ///
196 /// #### `resize-grip-visible`
197 /// Whether a corner resize grip is currently shown.
198 ///
199 /// Readable
200 ///
201 ///
202 /// #### `role`
203 /// Readable | Writable
204 ///
205 ///
206 /// #### `screen`
207 /// Readable | Writable
208 ///
209 ///
210 /// #### `skip-pager-hint`
211 /// Readable | Writable
212 ///
213 ///
214 /// #### `skip-taskbar-hint`
215 /// Readable | Writable
216 ///
217 ///
218 /// #### `startup-id`
219 /// The :startup-id is a write-only property for setting window's
220 /// startup notification identifier. See [`GtkWindowExt::set_startup_id()`][crate::prelude::GtkWindowExt::set_startup_id()]
221 /// for more details.
222 ///
223 /// Writable
224 ///
225 ///
226 /// #### `title`
227 /// Readable | Writable
228 ///
229 ///
230 /// #### `transient-for`
231 /// The transient parent of the window. See [`GtkWindowExt::set_transient_for()`][crate::prelude::GtkWindowExt::set_transient_for()] for
232 /// more details about transient windows.
233 ///
234 /// Readable | Writable | Construct
235 ///
236 ///
237 /// #### `type`
238 /// Readable | Writable | Construct Only
239 ///
240 ///
241 /// #### `type-hint`
242 /// Readable | Writable
243 ///
244 ///
245 /// #### `urgency-hint`
246 /// Readable | Writable
247 ///
248 ///
249 /// #### `window-position`
250 /// Readable | Writable
251 /// </details>
252 /// <details><summary><h4>Container</h4></summary>
253 ///
254 ///
255 /// #### `border-width`
256 /// Readable | Writable
257 ///
258 ///
259 /// #### `child`
260 /// Writable
261 ///
262 ///
263 /// #### `resize-mode`
264 /// Readable | Writable
265 /// </details>
266 /// <details><summary><h4>Widget</h4></summary>
267 ///
268 ///
269 /// #### `app-paintable`
270 /// Readable | Writable
271 ///
272 ///
273 /// #### `can-default`
274 /// Readable | Writable
275 ///
276 ///
277 /// #### `can-focus`
278 /// Readable | Writable
279 ///
280 ///
281 /// #### `composite-child`
282 /// Readable
283 ///
284 ///
285 /// #### `double-buffered`
286 /// Whether the widget is double buffered.
287 ///
288 /// Readable | Writable
289 ///
290 ///
291 /// #### `events`
292 /// Readable | Writable
293 ///
294 ///
295 /// #### `expand`
296 /// Whether to expand in both directions. Setting this sets both [`hexpand`][struct@crate::Widget#hexpand] and [`vexpand`][struct@crate::Widget#vexpand]
297 ///
298 /// Readable | Writable
299 ///
300 ///
301 /// #### `focus-on-click`
302 /// Whether the widget should grab focus when it is clicked with the mouse.
303 ///
304 /// This property is only relevant for widgets that can take focus.
305 ///
306 /// Before 3.20, several widgets (GtkButton, GtkFileChooserButton,
307 /// GtkComboBox) implemented this property individually.
308 ///
309 /// Readable | Writable
310 ///
311 ///
312 /// #### `halign`
313 /// How to distribute horizontal space if widget gets extra space, see [`Align`][crate::Align]
314 ///
315 /// Readable | Writable
316 ///
317 ///
318 /// #### `has-default`
319 /// Readable | Writable
320 ///
321 ///
322 /// #### `has-focus`
323 /// Readable | Writable
324 ///
325 ///
326 /// #### `has-tooltip`
327 /// Enables or disables the emission of [`query-tooltip`][struct@crate::Widget#query-tooltip] on `widget`.
328 /// A value of [`true`] indicates that `widget` can have a tooltip, in this case
329 /// the widget will be queried using [`query-tooltip`][struct@crate::Widget#query-tooltip] to determine
330 /// whether it will provide a tooltip or not.
331 ///
332 /// Note that setting this property to [`true`] for the first time will change
333 /// the event masks of the GdkWindows of this widget to include leave-notify
334 /// and motion-notify events. This cannot and will not be undone when the
335 /// property is set to [`false`] again.
336 ///
337 /// Readable | Writable
338 ///
339 ///
340 /// #### `height-request`
341 /// Readable | Writable
342 ///
343 ///
344 /// #### `hexpand`
345 /// Whether to expand horizontally. See [`WidgetExt::set_hexpand()`][crate::prelude::WidgetExt::set_hexpand()].
346 ///
347 /// Readable | Writable
348 ///
349 ///
350 /// #### `hexpand-set`
351 /// Whether to use the [`hexpand`][struct@crate::Widget#hexpand] property. See [`WidgetExt::is_hexpand_set()`][crate::prelude::WidgetExt::is_hexpand_set()].
352 ///
353 /// Readable | Writable
354 ///
355 ///
356 /// #### `is-focus`
357 /// Readable | Writable
358 ///
359 ///
360 /// #### `margin`
361 /// Sets all four sides' margin at once. If read, returns max
362 /// margin on any side.
363 ///
364 /// Readable | Writable
365 ///
366 ///
367 /// #### `margin-bottom`
368 /// Margin on bottom side of widget.
369 ///
370 /// This property adds margin outside of the widget's normal size
371 /// request, the margin will be added in addition to the size from
372 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
373 ///
374 /// Readable | Writable
375 ///
376 ///
377 /// #### `margin-end`
378 /// Margin on end of widget, horizontally. This property supports
379 /// left-to-right and right-to-left text directions.
380 ///
381 /// This property adds margin outside of the widget's normal size
382 /// request, the margin will be added in addition to the size from
383 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
384 ///
385 /// Readable | Writable
386 ///
387 ///
388 /// #### `margin-left`
389 /// Margin on left side of widget.
390 ///
391 /// This property adds margin outside of the widget's normal size
392 /// request, the margin will be added in addition to the size from
393 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
394 ///
395 /// Readable | Writable
396 ///
397 ///
398 /// #### `margin-right`
399 /// Margin on right side of widget.
400 ///
401 /// This property adds margin outside of the widget's normal size
402 /// request, the margin will be added in addition to the size from
403 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
404 ///
405 /// Readable | Writable
406 ///
407 ///
408 /// #### `margin-start`
409 /// Margin on start of widget, horizontally. This property supports
410 /// left-to-right and right-to-left text directions.
411 ///
412 /// This property adds margin outside of the widget's normal size
413 /// request, the margin will be added in addition to the size from
414 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
415 ///
416 /// Readable | Writable
417 ///
418 ///
419 /// #### `margin-top`
420 /// Margin on top side of widget.
421 ///
422 /// This property adds margin outside of the widget's normal size
423 /// request, the margin will be added in addition to the size from
424 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
425 ///
426 /// Readable | Writable
427 ///
428 ///
429 /// #### `name`
430 /// Readable | Writable
431 ///
432 ///
433 /// #### `no-show-all`
434 /// Readable | Writable
435 ///
436 ///
437 /// #### `opacity`
438 /// The requested opacity of the widget. See [`WidgetExt::set_opacity()`][crate::prelude::WidgetExt::set_opacity()] for
439 /// more details about window opacity.
440 ///
441 /// Before 3.8 this was only available in GtkWindow
442 ///
443 /// Readable | Writable
444 ///
445 ///
446 /// #### `parent`
447 /// Readable | Writable
448 ///
449 ///
450 /// #### `receives-default`
451 /// Readable | Writable
452 ///
453 ///
454 /// #### `scale-factor`
455 /// The scale factor of the widget. See [`WidgetExt::scale_factor()`][crate::prelude::WidgetExt::scale_factor()] for
456 /// more details about widget scaling.
457 ///
458 /// Readable
459 ///
460 ///
461 /// #### `sensitive`
462 /// Readable | Writable
463 ///
464 ///
465 /// #### `style`
466 /// The style of the widget, which contains information about how it will look (colors, etc).
467 ///
468 /// Readable | Writable
469 ///
470 ///
471 /// #### `tooltip-markup`
472 /// Sets the text of tooltip to be the given string, which is marked up
473 /// with the [Pango text markup language][PangoMarkupFormat].
474 /// Also see [`Tooltip::set_markup()`][crate::Tooltip::set_markup()].
475 ///
476 /// This is a convenience property which will take care of getting the
477 /// tooltip shown if the given string is not [`None`]: [`has-tooltip`][struct@crate::Widget#has-tooltip]
478 /// will automatically be set to [`true`] and there will be taken care of
479 /// [`query-tooltip`][struct@crate::Widget#query-tooltip] in the default signal handler.
480 ///
481 /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and [`tooltip-markup`][struct@crate::Widget#tooltip-markup]
482 /// are set, the last one wins.
483 ///
484 /// Readable | Writable
485 ///
486 ///
487 /// #### `tooltip-text`
488 /// Sets the text of tooltip to be the given string.
489 ///
490 /// Also see [`Tooltip::set_text()`][crate::Tooltip::set_text()].
491 ///
492 /// This is a convenience property which will take care of getting the
493 /// tooltip shown if the given string is not [`None`]: [`has-tooltip`][struct@crate::Widget#has-tooltip]
494 /// will automatically be set to [`true`] and there will be taken care of
495 /// [`query-tooltip`][struct@crate::Widget#query-tooltip] in the default signal handler.
496 ///
497 /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and [`tooltip-markup`][struct@crate::Widget#tooltip-markup]
498 /// are set, the last one wins.
499 ///
500 /// Readable | Writable
501 ///
502 ///
503 /// #### `valign`
504 /// How to distribute vertical space if widget gets extra space, see [`Align`][crate::Align]
505 ///
506 /// Readable | Writable
507 ///
508 ///
509 /// #### `vexpand`
510 /// Whether to expand vertically. See [`WidgetExt::set_vexpand()`][crate::prelude::WidgetExt::set_vexpand()].
511 ///
512 /// Readable | Writable
513 ///
514 ///
515 /// #### `vexpand-set`
516 /// Whether to use the [`vexpand`][struct@crate::Widget#vexpand] property. See [`WidgetExt::is_vexpand_set()`][crate::prelude::WidgetExt::is_vexpand_set()].
517 ///
518 /// Readable | Writable
519 ///
520 ///
521 /// #### `visible`
522 /// Readable | Writable
523 ///
524 ///
525 /// #### `width-request`
526 /// Readable | Writable
527 ///
528 ///
529 /// #### `window`
530 /// The widget's window if it is realized, [`None`] otherwise.
531 ///
532 /// Readable
533 /// </details>
534 ///
535 /// ## Signals
536 ///
537 ///
538 /// #### `apply`
539 /// The ::apply signal is emitted when the apply button is clicked.
540 ///
541 /// The default behavior of the [`Assistant`][crate::Assistant] is to switch to the page
542 /// after the current page, unless the current page is the last one.
543 ///
544 /// A handler for the ::apply signal should carry out the actions for
545 /// which the wizard has collected data. If the action takes a long time
546 /// to complete, you might consider putting a page of type
547 /// [`AssistantPageType::Progress`][crate::AssistantPageType::Progress] after the confirmation page and handle
548 /// this operation within the [`prepare`][struct@crate::Assistant#prepare] signal of the progress
549 /// page.
550 ///
551 ///
552 ///
553 ///
554 /// #### `cancel`
555 /// The ::cancel signal is emitted when then the cancel button is clicked.
556 ///
557 ///
558 ///
559 ///
560 /// #### `close`
561 /// The ::close signal is emitted either when the close button of
562 /// a summary page is clicked, or when the apply button in the last
563 /// page in the flow (of type [`AssistantPageType::Confirm`][crate::AssistantPageType::Confirm]) is clicked.
564 ///
565 ///
566 ///
567 ///
568 /// #### `escape`
569 /// Action
570 ///
571 ///
572 /// #### `prepare`
573 /// The ::prepare signal is emitted when a new page is set as the
574 /// assistant's current page, before making the new page visible.
575 ///
576 /// A handler for this signal can do any preparations which are
577 /// necessary before showing `page`.
578 ///
579 ///
580 /// <details><summary><h4>Window</h4></summary>
581 ///
582 ///
583 /// #### `activate-default`
584 /// The ::activate-default signal is a
585 /// [keybinding signal][GtkBindingSignal]
586 /// which gets emitted when the user activates the default widget
587 /// of `window`.
588 ///
589 /// Action
590 ///
591 ///
592 /// #### `activate-focus`
593 /// The ::activate-focus signal is a
594 /// [keybinding signal][GtkBindingSignal]
595 /// which gets emitted when the user activates the currently
596 /// focused widget of `window`.
597 ///
598 /// Action
599 ///
600 ///
601 /// #### `enable-debugging`
602 /// The ::enable-debugging signal is a [keybinding signal][GtkBindingSignal]
603 /// which gets emitted when the user enables or disables interactive
604 /// debugging. When `toggle` is [`true`], interactive debugging is toggled
605 /// on or off, when it is [`false`], the debugger will be pointed at the
606 /// widget under the pointer.
607 ///
608 /// The default bindings for this signal are Ctrl-Shift-I
609 /// and Ctrl-Shift-D.
610 ///
611 /// Action
612 ///
613 ///
614 /// #### `keys-changed`
615 /// The ::keys-changed signal gets emitted when the set of accelerators
616 /// or mnemonics that are associated with `window` changes.
617 ///
618 ///
619 ///
620 ///
621 /// #### `set-focus`
622 /// This signal is emitted whenever the currently focused widget in
623 /// this window changes.
624 ///
625 ///
626 /// </details>
627 /// <details><summary><h4>Container</h4></summary>
628 ///
629 ///
630 /// #### `add`
631 ///
632 ///
633 ///
634 /// #### `check-resize`
635 ///
636 ///
637 ///
638 /// #### `remove`
639 ///
640 ///
641 ///
642 /// #### `set-focus-child`
643 ///
644 /// </details>
645 /// <details><summary><h4>Widget</h4></summary>
646 ///
647 ///
648 /// #### `accel-closures-changed`
649 ///
650 ///
651 ///
652 /// #### `button-press-event`
653 /// The ::button-press-event signal will be emitted when a button
654 /// (typically from a mouse) is pressed.
655 ///
656 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the
657 /// widget needs to enable the [`gdk::EventMask::BUTTON_PRESS_MASK`][crate::gdk::EventMask::BUTTON_PRESS_MASK] mask.
658 ///
659 /// This signal will be sent to the grab widget if there is one.
660 ///
661 ///
662 ///
663 ///
664 /// #### `button-release-event`
665 /// The ::button-release-event signal will be emitted when a button
666 /// (typically from a mouse) is released.
667 ///
668 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the
669 /// widget needs to enable the [`gdk::EventMask::BUTTON_RELEASE_MASK`][crate::gdk::EventMask::BUTTON_RELEASE_MASK] mask.
670 ///
671 /// This signal will be sent to the grab widget if there is one.
672 ///
673 ///
674 ///
675 ///
676 /// #### `can-activate-accel`
677 /// Determines whether an accelerator that activates the signal
678 /// identified by `signal_id` can currently be activated.
679 /// This signal is present to allow applications and derived
680 /// widgets to override the default [`Widget`][crate::Widget] handling
681 /// for determining whether an accelerator can be activated.
682 ///
683 ///
684 ///
685 ///
686 /// #### `child-notify`
687 /// The ::child-notify signal is emitted for each
688 /// [child property][child-properties] that has
689 /// changed on an object. The signal's detail holds the property name.
690 ///
691 /// Detailed
692 ///
693 ///
694 /// #### `composited-changed`
695 /// The ::composited-changed signal is emitted when the composited
696 /// status of `widgets` screen changes.
697 /// See [`Screen::is_composited()`][crate::gdk::Screen::is_composited()].
698 ///
699 /// Action
700 ///
701 ///
702 /// #### `configure-event`
703 /// The ::configure-event signal will be emitted when the size, position or
704 /// stacking of the `widget`'s window has changed.
705 ///
706 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
707 /// to enable the [`gdk::EventMask::STRUCTURE_MASK`][crate::gdk::EventMask::STRUCTURE_MASK] mask. GDK will enable this mask
708 /// automatically for all new windows.
709 ///
710 ///
711 ///
712 ///
713 /// #### `damage-event`
714 /// Emitted when a redirected window belonging to `widget` gets drawn into.
715 /// The region/area members of the event shows what area of the redirected
716 /// drawable was drawn into.
717 ///
718 ///
719 ///
720 ///
721 /// #### `delete-event`
722 /// The ::delete-event signal is emitted if a user requests that
723 /// a toplevel window is closed. The default handler for this signal
724 /// destroys the window. Connecting [`WidgetExtManual::hide_on_delete()`][crate::prelude::WidgetExtManual::hide_on_delete()] to
725 /// this signal will cause the window to be hidden instead, so that
726 /// it can later be shown again without reconstructing it.
727 ///
728 ///
729 ///
730 ///
731 /// #### `destroy`
732 /// Signals that all holders of a reference to the widget should release
733 /// the reference that they hold. May result in finalization of the widget
734 /// if all references are released.
735 ///
736 /// This signal is not suitable for saving widget state.
737 ///
738 ///
739 ///
740 ///
741 /// #### `destroy-event`
742 /// The ::destroy-event signal is emitted when a [`gdk::Window`][crate::gdk::Window] is destroyed.
743 /// You rarely get this signal, because most widgets disconnect themselves
744 /// from their window before they destroy it, so no widget owns the
745 /// window at destroy time.
746 ///
747 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
748 /// to enable the [`gdk::EventMask::STRUCTURE_MASK`][crate::gdk::EventMask::STRUCTURE_MASK] mask. GDK will enable this mask
749 /// automatically for all new windows.
750 ///
751 ///
752 ///
753 ///
754 /// #### `direction-changed`
755 /// The ::direction-changed signal is emitted when the text direction
756 /// of a widget changes.
757 ///
758 ///
759 ///
760 ///
761 /// #### `drag-begin`
762 /// The ::drag-begin signal is emitted on the drag source when a drag is
763 /// started. A typical reason to connect to this signal is to set up a
764 /// custom drag icon with e.g. [`WidgetExt::drag_source_set_icon_pixbuf()`][crate::prelude::WidgetExt::drag_source_set_icon_pixbuf()].
765 ///
766 /// Note that some widgets set up a drag icon in the default handler of
767 /// this signal, so you may have to use `g_signal_connect_after()` to
768 /// override what the default handler did.
769 ///
770 ///
771 ///
772 ///
773 /// #### `drag-data-delete`
774 /// The ::drag-data-delete signal is emitted on the drag source when a drag
775 /// with the action [`gdk::DragAction::MOVE`][crate::gdk::DragAction::MOVE] is successfully completed. The signal
776 /// handler is responsible for deleting the data that has been dropped. What
777 /// "delete" means depends on the context of the drag operation.
778 ///
779 ///
780 ///
781 ///
782 /// #### `drag-data-get`
783 /// The ::drag-data-get signal is emitted on the drag source when the drop
784 /// site requests the data which is dragged. It is the responsibility of
785 /// the signal handler to fill `data` with the data in the format which
786 /// is indicated by `info`. See [`SelectionData::set()`][crate::SelectionData::set()] and
787 /// [`SelectionData::set_text()`][crate::SelectionData::set_text()].
788 ///
789 ///
790 ///
791 ///
792 /// #### `drag-data-received`
793 /// format == 8))
794 /// {
795 /// GdkDragAction action;
796 ///
797 /// // handle data here
798 ///
799 /// action = gdk_drag_context_get_selected_action (context);
800 /// if (action == GDK_ACTION_ASK)
801 /// {
802 /// GtkWidget *dialog;
803 /// gint response;
804 ///
805 /// dialog = gtk_message_dialog_new (NULL,
806 /// GTK_DIALOG_MODAL |
807 /// GTK_DIALOG_DESTROY_WITH_PARENT,
808 /// GTK_MESSAGE_INFO,
809 /// GTK_BUTTONS_YES_NO,
810 /// "Move the data ?\n");
811 /// response = gtk_dialog_run (GTK_DIALOG (dialog));
812 /// gtk_widget_destroy (dialog);
813 ///
814 /// if (response == GTK_RESPONSE_YES)
815 /// action = GDK_ACTION_MOVE;
816 /// else
817 /// action = GDK_ACTION_COPY;
818 /// }
819 ///
820 /// gtk_drag_finish (context, TRUE, action == GDK_ACTION_MOVE, time);
821 /// }
822 /// else
823 /// gtk_drag_finish (context, FALSE, FALSE, time);
824 /// }
825 /// ]|
826 ///
827 ///
828 ///
829 ///
830 /// #### `drag-drop`
831 /// The ::drag-drop signal is emitted on the drop site when the user drops
832 /// the data onto the widget. The signal handler must determine whether
833 /// the cursor position is in a drop zone or not. If it is not in a drop
834 /// zone, it returns [`false`] and no further processing is necessary.
835 /// Otherwise, the handler returns [`true`]. In this case, the handler must
836 /// ensure that `gtk_drag_finish()` is called to let the source know that
837 /// the drop is done. The call to `gtk_drag_finish()` can be done either
838 /// directly or in a [`drag-data-received`][struct@crate::Widget#drag-data-received] handler which gets
839 /// triggered by calling [`WidgetExt::drag_get_data()`][crate::prelude::WidgetExt::drag_get_data()] to receive the data for one
840 /// or more of the supported targets.
841 ///
842 ///
843 ///
844 ///
845 /// #### `drag-end`
846 /// The ::drag-end signal is emitted on the drag source when a drag is
847 /// finished. A typical reason to connect to this signal is to undo
848 /// things done in [`drag-begin`][struct@crate::Widget#drag-begin].
849 ///
850 ///
851 ///
852 ///
853 /// #### `drag-failed`
854 /// The ::drag-failed signal is emitted on the drag source when a drag has
855 /// failed. The signal handler may hook custom code to handle a failed DnD
856 /// operation based on the type of error, it returns [`true`] is the failure has
857 /// been already handled (not showing the default "drag operation failed"
858 /// animation), otherwise it returns [`false`].
859 ///
860 ///
861 ///
862 ///
863 /// #### `drag-leave`
864 /// The ::drag-leave signal is emitted on the drop site when the cursor
865 /// leaves the widget. A typical reason to connect to this signal is to
866 /// undo things done in [`drag-motion`][struct@crate::Widget#drag-motion], e.g. undo highlighting
867 /// with [`WidgetExt::drag_unhighlight()`][crate::prelude::WidgetExt::drag_unhighlight()].
868 ///
869 ///
870 /// Likewise, the [`drag-leave`][struct@crate::Widget#drag-leave] signal is also emitted before the
871 /// ::drag-drop signal, for instance to allow cleaning up of a preview item
872 /// created in the [`drag-motion`][struct@crate::Widget#drag-motion] signal handler.
873 ///
874 ///
875 ///
876 ///
877 /// #### `drag-motion`
878 /// suggested_action,
879 /// time);
880 /// }
881 /// else
882 /// {
883 /// // accept the drop
884 /// }
885 /// }
886 /// ]|
887 ///
888 ///
889 ///
890 ///
891 /// #### `draw`
892 /// This signal is emitted when a widget is supposed to render itself.
893 /// The `widget`'s top left corner must be painted at the origin of
894 /// the passed in context and be sized to the values returned by
895 /// [`WidgetExt::allocated_width()`][crate::prelude::WidgetExt::allocated_width()] and
896 /// [`WidgetExt::allocated_height()`][crate::prelude::WidgetExt::allocated_height()].
897 ///
898 /// Signal handlers connected to this signal can modify the cairo
899 /// context passed as `cr` in any way they like and don't need to
900 /// restore it. The signal emission takes care of calling `cairo_save()`
901 /// before and `cairo_restore()` after invoking the handler.
902 ///
903 /// The signal handler will get a `cr` with a clip region already set to the
904 /// widget's dirty region, i.e. to the area that needs repainting. Complicated
905 /// widgets that want to avoid redrawing themselves completely can get the full
906 /// extents of the clip region with `gdk_cairo_get_clip_rectangle()`, or they can
907 /// get a finer-grained representation of the dirty region with
908 /// `cairo_copy_clip_rectangle_list()`.
909 ///
910 ///
911 ///
912 ///
913 /// #### `enter-notify-event`
914 /// The ::enter-notify-event will be emitted when the pointer enters
915 /// the `widget`'s window.
916 ///
917 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
918 /// to enable the [`gdk::EventMask::ENTER_NOTIFY_MASK`][crate::gdk::EventMask::ENTER_NOTIFY_MASK] mask.
919 ///
920 /// This signal will be sent to the grab widget if there is one.
921 ///
922 ///
923 ///
924 ///
925 /// #### `event`
926 /// The GTK+ main loop will emit three signals for each GDK event delivered
927 /// to a widget: one generic ::event signal, another, more specific,
928 /// signal that matches the type of event delivered (e.g.
929 /// [`key-press-event`][struct@crate::Widget#key-press-event]) and finally a generic
930 /// [`event-after`][struct@crate::Widget#event-after] signal.
931 ///
932 ///
933 ///
934 ///
935 /// #### `event-after`
936 /// After the emission of the [`event`][struct@crate::Widget#event] signal and (optionally)
937 /// the second more specific signal, ::event-after will be emitted
938 /// regardless of the previous two signals handlers return values.
939 ///
940 ///
941 ///
942 ///
943 /// #### `focus`
944 ///
945 ///
946 ///
947 /// #### `focus-in-event`
948 /// The ::focus-in-event signal will be emitted when the keyboard focus
949 /// enters the `widget`'s window.
950 ///
951 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
952 /// to enable the [`gdk::EventMask::FOCUS_CHANGE_MASK`][crate::gdk::EventMask::FOCUS_CHANGE_MASK] mask.
953 ///
954 ///
955 ///
956 ///
957 /// #### `focus-out-event`
958 /// The ::focus-out-event signal will be emitted when the keyboard focus
959 /// leaves the `widget`'s window.
960 ///
961 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
962 /// to enable the [`gdk::EventMask::FOCUS_CHANGE_MASK`][crate::gdk::EventMask::FOCUS_CHANGE_MASK] mask.
963 ///
964 ///
965 ///
966 ///
967 /// #### `grab-broken-event`
968 /// Emitted when a pointer or keyboard grab on a window belonging
969 /// to `widget` gets broken.
970 ///
971 /// On X11, this happens when the grab window becomes unviewable
972 /// (i.e. it or one of its ancestors is unmapped), or if the same
973 /// application grabs the pointer or keyboard again.
974 ///
975 ///
976 ///
977 ///
978 /// #### `grab-focus`
979 /// Action
980 ///
981 ///
982 /// #### `grab-notify`
983 /// The ::grab-notify signal is emitted when a widget becomes
984 /// shadowed by a GTK+ grab (not a pointer or keyboard grab) on
985 /// another widget, or when it becomes unshadowed due to a grab
986 /// being removed.
987 ///
988 /// A widget is shadowed by a [`WidgetExt::grab_add()`][crate::prelude::WidgetExt::grab_add()] when the topmost
989 /// grab widget in the grab stack of its window group is not
990 /// its ancestor.
991 ///
992 ///
993 ///
994 ///
995 /// #### `hide`
996 /// The ::hide signal is emitted when `widget` is hidden, for example with
997 /// [`WidgetExt::hide()`][crate::prelude::WidgetExt::hide()].
998 ///
999 ///
1000 ///
1001 ///
1002 /// #### `hierarchy-changed`
1003 /// The ::hierarchy-changed signal is emitted when the
1004 /// anchored state of a widget changes. A widget is
1005 /// “anchored” when its toplevel
1006 /// ancestor is a [`Window`][crate::Window]. This signal is emitted when
1007 /// a widget changes from un-anchored to anchored or vice-versa.
1008 ///
1009 ///
1010 ///
1011 ///
1012 /// #### `key-press-event`
1013 /// The ::key-press-event signal is emitted when a key is pressed. The signal
1014 /// emission will reoccur at the key-repeat rate when the key is kept pressed.
1015 ///
1016 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
1017 /// to enable the [`gdk::EventMask::KEY_PRESS_MASK`][crate::gdk::EventMask::KEY_PRESS_MASK] mask.
1018 ///
1019 /// This signal will be sent to the grab widget if there is one.
1020 ///
1021 ///
1022 ///
1023 ///
1024 /// #### `key-release-event`
1025 /// The ::key-release-event signal is emitted when a key is released.
1026 ///
1027 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
1028 /// to enable the [`gdk::EventMask::KEY_RELEASE_MASK`][crate::gdk::EventMask::KEY_RELEASE_MASK] mask.
1029 ///
1030 /// This signal will be sent to the grab widget if there is one.
1031 ///
1032 ///
1033 ///
1034 ///
1035 /// #### `keynav-failed`
1036 /// Gets emitted if keyboard navigation fails.
1037 /// See [`WidgetExt::keynav_failed()`][crate::prelude::WidgetExt::keynav_failed()] for details.
1038 ///
1039 ///
1040 ///
1041 ///
1042 /// #### `leave-notify-event`
1043 /// The ::leave-notify-event will be emitted when the pointer leaves
1044 /// the `widget`'s window.
1045 ///
1046 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
1047 /// to enable the [`gdk::EventMask::LEAVE_NOTIFY_MASK`][crate::gdk::EventMask::LEAVE_NOTIFY_MASK] mask.
1048 ///
1049 /// This signal will be sent to the grab widget if there is one.
1050 ///
1051 ///
1052 ///
1053 ///
1054 /// #### `map`
1055 /// The ::map signal is emitted when `widget` is going to be mapped, that is
1056 /// when the widget is visible (which is controlled with
1057 /// [`WidgetExt::set_visible()`][crate::prelude::WidgetExt::set_visible()]) and all its parents up to the toplevel widget
1058 /// are also visible. Once the map has occurred, [`map-event`][struct@crate::Widget#map-event] will
1059 /// be emitted.
1060 ///
1061 /// The ::map signal can be used to determine whether a widget will be drawn,
1062 /// for instance it can resume an animation that was stopped during the
1063 /// emission of [`unmap`][struct@crate::Widget#unmap].
1064 ///
1065 ///
1066 ///
1067 ///
1068 /// #### `map-event`
1069 /// The ::map-event signal will be emitted when the `widget`'s window is
1070 /// mapped. A window is mapped when it becomes visible on the screen.
1071 ///
1072 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
1073 /// to enable the [`gdk::EventMask::STRUCTURE_MASK`][crate::gdk::EventMask::STRUCTURE_MASK] mask. GDK will enable this mask
1074 /// automatically for all new windows.
1075 ///
1076 ///
1077 ///
1078 ///
1079 /// #### `mnemonic-activate`
1080 /// The default handler for this signal activates `widget` if `group_cycling`
1081 /// is [`false`], or just makes `widget` grab focus if `group_cycling` is [`true`].
1082 ///
1083 ///
1084 ///
1085 ///
1086 /// #### `motion-notify-event`
1087 /// The ::motion-notify-event signal is emitted when the pointer moves
1088 /// over the widget's [`gdk::Window`][crate::gdk::Window].
1089 ///
1090 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget
1091 /// needs to enable the [`gdk::EventMask::POINTER_MOTION_MASK`][crate::gdk::EventMask::POINTER_MOTION_MASK] mask.
1092 ///
1093 /// This signal will be sent to the grab widget if there is one.
1094 ///
1095 ///
1096 ///
1097 ///
1098 /// #### `move-focus`
1099 /// Action
1100 ///
1101 ///
1102 /// #### `parent-set`
1103 /// The ::parent-set signal is emitted when a new parent
1104 /// has been set on a widget.
1105 ///
1106 ///
1107 ///
1108 ///
1109 /// #### `popup-menu`
1110 /// This signal gets emitted whenever a widget should pop up a context
1111 /// menu. This usually happens through the standard key binding mechanism;
1112 /// by pressing a certain key while a widget is focused, the user can cause
1113 /// the widget to pop up a menu. For example, the [`Entry`][crate::Entry] widget creates
1114 /// a menu with clipboard commands. See the
1115 /// [Popup Menu Migration Checklist][checklist-popup-menu]
1116 /// for an example of how to use this signal.
1117 ///
1118 /// Action
1119 ///
1120 ///
1121 /// #### `property-notify-event`
1122 /// The ::property-notify-event signal will be emitted when a property on
1123 /// the `widget`'s window has been changed or deleted.
1124 ///
1125 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
1126 /// to enable the [`gdk::EventMask::PROPERTY_CHANGE_MASK`][crate::gdk::EventMask::PROPERTY_CHANGE_MASK] mask.
1127 ///
1128 ///
1129 ///
1130 ///
1131 /// #### `proximity-in-event`
1132 /// To receive this signal the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
1133 /// to enable the [`gdk::EventMask::PROXIMITY_IN_MASK`][crate::gdk::EventMask::PROXIMITY_IN_MASK] mask.
1134 ///
1135 /// This signal will be sent to the grab widget if there is one.
1136 ///
1137 ///
1138 ///
1139 ///
1140 /// #### `proximity-out-event`
1141 /// To receive this signal the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
1142 /// to enable the [`gdk::EventMask::PROXIMITY_OUT_MASK`][crate::gdk::EventMask::PROXIMITY_OUT_MASK] mask.
1143 ///
1144 /// This signal will be sent to the grab widget if there is one.
1145 ///
1146 ///
1147 ///
1148 ///
1149 /// #### `query-tooltip`
1150 /// Emitted when [`has-tooltip`][struct@crate::Widget#has-tooltip] is [`true`] and the hover timeout
1151 /// has expired with the cursor hovering "above" `widget`; or emitted when `widget` got
1152 /// focus in keyboard mode.
1153 ///
1154 /// Using the given coordinates, the signal handler should determine
1155 /// whether a tooltip should be shown for `widget`. If this is the case
1156 /// [`true`] should be returned, [`false`] otherwise. Note that if
1157 /// `keyboard_mode` is [`true`], the values of `x` and `y` are undefined and
1158 /// should not be used.
1159 ///
1160 /// The signal handler is free to manipulate `tooltip` with the therefore
1161 /// destined function calls.
1162 ///
1163 ///
1164 ///
1165 ///
1166 /// #### `realize`
1167 /// The ::realize signal is emitted when `widget` is associated with a
1168 /// [`gdk::Window`][crate::gdk::Window], which means that [`WidgetExt::realize()`][crate::prelude::WidgetExt::realize()] has been called or the
1169 /// widget has been mapped (that is, it is going to be drawn).
1170 ///
1171 ///
1172 ///
1173 ///
1174 /// #### `screen-changed`
1175 /// The ::screen-changed signal gets emitted when the
1176 /// screen of a widget has changed.
1177 ///
1178 ///
1179 ///
1180 ///
1181 /// #### `scroll-event`
1182 /// The ::scroll-event signal is emitted when a button in the 4 to 7
1183 /// range is pressed. Wheel mice are usually configured to generate
1184 /// button press events for buttons 4 and 5 when the wheel is turned.
1185 ///
1186 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
1187 /// to enable the [`gdk::EventMask::SCROLL_MASK`][crate::gdk::EventMask::SCROLL_MASK] mask.
1188 ///
1189 /// This signal will be sent to the grab widget if there is one.
1190 ///
1191 ///
1192 ///
1193 ///
1194 /// #### `selection-clear-event`
1195 /// The ::selection-clear-event signal will be emitted when the
1196 /// the `widget`'s window has lost ownership of a selection.
1197 ///
1198 ///
1199 ///
1200 ///
1201 /// #### `selection-get`
1202 ///
1203 ///
1204 ///
1205 /// #### `selection-notify-event`
1206 ///
1207 ///
1208 ///
1209 /// #### `selection-received`
1210 ///
1211 ///
1212 ///
1213 /// #### `selection-request-event`
1214 /// The ::selection-request-event signal will be emitted when
1215 /// another client requests ownership of the selection owned by
1216 /// the `widget`'s window.
1217 ///
1218 ///
1219 ///
1220 ///
1221 /// #### `show`
1222 /// The ::show signal is emitted when `widget` is shown, for example with
1223 /// [`WidgetExt::show()`][crate::prelude::WidgetExt::show()].
1224 ///
1225 ///
1226 ///
1227 ///
1228 /// #### `show-help`
1229 /// Action
1230 ///
1231 ///
1232 /// #### `size-allocate`
1233 ///
1234 ///
1235 ///
1236 /// #### `state-changed`
1237 /// The ::state-changed signal is emitted when the widget state changes.
1238 /// See `gtk_widget_get_state()`.
1239 ///
1240 ///
1241 ///
1242 ///
1243 /// #### `state-flags-changed`
1244 /// The ::state-flags-changed signal is emitted when the widget state
1245 /// changes, see [`WidgetExt::state_flags()`][crate::prelude::WidgetExt::state_flags()].
1246 ///
1247 ///
1248 ///
1249 ///
1250 /// #### `style-set`
1251 /// The ::style-set signal is emitted when a new style has been set
1252 /// on a widget. Note that style-modifying functions like
1253 /// `gtk_widget_modify_base()` also cause this signal to be emitted.
1254 ///
1255 /// Note that this signal is emitted for changes to the deprecated
1256 /// `GtkStyle`. To track changes to the [`StyleContext`][crate::StyleContext] associated
1257 /// with a widget, use the [`style-updated`][struct@crate::Widget#style-updated] signal.
1258 ///
1259 ///
1260 ///
1261 ///
1262 /// #### `style-updated`
1263 /// The ::style-updated signal is a convenience signal that is emitted when the
1264 /// [`changed`][struct@crate::StyleContext#changed] signal is emitted on the `widget`'s associated
1265 /// [`StyleContext`][crate::StyleContext] as returned by [`WidgetExt::style_context()`][crate::prelude::WidgetExt::style_context()].
1266 ///
1267 /// Note that style-modifying functions like `gtk_widget_override_color()` also
1268 /// cause this signal to be emitted.
1269 ///
1270 ///
1271 ///
1272 ///
1273 /// #### `touch-event`
1274 ///
1275 ///
1276 ///
1277 /// #### `unmap`
1278 /// The ::unmap signal is emitted when `widget` is going to be unmapped, which
1279 /// means that either it or any of its parents up to the toplevel widget have
1280 /// been set as hidden.
1281 ///
1282 /// As ::unmap indicates that a widget will not be shown any longer, it can be
1283 /// used to, for example, stop an animation on the widget.
1284 ///
1285 ///
1286 ///
1287 ///
1288 /// #### `unmap-event`
1289 /// The ::unmap-event signal will be emitted when the `widget`'s window is
1290 /// unmapped. A window is unmapped when it becomes invisible on the screen.
1291 ///
1292 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
1293 /// to enable the [`gdk::EventMask::STRUCTURE_MASK`][crate::gdk::EventMask::STRUCTURE_MASK] mask. GDK will enable this mask
1294 /// automatically for all new windows.
1295 ///
1296 ///
1297 ///
1298 ///
1299 /// #### `unrealize`
1300 /// The ::unrealize signal is emitted when the [`gdk::Window`][crate::gdk::Window] associated with
1301 /// `widget` is destroyed, which means that [`WidgetExt::unrealize()`][crate::prelude::WidgetExt::unrealize()] has been
1302 /// called or the widget has been unmapped (that is, it is going to be
1303 /// hidden).
1304 ///
1305 ///
1306 ///
1307 ///
1308 /// #### `visibility-notify-event`
1309 /// The ::visibility-notify-event will be emitted when the `widget`'s
1310 /// window is obscured or unobscured.
1311 ///
1312 /// To receive this signal the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
1313 /// to enable the [`gdk::EventMask::VISIBILITY_NOTIFY_MASK`][crate::gdk::EventMask::VISIBILITY_NOTIFY_MASK] mask.
1314 ///
1315 ///
1316 ///
1317 ///
1318 /// #### `window-state-event`
1319 /// The ::window-state-event will be emitted when the state of the
1320 /// toplevel window associated to the `widget` changes.
1321 ///
1322 /// To receive this signal the [`gdk::Window`][crate::gdk::Window] associated to the widget
1323 /// needs to enable the [`gdk::EventMask::STRUCTURE_MASK`][crate::gdk::EventMask::STRUCTURE_MASK] mask. GDK will enable
1324 /// this mask automatically for all new windows.
1325 ///
1326 ///
1327 /// </details>
1328 ///
1329 /// # Implements
1330 ///
1331 /// [`AssistantExt`][trait@crate::prelude::AssistantExt], [`GtkWindowExt`][trait@crate::prelude::GtkWindowExt], [`BinExt`][trait@crate::prelude::BinExt], [`ContainerExt`][trait@crate::prelude::ContainerExt], [`WidgetExt`][trait@crate::prelude::WidgetExt], [`trait@glib::ObjectExt`], [`BuildableExt`][trait@crate::prelude::BuildableExt], [`GtkWindowExtManual`][trait@crate::prelude::GtkWindowExtManual], [`ContainerExtManual`][trait@crate::prelude::ContainerExtManual], [`WidgetExtManual`][trait@crate::prelude::WidgetExtManual], [`BuildableExtManual`][trait@crate::prelude::BuildableExtManual]
1332 #[doc(alias = "GtkAssistant")]
1333 pub struct Assistant(Object<ffi::GtkAssistant, ffi::GtkAssistantClass>) @extends Window, Bin, Container, Widget, @implements Buildable;
1334
1335 match fn {
1336 type_ => || ffi::gtk_assistant_get_type(),
1337 }
1338}
1339
1340impl Assistant {
1341 pub const NONE: Option<&'static Assistant> = None;
1342
1343 /// Creates a new [`Assistant`][crate::Assistant].
1344 ///
1345 /// # Returns
1346 ///
1347 /// a newly created [`Assistant`][crate::Assistant]
1348 #[doc(alias = "gtk_assistant_new")]
1349 pub fn new() -> Assistant {
1350 assert_initialized_main_thread!();
1351 unsafe { Widget::from_glib_none(ffi::gtk_assistant_new()).unsafe_cast() }
1352 }
1353
1354 // rustdoc-stripper-ignore-next
1355 /// Creates a new builder-pattern struct instance to construct [`Assistant`] objects.
1356 ///
1357 /// This method returns an instance of [`AssistantBuilder`](crate::builders::AssistantBuilder) which can be used to create [`Assistant`] objects.
1358 pub fn builder() -> AssistantBuilder {
1359 AssistantBuilder::new()
1360 }
1361}
1362
1363impl Default for Assistant {
1364 fn default() -> Self {
1365 Self::new()
1366 }
1367}
1368
1369// rustdoc-stripper-ignore-next
1370/// A [builder-pattern] type to construct [`Assistant`] objects.
1371///
1372/// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html
1373#[must_use = "The builder must be built to be used"]
1374pub struct AssistantBuilder {
1375 builder: glib::object::ObjectBuilder<'static, Assistant>,
1376}
1377
1378impl AssistantBuilder {
1379 fn new() -> Self {
1380 Self {
1381 builder: glib::object::Object::builder(),
1382 }
1383 }
1384
1385 /// [`true`] if the assistant uses a [`HeaderBar`][crate::HeaderBar] for action buttons
1386 /// instead of the action-area.
1387 ///
1388 /// For technical reasons, this property is declared as an integer
1389 /// property, but you should only set it to [`true`] or [`false`].
1390 pub fn use_header_bar(self, use_header_bar: i32) -> Self {
1391 Self {
1392 builder: self.builder.property("use-header-bar", use_header_bar),
1393 }
1394 }
1395
1396 /// Whether the window should receive the input focus.
1397 pub fn accept_focus(self, accept_focus: bool) -> Self {
1398 Self {
1399 builder: self.builder.property("accept-focus", accept_focus),
1400 }
1401 }
1402
1403 /// The [`Application`][crate::Application] associated with the window.
1404 ///
1405 /// The application will be kept alive for at least as long as it
1406 /// has any windows associated with it (see [`ApplicationExtManual::hold()`][crate::gio::prelude::ApplicationExtManual::hold()]
1407 /// for a way to keep it alive without windows).
1408 ///
1409 /// Normally, the connection between the application and the window
1410 /// will remain until the window is destroyed, but you can explicitly
1411 /// remove it by setting the :application property to [`None`].
1412 pub fn application(self, application: &impl IsA<Application>) -> Self {
1413 Self {
1414 builder: self
1415 .builder
1416 .property("application", application.clone().upcast()),
1417 }
1418 }
1419
1420 /// The widget to which this window is attached.
1421 /// See [`GtkWindowExt::set_attached_to()`][crate::prelude::GtkWindowExt::set_attached_to()].
1422 ///
1423 /// Examples of places where specifying this relation is useful are
1424 /// for instance a [`Menu`][crate::Menu] created by a [`ComboBox`][crate::ComboBox], a completion
1425 /// popup window created by [`Entry`][crate::Entry] or a typeahead search entry
1426 /// created by [`TreeView`][crate::TreeView].
1427 pub fn attached_to(self, attached_to: &impl IsA<Widget>) -> Self {
1428 Self {
1429 builder: self
1430 .builder
1431 .property("attached-to", attached_to.clone().upcast()),
1432 }
1433 }
1434
1435 /// Whether the window should be decorated by the window manager.
1436 pub fn decorated(self, decorated: bool) -> Self {
1437 Self {
1438 builder: self.builder.property("decorated", decorated),
1439 }
1440 }
1441
1442 pub fn default_height(self, default_height: i32) -> Self {
1443 Self {
1444 builder: self.builder.property("default-height", default_height),
1445 }
1446 }
1447
1448 pub fn default_width(self, default_width: i32) -> Self {
1449 Self {
1450 builder: self.builder.property("default-width", default_width),
1451 }
1452 }
1453
1454 /// Whether the window frame should have a close button.
1455 pub fn deletable(self, deletable: bool) -> Self {
1456 Self {
1457 builder: self.builder.property("deletable", deletable),
1458 }
1459 }
1460
1461 pub fn destroy_with_parent(self, destroy_with_parent: bool) -> Self {
1462 Self {
1463 builder: self
1464 .builder
1465 .property("destroy-with-parent", destroy_with_parent),
1466 }
1467 }
1468
1469 /// Whether the window should receive the input focus when mapped.
1470 pub fn focus_on_map(self, focus_on_map: bool) -> Self {
1471 Self {
1472 builder: self.builder.property("focus-on-map", focus_on_map),
1473 }
1474 }
1475
1476 /// Whether 'focus rectangles' are currently visible in this window.
1477 ///
1478 /// This property is maintained by GTK+ based on user input
1479 /// and should not be set by applications.
1480 pub fn focus_visible(self, focus_visible: bool) -> Self {
1481 Self {
1482 builder: self.builder.property("focus-visible", focus_visible),
1483 }
1484 }
1485
1486 /// The window gravity of the window. See [`GtkWindowExt::move_()`][crate::prelude::GtkWindowExt::move_()] and [`gdk::Gravity`][crate::gdk::Gravity] for
1487 /// more details about window gravity.
1488 pub fn gravity(self, gravity: gdk::Gravity) -> Self {
1489 Self {
1490 builder: self.builder.property("gravity", gravity),
1491 }
1492 }
1493
1494 /// Whether the titlebar should be hidden during maximization.
1495 pub fn hide_titlebar_when_maximized(self, hide_titlebar_when_maximized: bool) -> Self {
1496 Self {
1497 builder: self
1498 .builder
1499 .property("hide-titlebar-when-maximized", hide_titlebar_when_maximized),
1500 }
1501 }
1502
1503 pub fn icon(self, icon: &gdk_pixbuf::Pixbuf) -> Self {
1504 Self {
1505 builder: self.builder.property("icon", icon.clone()),
1506 }
1507 }
1508
1509 /// The :icon-name property specifies the name of the themed icon to
1510 /// use as the window icon. See [`IconTheme`][crate::IconTheme] for more details.
1511 pub fn icon_name(self, icon_name: impl Into<glib::GString>) -> Self {
1512 Self {
1513 builder: self.builder.property("icon-name", icon_name.into()),
1514 }
1515 }
1516
1517 /// Whether mnemonics are currently visible in this window.
1518 ///
1519 /// This property is maintained by GTK+ based on user input,
1520 /// and should not be set by applications.
1521 pub fn mnemonics_visible(self, mnemonics_visible: bool) -> Self {
1522 Self {
1523 builder: self
1524 .builder
1525 .property("mnemonics-visible", mnemonics_visible),
1526 }
1527 }
1528
1529 pub fn modal(self, modal: bool) -> Self {
1530 Self {
1531 builder: self.builder.property("modal", modal),
1532 }
1533 }
1534
1535 pub fn resizable(self, resizable: bool) -> Self {
1536 Self {
1537 builder: self.builder.property("resizable", resizable),
1538 }
1539 }
1540
1541 pub fn role(self, role: impl Into<glib::GString>) -> Self {
1542 Self {
1543 builder: self.builder.property("role", role.into()),
1544 }
1545 }
1546
1547 pub fn screen(self, screen: &gdk::Screen) -> Self {
1548 Self {
1549 builder: self.builder.property("screen", screen.clone()),
1550 }
1551 }
1552
1553 pub fn skip_pager_hint(self, skip_pager_hint: bool) -> Self {
1554 Self {
1555 builder: self.builder.property("skip-pager-hint", skip_pager_hint),
1556 }
1557 }
1558
1559 pub fn skip_taskbar_hint(self, skip_taskbar_hint: bool) -> Self {
1560 Self {
1561 builder: self
1562 .builder
1563 .property("skip-taskbar-hint", skip_taskbar_hint),
1564 }
1565 }
1566
1567 /// The :startup-id is a write-only property for setting window's
1568 /// startup notification identifier. See [`GtkWindowExt::set_startup_id()`][crate::prelude::GtkWindowExt::set_startup_id()]
1569 /// for more details.
1570 pub fn startup_id(self, startup_id: impl Into<glib::GString>) -> Self {
1571 Self {
1572 builder: self.builder.property("startup-id", startup_id.into()),
1573 }
1574 }
1575
1576 pub fn title(self, title: impl Into<glib::GString>) -> Self {
1577 Self {
1578 builder: self.builder.property("title", title.into()),
1579 }
1580 }
1581
1582 /// The transient parent of the window. See [`GtkWindowExt::set_transient_for()`][crate::prelude::GtkWindowExt::set_transient_for()] for
1583 /// more details about transient windows.
1584 pub fn transient_for(self, transient_for: &impl IsA<Window>) -> Self {
1585 Self {
1586 builder: self
1587 .builder
1588 .property("transient-for", transient_for.clone().upcast()),
1589 }
1590 }
1591
1592 pub fn type_(self, type_: WindowType) -> Self {
1593 Self {
1594 builder: self.builder.property("type", type_),
1595 }
1596 }
1597
1598 pub fn type_hint(self, type_hint: gdk::WindowTypeHint) -> Self {
1599 Self {
1600 builder: self.builder.property("type-hint", type_hint),
1601 }
1602 }
1603
1604 pub fn urgency_hint(self, urgency_hint: bool) -> Self {
1605 Self {
1606 builder: self.builder.property("urgency-hint", urgency_hint),
1607 }
1608 }
1609
1610 pub fn window_position(self, window_position: WindowPosition) -> Self {
1611 Self {
1612 builder: self.builder.property("window-position", window_position),
1613 }
1614 }
1615
1616 pub fn border_width(self, border_width: u32) -> Self {
1617 Self {
1618 builder: self.builder.property("border-width", border_width),
1619 }
1620 }
1621
1622 pub fn child(self, child: &impl IsA<Widget>) -> Self {
1623 Self {
1624 builder: self.builder.property("child", child.clone().upcast()),
1625 }
1626 }
1627
1628 pub fn resize_mode(self, resize_mode: ResizeMode) -> Self {
1629 Self {
1630 builder: self.builder.property("resize-mode", resize_mode),
1631 }
1632 }
1633
1634 pub fn app_paintable(self, app_paintable: bool) -> Self {
1635 Self {
1636 builder: self.builder.property("app-paintable", app_paintable),
1637 }
1638 }
1639
1640 pub fn can_default(self, can_default: bool) -> Self {
1641 Self {
1642 builder: self.builder.property("can-default", can_default),
1643 }
1644 }
1645
1646 pub fn can_focus(self, can_focus: bool) -> Self {
1647 Self {
1648 builder: self.builder.property("can-focus", can_focus),
1649 }
1650 }
1651
1652 pub fn events(self, events: gdk::EventMask) -> Self {
1653 Self {
1654 builder: self.builder.property("events", events),
1655 }
1656 }
1657
1658 /// Whether to expand in both directions. Setting this sets both [`hexpand`][struct@crate::Widget#hexpand] and [`vexpand`][struct@crate::Widget#vexpand]
1659 pub fn expand(self, expand: bool) -> Self {
1660 Self {
1661 builder: self.builder.property("expand", expand),
1662 }
1663 }
1664
1665 /// Whether the widget should grab focus when it is clicked with the mouse.
1666 ///
1667 /// This property is only relevant for widgets that can take focus.
1668 ///
1669 /// Before 3.20, several widgets (GtkButton, GtkFileChooserButton,
1670 /// GtkComboBox) implemented this property individually.
1671 pub fn focus_on_click(self, focus_on_click: bool) -> Self {
1672 Self {
1673 builder: self.builder.property("focus-on-click", focus_on_click),
1674 }
1675 }
1676
1677 /// How to distribute horizontal space if widget gets extra space, see [`Align`][crate::Align]
1678 pub fn halign(self, halign: Align) -> Self {
1679 Self {
1680 builder: self.builder.property("halign", halign),
1681 }
1682 }
1683
1684 pub fn has_default(self, has_default: bool) -> Self {
1685 Self {
1686 builder: self.builder.property("has-default", has_default),
1687 }
1688 }
1689
1690 pub fn has_focus(self, has_focus: bool) -> Self {
1691 Self {
1692 builder: self.builder.property("has-focus", has_focus),
1693 }
1694 }
1695
1696 /// Enables or disables the emission of [`query-tooltip`][struct@crate::Widget#query-tooltip] on `widget`.
1697 /// A value of [`true`] indicates that `widget` can have a tooltip, in this case
1698 /// the widget will be queried using [`query-tooltip`][struct@crate::Widget#query-tooltip] to determine
1699 /// whether it will provide a tooltip or not.
1700 ///
1701 /// Note that setting this property to [`true`] for the first time will change
1702 /// the event masks of the GdkWindows of this widget to include leave-notify
1703 /// and motion-notify events. This cannot and will not be undone when the
1704 /// property is set to [`false`] again.
1705 pub fn has_tooltip(self, has_tooltip: bool) -> Self {
1706 Self {
1707 builder: self.builder.property("has-tooltip", has_tooltip),
1708 }
1709 }
1710
1711 pub fn height_request(self, height_request: i32) -> Self {
1712 Self {
1713 builder: self.builder.property("height-request", height_request),
1714 }
1715 }
1716
1717 /// Whether to expand horizontally. See [`WidgetExt::set_hexpand()`][crate::prelude::WidgetExt::set_hexpand()].
1718 pub fn hexpand(self, hexpand: bool) -> Self {
1719 Self {
1720 builder: self.builder.property("hexpand", hexpand),
1721 }
1722 }
1723
1724 /// Whether to use the [`hexpand`][struct@crate::Widget#hexpand] property. See [`WidgetExt::is_hexpand_set()`][crate::prelude::WidgetExt::is_hexpand_set()].
1725 pub fn hexpand_set(self, hexpand_set: bool) -> Self {
1726 Self {
1727 builder: self.builder.property("hexpand-set", hexpand_set),
1728 }
1729 }
1730
1731 pub fn is_focus(self, is_focus: bool) -> Self {
1732 Self {
1733 builder: self.builder.property("is-focus", is_focus),
1734 }
1735 }
1736
1737 /// Sets all four sides' margin at once. If read, returns max
1738 /// margin on any side.
1739 pub fn margin(self, margin: i32) -> Self {
1740 Self {
1741 builder: self.builder.property("margin", margin),
1742 }
1743 }
1744
1745 /// Margin on bottom side of widget.
1746 ///
1747 /// This property adds margin outside of the widget's normal size
1748 /// request, the margin will be added in addition to the size from
1749 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1750 pub fn margin_bottom(self, margin_bottom: i32) -> Self {
1751 Self {
1752 builder: self.builder.property("margin-bottom", margin_bottom),
1753 }
1754 }
1755
1756 /// Margin on end of widget, horizontally. This property supports
1757 /// left-to-right and right-to-left text directions.
1758 ///
1759 /// This property adds margin outside of the widget's normal size
1760 /// request, the margin will be added in addition to the size from
1761 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1762 pub fn margin_end(self, margin_end: i32) -> Self {
1763 Self {
1764 builder: self.builder.property("margin-end", margin_end),
1765 }
1766 }
1767
1768 /// Margin on start of widget, horizontally. This property supports
1769 /// left-to-right and right-to-left text directions.
1770 ///
1771 /// This property adds margin outside of the widget's normal size
1772 /// request, the margin will be added in addition to the size from
1773 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1774 pub fn margin_start(self, margin_start: i32) -> Self {
1775 Self {
1776 builder: self.builder.property("margin-start", margin_start),
1777 }
1778 }
1779
1780 /// Margin on top side of widget.
1781 ///
1782 /// This property adds margin outside of the widget's normal size
1783 /// request, the margin will be added in addition to the size from
1784 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1785 pub fn margin_top(self, margin_top: i32) -> Self {
1786 Self {
1787 builder: self.builder.property("margin-top", margin_top),
1788 }
1789 }
1790
1791 pub fn name(self, name: impl Into<glib::GString>) -> Self {
1792 Self {
1793 builder: self.builder.property("name", name.into()),
1794 }
1795 }
1796
1797 pub fn no_show_all(self, no_show_all: bool) -> Self {
1798 Self {
1799 builder: self.builder.property("no-show-all", no_show_all),
1800 }
1801 }
1802
1803 /// The requested opacity of the widget. See [`WidgetExt::set_opacity()`][crate::prelude::WidgetExt::set_opacity()] for
1804 /// more details about window opacity.
1805 ///
1806 /// Before 3.8 this was only available in GtkWindow
1807 pub fn opacity(self, opacity: f64) -> Self {
1808 Self {
1809 builder: self.builder.property("opacity", opacity),
1810 }
1811 }
1812
1813 pub fn parent(self, parent: &impl IsA<Container>) -> Self {
1814 Self {
1815 builder: self.builder.property("parent", parent.clone().upcast()),
1816 }
1817 }
1818
1819 pub fn receives_default(self, receives_default: bool) -> Self {
1820 Self {
1821 builder: self.builder.property("receives-default", receives_default),
1822 }
1823 }
1824
1825 pub fn sensitive(self, sensitive: bool) -> Self {
1826 Self {
1827 builder: self.builder.property("sensitive", sensitive),
1828 }
1829 }
1830
1831 /// Sets the text of tooltip to be the given string, which is marked up
1832 /// with the [Pango text markup language][PangoMarkupFormat].
1833 /// Also see [`Tooltip::set_markup()`][crate::Tooltip::set_markup()].
1834 ///
1835 /// This is a convenience property which will take care of getting the
1836 /// tooltip shown if the given string is not [`None`]: [`has-tooltip`][struct@crate::Widget#has-tooltip]
1837 /// will automatically be set to [`true`] and there will be taken care of
1838 /// [`query-tooltip`][struct@crate::Widget#query-tooltip] in the default signal handler.
1839 ///
1840 /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and [`tooltip-markup`][struct@crate::Widget#tooltip-markup]
1841 /// are set, the last one wins.
1842 pub fn tooltip_markup(self, tooltip_markup: impl Into<glib::GString>) -> Self {
1843 Self {
1844 builder: self
1845 .builder
1846 .property("tooltip-markup", tooltip_markup.into()),
1847 }
1848 }
1849
1850 /// Sets the text of tooltip to be the given string.
1851 ///
1852 /// Also see [`Tooltip::set_text()`][crate::Tooltip::set_text()].
1853 ///
1854 /// This is a convenience property which will take care of getting the
1855 /// tooltip shown if the given string is not [`None`]: [`has-tooltip`][struct@crate::Widget#has-tooltip]
1856 /// will automatically be set to [`true`] and there will be taken care of
1857 /// [`query-tooltip`][struct@crate::Widget#query-tooltip] in the default signal handler.
1858 ///
1859 /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and [`tooltip-markup`][struct@crate::Widget#tooltip-markup]
1860 /// are set, the last one wins.
1861 pub fn tooltip_text(self, tooltip_text: impl Into<glib::GString>) -> Self {
1862 Self {
1863 builder: self.builder.property("tooltip-text", tooltip_text.into()),
1864 }
1865 }
1866
1867 /// How to distribute vertical space if widget gets extra space, see [`Align`][crate::Align]
1868 pub fn valign(self, valign: Align) -> Self {
1869 Self {
1870 builder: self.builder.property("valign", valign),
1871 }
1872 }
1873
1874 /// Whether to expand vertically. See [`WidgetExt::set_vexpand()`][crate::prelude::WidgetExt::set_vexpand()].
1875 pub fn vexpand(self, vexpand: bool) -> Self {
1876 Self {
1877 builder: self.builder.property("vexpand", vexpand),
1878 }
1879 }
1880
1881 /// Whether to use the [`vexpand`][struct@crate::Widget#vexpand] property. See [`WidgetExt::is_vexpand_set()`][crate::prelude::WidgetExt::is_vexpand_set()].
1882 pub fn vexpand_set(self, vexpand_set: bool) -> Self {
1883 Self {
1884 builder: self.builder.property("vexpand-set", vexpand_set),
1885 }
1886 }
1887
1888 pub fn visible(self, visible: bool) -> Self {
1889 Self {
1890 builder: self.builder.property("visible", visible),
1891 }
1892 }
1893
1894 pub fn width_request(self, width_request: i32) -> Self {
1895 Self {
1896 builder: self.builder.property("width-request", width_request),
1897 }
1898 }
1899
1900 // rustdoc-stripper-ignore-next
1901 /// Build the [`Assistant`].
1902 #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"]
1903 pub fn build(self) -> Assistant {
1904 assert_initialized_main_thread!();
1905 self.builder.build()
1906 }
1907}
1908
1909/// Trait containing all [`struct@Assistant`] methods.
1910///
1911/// # Implementors
1912///
1913/// [`Assistant`][struct@crate::Assistant]
1914pub trait AssistantExt: IsA<Assistant> + 'static {
1915 /// Adds a widget to the action area of a [`Assistant`][crate::Assistant].
1916 /// ## `child`
1917 /// a [`Widget`][crate::Widget]
1918 #[doc(alias = "gtk_assistant_add_action_widget")]
1919 fn add_action_widget(&self, child: &impl IsA<Widget>) {
1920 unsafe {
1921 ffi::gtk_assistant_add_action_widget(
1922 self.as_ref().to_glib_none().0,
1923 child.as_ref().to_glib_none().0,
1924 );
1925 }
1926 }
1927
1928 /// Appends a page to the `self`.
1929 /// ## `page`
1930 /// a [`Widget`][crate::Widget]
1931 ///
1932 /// # Returns
1933 ///
1934 /// the index (starting at 0) of the inserted page
1935 #[doc(alias = "gtk_assistant_append_page")]
1936 fn append_page(&self, page: &impl IsA<Widget>) -> i32 {
1937 unsafe {
1938 ffi::gtk_assistant_append_page(
1939 self.as_ref().to_glib_none().0,
1940 page.as_ref().to_glib_none().0,
1941 )
1942 }
1943 }
1944
1945 /// Erases the visited page history so the back button is not
1946 /// shown on the current page, and removes the cancel button
1947 /// from subsequent pages.
1948 ///
1949 /// Use this when the information provided up to the current
1950 /// page is hereafter deemed permanent and cannot be modified
1951 /// or undone. For example, showing a progress page to track
1952 /// a long-running, unreversible operation after the user has
1953 /// clicked apply on a confirmation page.
1954 #[doc(alias = "gtk_assistant_commit")]
1955 fn commit(&self) {
1956 unsafe {
1957 ffi::gtk_assistant_commit(self.as_ref().to_glib_none().0);
1958 }
1959 }
1960
1961 /// Returns the page number of the current page.
1962 ///
1963 /// # Returns
1964 ///
1965 /// The index (starting from 0) of the current
1966 /// page in the `self`, or -1 if the `self` has no pages,
1967 /// or no current page.
1968 #[doc(alias = "gtk_assistant_get_current_page")]
1969 #[doc(alias = "get_current_page")]
1970 fn current_page(&self) -> i32 {
1971 unsafe { ffi::gtk_assistant_get_current_page(self.as_ref().to_glib_none().0) }
1972 }
1973
1974 /// Returns the number of pages in the `self`
1975 ///
1976 /// # Returns
1977 ///
1978 /// the number of pages in the `self`
1979 #[doc(alias = "gtk_assistant_get_n_pages")]
1980 #[doc(alias = "get_n_pages")]
1981 fn n_pages(&self) -> i32 {
1982 unsafe { ffi::gtk_assistant_get_n_pages(self.as_ref().to_glib_none().0) }
1983 }
1984
1985 /// Returns the child widget contained in page number `page_num`.
1986 /// ## `page_num`
1987 /// the index of a page in the `self`,
1988 /// or -1 to get the last page
1989 ///
1990 /// # Returns
1991 ///
1992 /// the child widget, or [`None`]
1993 /// if `page_num` is out of bounds
1994 #[doc(alias = "gtk_assistant_get_nth_page")]
1995 #[doc(alias = "get_nth_page")]
1996 fn nth_page(&self, page_num: i32) -> Option<Widget> {
1997 unsafe {
1998 from_glib_none(ffi::gtk_assistant_get_nth_page(
1999 self.as_ref().to_glib_none().0,
2000 page_num,
2001 ))
2002 }
2003 }
2004
2005 /// Gets whether `page` is complete.
2006 /// ## `page`
2007 /// a page of `self`
2008 ///
2009 /// # Returns
2010 ///
2011 /// [`true`] if `page` is complete.
2012 #[doc(alias = "gtk_assistant_get_page_complete")]
2013 #[doc(alias = "get_page_complete")]
2014 fn page_is_complete(&self, page: &impl IsA<Widget>) -> bool {
2015 unsafe {
2016 from_glib(ffi::gtk_assistant_get_page_complete(
2017 self.as_ref().to_glib_none().0,
2018 page.as_ref().to_glib_none().0,
2019 ))
2020 }
2021 }
2022
2023 /// Gets whether page has padding.
2024 /// ## `page`
2025 /// a page of `self`
2026 ///
2027 /// # Returns
2028 ///
2029 /// [`true`] if `page` has padding
2030 #[doc(alias = "gtk_assistant_get_page_has_padding")]
2031 #[doc(alias = "get_page_has_padding")]
2032 fn page_has_padding(&self, page: &impl IsA<Widget>) -> bool {
2033 unsafe {
2034 from_glib(ffi::gtk_assistant_get_page_has_padding(
2035 self.as_ref().to_glib_none().0,
2036 page.as_ref().to_glib_none().0,
2037 ))
2038 }
2039 }
2040
2041 /// Gets the title for `page`.
2042 /// ## `page`
2043 /// a page of `self`
2044 ///
2045 /// # Returns
2046 ///
2047 /// the title for `page`
2048 #[doc(alias = "gtk_assistant_get_page_title")]
2049 #[doc(alias = "get_page_title")]
2050 fn page_title(&self, page: &impl IsA<Widget>) -> Option<glib::GString> {
2051 unsafe {
2052 from_glib_none(ffi::gtk_assistant_get_page_title(
2053 self.as_ref().to_glib_none().0,
2054 page.as_ref().to_glib_none().0,
2055 ))
2056 }
2057 }
2058
2059 /// Gets the page type of `page`.
2060 /// ## `page`
2061 /// a page of `self`
2062 ///
2063 /// # Returns
2064 ///
2065 /// the page type of `page`
2066 #[doc(alias = "gtk_assistant_get_page_type")]
2067 #[doc(alias = "get_page_type")]
2068 fn page_type(&self, page: &impl IsA<Widget>) -> AssistantPageType {
2069 unsafe {
2070 from_glib(ffi::gtk_assistant_get_page_type(
2071 self.as_ref().to_glib_none().0,
2072 page.as_ref().to_glib_none().0,
2073 ))
2074 }
2075 }
2076
2077 /// Inserts a page in the `self` at a given position.
2078 /// ## `page`
2079 /// a [`Widget`][crate::Widget]
2080 /// ## `position`
2081 /// the index (starting at 0) at which to insert the page,
2082 /// or -1 to append the page to the `self`
2083 ///
2084 /// # Returns
2085 ///
2086 /// the index (starting from 0) of the inserted page
2087 #[doc(alias = "gtk_assistant_insert_page")]
2088 fn insert_page(&self, page: &impl IsA<Widget>, position: i32) -> i32 {
2089 unsafe {
2090 ffi::gtk_assistant_insert_page(
2091 self.as_ref().to_glib_none().0,
2092 page.as_ref().to_glib_none().0,
2093 position,
2094 )
2095 }
2096 }
2097
2098 /// Navigate to the next page.
2099 ///
2100 /// It is a programming error to call this function when
2101 /// there is no next page.
2102 ///
2103 /// This function is for use when creating pages of the
2104 /// [`AssistantPageType::Custom`][crate::AssistantPageType::Custom] type.
2105 #[doc(alias = "gtk_assistant_next_page")]
2106 fn next_page(&self) {
2107 unsafe {
2108 ffi::gtk_assistant_next_page(self.as_ref().to_glib_none().0);
2109 }
2110 }
2111
2112 /// Prepends a page to the `self`.
2113 /// ## `page`
2114 /// a [`Widget`][crate::Widget]
2115 ///
2116 /// # Returns
2117 ///
2118 /// the index (starting at 0) of the inserted page
2119 #[doc(alias = "gtk_assistant_prepend_page")]
2120 fn prepend_page(&self, page: &impl IsA<Widget>) -> i32 {
2121 unsafe {
2122 ffi::gtk_assistant_prepend_page(
2123 self.as_ref().to_glib_none().0,
2124 page.as_ref().to_glib_none().0,
2125 )
2126 }
2127 }
2128
2129 /// Navigate to the previous visited page.
2130 ///
2131 /// It is a programming error to call this function when
2132 /// no previous page is available.
2133 ///
2134 /// This function is for use when creating pages of the
2135 /// [`AssistantPageType::Custom`][crate::AssistantPageType::Custom] type.
2136 #[doc(alias = "gtk_assistant_previous_page")]
2137 fn previous_page(&self) {
2138 unsafe {
2139 ffi::gtk_assistant_previous_page(self.as_ref().to_glib_none().0);
2140 }
2141 }
2142
2143 /// Removes a widget from the action area of a [`Assistant`][crate::Assistant].
2144 /// ## `child`
2145 /// a [`Widget`][crate::Widget]
2146 #[doc(alias = "gtk_assistant_remove_action_widget")]
2147 fn remove_action_widget(&self, child: &impl IsA<Widget>) {
2148 unsafe {
2149 ffi::gtk_assistant_remove_action_widget(
2150 self.as_ref().to_glib_none().0,
2151 child.as_ref().to_glib_none().0,
2152 );
2153 }
2154 }
2155
2156 /// Removes the `page_num`’s page from `self`.
2157 /// ## `page_num`
2158 /// the index of a page in the `self`,
2159 /// or -1 to remove the last page
2160 #[doc(alias = "gtk_assistant_remove_page")]
2161 fn remove_page(&self, page_num: i32) {
2162 unsafe {
2163 ffi::gtk_assistant_remove_page(self.as_ref().to_glib_none().0, page_num);
2164 }
2165 }
2166
2167 /// Switches the page to `page_num`.
2168 ///
2169 /// Note that this will only be necessary in custom buttons,
2170 /// as the `self` flow can be set with
2171 /// [`set_forward_page_func()`][Self::set_forward_page_func()].
2172 /// ## `page_num`
2173 /// index of the page to switch to, starting from 0.
2174 /// If negative, the last page will be used. If greater
2175 /// than the number of pages in the `self`, nothing
2176 /// will be done.
2177 #[doc(alias = "gtk_assistant_set_current_page")]
2178 fn set_current_page(&self, page_num: i32) {
2179 unsafe {
2180 ffi::gtk_assistant_set_current_page(self.as_ref().to_glib_none().0, page_num);
2181 }
2182 }
2183
2184 /// Sets the page forwarding function to be `page_func`.
2185 ///
2186 /// This function will be used to determine what will be
2187 /// the next page when the user presses the forward button.
2188 /// Setting `page_func` to [`None`] will make the assistant to
2189 /// use the default forward function, which just goes to the
2190 /// next visible page.
2191 /// ## `page_func`
2192 /// the `GtkAssistantPageFunc`, or [`None`]
2193 /// to use the default one
2194 #[doc(alias = "gtk_assistant_set_forward_page_func")]
2195 fn set_forward_page_func(&self, page_func: Option<Box_<dyn Fn(i32) -> i32 + 'static>>) {
2196 let page_func_data: Box_<Option<Box_<dyn Fn(i32) -> i32 + 'static>>> = Box_::new(page_func);
2197 unsafe extern "C" fn page_func_func(
2198 current_page: std::ffi::c_int,
2199 data: glib::ffi::gpointer,
2200 ) -> std::ffi::c_int {
2201 unsafe {
2202 let callback = &*(data as *mut Option<Box_<dyn Fn(i32) -> i32 + 'static>>);
2203 if let Some(ref callback) = *callback {
2204 callback(current_page)
2205 } else {
2206 panic!("cannot get closure...")
2207 }
2208 }
2209 }
2210 let page_func = if page_func_data.is_some() {
2211 Some(page_func_func as _)
2212 } else {
2213 None
2214 };
2215 unsafe extern "C" fn destroy_func(data: glib::ffi::gpointer) {
2216 unsafe {
2217 let _callback =
2218 Box_::from_raw(data as *mut Option<Box_<dyn Fn(i32) -> i32 + 'static>>);
2219 }
2220 }
2221 let destroy_call3 = Some(destroy_func as _);
2222 let super_callback0: Box_<Option<Box_<dyn Fn(i32) -> i32 + 'static>>> = page_func_data;
2223 unsafe {
2224 ffi::gtk_assistant_set_forward_page_func(
2225 self.as_ref().to_glib_none().0,
2226 page_func,
2227 Box_::into_raw(super_callback0) as *mut _,
2228 destroy_call3,
2229 );
2230 }
2231 }
2232
2233 /// Sets whether `page` contents are complete.
2234 ///
2235 /// This will make `self` update the buttons state
2236 /// to be able to continue the task.
2237 /// ## `page`
2238 /// a page of `self`
2239 /// ## `complete`
2240 /// the completeness status of the page
2241 #[doc(alias = "gtk_assistant_set_page_complete")]
2242 fn set_page_complete(&self, page: &impl IsA<Widget>, complete: bool) {
2243 unsafe {
2244 ffi::gtk_assistant_set_page_complete(
2245 self.as_ref().to_glib_none().0,
2246 page.as_ref().to_glib_none().0,
2247 complete.into_glib(),
2248 );
2249 }
2250 }
2251
2252 /// Sets whether the assistant is adding padding around
2253 /// the page.
2254 /// ## `page`
2255 /// a page of `self`
2256 /// ## `has_padding`
2257 /// whether this page has padding
2258 #[doc(alias = "gtk_assistant_set_page_has_padding")]
2259 fn set_page_has_padding(&self, page: &impl IsA<Widget>, has_padding: bool) {
2260 unsafe {
2261 ffi::gtk_assistant_set_page_has_padding(
2262 self.as_ref().to_glib_none().0,
2263 page.as_ref().to_glib_none().0,
2264 has_padding.into_glib(),
2265 );
2266 }
2267 }
2268
2269 /// Sets a title for `page`.
2270 ///
2271 /// The title is displayed in the header area of the assistant
2272 /// when `page` is the current page.
2273 /// ## `page`
2274 /// a page of `self`
2275 /// ## `title`
2276 /// the new title for `page`
2277 #[doc(alias = "gtk_assistant_set_page_title")]
2278 fn set_page_title(&self, page: &impl IsA<Widget>, title: &str) {
2279 unsafe {
2280 ffi::gtk_assistant_set_page_title(
2281 self.as_ref().to_glib_none().0,
2282 page.as_ref().to_glib_none().0,
2283 title.to_glib_none().0,
2284 );
2285 }
2286 }
2287
2288 /// Sets the page type for `page`.
2289 ///
2290 /// The page type determines the page behavior in the `self`.
2291 /// ## `page`
2292 /// a page of `self`
2293 /// ## `type_`
2294 /// the new type for `page`
2295 #[doc(alias = "gtk_assistant_set_page_type")]
2296 fn set_page_type(&self, page: &impl IsA<Widget>, type_: AssistantPageType) {
2297 unsafe {
2298 ffi::gtk_assistant_set_page_type(
2299 self.as_ref().to_glib_none().0,
2300 page.as_ref().to_glib_none().0,
2301 type_.into_glib(),
2302 );
2303 }
2304 }
2305
2306 /// Forces `self` to recompute the buttons state.
2307 ///
2308 /// GTK+ automatically takes care of this in most situations,
2309 /// e.g. when the user goes to a different page, or when the
2310 /// visibility or completeness of a page changes.
2311 ///
2312 /// One situation where it can be necessary to call this
2313 /// function is when changing a value on the current page
2314 /// affects the future page flow of the assistant.
2315 #[doc(alias = "gtk_assistant_update_buttons_state")]
2316 fn update_buttons_state(&self) {
2317 unsafe {
2318 ffi::gtk_assistant_update_buttons_state(self.as_ref().to_glib_none().0);
2319 }
2320 }
2321
2322 /// [`true`] if the assistant uses a [`HeaderBar`][crate::HeaderBar] for action buttons
2323 /// instead of the action-area.
2324 ///
2325 /// For technical reasons, this property is declared as an integer
2326 /// property, but you should only set it to [`true`] or [`false`].
2327 #[doc(alias = "use-header-bar")]
2328 fn use_header_bar(&self) -> i32 {
2329 ObjectExt::property(self.as_ref(), "use-header-bar")
2330 }
2331
2332 fn child_is_complete<T: IsA<crate::Widget>>(&self, item: &T) -> bool {
2333 crate::prelude::ContainerExtManual::child_property(
2334 self.as_ref(),
2335 &item.clone().upcast(),
2336 "complete",
2337 )
2338 }
2339
2340 fn set_child_complete<T: IsA<crate::Widget>>(&self, item: &T, complete: bool) {
2341 crate::prelude::ContainerExtManual::child_set_property(
2342 self.as_ref(),
2343 &item.clone().upcast(),
2344 "complete",
2345 &complete,
2346 )
2347 }
2348
2349 #[doc(alias = "child.has-padding")]
2350 fn child_has_padding<T: IsA<crate::Widget>>(&self, item: &T) -> bool {
2351 crate::prelude::ContainerExtManual::child_property(
2352 self.as_ref(),
2353 &item.clone().upcast(),
2354 "has-padding",
2355 )
2356 }
2357
2358 #[doc(alias = "child.has-padding")]
2359 fn set_child_has_padding<T: IsA<crate::Widget>>(&self, item: &T, has_padding: bool) {
2360 crate::prelude::ContainerExtManual::child_set_property(
2361 self.as_ref(),
2362 &item.clone().upcast(),
2363 "has-padding",
2364 &has_padding,
2365 )
2366 }
2367
2368 #[doc(alias = "child.page-type")]
2369 fn child_page_type<T: IsA<crate::Widget>>(&self, item: &T) -> AssistantPageType {
2370 crate::prelude::ContainerExtManual::child_property(
2371 self.as_ref(),
2372 &item.clone().upcast(),
2373 "page-type",
2374 )
2375 }
2376
2377 #[doc(alias = "child.page-type")]
2378 fn set_child_page_type<T: IsA<crate::Widget>>(&self, item: &T, page_type: AssistantPageType) {
2379 crate::prelude::ContainerExtManual::child_set_property(
2380 self.as_ref(),
2381 &item.clone().upcast(),
2382 "page-type",
2383 &page_type,
2384 )
2385 }
2386
2387 fn child_title<T: IsA<crate::Widget>>(&self, item: &T) -> Option<glib::GString> {
2388 crate::prelude::ContainerExtManual::child_property(
2389 self.as_ref(),
2390 &item.clone().upcast(),
2391 "title",
2392 )
2393 }
2394
2395 fn set_child_title<T: IsA<crate::Widget>>(&self, item: &T, title: Option<&str>) {
2396 crate::prelude::ContainerExtManual::child_set_property(
2397 self.as_ref(),
2398 &item.clone().upcast(),
2399 "title",
2400 &title,
2401 )
2402 }
2403
2404 /// The ::apply signal is emitted when the apply button is clicked.
2405 ///
2406 /// The default behavior of the [`Assistant`][crate::Assistant] is to switch to the page
2407 /// after the current page, unless the current page is the last one.
2408 ///
2409 /// A handler for the ::apply signal should carry out the actions for
2410 /// which the wizard has collected data. If the action takes a long time
2411 /// to complete, you might consider putting a page of type
2412 /// [`AssistantPageType::Progress`][crate::AssistantPageType::Progress] after the confirmation page and handle
2413 /// this operation within the [`prepare`][struct@crate::Assistant#prepare] signal of the progress
2414 /// page.
2415 #[doc(alias = "apply")]
2416 fn connect_apply<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
2417 unsafe extern "C" fn apply_trampoline<P: IsA<Assistant>, F: Fn(&P) + 'static>(
2418 this: *mut ffi::GtkAssistant,
2419 f: glib::ffi::gpointer,
2420 ) {
2421 unsafe {
2422 let f: &F = &*(f as *const F);
2423 f(Assistant::from_glib_borrow(this).unsafe_cast_ref())
2424 }
2425 }
2426 unsafe {
2427 let f: Box_<F> = Box_::new(f);
2428 connect_raw(
2429 self.as_ptr() as *mut _,
2430 c"apply".as_ptr(),
2431 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2432 apply_trampoline::<Self, F> as *const (),
2433 )),
2434 Box_::into_raw(f),
2435 )
2436 }
2437 }
2438
2439 /// The ::cancel signal is emitted when then the cancel button is clicked.
2440 #[doc(alias = "cancel")]
2441 fn connect_cancel<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
2442 unsafe extern "C" fn cancel_trampoline<P: IsA<Assistant>, F: Fn(&P) + 'static>(
2443 this: *mut ffi::GtkAssistant,
2444 f: glib::ffi::gpointer,
2445 ) {
2446 unsafe {
2447 let f: &F = &*(f as *const F);
2448 f(Assistant::from_glib_borrow(this).unsafe_cast_ref())
2449 }
2450 }
2451 unsafe {
2452 let f: Box_<F> = Box_::new(f);
2453 connect_raw(
2454 self.as_ptr() as *mut _,
2455 c"cancel".as_ptr(),
2456 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2457 cancel_trampoline::<Self, F> as *const (),
2458 )),
2459 Box_::into_raw(f),
2460 )
2461 }
2462 }
2463
2464 /// The ::close signal is emitted either when the close button of
2465 /// a summary page is clicked, or when the apply button in the last
2466 /// page in the flow (of type [`AssistantPageType::Confirm`][crate::AssistantPageType::Confirm]) is clicked.
2467 #[doc(alias = "close")]
2468 fn connect_close<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
2469 unsafe extern "C" fn close_trampoline<P: IsA<Assistant>, F: Fn(&P) + 'static>(
2470 this: *mut ffi::GtkAssistant,
2471 f: glib::ffi::gpointer,
2472 ) {
2473 unsafe {
2474 let f: &F = &*(f as *const F);
2475 f(Assistant::from_glib_borrow(this).unsafe_cast_ref())
2476 }
2477 }
2478 unsafe {
2479 let f: Box_<F> = Box_::new(f);
2480 connect_raw(
2481 self.as_ptr() as *mut _,
2482 c"close".as_ptr(),
2483 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2484 close_trampoline::<Self, F> as *const (),
2485 )),
2486 Box_::into_raw(f),
2487 )
2488 }
2489 }
2490
2491 #[doc(alias = "escape")]
2492 fn connect_escape<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
2493 unsafe extern "C" fn escape_trampoline<P: IsA<Assistant>, F: Fn(&P) + 'static>(
2494 this: *mut ffi::GtkAssistant,
2495 f: glib::ffi::gpointer,
2496 ) {
2497 unsafe {
2498 let f: &F = &*(f as *const F);
2499 f(Assistant::from_glib_borrow(this).unsafe_cast_ref())
2500 }
2501 }
2502 unsafe {
2503 let f: Box_<F> = Box_::new(f);
2504 connect_raw(
2505 self.as_ptr() as *mut _,
2506 c"escape".as_ptr(),
2507 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2508 escape_trampoline::<Self, F> as *const (),
2509 )),
2510 Box_::into_raw(f),
2511 )
2512 }
2513 }
2514
2515 fn emit_escape(&self) {
2516 self.emit_by_name::<()>("escape", &[]);
2517 }
2518
2519 /// The ::prepare signal is emitted when a new page is set as the
2520 /// assistant's current page, before making the new page visible.
2521 ///
2522 /// A handler for this signal can do any preparations which are
2523 /// necessary before showing `page`.
2524 /// ## `page`
2525 /// the current page
2526 #[doc(alias = "prepare")]
2527 fn connect_prepare<F: Fn(&Self, &Widget) + 'static>(&self, f: F) -> SignalHandlerId {
2528 unsafe extern "C" fn prepare_trampoline<P: IsA<Assistant>, F: Fn(&P, &Widget) + 'static>(
2529 this: *mut ffi::GtkAssistant,
2530 page: *mut ffi::GtkWidget,
2531 f: glib::ffi::gpointer,
2532 ) {
2533 unsafe {
2534 let f: &F = &*(f as *const F);
2535 f(
2536 Assistant::from_glib_borrow(this).unsafe_cast_ref(),
2537 &from_glib_borrow(page),
2538 )
2539 }
2540 }
2541 unsafe {
2542 let f: Box_<F> = Box_::new(f);
2543 connect_raw(
2544 self.as_ptr() as *mut _,
2545 c"prepare".as_ptr(),
2546 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2547 prepare_trampoline::<Self, F> as *const (),
2548 )),
2549 Box_::into_raw(f),
2550 )
2551 }
2552 }
2553}
2554
2555impl<O: IsA<Assistant>> AssistantExt for O {}