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