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