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