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 /// #### `force-close`
679 /// Emitted when the compositor has decided to eliminate a window.
680 ///
681 /// @window *has* to be in a hidden state after this signal was handled.
682 ///
683 ///
684 ///
685 ///
686 /// #### `keys-changed`
687 /// Emitted when the set of accelerators or mnemonics that
688 /// are associated with the window changes.
689 ///
690 ///
691 /// </details>
692 /// <details><summary><h4>Widget</h4></summary>
693 ///
694 ///
695 /// #### `destroy`
696 /// Signals that all holders of a reference to the widget should release
697 /// the reference that they hold.
698 ///
699 /// May result in finalization of the widget if all references are released.
700 ///
701 /// This signal is not suitable for saving widget state.
702 ///
703 ///
704 ///
705 ///
706 /// #### `direction-changed`
707 /// Emitted when the text direction of a widget changes.
708 ///
709 ///
710 ///
711 ///
712 /// #### `hide`
713 /// Emitted when @widget is hidden.
714 ///
715 ///
716 ///
717 ///
718 /// #### `keynav-failed`
719 /// Emitted if keyboard navigation fails.
720 ///
721 /// See [`WidgetExt::keynav_failed()`][crate::prelude::WidgetExt::keynav_failed()] for details.
722 ///
723 ///
724 ///
725 ///
726 /// #### `map`
727 /// Emitted when @widget is going to be mapped.
728 ///
729 /// A widget is mapped when the widget is visible (which is controlled with
730 /// [`visible`][struct@crate::Widget#visible]) and all its parents up to the toplevel widget
731 /// are also visible.
732 ///
733 /// The `::map` signal can be used to determine whether a widget will be drawn,
734 /// for instance it can resume an animation that was stopped during the
735 /// emission of [`unmap`][struct@crate::Widget#unmap].
736 ///
737 ///
738 ///
739 ///
740 /// #### `mnemonic-activate`
741 /// Emitted when a widget is activated via a mnemonic.
742 ///
743 /// The default handler for this signal activates @widget if @group_cycling
744 /// is false, or just makes @widget grab focus if @group_cycling is true.
745 ///
746 ///
747 ///
748 ///
749 /// #### `move-focus`
750 /// Emitted when the focus is moved.
751 ///
752 /// The `::move-focus` signal is a [keybinding signal](class.SignalAction.html).
753 ///
754 /// The default bindings for this signal are <kbd>Tab</kbd> to move forward,
755 /// and <kbd>Shift</kbd>+<kbd>Tab</kbd> to move backward.
756 ///
757 /// Action
758 ///
759 ///
760 /// #### `query-tooltip`
761 /// Emitted when the widget’s tooltip is about to be shown.
762 ///
763 /// This happens when the [`has-tooltip`][struct@crate::Widget#has-tooltip] property
764 /// is true and the hover timeout has expired with the cursor hovering
765 /// above @widget; or emitted when @widget got focus in keyboard mode.
766 ///
767 /// Using the given coordinates, the signal handler should determine
768 /// whether a tooltip should be shown for @widget. If this is the case
769 /// true should be returned, false otherwise. Note that if @keyboard_mode
770 /// is true, the values of @x and @y are undefined and should not be used.
771 ///
772 /// The signal handler is free to manipulate @tooltip with the therefore
773 /// destined function calls.
774 ///
775 ///
776 ///
777 ///
778 /// #### `realize`
779 /// Emitted when @widget is associated with a [`gdk::Surface`][crate::gdk::Surface].
780 ///
781 /// This means that [`WidgetExt::realize()`][crate::prelude::WidgetExt::realize()] has been called
782 /// or the widget has been mapped (that is, it is going to be drawn).
783 ///
784 ///
785 ///
786 ///
787 /// #### `show`
788 /// Emitted when @widget is shown.
789 ///
790 ///
791 ///
792 ///
793 /// #### `state-flags-changed`
794 /// Emitted when the widget state changes.
795 ///
796 /// See [`WidgetExt::state_flags()`][crate::prelude::WidgetExt::state_flags()].
797 ///
798 ///
799 ///
800 ///
801 /// #### `unmap`
802 /// Emitted when @widget is going to be unmapped.
803 ///
804 /// A widget is unmapped when either it or any of its parents up to the
805 /// toplevel widget have been set as hidden.
806 ///
807 /// As `::unmap` indicates that a widget will not be shown any longer,
808 /// it can be used to, for example, stop an animation on the widget.
809 ///
810 ///
811 ///
812 ///
813 /// #### `unrealize`
814 /// Emitted when the [`gdk::Surface`][crate::gdk::Surface] associated with @widget is destroyed.
815 ///
816 /// This means that [`WidgetExt::unrealize()`][crate::prelude::WidgetExt::unrealize()] has been called
817 /// or the widget has been unmapped (that is, it is going to be hidden).
818 ///
819 ///
820 /// </details>
821 ///
822 /// # Implements
823 ///
824 /// [`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]
825 #[doc(alias = "GtkShortcutsWindow")]
826 pub struct ShortcutsWindow(Object<ffi::GtkShortcutsWindow>) @extends Window, Widget, @implements Accessible, Buildable, ConstraintTarget, Native, Root, ShortcutManager;
827
828 match fn {
829 type_ => || ffi::gtk_shortcuts_window_get_type(),
830 }
831}
832
833impl ShortcutsWindow {
834 // rustdoc-stripper-ignore-next
835 /// Creates a new builder-pattern struct instance to construct [`ShortcutsWindow`] objects.
836 ///
837 /// This method returns an instance of [`ShortcutsWindowBuilder`](crate::builders::ShortcutsWindowBuilder) which can be used to create [`ShortcutsWindow`] objects.
838 pub fn builder() -> ShortcutsWindowBuilder {
839 ShortcutsWindowBuilder::new()
840 }
841
842 /// Adds a section to the shortcuts window.
843 ///
844 /// This is the programmatic equivalent to using [`Builder`][crate::Builder] and a
845 /// `<child>` tag to add the child.
846 ///
847 /// Using [`GtkWindowExt::set_child()`][crate::prelude::GtkWindowExt::set_child()] is not appropriate as the shortcuts
848 /// window manages its children internally.
849 ///
850 /// # Deprecated since 4.18
851 ///
852 /// This widget will be removed in GTK 5
853 /// ## `section`
854 /// the [`ShortcutsSection`][crate::ShortcutsSection] to add
855 #[cfg_attr(feature = "v4_18", deprecated = "Since 4.18")]
856 #[cfg(feature = "v4_14")]
857 #[cfg_attr(docsrs, doc(cfg(feature = "v4_14")))]
858 #[allow(deprecated)]
859 #[doc(alias = "gtk_shortcuts_window_add_section")]
860 pub fn add_section(&self, section: &ShortcutsSection) {
861 unsafe {
862 ffi::gtk_shortcuts_window_add_section(self.to_glib_none().0, section.to_glib_none().0);
863 }
864 }
865
866 /// The name of the section to show.
867 ///
868 /// This should be the section-name of one of the [`ShortcutsSection`][crate::ShortcutsSection]
869 /// objects that are in this shortcuts window.
870 ///
871 /// # Deprecated since 4.18
872 ///
873 /// This widget will be removed in GTK 5
874 #[cfg_attr(feature = "v4_18", deprecated = "Since 4.18")]
875 #[doc(alias = "section-name")]
876 pub fn section_name(&self) -> Option<glib::GString> {
877 ObjectExt::property(self, "section-name")
878 }
879
880 /// The name of the section to show.
881 ///
882 /// This should be the section-name of one of the [`ShortcutsSection`][crate::ShortcutsSection]
883 /// objects that are in this shortcuts window.
884 ///
885 /// # Deprecated since 4.18
886 ///
887 /// This widget will be removed in GTK 5
888 #[cfg_attr(feature = "v4_18", deprecated = "Since 4.18")]
889 #[doc(alias = "section-name")]
890 pub fn set_section_name(&self, section_name: Option<&str>) {
891 ObjectExt::set_property(self, "section-name", section_name)
892 }
893
894 /// The view name by which to filter the contents.
895 ///
896 /// This should correspond to the [`view`][struct@crate::ShortcutsGroup#view]
897 /// property of some of the [`ShortcutsGroup`][crate::ShortcutsGroup] objects that
898 /// are inside this shortcuts window.
899 ///
900 /// Set this to [`None`] to show all groups.
901 ///
902 /// # Deprecated since 4.18
903 ///
904 /// This widget will be removed in GTK 5
905 #[cfg_attr(feature = "v4_18", deprecated = "Since 4.18")]
906 #[doc(alias = "view-name")]
907 pub fn view_name(&self) -> Option<glib::GString> {
908 ObjectExt::property(self, "view-name")
909 }
910
911 /// The view name by which to filter the contents.
912 ///
913 /// This should correspond to the [`view`][struct@crate::ShortcutsGroup#view]
914 /// property of some of the [`ShortcutsGroup`][crate::ShortcutsGroup] objects that
915 /// are inside this shortcuts window.
916 ///
917 /// Set this to [`None`] to show all groups.
918 ///
919 /// # Deprecated since 4.18
920 ///
921 /// This widget will be removed in GTK 5
922 #[cfg_attr(feature = "v4_18", deprecated = "Since 4.18")]
923 #[doc(alias = "view-name")]
924 pub fn set_view_name(&self, view_name: Option<&str>) {
925 ObjectExt::set_property(self, "view-name", view_name)
926 }
927
928 /// Emitted when the user uses a keybinding to close the window.
929 ///
930 /// This is a [keybinding signal](class.SignalAction.html).
931 ///
932 /// The default binding for this signal is the <kbd>Escape</kbd> key.
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 = "close")]
939 pub fn connect_close<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
940 unsafe extern "C" fn close_trampoline<F: Fn(&ShortcutsWindow) + 'static>(
941 this: *mut ffi::GtkShortcutsWindow,
942 f: glib::ffi::gpointer,
943 ) {
944 unsafe {
945 let f: &F = &*(f as *const F);
946 f(&from_glib_borrow(this))
947 }
948 }
949 unsafe {
950 let f: Box_<F> = Box_::new(f);
951 connect_raw(
952 self.as_ptr() as *mut _,
953 c"close".as_ptr(),
954 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
955 close_trampoline::<F> as *const (),
956 )),
957 Box_::into_raw(f),
958 )
959 }
960 }
961
962 #[cfg_attr(feature = "v4_18", deprecated = "Since 4.18")]
963 pub fn emit_close(&self) {
964 self.emit_by_name::<()>("close", &[]);
965 }
966
967 /// Emitted when the user uses a keybinding to start a search.
968 ///
969 /// This is a [keybinding signal](class.SignalAction.html).
970 ///
971 /// The default binding for this signal is <kbd>Control</kbd>+<kbd>F</kbd>.
972 ///
973 /// # Deprecated since 4.18
974 ///
975 /// This widget will be removed in GTK 5
976 #[cfg_attr(feature = "v4_18", deprecated = "Since 4.18")]
977 #[doc(alias = "search")]
978 pub fn connect_search<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
979 unsafe extern "C" fn search_trampoline<F: Fn(&ShortcutsWindow) + 'static>(
980 this: *mut ffi::GtkShortcutsWindow,
981 f: glib::ffi::gpointer,
982 ) {
983 unsafe {
984 let f: &F = &*(f as *const F);
985 f(&from_glib_borrow(this))
986 }
987 }
988 unsafe {
989 let f: Box_<F> = Box_::new(f);
990 connect_raw(
991 self.as_ptr() as *mut _,
992 c"search".as_ptr(),
993 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
994 search_trampoline::<F> as *const (),
995 )),
996 Box_::into_raw(f),
997 )
998 }
999 }
1000
1001 #[cfg_attr(feature = "v4_18", deprecated = "Since 4.18")]
1002 pub fn emit_search(&self) {
1003 self.emit_by_name::<()>("search", &[]);
1004 }
1005
1006 #[cfg_attr(feature = "v4_18", deprecated = "Since 4.18")]
1007 #[doc(alias = "section-name")]
1008 pub fn connect_section_name_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1009 unsafe extern "C" fn notify_section_name_trampoline<F: Fn(&ShortcutsWindow) + 'static>(
1010 this: *mut ffi::GtkShortcutsWindow,
1011 _param_spec: glib::ffi::gpointer,
1012 f: glib::ffi::gpointer,
1013 ) {
1014 unsafe {
1015 let f: &F = &*(f as *const F);
1016 f(&from_glib_borrow(this))
1017 }
1018 }
1019 unsafe {
1020 let f: Box_<F> = Box_::new(f);
1021 connect_raw(
1022 self.as_ptr() as *mut _,
1023 c"notify::section-name".as_ptr(),
1024 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1025 notify_section_name_trampoline::<F> as *const (),
1026 )),
1027 Box_::into_raw(f),
1028 )
1029 }
1030 }
1031
1032 #[cfg_attr(feature = "v4_18", deprecated = "Since 4.18")]
1033 #[doc(alias = "view-name")]
1034 pub fn connect_view_name_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1035 unsafe extern "C" fn notify_view_name_trampoline<F: Fn(&ShortcutsWindow) + 'static>(
1036 this: *mut ffi::GtkShortcutsWindow,
1037 _param_spec: glib::ffi::gpointer,
1038 f: glib::ffi::gpointer,
1039 ) {
1040 unsafe {
1041 let f: &F = &*(f as *const F);
1042 f(&from_glib_borrow(this))
1043 }
1044 }
1045 unsafe {
1046 let f: Box_<F> = Box_::new(f);
1047 connect_raw(
1048 self.as_ptr() as *mut _,
1049 c"notify::view-name".as_ptr(),
1050 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1051 notify_view_name_trampoline::<F> as *const (),
1052 )),
1053 Box_::into_raw(f),
1054 )
1055 }
1056 }
1057}
1058
1059// rustdoc-stripper-ignore-next
1060/// A [builder-pattern] type to construct [`ShortcutsWindow`] objects.
1061///
1062/// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html
1063#[must_use = "The builder must be built to be used"]
1064pub struct ShortcutsWindowBuilder {
1065 builder: glib::object::ObjectBuilder<'static, ShortcutsWindow>,
1066}
1067
1068impl ShortcutsWindowBuilder {
1069 fn new() -> Self {
1070 Self {
1071 builder: glib::object::Object::builder(),
1072 }
1073 }
1074
1075 /// The name of the section to show.
1076 ///
1077 /// This should be the section-name of one of the [`ShortcutsSection`][crate::ShortcutsSection]
1078 /// objects that are in this shortcuts window.
1079 /// This widget will be removed in GTK 5
1080 #[cfg_attr(feature = "v4_18", deprecated = "Since 4.18")]
1081 pub fn section_name(self, section_name: impl Into<glib::GString>) -> Self {
1082 Self {
1083 builder: self.builder.property("section-name", section_name.into()),
1084 }
1085 }
1086
1087 /// The view name by which to filter the contents.
1088 ///
1089 /// This should correspond to the [`view`][struct@crate::ShortcutsGroup#view]
1090 /// property of some of the [`ShortcutsGroup`][crate::ShortcutsGroup] objects that
1091 /// are inside this shortcuts window.
1092 ///
1093 /// Set this to [`None`] to show all groups.
1094 /// This widget will be removed in GTK 5
1095 #[cfg_attr(feature = "v4_18", deprecated = "Since 4.18")]
1096 pub fn view_name(self, view_name: impl Into<glib::GString>) -> Self {
1097 Self {
1098 builder: self.builder.property("view-name", view_name.into()),
1099 }
1100 }
1101
1102 /// The [`Application`][crate::Application] associated with the window.
1103 ///
1104 /// The application will be kept alive for at least as long as it
1105 /// has any windows associated with it (see g_application_hold()
1106 /// for a way to keep it alive without windows).
1107 ///
1108 /// Normally, the connection between the application and the window
1109 /// will remain until the window is destroyed, but you can explicitly
1110 /// remove it by setting the this property to `NULL`.
1111 pub fn application(self, application: &impl IsA<Application>) -> Self {
1112 Self {
1113 builder: self
1114 .builder
1115 .property("application", application.clone().upcast()),
1116 }
1117 }
1118
1119 /// The child widget.
1120 pub fn child(self, child: &impl IsA<Widget>) -> Self {
1121 Self {
1122 builder: self.builder.property("child", child.clone().upcast()),
1123 }
1124 }
1125
1126 /// Whether the window should have a frame (also known as *decorations*).
1127 pub fn decorated(self, decorated: bool) -> Self {
1128 Self {
1129 builder: self.builder.property("decorated", decorated),
1130 }
1131 }
1132
1133 /// The default height of the window.
1134 pub fn default_height(self, default_height: i32) -> Self {
1135 Self {
1136 builder: self.builder.property("default-height", default_height),
1137 }
1138 }
1139
1140 /// The default widget.
1141 pub fn default_widget(self, default_widget: &impl IsA<Widget>) -> Self {
1142 Self {
1143 builder: self
1144 .builder
1145 .property("default-widget", default_widget.clone().upcast()),
1146 }
1147 }
1148
1149 /// The default width of the window.
1150 pub fn default_width(self, default_width: i32) -> Self {
1151 Self {
1152 builder: self.builder.property("default-width", default_width),
1153 }
1154 }
1155
1156 /// Whether the window frame should have a close button.
1157 pub fn deletable(self, deletable: bool) -> Self {
1158 Self {
1159 builder: self.builder.property("deletable", deletable),
1160 }
1161 }
1162
1163 /// If this window should be destroyed when the parent is destroyed.
1164 pub fn destroy_with_parent(self, destroy_with_parent: bool) -> Self {
1165 Self {
1166 builder: self
1167 .builder
1168 .property("destroy-with-parent", destroy_with_parent),
1169 }
1170 }
1171
1172 /// The display that will display this window.
1173 pub fn display(self, display: &impl IsA<gdk::Display>) -> Self {
1174 Self {
1175 builder: self.builder.property("display", display.clone().upcast()),
1176 }
1177 }
1178
1179 /// Whether 'focus rectangles' are currently visible in this window.
1180 ///
1181 /// This property is maintained by GTK based on user input
1182 /// and should not be set by applications.
1183 pub fn focus_visible(self, focus_visible: bool) -> Self {
1184 Self {
1185 builder: self.builder.property("focus-visible", focus_visible),
1186 }
1187 }
1188
1189 /// The focus widget.
1190 pub fn focus_widget(self, focus_widget: &impl IsA<Widget>) -> Self {
1191 Self {
1192 builder: self
1193 .builder
1194 .property("focus-widget", focus_widget.clone().upcast()),
1195 }
1196 }
1197
1198 /// Whether the window is fullscreen.
1199 ///
1200 /// Setting this property is the equivalent of calling
1201 /// [`GtkWindowExt::fullscreen()`][crate::prelude::GtkWindowExt::fullscreen()] or [`GtkWindowExt::unfullscreen()`][crate::prelude::GtkWindowExt::unfullscreen()];
1202 /// either operation is asynchronous, which means you will need to
1203 /// connect to the ::notify signal in order to know whether the
1204 /// operation was successful.
1205 pub fn fullscreened(self, fullscreened: bool) -> Self {
1206 Self {
1207 builder: self.builder.property("fullscreened", fullscreened),
1208 }
1209 }
1210
1211 /// The gravity to use when resizing the window programmatically.
1212 ///
1213 /// Gravity describes which point of the window we want to keep
1214 /// fixed (meaning that the window will grow in the opposite direction).
1215 /// For example, a gravity of `GTK_WINDOW_GRAVITY_TOP_RIGHT` means that we
1216 /// want the to fix top right corner of the window.
1217 #[cfg(feature = "v4_20")]
1218 #[cfg_attr(docsrs, doc(cfg(feature = "v4_20")))]
1219 pub fn gravity(self, gravity: WindowGravity) -> Self {
1220 Self {
1221 builder: self.builder.property("gravity", gravity),
1222 }
1223 }
1224
1225 /// Whether the window frame should handle <kbd>F10</kbd> for activating
1226 /// menubars.
1227 #[cfg(feature = "v4_2")]
1228 #[cfg_attr(docsrs, doc(cfg(feature = "v4_2")))]
1229 pub fn handle_menubar_accel(self, handle_menubar_accel: bool) -> Self {
1230 Self {
1231 builder: self
1232 .builder
1233 .property("handle-menubar-accel", handle_menubar_accel),
1234 }
1235 }
1236
1237 /// If this window should be hidden instead of destroyed when the user clicks
1238 /// the close button.
1239 pub fn hide_on_close(self, hide_on_close: bool) -> Self {
1240 Self {
1241 builder: self.builder.property("hide-on-close", hide_on_close),
1242 }
1243 }
1244
1245 /// Specifies the name of the themed icon to use as the window icon.
1246 ///
1247 /// See [`IconTheme`][crate::IconTheme] for more details.
1248 pub fn icon_name(self, icon_name: impl Into<glib::GString>) -> Self {
1249 Self {
1250 builder: self.builder.property("icon-name", icon_name.into()),
1251 }
1252 }
1253
1254 /// Whether the window is maximized.
1255 ///
1256 /// Setting this property is the equivalent of calling
1257 /// [`GtkWindowExt::maximize()`][crate::prelude::GtkWindowExt::maximize()] or [`GtkWindowExt::unmaximize()`][crate::prelude::GtkWindowExt::unmaximize()];
1258 /// either operation is asynchronous, which means you will need to
1259 /// connect to the ::notify signal in order to know whether the
1260 /// operation was successful.
1261 pub fn maximized(self, maximized: bool) -> Self {
1262 Self {
1263 builder: self.builder.property("maximized", maximized),
1264 }
1265 }
1266
1267 /// Whether mnemonics are currently visible in this window.
1268 ///
1269 /// This property is maintained by GTK based on user input,
1270 /// and should not be set by applications.
1271 pub fn mnemonics_visible(self, mnemonics_visible: bool) -> Self {
1272 Self {
1273 builder: self
1274 .builder
1275 .property("mnemonics-visible", mnemonics_visible),
1276 }
1277 }
1278
1279 /// If true, the window is modal.
1280 pub fn modal(self, modal: bool) -> Self {
1281 Self {
1282 builder: self.builder.property("modal", modal),
1283 }
1284 }
1285
1286 /// If true, users can resize the window.
1287 pub fn resizable(self, resizable: bool) -> Self {
1288 Self {
1289 builder: self.builder.property("resizable", resizable),
1290 }
1291 }
1292
1293 /// A write-only property for setting window's startup notification identifier.
1294 pub fn startup_id(self, startup_id: impl Into<glib::GString>) -> Self {
1295 Self {
1296 builder: self.builder.property("startup-id", startup_id.into()),
1297 }
1298 }
1299
1300 /// The title of the window.
1301 pub fn title(self, title: impl Into<glib::GString>) -> Self {
1302 Self {
1303 builder: self.builder.property("title", title.into()),
1304 }
1305 }
1306
1307 /// The titlebar widget.
1308 #[cfg(feature = "v4_6")]
1309 #[cfg_attr(docsrs, doc(cfg(feature = "v4_6")))]
1310 pub fn titlebar(self, titlebar: &impl IsA<Widget>) -> Self {
1311 Self {
1312 builder: self.builder.property("titlebar", titlebar.clone().upcast()),
1313 }
1314 }
1315
1316 /// The transient parent of the window.
1317 pub fn transient_for(self, transient_for: &impl IsA<Window>) -> Self {
1318 Self {
1319 builder: self
1320 .builder
1321 .property("transient-for", transient_for.clone().upcast()),
1322 }
1323 }
1324
1325 /// Whether the widget or any of its descendents can accept
1326 /// the input focus.
1327 ///
1328 /// This property is meant to be set by widget implementations,
1329 /// typically in their instance init function.
1330 pub fn can_focus(self, can_focus: bool) -> Self {
1331 Self {
1332 builder: self.builder.property("can-focus", can_focus),
1333 }
1334 }
1335
1336 /// Whether the widget can receive pointer events.
1337 pub fn can_target(self, can_target: bool) -> Self {
1338 Self {
1339 builder: self.builder.property("can-target", can_target),
1340 }
1341 }
1342
1343 /// A list of css classes applied to this widget.
1344 pub fn css_classes(self, css_classes: impl Into<glib::StrV>) -> Self {
1345 Self {
1346 builder: self.builder.property("css-classes", css_classes.into()),
1347 }
1348 }
1349
1350 /// The name of this widget in the CSS tree.
1351 ///
1352 /// This property is meant to be set by widget implementations,
1353 /// typically in their instance init function.
1354 pub fn css_name(self, css_name: impl Into<glib::GString>) -> Self {
1355 Self {
1356 builder: self.builder.property("css-name", css_name.into()),
1357 }
1358 }
1359
1360 /// The cursor used by @widget.
1361 pub fn cursor(self, cursor: &gdk::Cursor) -> Self {
1362 Self {
1363 builder: self.builder.property("cursor", cursor.clone()),
1364 }
1365 }
1366
1367 /// Whether the widget should grab focus when it is clicked with the mouse.
1368 ///
1369 /// This property is only relevant for widgets that can take focus.
1370 pub fn focus_on_click(self, focus_on_click: bool) -> Self {
1371 Self {
1372 builder: self.builder.property("focus-on-click", focus_on_click),
1373 }
1374 }
1375
1376 /// Whether this widget itself will accept the input focus.
1377 pub fn focusable(self, focusable: bool) -> Self {
1378 Self {
1379 builder: self.builder.property("focusable", focusable),
1380 }
1381 }
1382
1383 /// How to distribute horizontal space if widget gets extra space.
1384 pub fn halign(self, halign: Align) -> Self {
1385 Self {
1386 builder: self.builder.property("halign", halign),
1387 }
1388 }
1389
1390 /// Enables or disables the emission of the [`query-tooltip`][struct@crate::Widget#query-tooltip]
1391 /// signal on @widget.
1392 ///
1393 /// A true value indicates that @widget can have a tooltip, in this case
1394 /// the widget will be queried using [`query-tooltip`][struct@crate::Widget#query-tooltip] to
1395 /// determine whether it will provide a tooltip or not.
1396 pub fn has_tooltip(self, has_tooltip: bool) -> Self {
1397 Self {
1398 builder: self.builder.property("has-tooltip", has_tooltip),
1399 }
1400 }
1401
1402 /// Overrides for height request of the widget.
1403 ///
1404 /// If this is -1, the natural request will be used.
1405 pub fn height_request(self, height_request: i32) -> Self {
1406 Self {
1407 builder: self.builder.property("height-request", height_request),
1408 }
1409 }
1410
1411 /// Whether to expand horizontally.
1412 pub fn hexpand(self, hexpand: bool) -> Self {
1413 Self {
1414 builder: self.builder.property("hexpand", hexpand),
1415 }
1416 }
1417
1418 /// Whether to use the `hexpand` property.
1419 pub fn hexpand_set(self, hexpand_set: bool) -> Self {
1420 Self {
1421 builder: self.builder.property("hexpand-set", hexpand_set),
1422 }
1423 }
1424
1425 /// The [`LayoutManager`][crate::LayoutManager] instance to use to compute
1426 /// the preferred size of the widget, and allocate its children.
1427 ///
1428 /// This property is meant to be set by widget implementations,
1429 /// typically in their instance init function.
1430 pub fn layout_manager(self, layout_manager: &impl IsA<LayoutManager>) -> Self {
1431 Self {
1432 builder: self
1433 .builder
1434 .property("layout-manager", layout_manager.clone().upcast()),
1435 }
1436 }
1437
1438 /// Makes this widget act like a modal dialog, with respect to
1439 /// event delivery.
1440 ///
1441 /// Global event controllers will not handle events with targets
1442 /// inside the widget, unless they are set up to ignore propagation
1443 /// limits. See [`EventControllerExt::set_propagation_limit()`][crate::prelude::EventControllerExt::set_propagation_limit()].
1444 #[cfg(feature = "v4_18")]
1445 #[cfg_attr(docsrs, doc(cfg(feature = "v4_18")))]
1446 pub fn limit_events(self, limit_events: bool) -> Self {
1447 Self {
1448 builder: self.builder.property("limit-events", limit_events),
1449 }
1450 }
1451
1452 /// Margin on bottom side of widget.
1453 ///
1454 /// This property adds margin outside of the widget's normal size
1455 /// request, the margin will be added in addition to the size from
1456 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1457 pub fn margin_bottom(self, margin_bottom: i32) -> Self {
1458 Self {
1459 builder: self.builder.property("margin-bottom", margin_bottom),
1460 }
1461 }
1462
1463 /// Margin on end of widget, horizontally.
1464 ///
1465 /// This property supports left-to-right and right-to-left text
1466 /// directions.
1467 ///
1468 /// This property adds margin outside of the widget's normal size
1469 /// request, the margin will be added in addition to the size from
1470 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1471 pub fn margin_end(self, margin_end: i32) -> Self {
1472 Self {
1473 builder: self.builder.property("margin-end", margin_end),
1474 }
1475 }
1476
1477 /// Margin on start of widget, horizontally.
1478 ///
1479 /// This property supports left-to-right and right-to-left text
1480 /// directions.
1481 ///
1482 /// This property adds margin outside of the widget's normal size
1483 /// request, the margin will be added in addition to the size from
1484 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1485 pub fn margin_start(self, margin_start: i32) -> Self {
1486 Self {
1487 builder: self.builder.property("margin-start", margin_start),
1488 }
1489 }
1490
1491 /// Margin on top side of widget.
1492 ///
1493 /// This property adds margin outside of the widget's normal size
1494 /// request, the margin will be added in addition to the size from
1495 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1496 pub fn margin_top(self, margin_top: i32) -> Self {
1497 Self {
1498 builder: self.builder.property("margin-top", margin_top),
1499 }
1500 }
1501
1502 /// The name of the widget.
1503 pub fn name(self, name: impl Into<glib::GString>) -> Self {
1504 Self {
1505 builder: self.builder.property("name", name.into()),
1506 }
1507 }
1508
1509 /// The requested opacity of the widget.
1510 pub fn opacity(self, opacity: f64) -> Self {
1511 Self {
1512 builder: self.builder.property("opacity", opacity),
1513 }
1514 }
1515
1516 /// How content outside the widget's content area is treated.
1517 ///
1518 /// This property is meant to be set by widget implementations,
1519 /// typically in their instance init function.
1520 pub fn overflow(self, overflow: Overflow) -> Self {
1521 Self {
1522 builder: self.builder.property("overflow", overflow),
1523 }
1524 }
1525
1526 /// Whether the widget will receive the default action when it is focused.
1527 pub fn receives_default(self, receives_default: bool) -> Self {
1528 Self {
1529 builder: self.builder.property("receives-default", receives_default),
1530 }
1531 }
1532
1533 /// Whether the widget responds to input.
1534 pub fn sensitive(self, sensitive: bool) -> Self {
1535 Self {
1536 builder: self.builder.property("sensitive", sensitive),
1537 }
1538 }
1539
1540 /// Sets the text of tooltip to be the given string, which is marked up
1541 /// with Pango markup.
1542 ///
1543 /// Also see [`Tooltip::set_markup()`][crate::Tooltip::set_markup()].
1544 ///
1545 /// This is a convenience property which will take care of getting the
1546 /// tooltip shown if the given string is not `NULL`:
1547 /// [`has-tooltip`][struct@crate::Widget#has-tooltip] will automatically be set to true
1548 /// and there will be taken care of [`query-tooltip`][struct@crate::Widget#query-tooltip] in
1549 /// the default signal handler.
1550 ///
1551 /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and
1552 /// [`tooltip-markup`][struct@crate::Widget#tooltip-markup] are set, the last one wins.
1553 pub fn tooltip_markup(self, tooltip_markup: impl Into<glib::GString>) -> Self {
1554 Self {
1555 builder: self
1556 .builder
1557 .property("tooltip-markup", tooltip_markup.into()),
1558 }
1559 }
1560
1561 /// Sets the text of tooltip to be the given string.
1562 ///
1563 /// Also see [`Tooltip::set_text()`][crate::Tooltip::set_text()].
1564 ///
1565 /// This is a convenience property which will take care of getting the
1566 /// tooltip shown if the given string is not `NULL`:
1567 /// [`has-tooltip`][struct@crate::Widget#has-tooltip] will automatically be set to true
1568 /// and there will be taken care of [`query-tooltip`][struct@crate::Widget#query-tooltip] in
1569 /// the default signal handler.
1570 ///
1571 /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and
1572 /// [`tooltip-markup`][struct@crate::Widget#tooltip-markup] are set, the last one wins.
1573 pub fn tooltip_text(self, tooltip_text: impl Into<glib::GString>) -> Self {
1574 Self {
1575 builder: self.builder.property("tooltip-text", tooltip_text.into()),
1576 }
1577 }
1578
1579 /// How to distribute vertical space if widget gets extra space.
1580 pub fn valign(self, valign: Align) -> Self {
1581 Self {
1582 builder: self.builder.property("valign", valign),
1583 }
1584 }
1585
1586 /// Whether to expand vertically.
1587 pub fn vexpand(self, vexpand: bool) -> Self {
1588 Self {
1589 builder: self.builder.property("vexpand", vexpand),
1590 }
1591 }
1592
1593 /// Whether to use the `vexpand` property.
1594 pub fn vexpand_set(self, vexpand_set: bool) -> Self {
1595 Self {
1596 builder: self.builder.property("vexpand-set", vexpand_set),
1597 }
1598 }
1599
1600 /// Whether the widget is visible.
1601 pub fn visible(self, visible: bool) -> Self {
1602 Self {
1603 builder: self.builder.property("visible", visible),
1604 }
1605 }
1606
1607 /// Overrides for width request of the widget.
1608 ///
1609 /// If this is -1, the natural request will be used.
1610 pub fn width_request(self, width_request: i32) -> Self {
1611 Self {
1612 builder: self.builder.property("width-request", width_request),
1613 }
1614 }
1615
1616 /// The accessible role of the given [`Accessible`][crate::Accessible] implementation.
1617 ///
1618 /// The accessible role cannot be changed once set.
1619 pub fn accessible_role(self, accessible_role: AccessibleRole) -> Self {
1620 Self {
1621 builder: self.builder.property("accessible-role", accessible_role),
1622 }
1623 }
1624
1625 // rustdoc-stripper-ignore-next
1626 /// Build the [`ShortcutsWindow`].
1627 #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"]
1628 pub fn build(self) -> ShortcutsWindow {
1629 assert_initialized_main_thread!();
1630 self.builder.build()
1631 }
1632}