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