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