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 Accessible, AccessibleRole, Align, Application, Buildable, ConstraintTarget, LayoutManager,
14 Native, Overflow, Root, ShortcutManager, Widget, Window, ffi,
15};
16use glib::{
17 object::ObjectType as _,
18 prelude::*,
19 signal::{SignalHandlerId, connect_raw},
20 translate::*,
21};
22use std::boxed::Box as Box_;
23
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 unsafe {
937 let f: &F = &*(f as *const F);
938 f(&from_glib_borrow(this))
939 }
940 }
941 unsafe {
942 let f: Box_<F> = Box_::new(f);
943 connect_raw(
944 self.as_ptr() as *mut _,
945 c"close".as_ptr() as *const _,
946 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
947 close_trampoline::<F> as *const (),
948 )),
949 Box_::into_raw(f),
950 )
951 }
952 }
953
954 #[cfg_attr(feature = "v4_18", deprecated = "Since 4.18")]
955 pub fn emit_close(&self) {
956 self.emit_by_name::<()>("close", &[]);
957 }
958
959 /// Emitted when the user uses a keybinding to start a search.
960 ///
961 /// This is a [keybinding signal](class.SignalAction.html).
962 ///
963 /// The default binding for this signal is <kbd>Control</kbd>+<kbd>F</kbd>.
964 ///
965 /// # Deprecated since 4.18
966 ///
967 /// This widget will be removed in GTK 5
968 #[cfg_attr(feature = "v4_18", deprecated = "Since 4.18")]
969 #[doc(alias = "search")]
970 pub fn connect_search<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
971 unsafe extern "C" fn search_trampoline<F: Fn(&ShortcutsWindow) + 'static>(
972 this: *mut ffi::GtkShortcutsWindow,
973 f: glib::ffi::gpointer,
974 ) {
975 unsafe {
976 let f: &F = &*(f as *const F);
977 f(&from_glib_borrow(this))
978 }
979 }
980 unsafe {
981 let f: Box_<F> = Box_::new(f);
982 connect_raw(
983 self.as_ptr() as *mut _,
984 c"search".as_ptr() as *const _,
985 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
986 search_trampoline::<F> as *const (),
987 )),
988 Box_::into_raw(f),
989 )
990 }
991 }
992
993 #[cfg_attr(feature = "v4_18", deprecated = "Since 4.18")]
994 pub fn emit_search(&self) {
995 self.emit_by_name::<()>("search", &[]);
996 }
997
998 #[cfg_attr(feature = "v4_18", deprecated = "Since 4.18")]
999 #[doc(alias = "section-name")]
1000 pub fn connect_section_name_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1001 unsafe extern "C" fn notify_section_name_trampoline<F: Fn(&ShortcutsWindow) + 'static>(
1002 this: *mut ffi::GtkShortcutsWindow,
1003 _param_spec: glib::ffi::gpointer,
1004 f: glib::ffi::gpointer,
1005 ) {
1006 unsafe {
1007 let f: &F = &*(f as *const F);
1008 f(&from_glib_borrow(this))
1009 }
1010 }
1011 unsafe {
1012 let f: Box_<F> = Box_::new(f);
1013 connect_raw(
1014 self.as_ptr() as *mut _,
1015 c"notify::section-name".as_ptr() as *const _,
1016 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1017 notify_section_name_trampoline::<F> as *const (),
1018 )),
1019 Box_::into_raw(f),
1020 )
1021 }
1022 }
1023
1024 #[cfg_attr(feature = "v4_18", deprecated = "Since 4.18")]
1025 #[doc(alias = "view-name")]
1026 pub fn connect_view_name_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1027 unsafe extern "C" fn notify_view_name_trampoline<F: Fn(&ShortcutsWindow) + 'static>(
1028 this: *mut ffi::GtkShortcutsWindow,
1029 _param_spec: glib::ffi::gpointer,
1030 f: glib::ffi::gpointer,
1031 ) {
1032 unsafe {
1033 let f: &F = &*(f as *const F);
1034 f(&from_glib_borrow(this))
1035 }
1036 }
1037 unsafe {
1038 let f: Box_<F> = Box_::new(f);
1039 connect_raw(
1040 self.as_ptr() as *mut _,
1041 c"notify::view-name".as_ptr() as *const _,
1042 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1043 notify_view_name_trampoline::<F> as *const (),
1044 )),
1045 Box_::into_raw(f),
1046 )
1047 }
1048 }
1049}
1050
1051// rustdoc-stripper-ignore-next
1052/// A [builder-pattern] type to construct [`ShortcutsWindow`] objects.
1053///
1054/// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html
1055#[must_use = "The builder must be built to be used"]
1056pub struct ShortcutsWindowBuilder {
1057 builder: glib::object::ObjectBuilder<'static, ShortcutsWindow>,
1058}
1059
1060impl ShortcutsWindowBuilder {
1061 fn new() -> Self {
1062 Self {
1063 builder: glib::object::Object::builder(),
1064 }
1065 }
1066
1067 /// The name of the section to show.
1068 ///
1069 /// This should be the section-name of one of the [`ShortcutsSection`][crate::ShortcutsSection]
1070 /// objects that are in this shortcuts window.
1071 /// This widget will be removed in GTK 5
1072 #[cfg_attr(feature = "v4_18", deprecated = "Since 4.18")]
1073 pub fn section_name(self, section_name: impl Into<glib::GString>) -> Self {
1074 Self {
1075 builder: self.builder.property("section-name", section_name.into()),
1076 }
1077 }
1078
1079 /// The view name by which to filter the contents.
1080 ///
1081 /// This should correspond to the [`view`][struct@crate::ShortcutsGroup#view]
1082 /// property of some of the [`ShortcutsGroup`][crate::ShortcutsGroup] objects that
1083 /// are inside this shortcuts window.
1084 ///
1085 /// Set this to [`None`] to show all groups.
1086 /// This widget will be removed in GTK 5
1087 #[cfg_attr(feature = "v4_18", deprecated = "Since 4.18")]
1088 pub fn view_name(self, view_name: impl Into<glib::GString>) -> Self {
1089 Self {
1090 builder: self.builder.property("view-name", view_name.into()),
1091 }
1092 }
1093
1094 /// The [`Application`][crate::Application] associated with the window.
1095 ///
1096 /// The application will be kept alive for at least as long as it
1097 /// has any windows associated with it (see g_application_hold()
1098 /// for a way to keep it alive without windows).
1099 ///
1100 /// Normally, the connection between the application and the window
1101 /// will remain until the window is destroyed, but you can explicitly
1102 /// remove it by setting the this property to `NULL`.
1103 pub fn application(self, application: &impl IsA<Application>) -> Self {
1104 Self {
1105 builder: self
1106 .builder
1107 .property("application", application.clone().upcast()),
1108 }
1109 }
1110
1111 /// The child widget.
1112 pub fn child(self, child: &impl IsA<Widget>) -> Self {
1113 Self {
1114 builder: self.builder.property("child", child.clone().upcast()),
1115 }
1116 }
1117
1118 /// Whether the window should have a frame (also known as *decorations*).
1119 pub fn decorated(self, decorated: bool) -> Self {
1120 Self {
1121 builder: self.builder.property("decorated", decorated),
1122 }
1123 }
1124
1125 /// The default height of the window.
1126 pub fn default_height(self, default_height: i32) -> Self {
1127 Self {
1128 builder: self.builder.property("default-height", default_height),
1129 }
1130 }
1131
1132 /// The default widget.
1133 pub fn default_widget(self, default_widget: &impl IsA<Widget>) -> Self {
1134 Self {
1135 builder: self
1136 .builder
1137 .property("default-widget", default_widget.clone().upcast()),
1138 }
1139 }
1140
1141 /// The default width of the window.
1142 pub fn default_width(self, default_width: i32) -> Self {
1143 Self {
1144 builder: self.builder.property("default-width", default_width),
1145 }
1146 }
1147
1148 /// Whether the window frame should have a close button.
1149 pub fn deletable(self, deletable: bool) -> Self {
1150 Self {
1151 builder: self.builder.property("deletable", deletable),
1152 }
1153 }
1154
1155 /// If this window should be destroyed when the parent is destroyed.
1156 pub fn destroy_with_parent(self, destroy_with_parent: bool) -> Self {
1157 Self {
1158 builder: self
1159 .builder
1160 .property("destroy-with-parent", destroy_with_parent),
1161 }
1162 }
1163
1164 /// The display that will display this window.
1165 pub fn display(self, display: &impl IsA<gdk::Display>) -> Self {
1166 Self {
1167 builder: self.builder.property("display", display.clone().upcast()),
1168 }
1169 }
1170
1171 /// Whether 'focus rectangles' are currently visible in this window.
1172 ///
1173 /// This property is maintained by GTK based on user input
1174 /// and should not be set by applications.
1175 pub fn focus_visible(self, focus_visible: bool) -> Self {
1176 Self {
1177 builder: self.builder.property("focus-visible", focus_visible),
1178 }
1179 }
1180
1181 /// The focus widget.
1182 pub fn focus_widget(self, focus_widget: &impl IsA<Widget>) -> Self {
1183 Self {
1184 builder: self
1185 .builder
1186 .property("focus-widget", focus_widget.clone().upcast()),
1187 }
1188 }
1189
1190 /// Whether the window is fullscreen.
1191 ///
1192 /// Setting this property is the equivalent of calling
1193 /// [`GtkWindowExt::fullscreen()`][crate::prelude::GtkWindowExt::fullscreen()] or [`GtkWindowExt::unfullscreen()`][crate::prelude::GtkWindowExt::unfullscreen()];
1194 /// either operation is asynchronous, which means you will need to
1195 /// connect to the ::notify signal in order to know whether the
1196 /// operation was successful.
1197 pub fn fullscreened(self, fullscreened: bool) -> Self {
1198 Self {
1199 builder: self.builder.property("fullscreened", fullscreened),
1200 }
1201 }
1202
1203 /// The gravity to use when resizing the window programmatically.
1204 ///
1205 /// Gravity describes which point of the window we want to keep
1206 /// fixed (meaning that the window will grow in the opposite direction).
1207 /// For example, a gravity of `GTK_WINDOW_GRAVITY_TOP_RIGHT` means that we
1208 /// want the to fix top right corner of the window.
1209 #[cfg(feature = "v4_20")]
1210 #[cfg_attr(docsrs, doc(cfg(feature = "v4_20")))]
1211 pub fn gravity(self, gravity: WindowGravity) -> Self {
1212 Self {
1213 builder: self.builder.property("gravity", gravity),
1214 }
1215 }
1216
1217 /// Whether the window frame should handle <kbd>F10</kbd> for activating
1218 /// menubars.
1219 #[cfg(feature = "v4_2")]
1220 #[cfg_attr(docsrs, doc(cfg(feature = "v4_2")))]
1221 pub fn handle_menubar_accel(self, handle_menubar_accel: bool) -> Self {
1222 Self {
1223 builder: self
1224 .builder
1225 .property("handle-menubar-accel", handle_menubar_accel),
1226 }
1227 }
1228
1229 /// If this window should be hidden instead of destroyed when the user clicks
1230 /// the close button.
1231 pub fn hide_on_close(self, hide_on_close: bool) -> Self {
1232 Self {
1233 builder: self.builder.property("hide-on-close", hide_on_close),
1234 }
1235 }
1236
1237 /// Specifies the name of the themed icon to use as the window icon.
1238 ///
1239 /// See [`IconTheme`][crate::IconTheme] for more details.
1240 pub fn icon_name(self, icon_name: impl Into<glib::GString>) -> Self {
1241 Self {
1242 builder: self.builder.property("icon-name", icon_name.into()),
1243 }
1244 }
1245
1246 /// Whether the window is maximized.
1247 ///
1248 /// Setting this property is the equivalent of calling
1249 /// [`GtkWindowExt::maximize()`][crate::prelude::GtkWindowExt::maximize()] or [`GtkWindowExt::unmaximize()`][crate::prelude::GtkWindowExt::unmaximize()];
1250 /// either operation is asynchronous, which means you will need to
1251 /// connect to the ::notify signal in order to know whether the
1252 /// operation was successful.
1253 pub fn maximized(self, maximized: bool) -> Self {
1254 Self {
1255 builder: self.builder.property("maximized", maximized),
1256 }
1257 }
1258
1259 /// Whether mnemonics are currently visible in this window.
1260 ///
1261 /// This property is maintained by GTK based on user input,
1262 /// and should not be set by applications.
1263 pub fn mnemonics_visible(self, mnemonics_visible: bool) -> Self {
1264 Self {
1265 builder: self
1266 .builder
1267 .property("mnemonics-visible", mnemonics_visible),
1268 }
1269 }
1270
1271 /// If true, the window is modal.
1272 pub fn modal(self, modal: bool) -> Self {
1273 Self {
1274 builder: self.builder.property("modal", modal),
1275 }
1276 }
1277
1278 /// If true, users can resize the window.
1279 pub fn resizable(self, resizable: bool) -> Self {
1280 Self {
1281 builder: self.builder.property("resizable", resizable),
1282 }
1283 }
1284
1285 /// A write-only property for setting window's startup notification identifier.
1286 pub fn startup_id(self, startup_id: impl Into<glib::GString>) -> Self {
1287 Self {
1288 builder: self.builder.property("startup-id", startup_id.into()),
1289 }
1290 }
1291
1292 /// The title of the window.
1293 pub fn title(self, title: impl Into<glib::GString>) -> Self {
1294 Self {
1295 builder: self.builder.property("title", title.into()),
1296 }
1297 }
1298
1299 /// The titlebar widget.
1300 #[cfg(feature = "v4_6")]
1301 #[cfg_attr(docsrs, doc(cfg(feature = "v4_6")))]
1302 pub fn titlebar(self, titlebar: &impl IsA<Widget>) -> Self {
1303 Self {
1304 builder: self.builder.property("titlebar", titlebar.clone().upcast()),
1305 }
1306 }
1307
1308 /// The transient parent of the window.
1309 pub fn transient_for(self, transient_for: &impl IsA<Window>) -> Self {
1310 Self {
1311 builder: self
1312 .builder
1313 .property("transient-for", transient_for.clone().upcast()),
1314 }
1315 }
1316
1317 /// Whether the widget or any of its descendents can accept
1318 /// the input focus.
1319 ///
1320 /// This property is meant to be set by widget implementations,
1321 /// typically in their instance init function.
1322 pub fn can_focus(self, can_focus: bool) -> Self {
1323 Self {
1324 builder: self.builder.property("can-focus", can_focus),
1325 }
1326 }
1327
1328 /// Whether the widget can receive pointer events.
1329 pub fn can_target(self, can_target: bool) -> Self {
1330 Self {
1331 builder: self.builder.property("can-target", can_target),
1332 }
1333 }
1334
1335 /// A list of css classes applied to this widget.
1336 pub fn css_classes(self, css_classes: impl Into<glib::StrV>) -> Self {
1337 Self {
1338 builder: self.builder.property("css-classes", css_classes.into()),
1339 }
1340 }
1341
1342 /// The name of this widget in the CSS tree.
1343 ///
1344 /// This property is meant to be set by widget implementations,
1345 /// typically in their instance init function.
1346 pub fn css_name(self, css_name: impl Into<glib::GString>) -> Self {
1347 Self {
1348 builder: self.builder.property("css-name", css_name.into()),
1349 }
1350 }
1351
1352 /// The cursor used by @widget.
1353 pub fn cursor(self, cursor: &gdk::Cursor) -> Self {
1354 Self {
1355 builder: self.builder.property("cursor", cursor.clone()),
1356 }
1357 }
1358
1359 /// Whether the widget should grab focus when it is clicked with the mouse.
1360 ///
1361 /// This property is only relevant for widgets that can take focus.
1362 pub fn focus_on_click(self, focus_on_click: bool) -> Self {
1363 Self {
1364 builder: self.builder.property("focus-on-click", focus_on_click),
1365 }
1366 }
1367
1368 /// Whether this widget itself will accept the input focus.
1369 pub fn focusable(self, focusable: bool) -> Self {
1370 Self {
1371 builder: self.builder.property("focusable", focusable),
1372 }
1373 }
1374
1375 /// How to distribute horizontal space if widget gets extra space.
1376 pub fn halign(self, halign: Align) -> Self {
1377 Self {
1378 builder: self.builder.property("halign", halign),
1379 }
1380 }
1381
1382 /// Enables or disables the emission of the [`query-tooltip`][struct@crate::Widget#query-tooltip]
1383 /// signal on @widget.
1384 ///
1385 /// A true value indicates that @widget can have a tooltip, in this case
1386 /// the widget will be queried using [`query-tooltip`][struct@crate::Widget#query-tooltip] to
1387 /// determine whether it will provide a tooltip or not.
1388 pub fn has_tooltip(self, has_tooltip: bool) -> Self {
1389 Self {
1390 builder: self.builder.property("has-tooltip", has_tooltip),
1391 }
1392 }
1393
1394 /// Overrides for height request of the widget.
1395 ///
1396 /// If this is -1, the natural request will be used.
1397 pub fn height_request(self, height_request: i32) -> Self {
1398 Self {
1399 builder: self.builder.property("height-request", height_request),
1400 }
1401 }
1402
1403 /// Whether to expand horizontally.
1404 pub fn hexpand(self, hexpand: bool) -> Self {
1405 Self {
1406 builder: self.builder.property("hexpand", hexpand),
1407 }
1408 }
1409
1410 /// Whether to use the `hexpand` property.
1411 pub fn hexpand_set(self, hexpand_set: bool) -> Self {
1412 Self {
1413 builder: self.builder.property("hexpand-set", hexpand_set),
1414 }
1415 }
1416
1417 /// The [`LayoutManager`][crate::LayoutManager] instance to use to compute
1418 /// the preferred size of the widget, and allocate its children.
1419 ///
1420 /// This property is meant to be set by widget implementations,
1421 /// typically in their instance init function.
1422 pub fn layout_manager(self, layout_manager: &impl IsA<LayoutManager>) -> Self {
1423 Self {
1424 builder: self
1425 .builder
1426 .property("layout-manager", layout_manager.clone().upcast()),
1427 }
1428 }
1429
1430 /// Makes this widget act like a modal dialog, with respect to
1431 /// event delivery.
1432 ///
1433 /// Global event controllers will not handle events with targets
1434 /// inside the widget, unless they are set up to ignore propagation
1435 /// limits. See [`EventControllerExt::set_propagation_limit()`][crate::prelude::EventControllerExt::set_propagation_limit()].
1436 #[cfg(feature = "v4_18")]
1437 #[cfg_attr(docsrs, doc(cfg(feature = "v4_18")))]
1438 pub fn limit_events(self, limit_events: bool) -> Self {
1439 Self {
1440 builder: self.builder.property("limit-events", limit_events),
1441 }
1442 }
1443
1444 /// Margin on bottom side of widget.
1445 ///
1446 /// This property adds margin outside of the widget's normal size
1447 /// request, the margin will be added in addition to the size from
1448 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1449 pub fn margin_bottom(self, margin_bottom: i32) -> Self {
1450 Self {
1451 builder: self.builder.property("margin-bottom", margin_bottom),
1452 }
1453 }
1454
1455 /// Margin on end of widget, horizontally.
1456 ///
1457 /// This property supports left-to-right and right-to-left text
1458 /// directions.
1459 ///
1460 /// This property adds margin outside of the widget's normal size
1461 /// request, the margin will be added in addition to the size from
1462 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1463 pub fn margin_end(self, margin_end: i32) -> Self {
1464 Self {
1465 builder: self.builder.property("margin-end", margin_end),
1466 }
1467 }
1468
1469 /// Margin on start of widget, horizontally.
1470 ///
1471 /// This property supports left-to-right and right-to-left text
1472 /// directions.
1473 ///
1474 /// This property adds margin outside of the widget's normal size
1475 /// request, the margin will be added in addition to the size from
1476 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1477 pub fn margin_start(self, margin_start: i32) -> Self {
1478 Self {
1479 builder: self.builder.property("margin-start", margin_start),
1480 }
1481 }
1482
1483 /// Margin on top side of widget.
1484 ///
1485 /// This property adds margin outside of the widget's normal size
1486 /// request, the margin will be added in addition to the size from
1487 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1488 pub fn margin_top(self, margin_top: i32) -> Self {
1489 Self {
1490 builder: self.builder.property("margin-top", margin_top),
1491 }
1492 }
1493
1494 /// The name of the widget.
1495 pub fn name(self, name: impl Into<glib::GString>) -> Self {
1496 Self {
1497 builder: self.builder.property("name", name.into()),
1498 }
1499 }
1500
1501 /// The requested opacity of the widget.
1502 pub fn opacity(self, opacity: f64) -> Self {
1503 Self {
1504 builder: self.builder.property("opacity", opacity),
1505 }
1506 }
1507
1508 /// How content outside the widget's content area is treated.
1509 ///
1510 /// This property is meant to be set by widget implementations,
1511 /// typically in their instance init function.
1512 pub fn overflow(self, overflow: Overflow) -> Self {
1513 Self {
1514 builder: self.builder.property("overflow", overflow),
1515 }
1516 }
1517
1518 /// Whether the widget will receive the default action when it is focused.
1519 pub fn receives_default(self, receives_default: bool) -> Self {
1520 Self {
1521 builder: self.builder.property("receives-default", receives_default),
1522 }
1523 }
1524
1525 /// Whether the widget responds to input.
1526 pub fn sensitive(self, sensitive: bool) -> Self {
1527 Self {
1528 builder: self.builder.property("sensitive", sensitive),
1529 }
1530 }
1531
1532 /// Sets the text of tooltip to be the given string, which is marked up
1533 /// with Pango markup.
1534 ///
1535 /// Also see [`Tooltip::set_markup()`][crate::Tooltip::set_markup()].
1536 ///
1537 /// This is a convenience property which will take care of getting the
1538 /// tooltip shown if the given string is not `NULL`:
1539 /// [`has-tooltip`][struct@crate::Widget#has-tooltip] will automatically be set to true
1540 /// and there will be taken care of [`query-tooltip`][struct@crate::Widget#query-tooltip] in
1541 /// the default signal handler.
1542 ///
1543 /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and
1544 /// [`tooltip-markup`][struct@crate::Widget#tooltip-markup] are set, the last one wins.
1545 pub fn tooltip_markup(self, tooltip_markup: impl Into<glib::GString>) -> Self {
1546 Self {
1547 builder: self
1548 .builder
1549 .property("tooltip-markup", tooltip_markup.into()),
1550 }
1551 }
1552
1553 /// Sets the text of tooltip to be the given string.
1554 ///
1555 /// Also see [`Tooltip::set_text()`][crate::Tooltip::set_text()].
1556 ///
1557 /// This is a convenience property which will take care of getting the
1558 /// tooltip shown if the given string is not `NULL`:
1559 /// [`has-tooltip`][struct@crate::Widget#has-tooltip] will automatically be set to true
1560 /// and there will be taken care of [`query-tooltip`][struct@crate::Widget#query-tooltip] in
1561 /// the default signal handler.
1562 ///
1563 /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and
1564 /// [`tooltip-markup`][struct@crate::Widget#tooltip-markup] are set, the last one wins.
1565 pub fn tooltip_text(self, tooltip_text: impl Into<glib::GString>) -> Self {
1566 Self {
1567 builder: self.builder.property("tooltip-text", tooltip_text.into()),
1568 }
1569 }
1570
1571 /// How to distribute vertical space if widget gets extra space.
1572 pub fn valign(self, valign: Align) -> Self {
1573 Self {
1574 builder: self.builder.property("valign", valign),
1575 }
1576 }
1577
1578 /// Whether to expand vertically.
1579 pub fn vexpand(self, vexpand: bool) -> Self {
1580 Self {
1581 builder: self.builder.property("vexpand", vexpand),
1582 }
1583 }
1584
1585 /// Whether to use the `vexpand` property.
1586 pub fn vexpand_set(self, vexpand_set: bool) -> Self {
1587 Self {
1588 builder: self.builder.property("vexpand-set", vexpand_set),
1589 }
1590 }
1591
1592 /// Whether the widget is visible.
1593 pub fn visible(self, visible: bool) -> Self {
1594 Self {
1595 builder: self.builder.property("visible", visible),
1596 }
1597 }
1598
1599 /// Overrides for width request of the widget.
1600 ///
1601 /// If this is -1, the natural request will be used.
1602 pub fn width_request(self, width_request: i32) -> Self {
1603 Self {
1604 builder: self.builder.property("width-request", width_request),
1605 }
1606 }
1607
1608 /// The accessible role of the given [`Accessible`][crate::Accessible] implementation.
1609 ///
1610 /// The accessible role cannot be changed once set.
1611 pub fn accessible_role(self, accessible_role: AccessibleRole) -> Self {
1612 Self {
1613 builder: self.builder.property("accessible-role", accessible_role),
1614 }
1615 }
1616
1617 // rustdoc-stripper-ignore-next
1618 /// Build the [`ShortcutsWindow`].
1619 #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"]
1620 pub fn build(self) -> ShortcutsWindow {
1621 assert_initialized_main_thread!();
1622 self.builder.build()
1623 }
1624}