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