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