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