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