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