gtk4/auto/shortcuts_window.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_14")]
10#[cfg_attr(docsrs, doc(cfg(feature = "v4_14")))]
11use crate::ShortcutsSection;
12#[cfg(feature = "v4_20")]
13#[cfg_attr(docsrs, doc(cfg(feature = "v4_20")))]
14use crate::WindowGravity;
15use crate::{
16 AccessibleRole, Align, Application, Buildable, ConstraintTarget, LayoutManager, Native,
17 Overflow, Root, ShortcutManager, Widget, Window, ffi,
18};
19use glib::{
20 object::ObjectType as _,
21 prelude::*,
22 signal::{SignalHandlerId, connect_raw},
23 translate::*,
24};
25use std::boxed::Box as Box_;
26
27#[cfg(feature = "v4_10")]
28#[cfg_attr(docsrs, doc(cfg(feature = "v4_10")))]
29glib::wrapper! {
30 /// This widget will be removed in GTK 5
31 ///
32 ///
33 /// This example shows a [`ShortcutsWindow`][crate::ShortcutsWindow] with two sections, “Editor Shortcuts”
34 /// and “Terminal Shortcuts”.
35 ///
36 /// The .ui file for this example can be found [here](https://gitlab.gnome.org/GNOME/gtk/tree/main/demos/gtk-demo/shortcuts-builder.ui).
37 ///
38 /// # Shortcuts and Gestures
39 ///
40 /// The following signals have default keybindings:
41 ///
42 /// - [`close`][struct@crate::ShortcutsWindow#close]
43 /// - [`search`][struct@crate::ShortcutsWindow#search]
44 ///
45 /// # CSS nodes
46 ///
47 /// [`ShortcutsWindow`][crate::ShortcutsWindow] has a single CSS node with the name `window` and style
48 /// class `.shortcuts`.
49 ///
50 /// ## Properties
51 ///
52 ///
53 /// #### `section-name`
54 /// The name of the section to show.
55 ///
56 /// This should be the section-name of one of the [`ShortcutsSection`][crate::ShortcutsSection]
57 /// objects that are in this shortcuts window.
58 ///
59 /// Readable | Writable
60 ///
61 ///
62 /// #### `view-name`
63 /// The view name by which to filter the contents.
64 ///
65 /// This should correspond to the [`view`][struct@crate::ShortcutsGroup#view]
66 /// property of some of the [`ShortcutsGroup`][crate::ShortcutsGroup] objects that
67 /// are inside this shortcuts window.
68 ///
69 /// Set this to [`None`] to show all groups.
70 ///
71 /// Readable | Writable
72 /// <details><summary><h4>Window</h4></summary>
73 ///
74 ///
75 /// #### `application`
76 /// The [`Application`][crate::Application] associated with the window.
77 ///
78 /// The application will be kept alive for at least as long as it
79 /// has any windows associated with it (see g_application_hold()
80 /// for a way to keep it alive without windows).
81 ///
82 /// Normally, the connection between the application and the window
83 /// will remain until the window is destroyed, but you can explicitly
84 /// remove it by setting the this property to `NULL`.
85 ///
86 /// Readable | Writable
87 ///
88 ///
89 /// #### `child`
90 /// The child widget.
91 ///
92 /// Readable | Writable
93 ///
94 ///
95 /// #### `decorated`
96 /// Whether the window should have a frame (also known as *decorations*).
97 ///
98 /// Readable | Writable
99 ///
100 ///
101 /// #### `default-height`
102 /// The default height of the window.
103 ///
104 /// Readable | Writable
105 ///
106 ///
107 /// #### `default-widget`
108 /// The default widget.
109 ///
110 /// Readable | Writable
111 ///
112 ///
113 /// #### `default-width`
114 /// The default width of the window.
115 ///
116 /// Readable | Writable
117 ///
118 ///
119 /// #### `deletable`
120 /// Whether the window frame should have a close button.
121 ///
122 /// Readable | Writable
123 ///
124 ///
125 /// #### `destroy-with-parent`
126 /// If this window should be destroyed when the parent is destroyed.
127 ///
128 /// Readable | Writable
129 ///
130 ///
131 /// #### `display`
132 /// The display that will display this window.
133 ///
134 /// Readable | Writable
135 ///
136 ///
137 /// #### `focus-visible`
138 /// Whether 'focus rectangles' are currently visible in this window.
139 ///
140 /// This property is maintained by GTK based on user input
141 /// and should not be set by applications.
142 ///
143 /// Readable | Writable
144 ///
145 ///
146 /// #### `focus-widget`
147 /// The focus widget.
148 ///
149 /// Readable | Writable
150 ///
151 ///
152 /// #### `fullscreened`
153 /// Whether the window is fullscreen.
154 ///
155 /// Setting this property is the equivalent of calling
156 /// [`GtkWindowExt::fullscreen()`][crate::prelude::GtkWindowExt::fullscreen()] or [`GtkWindowExt::unfullscreen()`][crate::prelude::GtkWindowExt::unfullscreen()];
157 /// either operation is asynchronous, which means you will need to
158 /// connect to the ::notify signal in order to know whether the
159 /// operation was successful.
160 ///
161 /// Readable | Writable
162 ///
163 ///
164 /// #### `gravity`
165 /// The gravity to use when resizing the window programmatically.
166 ///
167 /// Gravity describes which point of the window we want to keep
168 /// fixed (meaning that the window will grow in the opposite direction).
169 /// For example, a gravity of `GTK_WINDOW_GRAVITY_TOP_RIGHT` means that we
170 /// want the to fix top right corner of the window.
171 ///
172 /// Readable | Writable
173 ///
174 ///
175 /// #### `handle-menubar-accel`
176 /// for activating
177 /// menubars.
178 ///
179 /// Readable | Writable
180 ///
181 ///
182 /// #### `hide-on-close`
183 /// If this window should be hidden instead of destroyed when the user clicks
184 /// the close button.
185 ///
186 /// Readable | Writable
187 ///
188 ///
189 /// #### `icon-name`
190 /// Specifies the name of the themed icon to use as the window icon.
191 ///
192 /// See [`IconTheme`][crate::IconTheme] for more details.
193 ///
194 /// Readable | Writable
195 ///
196 ///
197 /// #### `is-active`
198 /// Whether the toplevel is the currently active window.
199 ///
200 /// Readable
201 ///
202 ///
203 /// #### `maximized`
204 /// Whether the window is maximized.
205 ///
206 /// Setting this property is the equivalent of calling
207 /// [`GtkWindowExt::maximize()`][crate::prelude::GtkWindowExt::maximize()] or [`GtkWindowExt::unmaximize()`][crate::prelude::GtkWindowExt::unmaximize()];
208 /// either operation is asynchronous, which means you will need to
209 /// connect to the ::notify signal in order to know whether the
210 /// operation was successful.
211 ///
212 /// Readable | Writable
213 ///
214 ///
215 /// #### `mnemonics-visible`
216 /// Whether mnemonics are currently visible in this window.
217 ///
218 /// This property is maintained by GTK based on user input,
219 /// and should not be set by applications.
220 ///
221 /// Readable | Writable
222 ///
223 ///
224 /// #### `modal`
225 /// If true, the window is modal.
226 ///
227 /// Readable | Writable
228 ///
229 ///
230 /// #### `resizable`
231 /// If true, users can resize the window.
232 ///
233 /// Readable | Writable
234 ///
235 ///
236 /// #### `startup-id`
237 /// A write-only property for setting window's startup notification identifier.
238 ///
239 /// Writable
240 ///
241 ///
242 /// #### `suspended`
243 /// Whether the window is suspended.
244 ///
245 /// See [`GtkWindowExt::is_suspended()`][crate::prelude::GtkWindowExt::is_suspended()] for details about what suspended means.
246 ///
247 /// Readable
248 ///
249 ///
250 /// #### `title`
251 /// The title of the window.
252 ///
253 /// Readable | Writable
254 ///
255 ///
256 /// #### `titlebar`
257 /// The titlebar widget.
258 ///
259 /// Readable | Writable
260 ///
261 ///
262 /// #### `transient-for`
263 /// The transient parent of the window.
264 ///
265 /// Readable | Writable | Construct
266 /// </details>
267 /// <details><summary><h4>Widget</h4></summary>
268 ///
269 ///
270 /// #### `can-focus`
271 /// Whether the widget or any of its descendents can accept
272 /// the input focus.
273 ///
274 /// This property is meant to be set by widget implementations,
275 /// typically in their instance init function.
276 ///
277 /// Readable | Writable
278 ///
279 ///
280 /// #### `can-target`
281 /// Whether the widget can receive pointer events.
282 ///
283 /// Readable | Writable
284 ///
285 ///
286 /// #### `css-classes`
287 /// A list of css classes applied to this widget.
288 ///
289 /// Readable | Writable
290 ///
291 ///
292 /// #### `css-name`
293 /// The name of this widget in the CSS tree.
294 ///
295 /// This property is meant to be set by widget implementations,
296 /// typically in their instance init function.
297 ///
298 /// Readable | Writable | Construct Only
299 ///
300 ///
301 /// #### `cursor`
302 /// The cursor used by @widget.
303 ///
304 /// Readable | Writable
305 ///
306 ///
307 /// #### `focus-on-click`
308 /// Whether the widget should grab focus when it is clicked with the mouse.
309 ///
310 /// This property is only relevant for widgets that can take focus.
311 ///
312 /// Readable | Writable
313 ///
314 ///
315 /// #### `focusable`
316 /// Whether this widget itself will accept the input focus.
317 ///
318 /// Readable | Writable
319 ///
320 ///
321 /// #### `halign`
322 /// How to distribute horizontal space if widget gets extra space.
323 ///
324 /// Readable | Writable
325 ///
326 ///
327 /// #### `has-default`
328 /// Whether the widget is the default widget.
329 ///
330 /// Readable
331 ///
332 ///
333 /// #### `has-focus`
334 /// Whether the widget has the input focus.
335 ///
336 /// Readable
337 ///
338 ///
339 /// #### `has-tooltip`
340 /// Enables or disables the emission of the [`query-tooltip`][struct@crate::Widget#query-tooltip]
341 /// signal on @widget.
342 ///
343 /// A true value indicates that @widget can have a tooltip, in this case
344 /// the widget will be queried using [`query-tooltip`][struct@crate::Widget#query-tooltip] to
345 /// determine whether it will provide a tooltip or not.
346 ///
347 /// Readable | Writable
348 ///
349 ///
350 /// #### `height-request`
351 /// Overrides for height request of the widget.
352 ///
353 /// If this is -1, the natural request will be used.
354 ///
355 /// Readable | Writable
356 ///
357 ///
358 /// #### `hexpand`
359 /// Whether to expand horizontally.
360 ///
361 /// Readable | Writable
362 ///
363 ///
364 /// #### `hexpand-set`
365 /// Whether to use the `hexpand` property.
366 ///
367 /// Readable | Writable
368 ///
369 ///
370 /// #### `layout-manager`
371 /// The [`LayoutManager`][crate::LayoutManager] instance to use to compute
372 /// the preferred size of the widget, and allocate its children.
373 ///
374 /// This property is meant to be set by widget implementations,
375 /// typically in their instance init function.
376 ///
377 /// Readable | Writable
378 ///
379 ///
380 /// #### `limit-events`
381 /// Makes this widget act like a modal dialog, with respect to
382 /// event delivery.
383 ///
384 /// Global event controllers will not handle events with targets
385 /// inside the widget, unless they are set up to ignore propagation
386 /// limits. See [`EventControllerExt::set_propagation_limit()`][crate::prelude::EventControllerExt::set_propagation_limit()].
387 ///
388 /// Readable | Writable
389 ///
390 ///
391 /// #### `margin-bottom`
392 /// Margin on bottom side of widget.
393 ///
394 /// This property adds margin outside of the widget's normal size
395 /// request, the margin will be added in addition to the size from
396 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
397 ///
398 /// Readable | Writable
399 ///
400 ///
401 /// #### `margin-end`
402 /// Margin on end of widget, horizontally.
403 ///
404 /// This property supports left-to-right and right-to-left text
405 /// directions.
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-start`
415 /// Margin on start 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-top`
428 /// Margin on top side of widget.
429 ///
430 /// This property adds margin outside of the widget's normal size
431 /// request, the margin will be added in addition to the size from
432 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
433 ///
434 /// Readable | Writable
435 ///
436 ///
437 /// #### `name`
438 /// The name of the widget.
439 ///
440 /// Readable | Writable
441 ///
442 ///
443 /// #### `opacity`
444 /// The requested opacity of the widget.
445 ///
446 /// Readable | Writable
447 ///
448 ///
449 /// #### `overflow`
450 /// How content outside the widget's content area is treated.
451 ///
452 /// This property is meant to be set by widget implementations,
453 /// typically in their instance init function.
454 ///
455 /// Readable | Writable
456 ///
457 ///
458 /// #### `parent`
459 /// The parent widget of this widget.
460 ///
461 /// Readable
462 ///
463 ///
464 /// #### `receives-default`
465 /// Whether the widget will receive the default action when it is focused.
466 ///
467 /// Readable | Writable
468 ///
469 ///
470 /// #### `root`
471 /// The [`Root`][crate::Root] widget of the widget tree containing this widget.
472 ///
473 /// This will be `NULL` if the widget is not contained in a root widget.
474 ///
475 /// Readable
476 ///
477 ///
478 /// #### `scale-factor`
479 /// The scale factor of the widget.
480 ///
481 /// Readable
482 ///
483 ///
484 /// #### `sensitive`
485 /// Whether the widget responds to input.
486 ///
487 /// Readable | Writable
488 ///
489 ///
490 /// #### `tooltip-markup`
491 /// Sets the text of tooltip to be the given string, which is marked up
492 /// with Pango markup.
493 ///
494 /// Also see [`Tooltip::set_markup()`][crate::Tooltip::set_markup()].
495 ///
496 /// This is a convenience property which will take care of getting the
497 /// tooltip shown if the given string is not `NULL`:
498 /// [`has-tooltip`][struct@crate::Widget#has-tooltip] will automatically be set to true
499 /// and there will be taken care of [`query-tooltip`][struct@crate::Widget#query-tooltip] in
500 /// the default signal handler.
501 ///
502 /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and
503 /// [`tooltip-markup`][struct@crate::Widget#tooltip-markup] are set, the last one wins.
504 ///
505 /// Readable | Writable
506 ///
507 ///
508 /// #### `tooltip-text`
509 /// Sets the text of tooltip to be the given string.
510 ///
511 /// Also see [`Tooltip::set_text()`][crate::Tooltip::set_text()].
512 ///
513 /// This is a convenience property which will take care of getting the
514 /// tooltip shown if the given string is not `NULL`:
515 /// [`has-tooltip`][struct@crate::Widget#has-tooltip] will automatically be set to true
516 /// and there will be taken care of [`query-tooltip`][struct@crate::Widget#query-tooltip] in
517 /// the default signal handler.
518 ///
519 /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and
520 /// [`tooltip-markup`][struct@crate::Widget#tooltip-markup] are set, the last one wins.
521 ///
522 /// Readable | Writable
523 ///
524 ///
525 /// #### `valign`
526 /// How to distribute vertical space if widget gets extra space.
527 ///
528 /// Readable | Writable
529 ///
530 ///
531 /// #### `vexpand`
532 /// Whether to expand vertically.
533 ///
534 /// Readable | Writable
535 ///
536 ///
537 /// #### `vexpand-set`
538 /// Whether to use the `vexpand` property.
539 ///
540 /// Readable | Writable
541 ///
542 ///
543 /// #### `visible`
544 /// Whether the widget is visible.
545 ///
546 /// Readable | Writable
547 ///
548 ///
549 /// #### `width-request`
550 /// Overrides for width request of the widget.
551 ///
552 /// If this is -1, the natural request will be used.
553 ///
554 /// Readable | Writable
555 /// </details>
556 /// <details><summary><h4>Accessible</h4></summary>
557 ///
558 ///
559 /// #### `accessible-role`
560 /// The accessible role of the given [`Accessible`][crate::Accessible] implementation.
561 ///
562 /// The accessible role cannot be changed once set.
563 ///
564 /// Readable | Writable
565 /// </details>
566 ///
567 /// ## Signals
568 ///
569 ///
570 /// #### `close`
571 /// key.
572 ///
573 /// Action
574 ///
575 ///
576 /// #### `search`
577 /// .
578 ///
579 /// Action
580 /// <details><summary><h4>Window</h4></summary>
581 ///
582 ///
583 /// #### `activate-default`
584 /// key.
585 ///
586 /// Action
587 ///
588 ///
589 /// #### `activate-focus`
590 /// .
591 ///
592 /// Action
593 ///
594 ///
595 /// #### `close-request`
596 /// Emitted when the user clicks on the close button of the window.
597 ///
598 ///
599 ///
600 ///
601 /// #### `enable-debugging`
602 /// .
603 ///
604 /// Action
605 ///
606 ///
607 /// #### `force-close`
608 /// Emitted when the compositor has decided to eliminate a window.
609 ///
610 /// @window *has* to be in a hidden state after this signal was handled.
611 ///
612 ///
613 ///
614 ///
615 /// #### `keys-changed`
616 /// Emitted when the set of accelerators or mnemonics that
617 /// are associated with the window changes.
618 ///
619 ///
620 /// </details>
621 /// <details><summary><h4>Widget</h4></summary>
622 ///
623 ///
624 /// #### `destroy`
625 /// Signals that all holders of a reference to the widget should release
626 /// the reference that they hold.
627 ///
628 /// May result in finalization of the widget if all references are released.
629 ///
630 /// This signal is not suitable for saving widget state.
631 ///
632 ///
633 ///
634 ///
635 /// #### `direction-changed`
636 /// Emitted when the text direction of a widget changes.
637 ///
638 ///
639 ///
640 ///
641 /// #### `hide`
642 /// Emitted when @widget is hidden.
643 ///
644 ///
645 ///
646 ///
647 /// #### `keynav-failed`
648 /// Emitted if keyboard navigation fails.
649 ///
650 /// See [`WidgetExt::keynav_failed()`][crate::prelude::WidgetExt::keynav_failed()] for details.
651 ///
652 ///
653 ///
654 ///
655 /// #### `map`
656 /// Emitted when @widget is going to be mapped.
657 ///
658 /// A widget is mapped when the widget is visible (which is controlled with
659 /// [`visible`][struct@crate::Widget#visible]) and all its parents up to the toplevel widget
660 /// are also visible.
661 ///
662 /// The `::map` signal can be used to determine whether a widget will be drawn,
663 /// for instance it can resume an animation that was stopped during the
664 /// emission of [`unmap`][struct@crate::Widget#unmap].
665 ///
666 ///
667 ///
668 ///
669 /// #### `mnemonic-activate`
670 /// Emitted when a widget is activated via a mnemonic.
671 ///
672 /// The default handler for this signal activates @widget if @group_cycling
673 /// is false, or just makes @widget grab focus if @group_cycling is true.
674 ///
675 ///
676 ///
677 ///
678 /// #### `move-focus`
679 /// to move backward.
680 ///
681 /// Action
682 ///
683 ///
684 /// #### `query-tooltip`
685 /// Emitted when the widget’s tooltip is about to be shown.
686 ///
687 /// This happens when the [`has-tooltip`][struct@crate::Widget#has-tooltip] property
688 /// is true and the hover timeout has expired with the cursor hovering
689 /// above @widget; or emitted when @widget got focus in keyboard mode.
690 ///
691 /// Using the given coordinates, the signal handler should determine
692 /// whether a tooltip should be shown for @widget. If this is the case
693 /// true should be returned, false otherwise. Note that if @keyboard_mode
694 /// is true, the values of @x and @y are undefined and should not be used.
695 ///
696 /// The signal handler is free to manipulate @tooltip with the therefore
697 /// destined function calls.
698 ///
699 ///
700 ///
701 ///
702 /// #### `realize`
703 /// Emitted when @widget is associated with a [`gdk::Surface`][crate::gdk::Surface].
704 ///
705 /// This means that [`WidgetExt::realize()`][crate::prelude::WidgetExt::realize()] has been called
706 /// or the widget has been mapped (that is, it is going to be drawn).
707 ///
708 ///
709 ///
710 ///
711 /// #### `show`
712 /// Emitted when @widget is shown.
713 ///
714 ///
715 ///
716 ///
717 /// #### `state-flags-changed`
718 /// Emitted when the widget state changes.
719 ///
720 /// See [`WidgetExt::state_flags()`][crate::prelude::WidgetExt::state_flags()].
721 ///
722 ///
723 ///
724 ///
725 /// #### `unmap`
726 /// Emitted when @widget is going to be unmapped.
727 ///
728 /// A widget is unmapped when either it or any of its parents up to the
729 /// toplevel widget have been set as hidden.
730 ///
731 /// As `::unmap` indicates that a widget will not be shown any longer,
732 /// it can be used to, for example, stop an animation on the widget.
733 ///
734 ///
735 ///
736 ///
737 /// #### `unrealize`
738 /// Emitted when the [`gdk::Surface`][crate::gdk::Surface] associated with @widget is destroyed.
739 ///
740 /// This means that [`WidgetExt::unrealize()`][crate::prelude::WidgetExt::unrealize()] has been called
741 /// or the widget has been unmapped (that is, it is going to be hidden).
742 ///
743 ///
744 /// </details>
745 ///
746 /// # Implements
747 ///
748 /// [`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]
749 #[doc(alias = "GtkShortcutsWindow")]
750 pub struct ShortcutsWindow(Object<ffi::GtkShortcutsWindow>) @extends Window, Widget, @implements Accessible, Buildable, ConstraintTarget, Native, Root, ShortcutManager;
751
752 match fn {
753 type_ => || ffi::gtk_shortcuts_window_get_type(),
754 }
755}
756
757#[cfg(not(feature = "v4_10"))]
758glib::wrapper! {
759 #[doc(alias = "GtkShortcutsWindow")]
760 pub struct ShortcutsWindow(Object<ffi::GtkShortcutsWindow>) @extends Window, Widget, @implements Buildable, ConstraintTarget, Native, Root, ShortcutManager;
761
762 match fn {
763 type_ => || ffi::gtk_shortcuts_window_get_type(),
764 }
765}
766
767impl ShortcutsWindow {
768 // rustdoc-stripper-ignore-next
769 /// Creates a new builder-pattern struct instance to construct [`ShortcutsWindow`] objects.
770 ///
771 /// This method returns an instance of [`ShortcutsWindowBuilder`](crate::builders::ShortcutsWindowBuilder) which can be used to create [`ShortcutsWindow`] objects.
772 pub fn builder() -> ShortcutsWindowBuilder {
773 ShortcutsWindowBuilder::new()
774 }
775
776 /// ` tag to add the child.
777 ///
778 /// Using [`GtkWindowExt::set_child()`][crate::prelude::GtkWindowExt::set_child()] is not appropriate as the shortcuts
779 /// window manages its children internally.
780 ///
781 /// # Deprecated since 4.18
782 ///
783 /// This widget will be removed in GTK 5
784 /// ## `section`
785 /// the [`ShortcutsSection`][crate::ShortcutsSection] to add
786 #[cfg_attr(feature = "v4_18", deprecated = "Since 4.18")]
787 #[cfg(feature = "v4_14")]
788 #[cfg_attr(docsrs, doc(cfg(feature = "v4_14")))]
789 #[allow(deprecated)]
790 #[doc(alias = "gtk_shortcuts_window_add_section")]
791 pub fn add_section(&self, section: &ShortcutsSection) {
792 unsafe {
793 ffi::gtk_shortcuts_window_add_section(self.to_glib_none().0, section.to_glib_none().0);
794 }
795 }
796
797 /// The name of the section to show.
798 ///
799 /// This should be the section-name of one of the [`ShortcutsSection`][crate::ShortcutsSection]
800 /// objects that are in this shortcuts window.
801 ///
802 /// # Deprecated since 4.18
803 ///
804 /// This widget will be removed in GTK 5
805 #[cfg_attr(feature = "v4_18", deprecated = "Since 4.18")]
806 #[doc(alias = "section-name")]
807 pub fn section_name(&self) -> Option<glib::GString> {
808 ObjectExt::property(self, "section-name")
809 }
810
811 /// The name of the section to show.
812 ///
813 /// This should be the section-name of one of the [`ShortcutsSection`][crate::ShortcutsSection]
814 /// objects that are in this shortcuts window.
815 ///
816 /// # Deprecated since 4.18
817 ///
818 /// This widget will be removed in GTK 5
819 #[cfg_attr(feature = "v4_18", deprecated = "Since 4.18")]
820 #[doc(alias = "section-name")]
821 pub fn set_section_name(&self, section_name: Option<&str>) {
822 ObjectExt::set_property(self, "section-name", section_name)
823 }
824
825 /// The view name by which to filter the contents.
826 ///
827 /// This should correspond to the [`view`][struct@crate::ShortcutsGroup#view]
828 /// property of some of the [`ShortcutsGroup`][crate::ShortcutsGroup] objects that
829 /// are inside this shortcuts window.
830 ///
831 /// Set this to [`None`] to show all groups.
832 ///
833 /// # Deprecated since 4.18
834 ///
835 /// This widget will be removed in GTK 5
836 #[cfg_attr(feature = "v4_18", deprecated = "Since 4.18")]
837 #[doc(alias = "view-name")]
838 pub fn view_name(&self) -> Option<glib::GString> {
839 ObjectExt::property(self, "view-name")
840 }
841
842 /// The view name by which to filter the contents.
843 ///
844 /// This should correspond to the [`view`][struct@crate::ShortcutsGroup#view]
845 /// property of some of the [`ShortcutsGroup`][crate::ShortcutsGroup] objects that
846 /// are inside this shortcuts window.
847 ///
848 /// Set this to [`None`] to show all groups.
849 ///
850 /// # Deprecated since 4.18
851 ///
852 /// This widget will be removed in GTK 5
853 #[cfg_attr(feature = "v4_18", deprecated = "Since 4.18")]
854 #[doc(alias = "view-name")]
855 pub fn set_view_name(&self, view_name: Option<&str>) {
856 ObjectExt::set_property(self, "view-name", view_name)
857 }
858
859 /// key.
860 ///
861 /// # Deprecated since 4.18
862 ///
863 /// This widget will be removed in GTK 5
864 #[cfg_attr(feature = "v4_18", deprecated = "Since 4.18")]
865 #[doc(alias = "close")]
866 pub fn connect_close<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
867 unsafe extern "C" fn close_trampoline<F: Fn(&ShortcutsWindow) + 'static>(
868 this: *mut ffi::GtkShortcutsWindow,
869 f: glib::ffi::gpointer,
870 ) {
871 unsafe {
872 let f: &F = &*(f as *const F);
873 f(&from_glib_borrow(this))
874 }
875 }
876 unsafe {
877 let f: Box_<F> = Box_::new(f);
878 connect_raw(
879 self.as_ptr() as *mut _,
880 c"close".as_ptr(),
881 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
882 close_trampoline::<F> as *const (),
883 )),
884 Box_::into_raw(f),
885 )
886 }
887 }
888
889 #[cfg_attr(feature = "v4_18", deprecated = "Since 4.18")]
890 pub fn emit_close(&self) {
891 self.emit_by_name::<()>("close", &[]);
892 }
893
894 /// .
895 ///
896 /// # Deprecated since 4.18
897 ///
898 /// This widget will be removed in GTK 5
899 #[cfg_attr(feature = "v4_18", deprecated = "Since 4.18")]
900 #[doc(alias = "search")]
901 pub fn connect_search<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
902 unsafe extern "C" fn search_trampoline<F: Fn(&ShortcutsWindow) + 'static>(
903 this: *mut ffi::GtkShortcutsWindow,
904 f: glib::ffi::gpointer,
905 ) {
906 unsafe {
907 let f: &F = &*(f as *const F);
908 f(&from_glib_borrow(this))
909 }
910 }
911 unsafe {
912 let f: Box_<F> = Box_::new(f);
913 connect_raw(
914 self.as_ptr() as *mut _,
915 c"search".as_ptr(),
916 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
917 search_trampoline::<F> as *const (),
918 )),
919 Box_::into_raw(f),
920 )
921 }
922 }
923
924 #[cfg_attr(feature = "v4_18", deprecated = "Since 4.18")]
925 pub fn emit_search(&self) {
926 self.emit_by_name::<()>("search", &[]);
927 }
928
929 #[cfg_attr(feature = "v4_18", deprecated = "Since 4.18")]
930 #[doc(alias = "section-name")]
931 pub fn connect_section_name_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
932 unsafe extern "C" fn notify_section_name_trampoline<F: Fn(&ShortcutsWindow) + 'static>(
933 this: *mut ffi::GtkShortcutsWindow,
934 _param_spec: glib::ffi::gpointer,
935 f: glib::ffi::gpointer,
936 ) {
937 unsafe {
938 let f: &F = &*(f as *const F);
939 f(&from_glib_borrow(this))
940 }
941 }
942 unsafe {
943 let f: Box_<F> = Box_::new(f);
944 connect_raw(
945 self.as_ptr() as *mut _,
946 c"notify::section-name".as_ptr(),
947 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
948 notify_section_name_trampoline::<F> as *const (),
949 )),
950 Box_::into_raw(f),
951 )
952 }
953 }
954
955 #[cfg_attr(feature = "v4_18", deprecated = "Since 4.18")]
956 #[doc(alias = "view-name")]
957 pub fn connect_view_name_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
958 unsafe extern "C" fn notify_view_name_trampoline<F: Fn(&ShortcutsWindow) + 'static>(
959 this: *mut ffi::GtkShortcutsWindow,
960 _param_spec: glib::ffi::gpointer,
961 f: glib::ffi::gpointer,
962 ) {
963 unsafe {
964 let f: &F = &*(f as *const F);
965 f(&from_glib_borrow(this))
966 }
967 }
968 unsafe {
969 let f: Box_<F> = Box_::new(f);
970 connect_raw(
971 self.as_ptr() as *mut _,
972 c"notify::view-name".as_ptr(),
973 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
974 notify_view_name_trampoline::<F> as *const (),
975 )),
976 Box_::into_raw(f),
977 )
978 }
979 }
980}
981
982// rustdoc-stripper-ignore-next
983/// A [builder-pattern] type to construct [`ShortcutsWindow`] objects.
984///
985/// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html
986#[must_use = "The builder must be built to be used"]
987pub struct ShortcutsWindowBuilder {
988 builder: glib::object::ObjectBuilder<'static, ShortcutsWindow>,
989}
990
991impl ShortcutsWindowBuilder {
992 fn new() -> Self {
993 Self {
994 builder: glib::object::Object::builder(),
995 }
996 }
997
998 /// The name of the section to show.
999 ///
1000 /// This should be the section-name of one of the [`ShortcutsSection`][crate::ShortcutsSection]
1001 /// objects that are in this shortcuts window.
1002 /// This widget will be removed in GTK 5
1003 #[cfg_attr(feature = "v4_18", deprecated = "Since 4.18")]
1004 pub fn section_name(self, section_name: impl Into<glib::GString>) -> Self {
1005 Self {
1006 builder: self.builder.property("section-name", section_name.into()),
1007 }
1008 }
1009
1010 /// The view name by which to filter the contents.
1011 ///
1012 /// This should correspond to the [`view`][struct@crate::ShortcutsGroup#view]
1013 /// property of some of the [`ShortcutsGroup`][crate::ShortcutsGroup] objects that
1014 /// are inside this shortcuts window.
1015 ///
1016 /// Set this to [`None`] to show all groups.
1017 /// This widget will be removed in GTK 5
1018 #[cfg_attr(feature = "v4_18", deprecated = "Since 4.18")]
1019 pub fn view_name(self, view_name: impl Into<glib::GString>) -> Self {
1020 Self {
1021 builder: self.builder.property("view-name", view_name.into()),
1022 }
1023 }
1024
1025 /// The [`Application`][crate::Application] associated with the window.
1026 ///
1027 /// The application will be kept alive for at least as long as it
1028 /// has any windows associated with it (see g_application_hold()
1029 /// for a way to keep it alive without windows).
1030 ///
1031 /// Normally, the connection between the application and the window
1032 /// will remain until the window is destroyed, but you can explicitly
1033 /// remove it by setting the this property to `NULL`.
1034 pub fn application(self, application: &impl IsA<Application>) -> Self {
1035 Self {
1036 builder: self
1037 .builder
1038 .property("application", application.clone().upcast()),
1039 }
1040 }
1041
1042 /// The child widget.
1043 pub fn child(self, child: &impl IsA<Widget>) -> Self {
1044 Self {
1045 builder: self.builder.property("child", child.clone().upcast()),
1046 }
1047 }
1048
1049 /// Whether the window should have a frame (also known as *decorations*).
1050 pub fn decorated(self, decorated: bool) -> Self {
1051 Self {
1052 builder: self.builder.property("decorated", decorated),
1053 }
1054 }
1055
1056 /// The default height of the window.
1057 pub fn default_height(self, default_height: i32) -> Self {
1058 Self {
1059 builder: self.builder.property("default-height", default_height),
1060 }
1061 }
1062
1063 /// The default widget.
1064 pub fn default_widget(self, default_widget: &impl IsA<Widget>) -> Self {
1065 Self {
1066 builder: self
1067 .builder
1068 .property("default-widget", default_widget.clone().upcast()),
1069 }
1070 }
1071
1072 /// The default width of the window.
1073 pub fn default_width(self, default_width: i32) -> Self {
1074 Self {
1075 builder: self.builder.property("default-width", default_width),
1076 }
1077 }
1078
1079 /// Whether the window frame should have a close button.
1080 pub fn deletable(self, deletable: bool) -> Self {
1081 Self {
1082 builder: self.builder.property("deletable", deletable),
1083 }
1084 }
1085
1086 /// If this window should be destroyed when the parent is destroyed.
1087 pub fn destroy_with_parent(self, destroy_with_parent: bool) -> Self {
1088 Self {
1089 builder: self
1090 .builder
1091 .property("destroy-with-parent", destroy_with_parent),
1092 }
1093 }
1094
1095 /// The display that will display this window.
1096 pub fn display(self, display: &impl IsA<gdk::Display>) -> Self {
1097 Self {
1098 builder: self.builder.property("display", display.clone().upcast()),
1099 }
1100 }
1101
1102 /// Whether 'focus rectangles' are currently visible in this window.
1103 ///
1104 /// This property is maintained by GTK based on user input
1105 /// and should not be set by applications.
1106 pub fn focus_visible(self, focus_visible: bool) -> Self {
1107 Self {
1108 builder: self.builder.property("focus-visible", focus_visible),
1109 }
1110 }
1111
1112 /// The focus widget.
1113 pub fn focus_widget(self, focus_widget: &impl IsA<Widget>) -> Self {
1114 Self {
1115 builder: self
1116 .builder
1117 .property("focus-widget", focus_widget.clone().upcast()),
1118 }
1119 }
1120
1121 /// Whether the window is fullscreen.
1122 ///
1123 /// Setting this property is the equivalent of calling
1124 /// [`GtkWindowExt::fullscreen()`][crate::prelude::GtkWindowExt::fullscreen()] or [`GtkWindowExt::unfullscreen()`][crate::prelude::GtkWindowExt::unfullscreen()];
1125 /// either operation is asynchronous, which means you will need to
1126 /// connect to the ::notify signal in order to know whether the
1127 /// operation was successful.
1128 pub fn fullscreened(self, fullscreened: bool) -> Self {
1129 Self {
1130 builder: self.builder.property("fullscreened", fullscreened),
1131 }
1132 }
1133
1134 /// The gravity to use when resizing the window programmatically.
1135 ///
1136 /// Gravity describes which point of the window we want to keep
1137 /// fixed (meaning that the window will grow in the opposite direction).
1138 /// For example, a gravity of `GTK_WINDOW_GRAVITY_TOP_RIGHT` means that we
1139 /// want the to fix top right corner of the window.
1140 #[cfg(feature = "v4_20")]
1141 #[cfg_attr(docsrs, doc(cfg(feature = "v4_20")))]
1142 pub fn gravity(self, gravity: WindowGravity) -> Self {
1143 Self {
1144 builder: self.builder.property("gravity", gravity),
1145 }
1146 }
1147
1148 /// for activating
1149 /// menubars.
1150 #[cfg(feature = "v4_2")]
1151 #[cfg_attr(docsrs, doc(cfg(feature = "v4_2")))]
1152 pub fn handle_menubar_accel(self, handle_menubar_accel: bool) -> Self {
1153 Self {
1154 builder: self
1155 .builder
1156 .property("handle-menubar-accel", handle_menubar_accel),
1157 }
1158 }
1159
1160 /// If this window should be hidden instead of destroyed when the user clicks
1161 /// the close button.
1162 pub fn hide_on_close(self, hide_on_close: bool) -> Self {
1163 Self {
1164 builder: self.builder.property("hide-on-close", hide_on_close),
1165 }
1166 }
1167
1168 /// Specifies the name of the themed icon to use as the window icon.
1169 ///
1170 /// See [`IconTheme`][crate::IconTheme] for more details.
1171 pub fn icon_name(self, icon_name: impl Into<glib::GString>) -> Self {
1172 Self {
1173 builder: self.builder.property("icon-name", icon_name.into()),
1174 }
1175 }
1176
1177 /// Whether the window is maximized.
1178 ///
1179 /// Setting this property is the equivalent of calling
1180 /// [`GtkWindowExt::maximize()`][crate::prelude::GtkWindowExt::maximize()] or [`GtkWindowExt::unmaximize()`][crate::prelude::GtkWindowExt::unmaximize()];
1181 /// either operation is asynchronous, which means you will need to
1182 /// connect to the ::notify signal in order to know whether the
1183 /// operation was successful.
1184 pub fn maximized(self, maximized: bool) -> Self {
1185 Self {
1186 builder: self.builder.property("maximized", maximized),
1187 }
1188 }
1189
1190 /// Whether mnemonics are currently visible in this window.
1191 ///
1192 /// This property is maintained by GTK based on user input,
1193 /// and should not be set by applications.
1194 pub fn mnemonics_visible(self, mnemonics_visible: bool) -> Self {
1195 Self {
1196 builder: self
1197 .builder
1198 .property("mnemonics-visible", mnemonics_visible),
1199 }
1200 }
1201
1202 /// If true, the window is modal.
1203 pub fn modal(self, modal: bool) -> Self {
1204 Self {
1205 builder: self.builder.property("modal", modal),
1206 }
1207 }
1208
1209 /// If true, users can resize the window.
1210 pub fn resizable(self, resizable: bool) -> Self {
1211 Self {
1212 builder: self.builder.property("resizable", resizable),
1213 }
1214 }
1215
1216 /// A write-only property for setting window's startup notification identifier.
1217 pub fn startup_id(self, startup_id: impl Into<glib::GString>) -> Self {
1218 Self {
1219 builder: self.builder.property("startup-id", startup_id.into()),
1220 }
1221 }
1222
1223 /// The title of the window.
1224 pub fn title(self, title: impl Into<glib::GString>) -> Self {
1225 Self {
1226 builder: self.builder.property("title", title.into()),
1227 }
1228 }
1229
1230 /// The titlebar widget.
1231 #[cfg(feature = "v4_6")]
1232 #[cfg_attr(docsrs, doc(cfg(feature = "v4_6")))]
1233 pub fn titlebar(self, titlebar: &impl IsA<Widget>) -> Self {
1234 Self {
1235 builder: self.builder.property("titlebar", titlebar.clone().upcast()),
1236 }
1237 }
1238
1239 /// The transient parent of the window.
1240 pub fn transient_for(self, transient_for: &impl IsA<Window>) -> Self {
1241 Self {
1242 builder: self
1243 .builder
1244 .property("transient-for", transient_for.clone().upcast()),
1245 }
1246 }
1247
1248 /// Whether the widget or any of its descendents can accept
1249 /// the input focus.
1250 ///
1251 /// This property is meant to be set by widget implementations,
1252 /// typically in their instance init function.
1253 pub fn can_focus(self, can_focus: bool) -> Self {
1254 Self {
1255 builder: self.builder.property("can-focus", can_focus),
1256 }
1257 }
1258
1259 /// Whether the widget can receive pointer events.
1260 pub fn can_target(self, can_target: bool) -> Self {
1261 Self {
1262 builder: self.builder.property("can-target", can_target),
1263 }
1264 }
1265
1266 /// A list of css classes applied to this widget.
1267 pub fn css_classes(self, css_classes: impl Into<glib::StrV>) -> Self {
1268 Self {
1269 builder: self.builder.property("css-classes", css_classes.into()),
1270 }
1271 }
1272
1273 /// The name of this widget in the CSS tree.
1274 ///
1275 /// This property is meant to be set by widget implementations,
1276 /// typically in their instance init function.
1277 pub fn css_name(self, css_name: impl Into<glib::GString>) -> Self {
1278 Self {
1279 builder: self.builder.property("css-name", css_name.into()),
1280 }
1281 }
1282
1283 /// The cursor used by @widget.
1284 pub fn cursor(self, cursor: &gdk::Cursor) -> Self {
1285 Self {
1286 builder: self.builder.property("cursor", cursor.clone()),
1287 }
1288 }
1289
1290 /// Whether the widget should grab focus when it is clicked with the mouse.
1291 ///
1292 /// This property is only relevant for widgets that can take focus.
1293 pub fn focus_on_click(self, focus_on_click: bool) -> Self {
1294 Self {
1295 builder: self.builder.property("focus-on-click", focus_on_click),
1296 }
1297 }
1298
1299 /// Whether this widget itself will accept the input focus.
1300 pub fn focusable(self, focusable: bool) -> Self {
1301 Self {
1302 builder: self.builder.property("focusable", focusable),
1303 }
1304 }
1305
1306 /// How to distribute horizontal space if widget gets extra space.
1307 pub fn halign(self, halign: Align) -> Self {
1308 Self {
1309 builder: self.builder.property("halign", halign),
1310 }
1311 }
1312
1313 /// Enables or disables the emission of the [`query-tooltip`][struct@crate::Widget#query-tooltip]
1314 /// signal on @widget.
1315 ///
1316 /// A true value indicates that @widget can have a tooltip, in this case
1317 /// the widget will be queried using [`query-tooltip`][struct@crate::Widget#query-tooltip] to
1318 /// determine whether it will provide a tooltip or not.
1319 pub fn has_tooltip(self, has_tooltip: bool) -> Self {
1320 Self {
1321 builder: self.builder.property("has-tooltip", has_tooltip),
1322 }
1323 }
1324
1325 /// Overrides for height request of the widget.
1326 ///
1327 /// If this is -1, the natural request will be used.
1328 pub fn height_request(self, height_request: i32) -> Self {
1329 Self {
1330 builder: self.builder.property("height-request", height_request),
1331 }
1332 }
1333
1334 /// Whether to expand horizontally.
1335 pub fn hexpand(self, hexpand: bool) -> Self {
1336 Self {
1337 builder: self.builder.property("hexpand", hexpand),
1338 }
1339 }
1340
1341 /// Whether to use the `hexpand` property.
1342 pub fn hexpand_set(self, hexpand_set: bool) -> Self {
1343 Self {
1344 builder: self.builder.property("hexpand-set", hexpand_set),
1345 }
1346 }
1347
1348 /// The [`LayoutManager`][crate::LayoutManager] instance to use to compute
1349 /// the preferred size of the widget, and allocate its children.
1350 ///
1351 /// This property is meant to be set by widget implementations,
1352 /// typically in their instance init function.
1353 pub fn layout_manager(self, layout_manager: &impl IsA<LayoutManager>) -> Self {
1354 Self {
1355 builder: self
1356 .builder
1357 .property("layout-manager", layout_manager.clone().upcast()),
1358 }
1359 }
1360
1361 /// Makes this widget act like a modal dialog, with respect to
1362 /// event delivery.
1363 ///
1364 /// Global event controllers will not handle events with targets
1365 /// inside the widget, unless they are set up to ignore propagation
1366 /// limits. See [`EventControllerExt::set_propagation_limit()`][crate::prelude::EventControllerExt::set_propagation_limit()].
1367 #[cfg(feature = "v4_18")]
1368 #[cfg_attr(docsrs, doc(cfg(feature = "v4_18")))]
1369 pub fn limit_events(self, limit_events: bool) -> Self {
1370 Self {
1371 builder: self.builder.property("limit-events", limit_events),
1372 }
1373 }
1374
1375 /// Margin on bottom side of widget.
1376 ///
1377 /// This property adds margin outside of the widget's normal size
1378 /// request, the margin will be added in addition to the size from
1379 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1380 pub fn margin_bottom(self, margin_bottom: i32) -> Self {
1381 Self {
1382 builder: self.builder.property("margin-bottom", margin_bottom),
1383 }
1384 }
1385
1386 /// Margin on end of widget, horizontally.
1387 ///
1388 /// This property supports left-to-right and right-to-left text
1389 /// directions.
1390 ///
1391 /// This property adds margin outside of the widget's normal size
1392 /// request, the margin will be added in addition to the size from
1393 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1394 pub fn margin_end(self, margin_end: i32) -> Self {
1395 Self {
1396 builder: self.builder.property("margin-end", margin_end),
1397 }
1398 }
1399
1400 /// Margin on start of widget, horizontally.
1401 ///
1402 /// This property supports left-to-right and right-to-left text
1403 /// directions.
1404 ///
1405 /// This property adds margin outside of the widget's normal size
1406 /// request, the margin will be added in addition to the size from
1407 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1408 pub fn margin_start(self, margin_start: i32) -> Self {
1409 Self {
1410 builder: self.builder.property("margin-start", margin_start),
1411 }
1412 }
1413
1414 /// Margin on top side of widget.
1415 ///
1416 /// This property adds margin outside of the widget's normal size
1417 /// request, the margin will be added in addition to the size from
1418 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1419 pub fn margin_top(self, margin_top: i32) -> Self {
1420 Self {
1421 builder: self.builder.property("margin-top", margin_top),
1422 }
1423 }
1424
1425 /// The name of the widget.
1426 pub fn name(self, name: impl Into<glib::GString>) -> Self {
1427 Self {
1428 builder: self.builder.property("name", name.into()),
1429 }
1430 }
1431
1432 /// The requested opacity of the widget.
1433 pub fn opacity(self, opacity: f64) -> Self {
1434 Self {
1435 builder: self.builder.property("opacity", opacity),
1436 }
1437 }
1438
1439 /// How content outside the widget's content area is treated.
1440 ///
1441 /// This property is meant to be set by widget implementations,
1442 /// typically in their instance init function.
1443 pub fn overflow(self, overflow: Overflow) -> Self {
1444 Self {
1445 builder: self.builder.property("overflow", overflow),
1446 }
1447 }
1448
1449 /// Whether the widget will receive the default action when it is focused.
1450 pub fn receives_default(self, receives_default: bool) -> Self {
1451 Self {
1452 builder: self.builder.property("receives-default", receives_default),
1453 }
1454 }
1455
1456 /// Whether the widget responds to input.
1457 pub fn sensitive(self, sensitive: bool) -> Self {
1458 Self {
1459 builder: self.builder.property("sensitive", sensitive),
1460 }
1461 }
1462
1463 /// Sets the text of tooltip to be the given string, which is marked up
1464 /// with Pango markup.
1465 ///
1466 /// Also see [`Tooltip::set_markup()`][crate::Tooltip::set_markup()].
1467 ///
1468 /// This is a convenience property which will take care of getting the
1469 /// tooltip shown if the given string is not `NULL`:
1470 /// [`has-tooltip`][struct@crate::Widget#has-tooltip] will automatically be set to true
1471 /// and there will be taken care of [`query-tooltip`][struct@crate::Widget#query-tooltip] in
1472 /// the default signal handler.
1473 ///
1474 /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and
1475 /// [`tooltip-markup`][struct@crate::Widget#tooltip-markup] are set, the last one wins.
1476 pub fn tooltip_markup(self, tooltip_markup: impl Into<glib::GString>) -> Self {
1477 Self {
1478 builder: self
1479 .builder
1480 .property("tooltip-markup", tooltip_markup.into()),
1481 }
1482 }
1483
1484 /// Sets the text of tooltip to be the given string.
1485 ///
1486 /// Also see [`Tooltip::set_text()`][crate::Tooltip::set_text()].
1487 ///
1488 /// This is a convenience property which will take care of getting the
1489 /// tooltip shown if the given string is not `NULL`:
1490 /// [`has-tooltip`][struct@crate::Widget#has-tooltip] will automatically be set to true
1491 /// and there will be taken care of [`query-tooltip`][struct@crate::Widget#query-tooltip] in
1492 /// the default signal handler.
1493 ///
1494 /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and
1495 /// [`tooltip-markup`][struct@crate::Widget#tooltip-markup] are set, the last one wins.
1496 pub fn tooltip_text(self, tooltip_text: impl Into<glib::GString>) -> Self {
1497 Self {
1498 builder: self.builder.property("tooltip-text", tooltip_text.into()),
1499 }
1500 }
1501
1502 /// How to distribute vertical space if widget gets extra space.
1503 pub fn valign(self, valign: Align) -> Self {
1504 Self {
1505 builder: self.builder.property("valign", valign),
1506 }
1507 }
1508
1509 /// Whether to expand vertically.
1510 pub fn vexpand(self, vexpand: bool) -> Self {
1511 Self {
1512 builder: self.builder.property("vexpand", vexpand),
1513 }
1514 }
1515
1516 /// Whether to use the `vexpand` property.
1517 pub fn vexpand_set(self, vexpand_set: bool) -> Self {
1518 Self {
1519 builder: self.builder.property("vexpand-set", vexpand_set),
1520 }
1521 }
1522
1523 /// Whether the widget is visible.
1524 pub fn visible(self, visible: bool) -> Self {
1525 Self {
1526 builder: self.builder.property("visible", visible),
1527 }
1528 }
1529
1530 /// Overrides for width request of the widget.
1531 ///
1532 /// If this is -1, the natural request will be used.
1533 pub fn width_request(self, width_request: i32) -> Self {
1534 Self {
1535 builder: self.builder.property("width-request", width_request),
1536 }
1537 }
1538
1539 /// The accessible role of the given [`Accessible`][crate::Accessible] implementation.
1540 ///
1541 /// The accessible role cannot be changed once set.
1542 pub fn accessible_role(self, accessible_role: AccessibleRole) -> Self {
1543 Self {
1544 builder: self.builder.property("accessible-role", accessible_role),
1545 }
1546 }
1547
1548 // rustdoc-stripper-ignore-next
1549 /// Build the [`ShortcutsWindow`].
1550 #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"]
1551 pub fn build(self) -> ShortcutsWindow {
1552 assert_initialized_main_thread!();
1553 self.builder.build()
1554 }
1555}