gtk4/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#![allow(deprecated)]
5
6#[cfg(feature = "v4_20")]
7#[cfg_attr(docsrs, doc(cfg(feature = "v4_20")))]
8use crate::WindowGravity;
9use crate::{
10 ffi, Accessible, AccessibleRole, Align, Application, AssistantPage, AssistantPageType,
11 Buildable, ConstraintTarget, LayoutManager, Native, Overflow, Root, ShortcutManager, Widget,
12 Window,
13};
14use glib::{
15 object::ObjectType as _,
16 prelude::*,
17 signal::{connect_raw, SignalHandlerId},
18 translate::*,
19};
20use std::boxed::Box as Box_;
21
22glib::wrapper! {
23 /// This widget will be removed in GTK 5
24 /// [`Assistant`][crate::Assistant] is used to represent a complex as a series of steps.
25 ///
26 /// <picture>
27 /// <source srcset="assistant-dark.png" media="(prefers-color-scheme: dark)">
28 /// <img alt="An example GtkAssistant" src="assistant.png">
29 /// </picture>
30 ///
31 /// Each step consists of one or more pages. [`Assistant`][crate::Assistant] guides the user
32 /// through the pages, and controls the page flow to collect the data needed
33 /// for the operation.
34 ///
35 /// [`Assistant`][crate::Assistant] handles which buttons to show and to make sensitive based
36 /// on page sequence knowledge and the [`AssistantPageType`][crate::AssistantPageType] of each
37 /// page in addition to state information like the *completed* and *committed*
38 /// page statuses.
39 ///
40 /// If you have a case that doesn’t quite fit in [`Assistant`][crate::Assistant]s way of
41 /// handling buttons, you can use the [`AssistantPageType::Custom`][crate::AssistantPageType::Custom] page
42 /// type and handle buttons yourself.
43 ///
44 /// [`Assistant`][crate::Assistant] maintains a [`AssistantPage`][crate::AssistantPage] object for each added
45 /// child, which holds additional per-child properties. You
46 /// obtain the [`AssistantPage`][crate::AssistantPage] for a child with [`page()`][Self::page()].
47 ///
48 /// # GtkAssistant as GtkBuildable
49 ///
50 /// The [`Assistant`][crate::Assistant] implementation of the [`Buildable`][crate::Buildable] interface
51 /// exposes the @action_area as internal children with the name
52 /// “action_area”.
53 ///
54 /// To add pages to an assistant in [`Builder`][crate::Builder], simply add it as a
55 /// child to the [`Assistant`][crate::Assistant] object. If you need to set per-object
56 /// properties, create a [`AssistantPage`][crate::AssistantPage] object explicitly, and
57 /// set the child widget as a property on it.
58 ///
59 /// # CSS nodes
60 ///
61 /// [`Assistant`][crate::Assistant] has a single CSS node with the name window and style
62 /// class .assistant.
63 ///
64 /// ## Properties
65 ///
66 ///
67 /// #### `pages`
68 /// `GListModel` containing the pages.
69 ///
70 /// Readable
71 ///
72 ///
73 /// #### `use-header-bar`
74 /// [`true`] if the assistant uses a [`HeaderBar`][crate::HeaderBar] for action buttons
75 /// instead of the action-area.
76 ///
77 /// For technical reasons, this property is declared as an integer
78 /// property, but you should only set it to [`true`] or [`false`].
79 ///
80 /// Readable | Writeable | Construct Only
81 /// <details><summary><h4>Window</h4></summary>
82 ///
83 ///
84 /// #### `application`
85 /// The [`Application`][crate::Application] associated with the window.
86 ///
87 /// The application will be kept alive for at least as long as it
88 /// has any windows associated with it (see g_application_hold()
89 /// for a way to keep it alive without windows).
90 ///
91 /// Normally, the connection between the application and the window
92 /// will remain until the window is destroyed, but you can explicitly
93 /// remove it by setting the this property to `NULL`.
94 ///
95 /// Readable | Writeable
96 ///
97 ///
98 /// #### `child`
99 /// The child widget.
100 ///
101 /// Readable | Writeable
102 ///
103 ///
104 /// #### `decorated`
105 /// Whether the window should have a frame (also known as *decorations*).
106 ///
107 /// Readable | Writeable
108 ///
109 ///
110 /// #### `default-height`
111 /// The default height of the window.
112 ///
113 /// Readable | Writeable
114 ///
115 ///
116 /// #### `default-widget`
117 /// The default widget.
118 ///
119 /// Readable | Writeable
120 ///
121 ///
122 /// #### `default-width`
123 /// The default width of the window.
124 ///
125 /// Readable | Writeable
126 ///
127 ///
128 /// #### `deletable`
129 /// Whether the window frame should have a close button.
130 ///
131 /// Readable | Writeable
132 ///
133 ///
134 /// #### `destroy-with-parent`
135 /// If this window should be destroyed when the parent is destroyed.
136 ///
137 /// Readable | Writeable
138 ///
139 ///
140 /// #### `display`
141 /// The display that will display this window.
142 ///
143 /// Readable | Writeable
144 ///
145 ///
146 /// #### `focus-visible`
147 /// Whether 'focus rectangles' are currently visible in this window.
148 ///
149 /// This property is maintained by GTK based on user input
150 /// and should not be set by applications.
151 ///
152 /// Readable | Writeable
153 ///
154 ///
155 /// #### `focus-widget`
156 /// The focus widget.
157 ///
158 /// Readable | Writeable
159 ///
160 ///
161 /// #### `fullscreened`
162 /// Whether the window is fullscreen.
163 ///
164 /// Setting this property is the equivalent of calling
165 /// [`GtkWindowExt::fullscreen()`][crate::prelude::GtkWindowExt::fullscreen()] or [`GtkWindowExt::unfullscreen()`][crate::prelude::GtkWindowExt::unfullscreen()];
166 /// either operation is asynchronous, which means you will need to
167 /// connect to the ::notify signal in order to know whether the
168 /// operation was successful.
169 ///
170 /// Readable | Writeable
171 ///
172 ///
173 /// #### `gravity`
174 /// The gravity to use when resizing the window programmatically.
175 ///
176 /// Gravity describes which point of the window we want to keep
177 /// fixed (meaning that the window will grow in the opposite direction).
178 /// For example, a gravity of `GTK_WINDOW_GRAVITY_TOP_RIGHT` means that we
179 /// want the to fix top right corner of the window.
180 ///
181 /// Readable | Writeable
182 ///
183 ///
184 /// #### `handle-menubar-accel`
185 /// Whether the window frame should handle <kbd>F10</kbd> for activating
186 /// menubars.
187 ///
188 /// Readable | Writeable
189 ///
190 ///
191 /// #### `hide-on-close`
192 /// If this window should be hidden instead of destroyed when the user clicks
193 /// the close button.
194 ///
195 /// Readable | Writeable
196 ///
197 ///
198 /// #### `icon-name`
199 /// Specifies the name of the themed icon to use as the window icon.
200 ///
201 /// See [`IconTheme`][crate::IconTheme] for more details.
202 ///
203 /// Readable | Writeable
204 ///
205 ///
206 /// #### `is-active`
207 /// Whether the toplevel is the currently active window.
208 ///
209 /// Readable
210 ///
211 ///
212 /// #### `maximized`
213 /// Whether the window is maximized.
214 ///
215 /// Setting this property is the equivalent of calling
216 /// [`GtkWindowExt::maximize()`][crate::prelude::GtkWindowExt::maximize()] or [`GtkWindowExt::unmaximize()`][crate::prelude::GtkWindowExt::unmaximize()];
217 /// either operation is asynchronous, which means you will need to
218 /// connect to the ::notify signal in order to know whether the
219 /// operation was successful.
220 ///
221 /// Readable | Writeable
222 ///
223 ///
224 /// #### `mnemonics-visible`
225 /// Whether mnemonics are currently visible in this window.
226 ///
227 /// This property is maintained by GTK based on user input,
228 /// and should not be set by applications.
229 ///
230 /// Readable | Writeable
231 ///
232 ///
233 /// #### `modal`
234 /// If true, the window is modal.
235 ///
236 /// Readable | Writeable
237 ///
238 ///
239 /// #### `resizable`
240 /// If true, users can resize the window.
241 ///
242 /// Readable | Writeable
243 ///
244 ///
245 /// #### `startup-id`
246 /// A write-only property for setting window's startup notification identifier.
247 ///
248 /// Writeable
249 ///
250 ///
251 /// #### `suspended`
252 /// Whether the window is suspended.
253 ///
254 /// See [`GtkWindowExt::is_suspended()`][crate::prelude::GtkWindowExt::is_suspended()] for details about what suspended means.
255 ///
256 /// Readable
257 ///
258 ///
259 /// #### `title`
260 /// The title of the window.
261 ///
262 /// Readable | Writeable
263 ///
264 ///
265 /// #### `titlebar`
266 /// The titlebar widget.
267 ///
268 /// Readable | Writeable
269 ///
270 ///
271 /// #### `transient-for`
272 /// The transient parent of the window.
273 ///
274 /// Readable | Writeable | Construct
275 /// </details>
276 /// <details><summary><h4>Widget</h4></summary>
277 ///
278 ///
279 /// #### `can-focus`
280 /// Whether the widget or any of its descendents can accept
281 /// the input focus.
282 ///
283 /// This property is meant to be set by widget implementations,
284 /// typically in their instance init function.
285 ///
286 /// Readable | Writeable
287 ///
288 ///
289 /// #### `can-target`
290 /// Whether the widget can receive pointer events.
291 ///
292 /// Readable | Writeable
293 ///
294 ///
295 /// #### `css-classes`
296 /// A list of css classes applied to this widget.
297 ///
298 /// Readable | Writeable
299 ///
300 ///
301 /// #### `css-name`
302 /// The name of this widget in the CSS tree.
303 ///
304 /// This property is meant to be set by widget implementations,
305 /// typically in their instance init function.
306 ///
307 /// Readable | Writeable | Construct Only
308 ///
309 ///
310 /// #### `cursor`
311 /// The cursor used by @widget.
312 ///
313 /// Readable | Writeable
314 ///
315 ///
316 /// #### `focus-on-click`
317 /// Whether the widget should grab focus when it is clicked with the mouse.
318 ///
319 /// This property is only relevant for widgets that can take focus.
320 ///
321 /// Readable | Writeable
322 ///
323 ///
324 /// #### `focusable`
325 /// Whether this widget itself will accept the input focus.
326 ///
327 /// Readable | Writeable
328 ///
329 ///
330 /// #### `halign`
331 /// How to distribute horizontal space if widget gets extra space.
332 ///
333 /// Readable | Writeable
334 ///
335 ///
336 /// #### `has-default`
337 /// Whether the widget is the default widget.
338 ///
339 /// Readable
340 ///
341 ///
342 /// #### `has-focus`
343 /// Whether the widget has the input focus.
344 ///
345 /// Readable
346 ///
347 ///
348 /// #### `has-tooltip`
349 /// Enables or disables the emission of the [`query-tooltip`][struct@crate::Widget#query-tooltip]
350 /// signal on @widget.
351 ///
352 /// A true value indicates that @widget can have a tooltip, in this case
353 /// the widget will be queried using [`query-tooltip`][struct@crate::Widget#query-tooltip] to
354 /// determine whether it will provide a tooltip or not.
355 ///
356 /// Readable | Writeable
357 ///
358 ///
359 /// #### `height-request`
360 /// Overrides for height request of the widget.
361 ///
362 /// If this is -1, the natural request will be used.
363 ///
364 /// Readable | Writeable
365 ///
366 ///
367 /// #### `hexpand`
368 /// Whether to expand horizontally.
369 ///
370 /// Readable | Writeable
371 ///
372 ///
373 /// #### `hexpand-set`
374 /// Whether to use the `hexpand` property.
375 ///
376 /// Readable | Writeable
377 ///
378 ///
379 /// #### `layout-manager`
380 /// The [`LayoutManager`][crate::LayoutManager] instance to use to compute
381 /// the preferred size of the widget, and allocate its children.
382 ///
383 /// This property is meant to be set by widget implementations,
384 /// typically in their instance init function.
385 ///
386 /// Readable | Writeable
387 ///
388 ///
389 /// #### `limit-events`
390 /// Makes this widget act like a modal dialog, with respect to
391 /// event delivery.
392 ///
393 /// Global event controllers will not handle events with targets
394 /// inside the widget, unless they are set up to ignore propagation
395 /// limits. See [`EventControllerExt::set_propagation_limit()`][crate::prelude::EventControllerExt::set_propagation_limit()].
396 ///
397 /// Readable | Writeable
398 ///
399 ///
400 /// #### `margin-bottom`
401 /// Margin on bottom side of widget.
402 ///
403 /// This property adds margin outside of the widget's normal size
404 /// request, the margin will be added in addition to the size from
405 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
406 ///
407 /// Readable | Writeable
408 ///
409 ///
410 /// #### `margin-end`
411 /// Margin on end of widget, horizontally.
412 ///
413 /// This property supports left-to-right and right-to-left text
414 /// directions.
415 ///
416 /// This property adds margin outside of the widget's normal size
417 /// request, the margin will be added in addition to the size from
418 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
419 ///
420 /// Readable | Writeable
421 ///
422 ///
423 /// #### `margin-start`
424 /// Margin on start of widget, horizontally.
425 ///
426 /// This property supports left-to-right and right-to-left text
427 /// directions.
428 ///
429 /// This property adds margin outside of the widget's normal size
430 /// request, the margin will be added in addition to the size from
431 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
432 ///
433 /// Readable | Writeable
434 ///
435 ///
436 /// #### `margin-top`
437 /// Margin on top side of widget.
438 ///
439 /// This property adds margin outside of the widget's normal size
440 /// request, the margin will be added in addition to the size from
441 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
442 ///
443 /// Readable | Writeable
444 ///
445 ///
446 /// #### `name`
447 /// The name of the widget.
448 ///
449 /// Readable | Writeable
450 ///
451 ///
452 /// #### `opacity`
453 /// The requested opacity of the widget.
454 ///
455 /// Readable | Writeable
456 ///
457 ///
458 /// #### `overflow`
459 /// How content outside the widget's content area is treated.
460 ///
461 /// This property is meant to be set by widget implementations,
462 /// typically in their instance init function.
463 ///
464 /// Readable | Writeable
465 ///
466 ///
467 /// #### `parent`
468 /// The parent widget of this widget.
469 ///
470 /// Readable
471 ///
472 ///
473 /// #### `receives-default`
474 /// Whether the widget will receive the default action when it is focused.
475 ///
476 /// Readable | Writeable
477 ///
478 ///
479 /// #### `root`
480 /// The [`Root`][crate::Root] widget of the widget tree containing this widget.
481 ///
482 /// This will be `NULL` if the widget is not contained in a root widget.
483 ///
484 /// Readable
485 ///
486 ///
487 /// #### `scale-factor`
488 /// The scale factor of the widget.
489 ///
490 /// Readable
491 ///
492 ///
493 /// #### `sensitive`
494 /// Whether the widget responds to input.
495 ///
496 /// Readable | Writeable
497 ///
498 ///
499 /// #### `tooltip-markup`
500 /// Sets the text of tooltip to be the given string, which is marked up
501 /// with Pango markup.
502 ///
503 /// Also see [`Tooltip::set_markup()`][crate::Tooltip::set_markup()].
504 ///
505 /// This is a convenience property which will take care of getting the
506 /// tooltip shown if the given string is not `NULL`:
507 /// [`has-tooltip`][struct@crate::Widget#has-tooltip] will automatically be set to true
508 /// and there will be taken care of [`query-tooltip`][struct@crate::Widget#query-tooltip] in
509 /// the default signal handler.
510 ///
511 /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and
512 /// [`tooltip-markup`][struct@crate::Widget#tooltip-markup] are set, the last one wins.
513 ///
514 /// Readable | Writeable
515 ///
516 ///
517 /// #### `tooltip-text`
518 /// Sets the text of tooltip to be the given string.
519 ///
520 /// Also see [`Tooltip::set_text()`][crate::Tooltip::set_text()].
521 ///
522 /// This is a convenience property which will take care of getting the
523 /// tooltip shown if the given string is not `NULL`:
524 /// [`has-tooltip`][struct@crate::Widget#has-tooltip] will automatically be set to true
525 /// and there will be taken care of [`query-tooltip`][struct@crate::Widget#query-tooltip] in
526 /// the default signal handler.
527 ///
528 /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and
529 /// [`tooltip-markup`][struct@crate::Widget#tooltip-markup] are set, the last one wins.
530 ///
531 /// Readable | Writeable
532 ///
533 ///
534 /// #### `valign`
535 /// How to distribute vertical space if widget gets extra space.
536 ///
537 /// Readable | Writeable
538 ///
539 ///
540 /// #### `vexpand`
541 /// Whether to expand vertically.
542 ///
543 /// Readable | Writeable
544 ///
545 ///
546 /// #### `vexpand-set`
547 /// Whether to use the `vexpand` property.
548 ///
549 /// Readable | Writeable
550 ///
551 ///
552 /// #### `visible`
553 /// Whether the widget is visible.
554 ///
555 /// Readable | Writeable
556 ///
557 ///
558 /// #### `width-request`
559 /// Overrides for width request of the widget.
560 ///
561 /// If this is -1, the natural request will be used.
562 ///
563 /// Readable | Writeable
564 /// </details>
565 /// <details><summary><h4>Accessible</h4></summary>
566 ///
567 ///
568 /// #### `accessible-role`
569 /// The accessible role of the given [`Accessible`][crate::Accessible] implementation.
570 ///
571 /// The accessible role cannot be changed once set.
572 ///
573 /// Readable | Writeable
574 /// </details>
575 ///
576 /// ## Signals
577 ///
578 ///
579 /// #### `apply`
580 /// Emitted when the apply button is clicked.
581 ///
582 /// The default behavior of the [`Assistant`][crate::Assistant] is to switch to the page
583 /// after the current page, unless the current page is the last one.
584 ///
585 /// A handler for the ::apply signal should carry out the actions for
586 /// which the wizard has collected data. If the action takes a long time
587 /// to complete, you might consider putting a page of type
588 /// [`AssistantPageType::Progress`][crate::AssistantPageType::Progress] after the confirmation page and handle
589 /// this operation within the [`prepare`][struct@crate::Assistant#prepare] signal of
590 /// the progress page.
591 ///
592 ///
593 ///
594 ///
595 /// #### `cancel`
596 /// Emitted when then the cancel button is clicked.
597 ///
598 ///
599 ///
600 ///
601 /// #### `close`
602 /// Emitted either when the close button of a summary page is clicked,
603 /// or when the apply button in the last page in the flow (of type
604 /// [`AssistantPageType::Confirm`][crate::AssistantPageType::Confirm]) is clicked.
605 ///
606 ///
607 ///
608 ///
609 /// #### `escape`
610 /// The action signal for the Escape binding.
611 ///
612 /// Action
613 ///
614 ///
615 /// #### `prepare`
616 /// Emitted when a new page is set as the assistant's current page,
617 /// before making the new page visible.
618 ///
619 /// A handler for this signal can do any preparations which are
620 /// necessary before showing @page.
621 ///
622 ///
623 /// <details><summary><h4>Window</h4></summary>
624 ///
625 ///
626 /// #### `activate-default`
627 /// Emitted when the user activates the default widget.
628 ///
629 /// This is a [keybinding signal](class.SignalAction.html).
630 ///
631 /// The keybindings for this signal are all forms of the <kbd>Enter</kbd> key.
632 ///
633 /// Action
634 ///
635 ///
636 /// #### `activate-focus`
637 /// Emitted when the user activates the currently focused
638 /// widget of @window.
639 ///
640 /// This is a [keybinding signal](class.SignalAction.html).
641 ///
642 /// The default binding for this signal is <kbd>␣</kbd>.
643 ///
644 /// Action
645 ///
646 ///
647 /// #### `close-request`
648 /// Emitted when the user clicks on the close button of the window.
649 ///
650 ///
651 ///
652 ///
653 /// #### `enable-debugging`
654 /// Emitted when the user enables or disables interactive debugging.
655 ///
656 /// When @toggle is true, interactive debugging is toggled on or off,
657 /// when it is false, the debugger will be pointed at the widget
658 /// under the pointer.
659 ///
660 /// This is a [keybinding signal](class.SignalAction.html).
661 ///
662 /// The default bindings for this signal are
663 /// <kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>I</kbd> and
664 /// <kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>D</kbd>.
665 ///
666 /// Action
667 ///
668 ///
669 /// #### `keys-changed`
670 /// Emitted when the set of accelerators or mnemonics that
671 /// are associated with the window changes.
672 ///
673 ///
674 /// </details>
675 /// <details><summary><h4>Widget</h4></summary>
676 ///
677 ///
678 /// #### `destroy`
679 /// Signals that all holders of a reference to the widget should release
680 /// the reference that they hold.
681 ///
682 /// May result in finalization of the widget if all references are released.
683 ///
684 /// This signal is not suitable for saving widget state.
685 ///
686 ///
687 ///
688 ///
689 /// #### `direction-changed`
690 /// Emitted when the text direction of a widget changes.
691 ///
692 ///
693 ///
694 ///
695 /// #### `hide`
696 /// Emitted when @widget is hidden.
697 ///
698 ///
699 ///
700 ///
701 /// #### `keynav-failed`
702 /// Emitted if keyboard navigation fails.
703 ///
704 /// See [`WidgetExt::keynav_failed()`][crate::prelude::WidgetExt::keynav_failed()] for details.
705 ///
706 ///
707 ///
708 ///
709 /// #### `map`
710 /// Emitted when @widget is going to be mapped.
711 ///
712 /// A widget is mapped when the widget is visible (which is controlled with
713 /// [`visible`][struct@crate::Widget#visible]) and all its parents up to the toplevel widget
714 /// are also visible.
715 ///
716 /// The `::map` signal can be used to determine whether a widget will be drawn,
717 /// for instance it can resume an animation that was stopped during the
718 /// emission of [`unmap`][struct@crate::Widget#unmap].
719 ///
720 ///
721 ///
722 ///
723 /// #### `mnemonic-activate`
724 /// Emitted when a widget is activated via a mnemonic.
725 ///
726 /// The default handler for this signal activates @widget if @group_cycling
727 /// is false, or just makes @widget grab focus if @group_cycling is true.
728 ///
729 ///
730 ///
731 ///
732 /// #### `move-focus`
733 /// Emitted when the focus is moved.
734 ///
735 /// The `::move-focus` signal is a [keybinding signal](class.SignalAction.html).
736 ///
737 /// The default bindings for this signal are <kbd>Tab</kbd> to move forward,
738 /// and <kbd>Shift</kbd>+<kbd>Tab</kbd> to move backward.
739 ///
740 /// Action
741 ///
742 ///
743 /// #### `query-tooltip`
744 /// Emitted when the widget’s tooltip is about to be shown.
745 ///
746 /// This happens when the [`has-tooltip`][struct@crate::Widget#has-tooltip] property
747 /// is true and the hover timeout has expired with the cursor hovering
748 /// above @widget; or emitted when @widget got focus in keyboard mode.
749 ///
750 /// Using the given coordinates, the signal handler should determine
751 /// whether a tooltip should be shown for @widget. If this is the case
752 /// true should be returned, false otherwise. Note that if @keyboard_mode
753 /// is true, the values of @x and @y are undefined and should not be used.
754 ///
755 /// The signal handler is free to manipulate @tooltip with the therefore
756 /// destined function calls.
757 ///
758 ///
759 ///
760 ///
761 /// #### `realize`
762 /// Emitted when @widget is associated with a [`gdk::Surface`][crate::gdk::Surface].
763 ///
764 /// This means that [`WidgetExt::realize()`][crate::prelude::WidgetExt::realize()] has been called
765 /// or the widget has been mapped (that is, it is going to be drawn).
766 ///
767 ///
768 ///
769 ///
770 /// #### `show`
771 /// Emitted when @widget is shown.
772 ///
773 ///
774 ///
775 ///
776 /// #### `state-flags-changed`
777 /// Emitted when the widget state changes.
778 ///
779 /// See [`WidgetExt::state_flags()`][crate::prelude::WidgetExt::state_flags()].
780 ///
781 ///
782 ///
783 ///
784 /// #### `unmap`
785 /// Emitted when @widget is going to be unmapped.
786 ///
787 /// A widget is unmapped when either it or any of its parents up to the
788 /// toplevel widget have been set as hidden.
789 ///
790 /// As `::unmap` indicates that a widget will not be shown any longer,
791 /// it can be used to, for example, stop an animation on the widget.
792 ///
793 ///
794 ///
795 ///
796 /// #### `unrealize`
797 /// Emitted when the [`gdk::Surface`][crate::gdk::Surface] associated with @widget is destroyed.
798 ///
799 /// This means that [`WidgetExt::unrealize()`][crate::prelude::WidgetExt::unrealize()] has been called
800 /// or the widget has been unmapped (that is, it is going to be hidden).
801 ///
802 ///
803 /// </details>
804 ///
805 /// # Implements
806 ///
807 /// [`GtkWindowExt`][trait@crate::prelude::GtkWindowExt], [`WidgetExt`][trait@crate::prelude::WidgetExt], [`trait@glib::ObjectExt`], [`AccessibleExt`][trait@crate::prelude::AccessibleExt], [`BuildableExt`][trait@crate::prelude::BuildableExt], [`ConstraintTargetExt`][trait@crate::prelude::ConstraintTargetExt], [`NativeExt`][trait@crate::prelude::NativeExt], [`RootExt`][trait@crate::prelude::RootExt], [`ShortcutManagerExt`][trait@crate::prelude::ShortcutManagerExt], [`WidgetExtManual`][trait@crate::prelude::WidgetExtManual], [`AccessibleExtManual`][trait@crate::prelude::AccessibleExtManual]
808 #[doc(alias = "GtkAssistant")]
809 pub struct Assistant(Object<ffi::GtkAssistant>) @extends Window, Widget, @implements Accessible, Buildable, ConstraintTarget, Native, Root, ShortcutManager;
810
811 match fn {
812 type_ => || ffi::gtk_assistant_get_type(),
813 }
814}
815
816impl Assistant {
817 /// Creates a new [`Assistant`][crate::Assistant].
818 ///
819 /// # Deprecated since 4.10
820 ///
821 /// This widget will be removed in GTK 5
822 ///
823 /// # Returns
824 ///
825 /// a newly created [`Assistant`][crate::Assistant]
826 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
827 #[allow(deprecated)]
828 #[doc(alias = "gtk_assistant_new")]
829 pub fn new() -> Assistant {
830 assert_initialized_main_thread!();
831 unsafe { Widget::from_glib_none(ffi::gtk_assistant_new()).unsafe_cast() }
832 }
833
834 // rustdoc-stripper-ignore-next
835 /// Creates a new builder-pattern struct instance to construct [`Assistant`] objects.
836 ///
837 /// This method returns an instance of [`AssistantBuilder`](crate::builders::AssistantBuilder) which can be used to create [`Assistant`] objects.
838 pub fn builder() -> AssistantBuilder {
839 AssistantBuilder::new()
840 }
841
842 /// Adds a widget to the action area of a [`Assistant`][crate::Assistant].
843 ///
844 /// # Deprecated since 4.10
845 ///
846 /// This widget will be removed in GTK 5
847 /// ## `child`
848 /// a [`Widget`][crate::Widget]
849 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
850 #[allow(deprecated)]
851 #[doc(alias = "gtk_assistant_add_action_widget")]
852 pub fn add_action_widget(&self, child: &impl IsA<Widget>) {
853 unsafe {
854 ffi::gtk_assistant_add_action_widget(
855 self.to_glib_none().0,
856 child.as_ref().to_glib_none().0,
857 );
858 }
859 }
860
861 /// Appends a page to the @self.
862 ///
863 /// # Deprecated since 4.10
864 ///
865 /// This widget will be removed in GTK 5
866 /// ## `page`
867 /// a [`Widget`][crate::Widget]
868 ///
869 /// # Returns
870 ///
871 /// the index (starting at 0) of the inserted page
872 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
873 #[allow(deprecated)]
874 #[doc(alias = "gtk_assistant_append_page")]
875 pub fn append_page(&self, page: &impl IsA<Widget>) -> i32 {
876 unsafe {
877 ffi::gtk_assistant_append_page(self.to_glib_none().0, page.as_ref().to_glib_none().0)
878 }
879 }
880
881 /// Erases the visited page history.
882 ///
883 /// GTK will then hide the back button on the current page,
884 /// and removes the cancel button from subsequent pages.
885 ///
886 /// Use this when the information provided up to the current
887 /// page is hereafter deemed permanent and cannot be modified
888 /// or undone. For example, showing a progress page to track
889 /// a long-running, unreversible operation after the user has
890 /// clicked apply on a confirmation page.
891 ///
892 /// # Deprecated since 4.10
893 ///
894 /// This widget will be removed in GTK 5
895 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
896 #[allow(deprecated)]
897 #[doc(alias = "gtk_assistant_commit")]
898 pub fn commit(&self) {
899 unsafe {
900 ffi::gtk_assistant_commit(self.to_glib_none().0);
901 }
902 }
903
904 /// Returns the page number of the current page.
905 ///
906 /// # Deprecated since 4.10
907 ///
908 /// This widget will be removed in GTK 5
909 ///
910 /// # Returns
911 ///
912 /// The index (starting from 0) of the current
913 /// page in the @self, or -1 if the @self has no pages,
914 /// or no current page
915 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
916 #[allow(deprecated)]
917 #[doc(alias = "gtk_assistant_get_current_page")]
918 #[doc(alias = "get_current_page")]
919 pub fn current_page(&self) -> i32 {
920 unsafe { ffi::gtk_assistant_get_current_page(self.to_glib_none().0) }
921 }
922
923 /// Returns the number of pages in the @self
924 ///
925 /// # Deprecated since 4.10
926 ///
927 /// This widget will be removed in GTK 5
928 ///
929 /// # Returns
930 ///
931 /// the number of pages in the @self
932 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
933 #[allow(deprecated)]
934 #[doc(alias = "gtk_assistant_get_n_pages")]
935 #[doc(alias = "get_n_pages")]
936 pub fn n_pages(&self) -> i32 {
937 unsafe { ffi::gtk_assistant_get_n_pages(self.to_glib_none().0) }
938 }
939
940 /// Returns the child widget contained in page number @page_num.
941 ///
942 /// # Deprecated since 4.10
943 ///
944 /// This widget will be removed in GTK 5
945 /// ## `page_num`
946 /// the index of a page in the @self,
947 /// or -1 to get the last page
948 ///
949 /// # Returns
950 ///
951 /// the child widget, or [`None`]
952 /// if @page_num is out of bounds
953 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
954 #[allow(deprecated)]
955 #[doc(alias = "gtk_assistant_get_nth_page")]
956 #[doc(alias = "get_nth_page")]
957 pub fn nth_page(&self, page_num: i32) -> Option<Widget> {
958 unsafe {
959 from_glib_none(ffi::gtk_assistant_get_nth_page(
960 self.to_glib_none().0,
961 page_num,
962 ))
963 }
964 }
965
966 /// Returns the [`AssistantPage`][crate::AssistantPage] object for @child.
967 ///
968 /// # Deprecated since 4.10
969 ///
970 /// This widget will be removed in GTK 5
971 /// ## `child`
972 /// a child of @self
973 ///
974 /// # Returns
975 ///
976 /// the [`AssistantPage`][crate::AssistantPage] for @child
977 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
978 #[allow(deprecated)]
979 #[doc(alias = "gtk_assistant_get_page")]
980 #[doc(alias = "get_page")]
981 pub fn page(&self, child: &impl IsA<Widget>) -> AssistantPage {
982 unsafe {
983 from_glib_none(ffi::gtk_assistant_get_page(
984 self.to_glib_none().0,
985 child.as_ref().to_glib_none().0,
986 ))
987 }
988 }
989
990 /// Gets whether @page is complete.
991 ///
992 /// # Deprecated since 4.10
993 ///
994 /// This widget will be removed in GTK 5
995 /// ## `page`
996 /// a page of @self
997 ///
998 /// # Returns
999 ///
1000 /// [`true`] if @page is complete.
1001 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
1002 #[allow(deprecated)]
1003 #[doc(alias = "gtk_assistant_get_page_complete")]
1004 #[doc(alias = "get_page_complete")]
1005 pub fn page_is_complete(&self, page: &impl IsA<Widget>) -> bool {
1006 unsafe {
1007 from_glib(ffi::gtk_assistant_get_page_complete(
1008 self.to_glib_none().0,
1009 page.as_ref().to_glib_none().0,
1010 ))
1011 }
1012 }
1013
1014 /// Gets the title for @page.
1015 ///
1016 /// # Deprecated since 4.10
1017 ///
1018 /// This widget will be removed in GTK 5
1019 /// ## `page`
1020 /// a page of @self
1021 ///
1022 /// # Returns
1023 ///
1024 /// the title for @page
1025 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
1026 #[allow(deprecated)]
1027 #[doc(alias = "gtk_assistant_get_page_title")]
1028 #[doc(alias = "get_page_title")]
1029 pub fn page_title(&self, page: &impl IsA<Widget>) -> glib::GString {
1030 unsafe {
1031 from_glib_none(ffi::gtk_assistant_get_page_title(
1032 self.to_glib_none().0,
1033 page.as_ref().to_glib_none().0,
1034 ))
1035 }
1036 }
1037
1038 /// Gets the page type of @page.
1039 ///
1040 /// # Deprecated since 4.10
1041 ///
1042 /// This widget will be removed in GTK 5
1043 /// ## `page`
1044 /// a page of @self
1045 ///
1046 /// # Returns
1047 ///
1048 /// the page type of @page
1049 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
1050 #[allow(deprecated)]
1051 #[doc(alias = "gtk_assistant_get_page_type")]
1052 #[doc(alias = "get_page_type")]
1053 pub fn page_type(&self, page: &impl IsA<Widget>) -> AssistantPageType {
1054 unsafe {
1055 from_glib(ffi::gtk_assistant_get_page_type(
1056 self.to_glib_none().0,
1057 page.as_ref().to_glib_none().0,
1058 ))
1059 }
1060 }
1061
1062 /// Gets a list model of the assistant pages.
1063 ///
1064 /// # Deprecated since 4.10
1065 ///
1066 /// This widget will be removed in GTK 5
1067 ///
1068 /// # Returns
1069 ///
1070 /// A list model of the pages.
1071 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
1072 #[allow(deprecated)]
1073 #[doc(alias = "gtk_assistant_get_pages")]
1074 #[doc(alias = "get_pages")]
1075 pub fn pages(&self) -> gio::ListModel {
1076 unsafe { from_glib_full(ffi::gtk_assistant_get_pages(self.to_glib_none().0)) }
1077 }
1078
1079 /// Inserts a page in the @self at a given position.
1080 ///
1081 /// # Deprecated since 4.10
1082 ///
1083 /// This widget will be removed in GTK 5
1084 /// ## `page`
1085 /// a [`Widget`][crate::Widget]
1086 /// ## `position`
1087 /// the index (starting at 0) at which to insert the page,
1088 /// or -1 to append the page to the @self
1089 ///
1090 /// # Returns
1091 ///
1092 /// the index (starting from 0) of the inserted page
1093 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
1094 #[allow(deprecated)]
1095 #[doc(alias = "gtk_assistant_insert_page")]
1096 pub fn insert_page(&self, page: &impl IsA<Widget>, position: i32) -> i32 {
1097 unsafe {
1098 ffi::gtk_assistant_insert_page(
1099 self.to_glib_none().0,
1100 page.as_ref().to_glib_none().0,
1101 position,
1102 )
1103 }
1104 }
1105
1106 /// Navigate to the next page.
1107 ///
1108 /// It is a programming error to call this function when
1109 /// there is no next page.
1110 ///
1111 /// This function is for use when creating pages of the
1112 /// [`AssistantPageType::Custom`][crate::AssistantPageType::Custom] type.
1113 ///
1114 /// # Deprecated since 4.10
1115 ///
1116 /// This widget will be removed in GTK 5
1117 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
1118 #[allow(deprecated)]
1119 #[doc(alias = "gtk_assistant_next_page")]
1120 pub fn next_page(&self) {
1121 unsafe {
1122 ffi::gtk_assistant_next_page(self.to_glib_none().0);
1123 }
1124 }
1125
1126 /// Prepends a page to the @self.
1127 ///
1128 /// # Deprecated since 4.10
1129 ///
1130 /// This widget will be removed in GTK 5
1131 /// ## `page`
1132 /// a [`Widget`][crate::Widget]
1133 ///
1134 /// # Returns
1135 ///
1136 /// the index (starting at 0) of the inserted page
1137 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
1138 #[allow(deprecated)]
1139 #[doc(alias = "gtk_assistant_prepend_page")]
1140 pub fn prepend_page(&self, page: &impl IsA<Widget>) -> i32 {
1141 unsafe {
1142 ffi::gtk_assistant_prepend_page(self.to_glib_none().0, page.as_ref().to_glib_none().0)
1143 }
1144 }
1145
1146 /// Navigate to the previous visited page.
1147 ///
1148 /// It is a programming error to call this function when
1149 /// no previous page is available.
1150 ///
1151 /// This function is for use when creating pages of the
1152 /// [`AssistantPageType::Custom`][crate::AssistantPageType::Custom] type.
1153 ///
1154 /// # Deprecated since 4.10
1155 ///
1156 /// This widget will be removed in GTK 5
1157 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
1158 #[allow(deprecated)]
1159 #[doc(alias = "gtk_assistant_previous_page")]
1160 pub fn previous_page(&self) {
1161 unsafe {
1162 ffi::gtk_assistant_previous_page(self.to_glib_none().0);
1163 }
1164 }
1165
1166 /// Removes a widget from the action area of a [`Assistant`][crate::Assistant].
1167 ///
1168 /// # Deprecated since 4.10
1169 ///
1170 /// This widget will be removed in GTK 5
1171 /// ## `child`
1172 /// a [`Widget`][crate::Widget]
1173 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
1174 #[allow(deprecated)]
1175 #[doc(alias = "gtk_assistant_remove_action_widget")]
1176 pub fn remove_action_widget(&self, child: &impl IsA<Widget>) {
1177 unsafe {
1178 ffi::gtk_assistant_remove_action_widget(
1179 self.to_glib_none().0,
1180 child.as_ref().to_glib_none().0,
1181 );
1182 }
1183 }
1184
1185 /// Removes the @page_num’s page from @self.
1186 ///
1187 /// # Deprecated since 4.10
1188 ///
1189 /// This widget will be removed in GTK 5
1190 /// ## `page_num`
1191 /// the index of a page in the @self,
1192 /// or -1 to remove the last page
1193 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
1194 #[allow(deprecated)]
1195 #[doc(alias = "gtk_assistant_remove_page")]
1196 pub fn remove_page(&self, page_num: i32) {
1197 unsafe {
1198 ffi::gtk_assistant_remove_page(self.to_glib_none().0, page_num);
1199 }
1200 }
1201
1202 /// Switches the page to @page_num.
1203 ///
1204 /// Note that this will only be necessary in custom buttons,
1205 /// as the @self flow can be set with
1206 /// gtk_assistant_set_forward_page_func().
1207 ///
1208 /// # Deprecated since 4.10
1209 ///
1210 /// This widget will be removed in GTK 5
1211 /// ## `page_num`
1212 /// index of the page to switch to, starting from 0.
1213 /// If negative, the last page will be used. If greater
1214 /// than the number of pages in the @self, nothing
1215 /// will be done.
1216 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
1217 #[allow(deprecated)]
1218 #[doc(alias = "gtk_assistant_set_current_page")]
1219 pub fn set_current_page(&self, page_num: i32) {
1220 unsafe {
1221 ffi::gtk_assistant_set_current_page(self.to_glib_none().0, page_num);
1222 }
1223 }
1224
1225 /// Sets the page forwarding function to be @page_func.
1226 ///
1227 /// This function will be used to determine what will be
1228 /// the next page when the user presses the forward button.
1229 /// Setting @page_func to [`None`] will make the assistant to
1230 /// use the default forward function, which just goes to the
1231 /// next visible page.
1232 ///
1233 /// # Deprecated since 4.10
1234 ///
1235 /// This widget will be removed in GTK 5
1236 /// ## `page_func`
1237 /// the `GtkAssistantPageFunc`, or [`None`]
1238 /// to use the default one
1239 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
1240 #[allow(deprecated)]
1241 #[doc(alias = "gtk_assistant_set_forward_page_func")]
1242 pub fn set_forward_page_func<P: Fn(i32) -> i32 + 'static>(&self, page_func: P) {
1243 let page_func_data: Box_<P> = Box_::new(page_func);
1244 unsafe extern "C" fn page_func_func<P: Fn(i32) -> i32 + 'static>(
1245 current_page: std::ffi::c_int,
1246 data: glib::ffi::gpointer,
1247 ) -> std::ffi::c_int {
1248 let callback = &*(data as *mut P);
1249 (*callback)(current_page)
1250 }
1251 let page_func = Some(page_func_func::<P> as _);
1252 unsafe extern "C" fn destroy_func<P: Fn(i32) -> i32 + 'static>(data: glib::ffi::gpointer) {
1253 let _callback = Box_::from_raw(data as *mut P);
1254 }
1255 let destroy_call3 = Some(destroy_func::<P> as _);
1256 let super_callback0: Box_<P> = page_func_data;
1257 unsafe {
1258 ffi::gtk_assistant_set_forward_page_func(
1259 self.to_glib_none().0,
1260 page_func,
1261 Box_::into_raw(super_callback0) as *mut _,
1262 destroy_call3,
1263 );
1264 }
1265 }
1266
1267 /// Sets whether @page contents are complete.
1268 ///
1269 /// This will make @self update the buttons state
1270 /// to be able to continue the task.
1271 ///
1272 /// # Deprecated since 4.10
1273 ///
1274 /// This widget will be removed in GTK 5
1275 /// ## `page`
1276 /// a page of @self
1277 /// ## `complete`
1278 /// the completeness status of the page
1279 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
1280 #[allow(deprecated)]
1281 #[doc(alias = "gtk_assistant_set_page_complete")]
1282 pub fn set_page_complete(&self, page: &impl IsA<Widget>, complete: bool) {
1283 unsafe {
1284 ffi::gtk_assistant_set_page_complete(
1285 self.to_glib_none().0,
1286 page.as_ref().to_glib_none().0,
1287 complete.into_glib(),
1288 );
1289 }
1290 }
1291
1292 /// Sets a title for @page.
1293 ///
1294 /// The title is displayed in the header area of the assistant
1295 /// when @page is the current page.
1296 ///
1297 /// # Deprecated since 4.10
1298 ///
1299 /// This widget will be removed in GTK 5
1300 /// ## `page`
1301 /// a page of @self
1302 /// ## `title`
1303 /// the new title for @page
1304 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
1305 #[allow(deprecated)]
1306 #[doc(alias = "gtk_assistant_set_page_title")]
1307 pub fn set_page_title(&self, page: &impl IsA<Widget>, title: &str) {
1308 unsafe {
1309 ffi::gtk_assistant_set_page_title(
1310 self.to_glib_none().0,
1311 page.as_ref().to_glib_none().0,
1312 title.to_glib_none().0,
1313 );
1314 }
1315 }
1316
1317 /// Sets the page type for @page.
1318 ///
1319 /// The page type determines the page behavior in the @self.
1320 ///
1321 /// # Deprecated since 4.10
1322 ///
1323 /// This widget will be removed in GTK 5
1324 /// ## `page`
1325 /// a page of @self
1326 /// ## `type_`
1327 /// the new type for @page
1328 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
1329 #[allow(deprecated)]
1330 #[doc(alias = "gtk_assistant_set_page_type")]
1331 pub fn set_page_type(&self, page: &impl IsA<Widget>, type_: AssistantPageType) {
1332 unsafe {
1333 ffi::gtk_assistant_set_page_type(
1334 self.to_glib_none().0,
1335 page.as_ref().to_glib_none().0,
1336 type_.into_glib(),
1337 );
1338 }
1339 }
1340
1341 /// Forces @self to recompute the buttons state.
1342 ///
1343 /// GTK automatically takes care of this in most situations,
1344 /// e.g. when the user goes to a different page, or when the
1345 /// visibility or completeness of a page changes.
1346 ///
1347 /// One situation where it can be necessary to call this
1348 /// function is when changing a value on the current page
1349 /// affects the future page flow of the assistant.
1350 ///
1351 /// # Deprecated since 4.10
1352 ///
1353 /// This widget will be removed in GTK 5
1354 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
1355 #[allow(deprecated)]
1356 #[doc(alias = "gtk_assistant_update_buttons_state")]
1357 pub fn update_buttons_state(&self) {
1358 unsafe {
1359 ffi::gtk_assistant_update_buttons_state(self.to_glib_none().0);
1360 }
1361 }
1362
1363 /// [`true`] if the assistant uses a [`HeaderBar`][crate::HeaderBar] for action buttons
1364 /// instead of the action-area.
1365 ///
1366 /// For technical reasons, this property is declared as an integer
1367 /// property, but you should only set it to [`true`] or [`false`].
1368 ///
1369 /// # Deprecated since 4.10
1370 ///
1371 /// This widget will be removed in GTK 5
1372 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
1373 #[doc(alias = "use-header-bar")]
1374 pub fn use_header_bar(&self) -> i32 {
1375 ObjectExt::property(self, "use-header-bar")
1376 }
1377
1378 /// Emitted when the apply button is clicked.
1379 ///
1380 /// The default behavior of the [`Assistant`][crate::Assistant] is to switch to the page
1381 /// after the current page, unless the current page is the last one.
1382 ///
1383 /// A handler for the ::apply signal should carry out the actions for
1384 /// which the wizard has collected data. If the action takes a long time
1385 /// to complete, you might consider putting a page of type
1386 /// [`AssistantPageType::Progress`][crate::AssistantPageType::Progress] after the confirmation page and handle
1387 /// this operation within the [`prepare`][struct@crate::Assistant#prepare] signal of
1388 /// the progress page.
1389 ///
1390 /// # Deprecated since 4.10
1391 ///
1392 /// This widget will be removed in GTK 5
1393 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
1394 #[doc(alias = "apply")]
1395 pub fn connect_apply<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1396 unsafe extern "C" fn apply_trampoline<F: Fn(&Assistant) + 'static>(
1397 this: *mut ffi::GtkAssistant,
1398 f: glib::ffi::gpointer,
1399 ) {
1400 let f: &F = &*(f as *const F);
1401 f(&from_glib_borrow(this))
1402 }
1403 unsafe {
1404 let f: Box_<F> = Box_::new(f);
1405 connect_raw(
1406 self.as_ptr() as *mut _,
1407 c"apply".as_ptr() as *const _,
1408 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1409 apply_trampoline::<F> as *const (),
1410 )),
1411 Box_::into_raw(f),
1412 )
1413 }
1414 }
1415
1416 /// Emitted when then the cancel button is clicked.
1417 ///
1418 /// # Deprecated since 4.10
1419 ///
1420 /// This widget will be removed in GTK 5
1421 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
1422 #[doc(alias = "cancel")]
1423 pub fn connect_cancel<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1424 unsafe extern "C" fn cancel_trampoline<F: Fn(&Assistant) + 'static>(
1425 this: *mut ffi::GtkAssistant,
1426 f: glib::ffi::gpointer,
1427 ) {
1428 let f: &F = &*(f as *const F);
1429 f(&from_glib_borrow(this))
1430 }
1431 unsafe {
1432 let f: Box_<F> = Box_::new(f);
1433 connect_raw(
1434 self.as_ptr() as *mut _,
1435 c"cancel".as_ptr() as *const _,
1436 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1437 cancel_trampoline::<F> as *const (),
1438 )),
1439 Box_::into_raw(f),
1440 )
1441 }
1442 }
1443
1444 /// Emitted either when the close button of a summary page is clicked,
1445 /// or when the apply button in the last page in the flow (of type
1446 /// [`AssistantPageType::Confirm`][crate::AssistantPageType::Confirm]) is clicked.
1447 ///
1448 /// # Deprecated since 4.10
1449 ///
1450 /// This widget will be removed in GTK 5
1451 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
1452 #[doc(alias = "close")]
1453 pub fn connect_close<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1454 unsafe extern "C" fn close_trampoline<F: Fn(&Assistant) + 'static>(
1455 this: *mut ffi::GtkAssistant,
1456 f: glib::ffi::gpointer,
1457 ) {
1458 let f: &F = &*(f as *const F);
1459 f(&from_glib_borrow(this))
1460 }
1461 unsafe {
1462 let f: Box_<F> = Box_::new(f);
1463 connect_raw(
1464 self.as_ptr() as *mut _,
1465 c"close".as_ptr() as *const _,
1466 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1467 close_trampoline::<F> as *const (),
1468 )),
1469 Box_::into_raw(f),
1470 )
1471 }
1472 }
1473
1474 /// The action signal for the Escape binding.
1475 ///
1476 /// # Deprecated since 4.10
1477 ///
1478 /// This widget will be removed in GTK 5
1479 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
1480 #[doc(alias = "escape")]
1481 pub fn connect_escape<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1482 unsafe extern "C" fn escape_trampoline<F: Fn(&Assistant) + 'static>(
1483 this: *mut ffi::GtkAssistant,
1484 f: glib::ffi::gpointer,
1485 ) {
1486 let f: &F = &*(f as *const F);
1487 f(&from_glib_borrow(this))
1488 }
1489 unsafe {
1490 let f: Box_<F> = Box_::new(f);
1491 connect_raw(
1492 self.as_ptr() as *mut _,
1493 c"escape".as_ptr() as *const _,
1494 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1495 escape_trampoline::<F> as *const (),
1496 )),
1497 Box_::into_raw(f),
1498 )
1499 }
1500 }
1501
1502 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
1503 pub fn emit_escape(&self) {
1504 self.emit_by_name::<()>("escape", &[]);
1505 }
1506
1507 /// Emitted when a new page is set as the assistant's current page,
1508 /// before making the new page visible.
1509 ///
1510 /// A handler for this signal can do any preparations which are
1511 /// necessary before showing @page.
1512 ///
1513 /// # Deprecated since 4.10
1514 ///
1515 /// This widget will be removed in GTK 5
1516 /// ## `page`
1517 /// the current page
1518 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
1519 #[doc(alias = "prepare")]
1520 pub fn connect_prepare<F: Fn(&Self, &Widget) + 'static>(&self, f: F) -> SignalHandlerId {
1521 unsafe extern "C" fn prepare_trampoline<F: Fn(&Assistant, &Widget) + 'static>(
1522 this: *mut ffi::GtkAssistant,
1523 page: *mut ffi::GtkWidget,
1524 f: glib::ffi::gpointer,
1525 ) {
1526 let f: &F = &*(f as *const F);
1527 f(&from_glib_borrow(this), &from_glib_borrow(page))
1528 }
1529 unsafe {
1530 let f: Box_<F> = Box_::new(f);
1531 connect_raw(
1532 self.as_ptr() as *mut _,
1533 c"prepare".as_ptr() as *const _,
1534 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1535 prepare_trampoline::<F> as *const (),
1536 )),
1537 Box_::into_raw(f),
1538 )
1539 }
1540 }
1541
1542 #[doc(alias = "pages")]
1543 pub fn connect_pages_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1544 unsafe extern "C" fn notify_pages_trampoline<F: Fn(&Assistant) + 'static>(
1545 this: *mut ffi::GtkAssistant,
1546 _param_spec: glib::ffi::gpointer,
1547 f: glib::ffi::gpointer,
1548 ) {
1549 let f: &F = &*(f as *const F);
1550 f(&from_glib_borrow(this))
1551 }
1552 unsafe {
1553 let f: Box_<F> = Box_::new(f);
1554 connect_raw(
1555 self.as_ptr() as *mut _,
1556 c"notify::pages".as_ptr() as *const _,
1557 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1558 notify_pages_trampoline::<F> as *const (),
1559 )),
1560 Box_::into_raw(f),
1561 )
1562 }
1563 }
1564}
1565
1566impl Default for Assistant {
1567 fn default() -> Self {
1568 Self::new()
1569 }
1570}
1571
1572// rustdoc-stripper-ignore-next
1573/// A [builder-pattern] type to construct [`Assistant`] objects.
1574///
1575/// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html
1576#[must_use = "The builder must be built to be used"]
1577pub struct AssistantBuilder {
1578 builder: glib::object::ObjectBuilder<'static, Assistant>,
1579}
1580
1581impl AssistantBuilder {
1582 fn new() -> Self {
1583 Self {
1584 builder: glib::object::Object::builder(),
1585 }
1586 }
1587
1588 /// [`true`] if the assistant uses a [`HeaderBar`][crate::HeaderBar] for action buttons
1589 /// instead of the action-area.
1590 ///
1591 /// For technical reasons, this property is declared as an integer
1592 /// property, but you should only set it to [`true`] or [`false`].
1593 /// This widget will be removed in GTK 5
1594 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
1595 pub fn use_header_bar(self, use_header_bar: i32) -> Self {
1596 Self {
1597 builder: self.builder.property("use-header-bar", use_header_bar),
1598 }
1599 }
1600
1601 /// The [`Application`][crate::Application] associated with the window.
1602 ///
1603 /// The application will be kept alive for at least as long as it
1604 /// has any windows associated with it (see g_application_hold()
1605 /// for a way to keep it alive without windows).
1606 ///
1607 /// Normally, the connection between the application and the window
1608 /// will remain until the window is destroyed, but you can explicitly
1609 /// remove it by setting the this property to `NULL`.
1610 pub fn application(self, application: &impl IsA<Application>) -> Self {
1611 Self {
1612 builder: self
1613 .builder
1614 .property("application", application.clone().upcast()),
1615 }
1616 }
1617
1618 /// The child widget.
1619 pub fn child(self, child: &impl IsA<Widget>) -> Self {
1620 Self {
1621 builder: self.builder.property("child", child.clone().upcast()),
1622 }
1623 }
1624
1625 /// Whether the window should have a frame (also known as *decorations*).
1626 pub fn decorated(self, decorated: bool) -> Self {
1627 Self {
1628 builder: self.builder.property("decorated", decorated),
1629 }
1630 }
1631
1632 /// The default height of the window.
1633 pub fn default_height(self, default_height: i32) -> Self {
1634 Self {
1635 builder: self.builder.property("default-height", default_height),
1636 }
1637 }
1638
1639 /// The default widget.
1640 pub fn default_widget(self, default_widget: &impl IsA<Widget>) -> Self {
1641 Self {
1642 builder: self
1643 .builder
1644 .property("default-widget", default_widget.clone().upcast()),
1645 }
1646 }
1647
1648 /// The default width of the window.
1649 pub fn default_width(self, default_width: i32) -> Self {
1650 Self {
1651 builder: self.builder.property("default-width", default_width),
1652 }
1653 }
1654
1655 /// Whether the window frame should have a close button.
1656 pub fn deletable(self, deletable: bool) -> Self {
1657 Self {
1658 builder: self.builder.property("deletable", deletable),
1659 }
1660 }
1661
1662 /// If this window should be destroyed when the parent is destroyed.
1663 pub fn destroy_with_parent(self, destroy_with_parent: bool) -> Self {
1664 Self {
1665 builder: self
1666 .builder
1667 .property("destroy-with-parent", destroy_with_parent),
1668 }
1669 }
1670
1671 /// The display that will display this window.
1672 pub fn display(self, display: &impl IsA<gdk::Display>) -> Self {
1673 Self {
1674 builder: self.builder.property("display", display.clone().upcast()),
1675 }
1676 }
1677
1678 /// Whether 'focus rectangles' are currently visible in this window.
1679 ///
1680 /// This property is maintained by GTK based on user input
1681 /// and should not be set by applications.
1682 pub fn focus_visible(self, focus_visible: bool) -> Self {
1683 Self {
1684 builder: self.builder.property("focus-visible", focus_visible),
1685 }
1686 }
1687
1688 /// The focus widget.
1689 pub fn focus_widget(self, focus_widget: &impl IsA<Widget>) -> Self {
1690 Self {
1691 builder: self
1692 .builder
1693 .property("focus-widget", focus_widget.clone().upcast()),
1694 }
1695 }
1696
1697 /// Whether the window is fullscreen.
1698 ///
1699 /// Setting this property is the equivalent of calling
1700 /// [`GtkWindowExt::fullscreen()`][crate::prelude::GtkWindowExt::fullscreen()] or [`GtkWindowExt::unfullscreen()`][crate::prelude::GtkWindowExt::unfullscreen()];
1701 /// either operation is asynchronous, which means you will need to
1702 /// connect to the ::notify signal in order to know whether the
1703 /// operation was successful.
1704 pub fn fullscreened(self, fullscreened: bool) -> Self {
1705 Self {
1706 builder: self.builder.property("fullscreened", fullscreened),
1707 }
1708 }
1709
1710 /// The gravity to use when resizing the window programmatically.
1711 ///
1712 /// Gravity describes which point of the window we want to keep
1713 /// fixed (meaning that the window will grow in the opposite direction).
1714 /// For example, a gravity of `GTK_WINDOW_GRAVITY_TOP_RIGHT` means that we
1715 /// want the to fix top right corner of the window.
1716 #[cfg(feature = "v4_20")]
1717 #[cfg_attr(docsrs, doc(cfg(feature = "v4_20")))]
1718 pub fn gravity(self, gravity: WindowGravity) -> Self {
1719 Self {
1720 builder: self.builder.property("gravity", gravity),
1721 }
1722 }
1723
1724 /// Whether the window frame should handle <kbd>F10</kbd> for activating
1725 /// menubars.
1726 #[cfg(feature = "v4_2")]
1727 #[cfg_attr(docsrs, doc(cfg(feature = "v4_2")))]
1728 pub fn handle_menubar_accel(self, handle_menubar_accel: bool) -> Self {
1729 Self {
1730 builder: self
1731 .builder
1732 .property("handle-menubar-accel", handle_menubar_accel),
1733 }
1734 }
1735
1736 /// If this window should be hidden instead of destroyed when the user clicks
1737 /// the close button.
1738 pub fn hide_on_close(self, hide_on_close: bool) -> Self {
1739 Self {
1740 builder: self.builder.property("hide-on-close", hide_on_close),
1741 }
1742 }
1743
1744 /// Specifies the name of the themed icon to use as the window icon.
1745 ///
1746 /// See [`IconTheme`][crate::IconTheme] for more details.
1747 pub fn icon_name(self, icon_name: impl Into<glib::GString>) -> Self {
1748 Self {
1749 builder: self.builder.property("icon-name", icon_name.into()),
1750 }
1751 }
1752
1753 /// Whether the window is maximized.
1754 ///
1755 /// Setting this property is the equivalent of calling
1756 /// [`GtkWindowExt::maximize()`][crate::prelude::GtkWindowExt::maximize()] or [`GtkWindowExt::unmaximize()`][crate::prelude::GtkWindowExt::unmaximize()];
1757 /// either operation is asynchronous, which means you will need to
1758 /// connect to the ::notify signal in order to know whether the
1759 /// operation was successful.
1760 pub fn maximized(self, maximized: bool) -> Self {
1761 Self {
1762 builder: self.builder.property("maximized", maximized),
1763 }
1764 }
1765
1766 /// Whether mnemonics are currently visible in this window.
1767 ///
1768 /// This property is maintained by GTK based on user input,
1769 /// and should not be set by applications.
1770 pub fn mnemonics_visible(self, mnemonics_visible: bool) -> Self {
1771 Self {
1772 builder: self
1773 .builder
1774 .property("mnemonics-visible", mnemonics_visible),
1775 }
1776 }
1777
1778 /// If true, the window is modal.
1779 pub fn modal(self, modal: bool) -> Self {
1780 Self {
1781 builder: self.builder.property("modal", modal),
1782 }
1783 }
1784
1785 /// If true, users can resize the window.
1786 pub fn resizable(self, resizable: bool) -> Self {
1787 Self {
1788 builder: self.builder.property("resizable", resizable),
1789 }
1790 }
1791
1792 /// A write-only property for setting window's startup notification identifier.
1793 pub fn startup_id(self, startup_id: impl Into<glib::GString>) -> Self {
1794 Self {
1795 builder: self.builder.property("startup-id", startup_id.into()),
1796 }
1797 }
1798
1799 /// The title of the window.
1800 pub fn title(self, title: impl Into<glib::GString>) -> Self {
1801 Self {
1802 builder: self.builder.property("title", title.into()),
1803 }
1804 }
1805
1806 /// The titlebar widget.
1807 #[cfg(feature = "v4_6")]
1808 #[cfg_attr(docsrs, doc(cfg(feature = "v4_6")))]
1809 pub fn titlebar(self, titlebar: &impl IsA<Widget>) -> Self {
1810 Self {
1811 builder: self.builder.property("titlebar", titlebar.clone().upcast()),
1812 }
1813 }
1814
1815 /// The transient parent of the window.
1816 pub fn transient_for(self, transient_for: &impl IsA<Window>) -> Self {
1817 Self {
1818 builder: self
1819 .builder
1820 .property("transient-for", transient_for.clone().upcast()),
1821 }
1822 }
1823
1824 /// Whether the widget or any of its descendents can accept
1825 /// the input focus.
1826 ///
1827 /// This property is meant to be set by widget implementations,
1828 /// typically in their instance init function.
1829 pub fn can_focus(self, can_focus: bool) -> Self {
1830 Self {
1831 builder: self.builder.property("can-focus", can_focus),
1832 }
1833 }
1834
1835 /// Whether the widget can receive pointer events.
1836 pub fn can_target(self, can_target: bool) -> Self {
1837 Self {
1838 builder: self.builder.property("can-target", can_target),
1839 }
1840 }
1841
1842 /// A list of css classes applied to this widget.
1843 pub fn css_classes(self, css_classes: impl Into<glib::StrV>) -> Self {
1844 Self {
1845 builder: self.builder.property("css-classes", css_classes.into()),
1846 }
1847 }
1848
1849 /// The name of this widget in the CSS tree.
1850 ///
1851 /// This property is meant to be set by widget implementations,
1852 /// typically in their instance init function.
1853 pub fn css_name(self, css_name: impl Into<glib::GString>) -> Self {
1854 Self {
1855 builder: self.builder.property("css-name", css_name.into()),
1856 }
1857 }
1858
1859 /// The cursor used by @widget.
1860 pub fn cursor(self, cursor: &gdk::Cursor) -> Self {
1861 Self {
1862 builder: self.builder.property("cursor", cursor.clone()),
1863 }
1864 }
1865
1866 /// Whether the widget should grab focus when it is clicked with the mouse.
1867 ///
1868 /// This property is only relevant for widgets that can take focus.
1869 pub fn focus_on_click(self, focus_on_click: bool) -> Self {
1870 Self {
1871 builder: self.builder.property("focus-on-click", focus_on_click),
1872 }
1873 }
1874
1875 /// Whether this widget itself will accept the input focus.
1876 pub fn focusable(self, focusable: bool) -> Self {
1877 Self {
1878 builder: self.builder.property("focusable", focusable),
1879 }
1880 }
1881
1882 /// How to distribute horizontal space if widget gets extra space.
1883 pub fn halign(self, halign: Align) -> Self {
1884 Self {
1885 builder: self.builder.property("halign", halign),
1886 }
1887 }
1888
1889 /// Enables or disables the emission of the [`query-tooltip`][struct@crate::Widget#query-tooltip]
1890 /// signal on @widget.
1891 ///
1892 /// A true value indicates that @widget can have a tooltip, in this case
1893 /// the widget will be queried using [`query-tooltip`][struct@crate::Widget#query-tooltip] to
1894 /// determine whether it will provide a tooltip or not.
1895 pub fn has_tooltip(self, has_tooltip: bool) -> Self {
1896 Self {
1897 builder: self.builder.property("has-tooltip", has_tooltip),
1898 }
1899 }
1900
1901 /// Overrides for height request of the widget.
1902 ///
1903 /// If this is -1, the natural request will be used.
1904 pub fn height_request(self, height_request: i32) -> Self {
1905 Self {
1906 builder: self.builder.property("height-request", height_request),
1907 }
1908 }
1909
1910 /// Whether to expand horizontally.
1911 pub fn hexpand(self, hexpand: bool) -> Self {
1912 Self {
1913 builder: self.builder.property("hexpand", hexpand),
1914 }
1915 }
1916
1917 /// Whether to use the `hexpand` property.
1918 pub fn hexpand_set(self, hexpand_set: bool) -> Self {
1919 Self {
1920 builder: self.builder.property("hexpand-set", hexpand_set),
1921 }
1922 }
1923
1924 /// The [`LayoutManager`][crate::LayoutManager] instance to use to compute
1925 /// the preferred size of the widget, and allocate its children.
1926 ///
1927 /// This property is meant to be set by widget implementations,
1928 /// typically in their instance init function.
1929 pub fn layout_manager(self, layout_manager: &impl IsA<LayoutManager>) -> Self {
1930 Self {
1931 builder: self
1932 .builder
1933 .property("layout-manager", layout_manager.clone().upcast()),
1934 }
1935 }
1936
1937 /// Makes this widget act like a modal dialog, with respect to
1938 /// event delivery.
1939 ///
1940 /// Global event controllers will not handle events with targets
1941 /// inside the widget, unless they are set up to ignore propagation
1942 /// limits. See [`EventControllerExt::set_propagation_limit()`][crate::prelude::EventControllerExt::set_propagation_limit()].
1943 #[cfg(feature = "v4_18")]
1944 #[cfg_attr(docsrs, doc(cfg(feature = "v4_18")))]
1945 pub fn limit_events(self, limit_events: bool) -> Self {
1946 Self {
1947 builder: self.builder.property("limit-events", limit_events),
1948 }
1949 }
1950
1951 /// Margin on bottom side of widget.
1952 ///
1953 /// This property adds margin outside of the widget's normal size
1954 /// request, the margin will be added in addition to the size from
1955 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1956 pub fn margin_bottom(self, margin_bottom: i32) -> Self {
1957 Self {
1958 builder: self.builder.property("margin-bottom", margin_bottom),
1959 }
1960 }
1961
1962 /// Margin on end of widget, horizontally.
1963 ///
1964 /// This property supports left-to-right and right-to-left text
1965 /// directions.
1966 ///
1967 /// This property adds margin outside of the widget's normal size
1968 /// request, the margin will be added in addition to the size from
1969 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1970 pub fn margin_end(self, margin_end: i32) -> Self {
1971 Self {
1972 builder: self.builder.property("margin-end", margin_end),
1973 }
1974 }
1975
1976 /// Margin on start of widget, horizontally.
1977 ///
1978 /// This property supports left-to-right and right-to-left text
1979 /// directions.
1980 ///
1981 /// This property adds margin outside of the widget's normal size
1982 /// request, the margin will be added in addition to the size from
1983 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1984 pub fn margin_start(self, margin_start: i32) -> Self {
1985 Self {
1986 builder: self.builder.property("margin-start", margin_start),
1987 }
1988 }
1989
1990 /// Margin on top side of widget.
1991 ///
1992 /// This property adds margin outside of the widget's normal size
1993 /// request, the margin will be added in addition to the size from
1994 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1995 pub fn margin_top(self, margin_top: i32) -> Self {
1996 Self {
1997 builder: self.builder.property("margin-top", margin_top),
1998 }
1999 }
2000
2001 /// The name of the widget.
2002 pub fn name(self, name: impl Into<glib::GString>) -> Self {
2003 Self {
2004 builder: self.builder.property("name", name.into()),
2005 }
2006 }
2007
2008 /// The requested opacity of the widget.
2009 pub fn opacity(self, opacity: f64) -> Self {
2010 Self {
2011 builder: self.builder.property("opacity", opacity),
2012 }
2013 }
2014
2015 /// How content outside the widget's content area is treated.
2016 ///
2017 /// This property is meant to be set by widget implementations,
2018 /// typically in their instance init function.
2019 pub fn overflow(self, overflow: Overflow) -> Self {
2020 Self {
2021 builder: self.builder.property("overflow", overflow),
2022 }
2023 }
2024
2025 /// Whether the widget will receive the default action when it is focused.
2026 pub fn receives_default(self, receives_default: bool) -> Self {
2027 Self {
2028 builder: self.builder.property("receives-default", receives_default),
2029 }
2030 }
2031
2032 /// Whether the widget responds to input.
2033 pub fn sensitive(self, sensitive: bool) -> Self {
2034 Self {
2035 builder: self.builder.property("sensitive", sensitive),
2036 }
2037 }
2038
2039 /// Sets the text of tooltip to be the given string, which is marked up
2040 /// with Pango markup.
2041 ///
2042 /// Also see [`Tooltip::set_markup()`][crate::Tooltip::set_markup()].
2043 ///
2044 /// This is a convenience property which will take care of getting the
2045 /// tooltip shown if the given string is not `NULL`:
2046 /// [`has-tooltip`][struct@crate::Widget#has-tooltip] will automatically be set to true
2047 /// and there will be taken care of [`query-tooltip`][struct@crate::Widget#query-tooltip] in
2048 /// the default signal handler.
2049 ///
2050 /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and
2051 /// [`tooltip-markup`][struct@crate::Widget#tooltip-markup] are set, the last one wins.
2052 pub fn tooltip_markup(self, tooltip_markup: impl Into<glib::GString>) -> Self {
2053 Self {
2054 builder: self
2055 .builder
2056 .property("tooltip-markup", tooltip_markup.into()),
2057 }
2058 }
2059
2060 /// Sets the text of tooltip to be the given string.
2061 ///
2062 /// Also see [`Tooltip::set_text()`][crate::Tooltip::set_text()].
2063 ///
2064 /// This is a convenience property which will take care of getting the
2065 /// tooltip shown if the given string is not `NULL`:
2066 /// [`has-tooltip`][struct@crate::Widget#has-tooltip] will automatically be set to true
2067 /// and there will be taken care of [`query-tooltip`][struct@crate::Widget#query-tooltip] in
2068 /// the default signal handler.
2069 ///
2070 /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and
2071 /// [`tooltip-markup`][struct@crate::Widget#tooltip-markup] are set, the last one wins.
2072 pub fn tooltip_text(self, tooltip_text: impl Into<glib::GString>) -> Self {
2073 Self {
2074 builder: self.builder.property("tooltip-text", tooltip_text.into()),
2075 }
2076 }
2077
2078 /// How to distribute vertical space if widget gets extra space.
2079 pub fn valign(self, valign: Align) -> Self {
2080 Self {
2081 builder: self.builder.property("valign", valign),
2082 }
2083 }
2084
2085 /// Whether to expand vertically.
2086 pub fn vexpand(self, vexpand: bool) -> Self {
2087 Self {
2088 builder: self.builder.property("vexpand", vexpand),
2089 }
2090 }
2091
2092 /// Whether to use the `vexpand` property.
2093 pub fn vexpand_set(self, vexpand_set: bool) -> Self {
2094 Self {
2095 builder: self.builder.property("vexpand-set", vexpand_set),
2096 }
2097 }
2098
2099 /// Whether the widget is visible.
2100 pub fn visible(self, visible: bool) -> Self {
2101 Self {
2102 builder: self.builder.property("visible", visible),
2103 }
2104 }
2105
2106 /// Overrides for width request of the widget.
2107 ///
2108 /// If this is -1, the natural request will be used.
2109 pub fn width_request(self, width_request: i32) -> Self {
2110 Self {
2111 builder: self.builder.property("width-request", width_request),
2112 }
2113 }
2114
2115 /// The accessible role of the given [`Accessible`][crate::Accessible] implementation.
2116 ///
2117 /// The accessible role cannot be changed once set.
2118 pub fn accessible_role(self, accessible_role: AccessibleRole) -> Self {
2119 Self {
2120 builder: self.builder.property("accessible-role", accessible_role),
2121 }
2122 }
2123
2124 // rustdoc-stripper-ignore-next
2125 /// Build the [`Assistant`].
2126 #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"]
2127 pub fn build(self) -> Assistant {
2128 assert_initialized_main_thread!();
2129 self.builder.build()
2130 }
2131}