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