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