gtk/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
5use crate::{
6 Align, Application, Bin, Buildable, Container, ResizeMode, Widget, Window, WindowPosition,
7 WindowType, ffi,
8};
9use glib::{
10 object::ObjectType as _,
11 prelude::*,
12 signal::{SignalHandlerId, connect_raw},
13 translate::*,
14};
15use std::boxed::Box as Box_;
16
17glib::wrapper! {
18 /// A GtkShortcutsWindow shows brief information about the keyboard shortcuts
19 /// and gestures of an application. The shortcuts can be grouped, and you can
20 /// have multiple sections in this window, corresponding to the major modes of
21 /// your application.
22 ///
23 /// Additionally, the shortcuts can be filtered by the current view, to avoid
24 /// showing information that is not relevant in the current application context.
25 ///
26 /// The recommended way to construct a GtkShortcutsWindow is with GtkBuilder,
27 /// by populating a [`ShortcutsWindow`][crate::ShortcutsWindow] with one or more [`ShortcutsSection`][crate::ShortcutsSection]
28 /// objects, which contain `GtkShortcutsGroups` that in turn contain objects of
29 /// class [`ShortcutsShortcut`][crate::ShortcutsShortcut].
30 ///
31 /// # A simple example:
32 ///
33 /// 
34 ///
35 /// This example has as single section. As you can see, the shortcut groups
36 /// are arranged in columns, and spread across several pages if there are too
37 /// many to find on a single page.
38 ///
39 /// The .ui file for this example can be found [here](https://git.gnome.org/browse/gtk+/tree/demos/gtk-demo/shortcuts-gedit.ui).
40 ///
41 /// # An example with multiple views:
42 ///
43 /// 
44 ///
45 /// This example shows a [`ShortcutsWindow`][crate::ShortcutsWindow] that has been configured to show only
46 /// the shortcuts relevant to the "stopwatch" view.
47 ///
48 /// The .ui file for this example can be found [here](https://git.gnome.org/browse/gtk+/tree/demos/gtk-demo/shortcuts-clocks.ui).
49 ///
50 /// # An example with multiple sections:
51 ///
52 /// 
53 ///
54 /// This example shows a [`ShortcutsWindow`][crate::ShortcutsWindow] with two sections, "Editor Shortcuts"
55 /// and "Terminal Shortcuts".
56 ///
57 /// The .ui file for this example can be found [here](https://git.gnome.org/browse/gtk+/tree/demos/gtk-demo/shortcuts-builder.ui).
58 ///
59 /// ## Properties
60 ///
61 ///
62 /// #### `section-name`
63 /// The name of the section to show.
64 ///
65 /// This should be the section-name of one of the [`ShortcutsSection`][crate::ShortcutsSection]
66 /// objects that are in this shortcuts window.
67 ///
68 /// Readable | Writable
69 ///
70 ///
71 /// #### `view-name`
72 /// The view name by which to filter the contents.
73 ///
74 /// This should correspond to the [`view`][struct@crate::ShortcutsGroup#view] property of some of
75 /// the [`ShortcutsGroup`][crate::ShortcutsGroup] objects that are inside this shortcuts window.
76 ///
77 /// Set this to [`None`] to show all groups.
78 ///
79 /// Readable | Writable
80 /// <details><summary><h4>Window</h4></summary>
81 ///
82 ///
83 /// #### `accept-focus`
84 /// Whether the window should receive the input focus.
85 ///
86 /// Readable | Writable
87 ///
88 ///
89 /// #### `application`
90 /// The [`Application`][crate::Application] associated with the window.
91 ///
92 /// The application will be kept alive for at least as long as it
93 /// has any windows associated with it (see [`ApplicationExtManual::hold()`][crate::gio::prelude::ApplicationExtManual::hold()]
94 /// for a way to keep it alive without windows).
95 ///
96 /// Normally, the connection between the application and the window
97 /// will remain until the window is destroyed, but you can explicitly
98 /// remove it by setting the :application property to [`None`].
99 ///
100 /// Readable | Writable
101 ///
102 ///
103 /// #### `attached-to`
104 /// The widget to which this window is attached.
105 /// See [`GtkWindowExt::set_attached_to()`][crate::prelude::GtkWindowExt::set_attached_to()].
106 ///
107 /// Examples of places where specifying this relation is useful are
108 /// for instance a [`Menu`][crate::Menu] created by a [`ComboBox`][crate::ComboBox], a completion
109 /// popup window created by [`Entry`][crate::Entry] or a typeahead search entry
110 /// created by [`TreeView`][crate::TreeView].
111 ///
112 /// Readable | Writable | Construct
113 ///
114 ///
115 /// #### `decorated`
116 /// Whether the window should be decorated by the window manager.
117 ///
118 /// Readable | Writable
119 ///
120 ///
121 /// #### `default-height`
122 /// Readable | Writable
123 ///
124 ///
125 /// #### `default-width`
126 /// Readable | Writable
127 ///
128 ///
129 /// #### `deletable`
130 /// Whether the window frame should have a close button.
131 ///
132 /// Readable | Writable
133 ///
134 ///
135 /// #### `destroy-with-parent`
136 /// Readable | Writable
137 ///
138 ///
139 /// #### `focus-on-map`
140 /// Whether the window should receive the input focus when mapped.
141 ///
142 /// Readable | Writable
143 ///
144 ///
145 /// #### `focus-visible`
146 /// Whether 'focus rectangles' are currently visible in this window.
147 ///
148 /// This property is maintained by GTK+ based on user input
149 /// and should not be set by applications.
150 ///
151 /// Readable | Writable
152 ///
153 ///
154 /// #### `gravity`
155 /// The window gravity of the window. See [`GtkWindowExt::move_()`][crate::prelude::GtkWindowExt::move_()] and [`gdk::Gravity`][crate::gdk::Gravity] for
156 /// more details about window gravity.
157 ///
158 /// Readable | Writable
159 ///
160 ///
161 /// #### `has-resize-grip`
162 /// Whether the window has a corner resize grip.
163 ///
164 /// Note that the resize grip is only shown if the window is
165 /// actually resizable and not maximized. Use
166 /// [`resize-grip-visible`][struct@crate::Window#resize-grip-visible] to find out if the resize
167 /// grip is currently shown.
168 ///
169 /// Readable | Writable
170 ///
171 ///
172 /// #### `has-toplevel-focus`
173 /// Readable
174 ///
175 ///
176 /// #### `hide-titlebar-when-maximized`
177 /// Whether the titlebar should be hidden during maximization.
178 ///
179 /// Readable | Writable
180 ///
181 ///
182 /// #### `icon`
183 /// Readable | Writable
184 ///
185 ///
186 /// #### `icon-name`
187 /// The :icon-name property specifies the name of the themed icon to
188 /// use as the window icon. See [`IconTheme`][crate::IconTheme] for more details.
189 ///
190 /// Readable | Writable
191 ///
192 ///
193 /// #### `is-active`
194 /// Readable
195 ///
196 ///
197 /// #### `is-maximized`
198 /// Readable
199 ///
200 ///
201 /// #### `mnemonics-visible`
202 /// Whether mnemonics are currently visible in this window.
203 ///
204 /// This property is maintained by GTK+ based on user input,
205 /// and should not be set by applications.
206 ///
207 /// Readable | Writable
208 ///
209 ///
210 /// #### `modal`
211 /// Readable | Writable
212 ///
213 ///
214 /// #### `resizable`
215 /// Readable | Writable
216 ///
217 ///
218 /// #### `resize-grip-visible`
219 /// Whether a corner resize grip is currently shown.
220 ///
221 /// Readable
222 ///
223 ///
224 /// #### `role`
225 /// Readable | Writable
226 ///
227 ///
228 /// #### `screen`
229 /// Readable | Writable
230 ///
231 ///
232 /// #### `skip-pager-hint`
233 /// Readable | Writable
234 ///
235 ///
236 /// #### `skip-taskbar-hint`
237 /// Readable | Writable
238 ///
239 ///
240 /// #### `startup-id`
241 /// The :startup-id is a write-only property for setting window's
242 /// startup notification identifier. See [`GtkWindowExt::set_startup_id()`][crate::prelude::GtkWindowExt::set_startup_id()]
243 /// for more details.
244 ///
245 /// Writable
246 ///
247 ///
248 /// #### `title`
249 /// Readable | Writable
250 ///
251 ///
252 /// #### `transient-for`
253 /// The transient parent of the window. See [`GtkWindowExt::set_transient_for()`][crate::prelude::GtkWindowExt::set_transient_for()] for
254 /// more details about transient windows.
255 ///
256 /// Readable | Writable | Construct
257 ///
258 ///
259 /// #### `type`
260 /// Readable | Writable | Construct Only
261 ///
262 ///
263 /// #### `type-hint`
264 /// Readable | Writable
265 ///
266 ///
267 /// #### `urgency-hint`
268 /// Readable | Writable
269 ///
270 ///
271 /// #### `window-position`
272 /// Readable | Writable
273 /// </details>
274 /// <details><summary><h4>Container</h4></summary>
275 ///
276 ///
277 /// #### `border-width`
278 /// Readable | Writable
279 ///
280 ///
281 /// #### `child`
282 /// Writable
283 ///
284 ///
285 /// #### `resize-mode`
286 /// Readable | Writable
287 /// </details>
288 /// <details><summary><h4>Widget</h4></summary>
289 ///
290 ///
291 /// #### `app-paintable`
292 /// Readable | Writable
293 ///
294 ///
295 /// #### `can-default`
296 /// Readable | Writable
297 ///
298 ///
299 /// #### `can-focus`
300 /// Readable | Writable
301 ///
302 ///
303 /// #### `composite-child`
304 /// Readable
305 ///
306 ///
307 /// #### `double-buffered`
308 /// Whether the widget is double buffered.
309 ///
310 /// Readable | Writable
311 ///
312 ///
313 /// #### `events`
314 /// Readable | Writable
315 ///
316 ///
317 /// #### `expand`
318 /// Whether to expand in both directions. Setting this sets both [`hexpand`][struct@crate::Widget#hexpand] and [`vexpand`][struct@crate::Widget#vexpand]
319 ///
320 /// Readable | Writable
321 ///
322 ///
323 /// #### `focus-on-click`
324 /// Whether the widget should grab focus when it is clicked with the mouse.
325 ///
326 /// This property is only relevant for widgets that can take focus.
327 ///
328 /// Before 3.20, several widgets (GtkButton, GtkFileChooserButton,
329 /// GtkComboBox) implemented this property individually.
330 ///
331 /// Readable | Writable
332 ///
333 ///
334 /// #### `halign`
335 /// How to distribute horizontal space if widget gets extra space, see [`Align`][crate::Align]
336 ///
337 /// Readable | Writable
338 ///
339 ///
340 /// #### `has-default`
341 /// Readable | Writable
342 ///
343 ///
344 /// #### `has-focus`
345 /// Readable | Writable
346 ///
347 ///
348 /// #### `has-tooltip`
349 /// Enables or disables the emission of [`query-tooltip`][struct@crate::Widget#query-tooltip] on `widget`.
350 /// A value of [`true`] indicates that `widget` can have a tooltip, in this case
351 /// the widget will be queried using [`query-tooltip`][struct@crate::Widget#query-tooltip] to determine
352 /// whether it will provide a tooltip or not.
353 ///
354 /// Note that setting this property to [`true`] for the first time will change
355 /// the event masks of the GdkWindows of this widget to include leave-notify
356 /// and motion-notify events. This cannot and will not be undone when the
357 /// property is set to [`false`] again.
358 ///
359 /// Readable | Writable
360 ///
361 ///
362 /// #### `height-request`
363 /// Readable | Writable
364 ///
365 ///
366 /// #### `hexpand`
367 /// Whether to expand horizontally. See [`WidgetExt::set_hexpand()`][crate::prelude::WidgetExt::set_hexpand()].
368 ///
369 /// Readable | Writable
370 ///
371 ///
372 /// #### `hexpand-set`
373 /// Whether to use the [`hexpand`][struct@crate::Widget#hexpand] property. See [`WidgetExt::is_hexpand_set()`][crate::prelude::WidgetExt::is_hexpand_set()].
374 ///
375 /// Readable | Writable
376 ///
377 ///
378 /// #### `is-focus`
379 /// Readable | Writable
380 ///
381 ///
382 /// #### `margin`
383 /// Sets all four sides' margin at once. If read, returns max
384 /// margin on any side.
385 ///
386 /// Readable | Writable
387 ///
388 ///
389 /// #### `margin-bottom`
390 /// Margin on bottom side of widget.
391 ///
392 /// This property adds margin outside of the widget's normal size
393 /// request, the margin will be added in addition to the size from
394 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
395 ///
396 /// Readable | Writable
397 ///
398 ///
399 /// #### `margin-end`
400 /// Margin on end of widget, horizontally. This property supports
401 /// left-to-right and right-to-left text directions.
402 ///
403 /// This property adds margin outside of the widget's normal size
404 /// request, the margin will be added in addition to the size from
405 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
406 ///
407 /// Readable | Writable
408 ///
409 ///
410 /// #### `margin-left`
411 /// Margin on left side of widget.
412 ///
413 /// This property adds margin outside of the widget's normal size
414 /// request, the margin will be added in addition to the size from
415 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
416 ///
417 /// Readable | Writable
418 ///
419 ///
420 /// #### `margin-right`
421 /// Margin on right side of widget.
422 ///
423 /// This property adds margin outside of the widget's normal size
424 /// request, the margin will be added in addition to the size from
425 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
426 ///
427 /// Readable | Writable
428 ///
429 ///
430 /// #### `margin-start`
431 /// Margin on start of widget, horizontally. This property supports
432 /// left-to-right and right-to-left text directions.
433 ///
434 /// This property adds margin outside of the widget's normal size
435 /// request, the margin will be added in addition to the size from
436 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
437 ///
438 /// Readable | Writable
439 ///
440 ///
441 /// #### `margin-top`
442 /// Margin on top side of widget.
443 ///
444 /// This property adds margin outside of the widget's normal size
445 /// request, the margin will be added in addition to the size from
446 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
447 ///
448 /// Readable | Writable
449 ///
450 ///
451 /// #### `name`
452 /// Readable | Writable
453 ///
454 ///
455 /// #### `no-show-all`
456 /// Readable | Writable
457 ///
458 ///
459 /// #### `opacity`
460 /// The requested opacity of the widget. See [`WidgetExt::set_opacity()`][crate::prelude::WidgetExt::set_opacity()] for
461 /// more details about window opacity.
462 ///
463 /// Before 3.8 this was only available in GtkWindow
464 ///
465 /// Readable | Writable
466 ///
467 ///
468 /// #### `parent`
469 /// Readable | Writable
470 ///
471 ///
472 /// #### `receives-default`
473 /// Readable | Writable
474 ///
475 ///
476 /// #### `scale-factor`
477 /// The scale factor of the widget. See [`WidgetExt::scale_factor()`][crate::prelude::WidgetExt::scale_factor()] for
478 /// more details about widget scaling.
479 ///
480 /// Readable
481 ///
482 ///
483 /// #### `sensitive`
484 /// Readable | Writable
485 ///
486 ///
487 /// #### `style`
488 /// The style of the widget, which contains information about how it will look (colors, etc).
489 ///
490 /// Readable | Writable
491 ///
492 ///
493 /// #### `tooltip-markup`
494 /// Sets the text of tooltip to be the given string, which is marked up
495 /// with the [Pango text markup language][PangoMarkupFormat].
496 /// Also see [`Tooltip::set_markup()`][crate::Tooltip::set_markup()].
497 ///
498 /// This is a convenience property which will take care of getting the
499 /// tooltip shown if the given string is not [`None`]: [`has-tooltip`][struct@crate::Widget#has-tooltip]
500 /// will automatically be set to [`true`] and there will be taken care of
501 /// [`query-tooltip`][struct@crate::Widget#query-tooltip] in the default signal handler.
502 ///
503 /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and [`tooltip-markup`][struct@crate::Widget#tooltip-markup]
504 /// are set, the last one wins.
505 ///
506 /// Readable | Writable
507 ///
508 ///
509 /// #### `tooltip-text`
510 /// Sets the text of tooltip to be the given string.
511 ///
512 /// Also see [`Tooltip::set_text()`][crate::Tooltip::set_text()].
513 ///
514 /// This is a convenience property which will take care of getting the
515 /// tooltip shown if the given string is not [`None`]: [`has-tooltip`][struct@crate::Widget#has-tooltip]
516 /// will automatically be set to [`true`] and there will be taken care of
517 /// [`query-tooltip`][struct@crate::Widget#query-tooltip] in the default signal handler.
518 ///
519 /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and [`tooltip-markup`][struct@crate::Widget#tooltip-markup]
520 /// are set, the last one wins.
521 ///
522 /// Readable | Writable
523 ///
524 ///
525 /// #### `valign`
526 /// How to distribute vertical space if widget gets extra space, see [`Align`][crate::Align]
527 ///
528 /// Readable | Writable
529 ///
530 ///
531 /// #### `vexpand`
532 /// Whether to expand vertically. See [`WidgetExt::set_vexpand()`][crate::prelude::WidgetExt::set_vexpand()].
533 ///
534 /// Readable | Writable
535 ///
536 ///
537 /// #### `vexpand-set`
538 /// Whether to use the [`vexpand`][struct@crate::Widget#vexpand] property. See [`WidgetExt::is_vexpand_set()`][crate::prelude::WidgetExt::is_vexpand_set()].
539 ///
540 /// Readable | Writable
541 ///
542 ///
543 /// #### `visible`
544 /// Readable | Writable
545 ///
546 ///
547 /// #### `width-request`
548 /// Readable | Writable
549 ///
550 ///
551 /// #### `window`
552 /// The widget's window if it is realized, [`None`] otherwise.
553 ///
554 /// Readable
555 /// </details>
556 ///
557 /// ## Signals
558 ///
559 ///
560 /// #### `close`
561 /// The ::close signal is a
562 /// [keybinding signal][GtkBindingSignal]
563 /// which gets emitted when the user uses a keybinding to close
564 /// the window.
565 ///
566 /// The default binding for this signal is the Escape key.
567 ///
568 /// Action
569 ///
570 ///
571 /// #### `search`
572 /// The ::search signal is a
573 /// [keybinding signal][GtkBindingSignal]
574 /// which gets emitted when the user uses a keybinding to start a search.
575 ///
576 /// The default binding for this signal is Control-F.
577 ///
578 /// Action
579 /// <details><summary><h4>Window</h4></summary>
580 ///
581 ///
582 /// #### `activate-default`
583 /// The ::activate-default signal is a
584 /// [keybinding signal][GtkBindingSignal]
585 /// which gets emitted when the user activates the default widget
586 /// of `window`.
587 ///
588 /// Action
589 ///
590 ///
591 /// #### `activate-focus`
592 /// The ::activate-focus signal is a
593 /// [keybinding signal][GtkBindingSignal]
594 /// which gets emitted when the user activates the currently
595 /// focused widget of `window`.
596 ///
597 /// Action
598 ///
599 ///
600 /// #### `enable-debugging`
601 /// The ::enable-debugging signal is a [keybinding signal][GtkBindingSignal]
602 /// which gets emitted when the user enables or disables interactive
603 /// debugging. When `toggle` is [`true`], interactive debugging is toggled
604 /// on or off, when it is [`false`], the debugger will be pointed at the
605 /// widget under the pointer.
606 ///
607 /// The default bindings for this signal are Ctrl-Shift-I
608 /// and Ctrl-Shift-D.
609 ///
610 /// Action
611 ///
612 ///
613 /// #### `keys-changed`
614 /// The ::keys-changed signal gets emitted when the set of accelerators
615 /// or mnemonics that are associated with `window` changes.
616 ///
617 ///
618 ///
619 ///
620 /// #### `set-focus`
621 /// This signal is emitted whenever the currently focused widget in
622 /// this window changes.
623 ///
624 ///
625 /// </details>
626 /// <details><summary><h4>Container</h4></summary>
627 ///
628 ///
629 /// #### `add`
630 ///
631 ///
632 ///
633 /// #### `check-resize`
634 ///
635 ///
636 ///
637 /// #### `remove`
638 ///
639 ///
640 ///
641 /// #### `set-focus-child`
642 ///
643 /// </details>
644 /// <details><summary><h4>Widget</h4></summary>
645 ///
646 ///
647 /// #### `accel-closures-changed`
648 ///
649 ///
650 ///
651 /// #### `button-press-event`
652 /// The ::button-press-event signal will be emitted when a button
653 /// (typically from a mouse) is pressed.
654 ///
655 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the
656 /// widget needs to enable the [`gdk::EventMask::BUTTON_PRESS_MASK`][crate::gdk::EventMask::BUTTON_PRESS_MASK] mask.
657 ///
658 /// This signal will be sent to the grab widget if there is one.
659 ///
660 ///
661 ///
662 ///
663 /// #### `button-release-event`
664 /// The ::button-release-event signal will be emitted when a button
665 /// (typically from a mouse) is released.
666 ///
667 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the
668 /// widget needs to enable the [`gdk::EventMask::BUTTON_RELEASE_MASK`][crate::gdk::EventMask::BUTTON_RELEASE_MASK] mask.
669 ///
670 /// This signal will be sent to the grab widget if there is one.
671 ///
672 ///
673 ///
674 ///
675 /// #### `can-activate-accel`
676 /// Determines whether an accelerator that activates the signal
677 /// identified by `signal_id` can currently be activated.
678 /// This signal is present to allow applications and derived
679 /// widgets to override the default [`Widget`][crate::Widget] handling
680 /// for determining whether an accelerator can be activated.
681 ///
682 ///
683 ///
684 ///
685 /// #### `child-notify`
686 /// The ::child-notify signal is emitted for each
687 /// [child property][child-properties] that has
688 /// changed on an object. The signal's detail holds the property name.
689 ///
690 /// Detailed
691 ///
692 ///
693 /// #### `composited-changed`
694 /// The ::composited-changed signal is emitted when the composited
695 /// status of `widgets` screen changes.
696 /// See [`Screen::is_composited()`][crate::gdk::Screen::is_composited()].
697 ///
698 /// Action
699 ///
700 ///
701 /// #### `configure-event`
702 /// The ::configure-event signal will be emitted when the size, position or
703 /// stacking of the `widget`'s window has changed.
704 ///
705 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
706 /// to enable the [`gdk::EventMask::STRUCTURE_MASK`][crate::gdk::EventMask::STRUCTURE_MASK] mask. GDK will enable this mask
707 /// automatically for all new windows.
708 ///
709 ///
710 ///
711 ///
712 /// #### `damage-event`
713 /// Emitted when a redirected window belonging to `widget` gets drawn into.
714 /// The region/area members of the event shows what area of the redirected
715 /// drawable was drawn into.
716 ///
717 ///
718 ///
719 ///
720 /// #### `delete-event`
721 /// The ::delete-event signal is emitted if a user requests that
722 /// a toplevel window is closed. The default handler for this signal
723 /// destroys the window. Connecting [`WidgetExtManual::hide_on_delete()`][crate::prelude::WidgetExtManual::hide_on_delete()] to
724 /// this signal will cause the window to be hidden instead, so that
725 /// it can later be shown again without reconstructing it.
726 ///
727 ///
728 ///
729 ///
730 /// #### `destroy`
731 /// Signals that all holders of a reference to the widget should release
732 /// the reference that they hold. May result in finalization of the widget
733 /// if all references are released.
734 ///
735 /// This signal is not suitable for saving widget state.
736 ///
737 ///
738 ///
739 ///
740 /// #### `destroy-event`
741 /// The ::destroy-event signal is emitted when a [`gdk::Window`][crate::gdk::Window] is destroyed.
742 /// You rarely get this signal, because most widgets disconnect themselves
743 /// from their window before they destroy it, so no widget owns the
744 /// window at destroy time.
745 ///
746 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
747 /// to enable the [`gdk::EventMask::STRUCTURE_MASK`][crate::gdk::EventMask::STRUCTURE_MASK] mask. GDK will enable this mask
748 /// automatically for all new windows.
749 ///
750 ///
751 ///
752 ///
753 /// #### `direction-changed`
754 /// The ::direction-changed signal is emitted when the text direction
755 /// of a widget changes.
756 ///
757 ///
758 ///
759 ///
760 /// #### `drag-begin`
761 /// The ::drag-begin signal is emitted on the drag source when a drag is
762 /// started. A typical reason to connect to this signal is to set up a
763 /// custom drag icon with e.g. [`WidgetExt::drag_source_set_icon_pixbuf()`][crate::prelude::WidgetExt::drag_source_set_icon_pixbuf()].
764 ///
765 /// Note that some widgets set up a drag icon in the default handler of
766 /// this signal, so you may have to use `g_signal_connect_after()` to
767 /// override what the default handler did.
768 ///
769 ///
770 ///
771 ///
772 /// #### `drag-data-delete`
773 /// The ::drag-data-delete signal is emitted on the drag source when a drag
774 /// with the action [`gdk::DragAction::MOVE`][crate::gdk::DragAction::MOVE] is successfully completed. The signal
775 /// handler is responsible for deleting the data that has been dropped. What
776 /// "delete" means depends on the context of the drag operation.
777 ///
778 ///
779 ///
780 ///
781 /// #### `drag-data-get`
782 /// The ::drag-data-get signal is emitted on the drag source when the drop
783 /// site requests the data which is dragged. It is the responsibility of
784 /// the signal handler to fill `data` with the data in the format which
785 /// is indicated by `info`. See [`SelectionData::set()`][crate::SelectionData::set()] and
786 /// [`SelectionData::set_text()`][crate::SelectionData::set_text()].
787 ///
788 ///
789 ///
790 ///
791 /// #### `drag-data-received`
792 /// The ::drag-data-received signal is emitted on the drop site when the
793 /// dragged data has been received. If the data was received in order to
794 /// determine whether the drop will be accepted, the handler is expected
795 /// to call `gdk_drag_status()` and not finish the drag.
796 /// If the data was received in response to a [`drag-drop`][struct@crate::Widget#drag-drop] signal
797 /// (and this is the last target to be received), the handler for this
798 /// signal is expected to process the received data and then call
799 /// `gtk_drag_finish()`, setting the `success` parameter depending on
800 /// whether the data was processed successfully.
801 ///
802 /// Applications must create some means to determine why the signal was emitted
803 /// and therefore whether to call `gdk_drag_status()` or `gtk_drag_finish()`.
804 ///
805 /// The handler may inspect the selected action with
806 /// [`DragContext::selected_action()`][crate::gdk::DragContext::selected_action()] before calling
807 /// `gtk_drag_finish()`, e.g. to implement [`gdk::DragAction::ASK`][crate::gdk::DragAction::ASK] as
808 /// shown in the following example:
809 ///
810 ///
811 /// **⚠️ The following code is in C ⚠️**
812 ///
813 /// ```C
814 /// void
815 /// drag_data_received (GtkWidget *widget,
816 /// GdkDragContext *context,
817 /// gint x,
818 /// gint y,
819 /// GtkSelectionData *data,
820 /// guint info,
821 /// guint time)
822 /// {
823 /// if ((data->length >= 0) && (data->format == 8))
824 /// {
825 /// GdkDragAction action;
826 ///
827 /// // handle data here
828 ///
829 /// action = gdk_drag_context_get_selected_action (context);
830 /// if (action == GDK_ACTION_ASK)
831 /// {
832 /// GtkWidget *dialog;
833 /// gint response;
834 ///
835 /// dialog = gtk_message_dialog_new (NULL,
836 /// GTK_DIALOG_MODAL |
837 /// GTK_DIALOG_DESTROY_WITH_PARENT,
838 /// GTK_MESSAGE_INFO,
839 /// GTK_BUTTONS_YES_NO,
840 /// "Move the data ?\n");
841 /// response = gtk_dialog_run (GTK_DIALOG (dialog));
842 /// gtk_widget_destroy (dialog);
843 ///
844 /// if (response == GTK_RESPONSE_YES)
845 /// action = GDK_ACTION_MOVE;
846 /// else
847 /// action = GDK_ACTION_COPY;
848 /// }
849 ///
850 /// gtk_drag_finish (context, TRUE, action == GDK_ACTION_MOVE, time);
851 /// }
852 /// else
853 /// gtk_drag_finish (context, FALSE, FALSE, time);
854 /// }
855 /// ```
856 ///
857 ///
858 ///
859 ///
860 /// #### `drag-drop`
861 /// The ::drag-drop signal is emitted on the drop site when the user drops
862 /// the data onto the widget. The signal handler must determine whether
863 /// the cursor position is in a drop zone or not. If it is not in a drop
864 /// zone, it returns [`false`] and no further processing is necessary.
865 /// Otherwise, the handler returns [`true`]. In this case, the handler must
866 /// ensure that `gtk_drag_finish()` is called to let the source know that
867 /// the drop is done. The call to `gtk_drag_finish()` can be done either
868 /// directly or in a [`drag-data-received`][struct@crate::Widget#drag-data-received] handler which gets
869 /// triggered by calling [`WidgetExt::drag_get_data()`][crate::prelude::WidgetExt::drag_get_data()] to receive the data for one
870 /// or more of the supported targets.
871 ///
872 ///
873 ///
874 ///
875 /// #### `drag-end`
876 /// The ::drag-end signal is emitted on the drag source when a drag is
877 /// finished. A typical reason to connect to this signal is to undo
878 /// things done in [`drag-begin`][struct@crate::Widget#drag-begin].
879 ///
880 ///
881 ///
882 ///
883 /// #### `drag-failed`
884 /// The ::drag-failed signal is emitted on the drag source when a drag has
885 /// failed. The signal handler may hook custom code to handle a failed DnD
886 /// operation based on the type of error, it returns [`true`] is the failure has
887 /// been already handled (not showing the default "drag operation failed"
888 /// animation), otherwise it returns [`false`].
889 ///
890 ///
891 ///
892 ///
893 /// #### `drag-leave`
894 /// The ::drag-leave signal is emitted on the drop site when the cursor
895 /// leaves the widget. A typical reason to connect to this signal is to
896 /// undo things done in [`drag-motion`][struct@crate::Widget#drag-motion], e.g. undo highlighting
897 /// with [`WidgetExt::drag_unhighlight()`][crate::prelude::WidgetExt::drag_unhighlight()].
898 ///
899 ///
900 /// Likewise, the [`drag-leave`][struct@crate::Widget#drag-leave] signal is also emitted before the
901 /// ::drag-drop signal, for instance to allow cleaning up of a preview item
902 /// created in the [`drag-motion`][struct@crate::Widget#drag-motion] signal handler.
903 ///
904 ///
905 ///
906 ///
907 /// #### `drag-motion`
908 /// The ::drag-motion signal is emitted on the drop site when the user
909 /// moves the cursor over the widget during a drag. The signal handler
910 /// must determine whether the cursor position is in a drop zone or not.
911 /// If it is not in a drop zone, it returns [`false`] and no further processing
912 /// is necessary. Otherwise, the handler returns [`true`]. In this case, the
913 /// handler is responsible for providing the necessary information for
914 /// displaying feedback to the user, by calling `gdk_drag_status()`.
915 ///
916 /// If the decision whether the drop will be accepted or rejected can't be
917 /// made based solely on the cursor position and the type of the data, the
918 /// handler may inspect the dragged data by calling [`WidgetExt::drag_get_data()`][crate::prelude::WidgetExt::drag_get_data()] and
919 /// defer the `gdk_drag_status()` call to the [`drag-data-received`][struct@crate::Widget#drag-data-received]
920 /// handler. Note that you must pass [`DestDefaults::DROP`][crate::DestDefaults::DROP],
921 /// [`DestDefaults::MOTION`][crate::DestDefaults::MOTION] or [`DestDefaults::ALL`][crate::DestDefaults::ALL] to [`WidgetExtManual::drag_dest_set()`][crate::prelude::WidgetExtManual::drag_dest_set()]
922 /// when using the drag-motion signal that way.
923 ///
924 /// Also note that there is no drag-enter signal. The drag receiver has to
925 /// keep track of whether he has received any drag-motion signals since the
926 /// last [`drag-leave`][struct@crate::Widget#drag-leave] and if not, treat the drag-motion signal as
927 /// an "enter" signal. Upon an "enter", the handler will typically highlight
928 /// the drop site with [`WidgetExt::drag_highlight()`][crate::prelude::WidgetExt::drag_highlight()].
929 ///
930 ///
931 /// **⚠️ The following code is in C ⚠️**
932 ///
933 /// ```C
934 /// static void
935 /// drag_motion (GtkWidget *widget,
936 /// GdkDragContext *context,
937 /// gint x,
938 /// gint y,
939 /// guint time)
940 /// {
941 /// GdkAtom target;
942 ///
943 /// PrivateData *private_data = GET_PRIVATE_DATA (widget);
944 ///
945 /// if (!private_data->drag_highlight)
946 /// {
947 /// private_data->drag_highlight = 1;
948 /// gtk_drag_highlight (widget);
949 /// }
950 ///
951 /// target = gtk_drag_dest_find_target (widget, context, NULL);
952 /// if (target == GDK_NONE)
953 /// gdk_drag_status (context, 0, time);
954 /// else
955 /// {
956 /// private_data->pending_status
957 /// = gdk_drag_context_get_suggested_action (context);
958 /// gtk_drag_get_data (widget, context, target, time);
959 /// }
960 ///
961 /// return TRUE;
962 /// }
963 ///
964 /// static void
965 /// drag_data_received (GtkWidget *widget,
966 /// GdkDragContext *context,
967 /// gint x,
968 /// gint y,
969 /// GtkSelectionData *selection_data,
970 /// guint info,
971 /// guint time)
972 /// {
973 /// PrivateData *private_data = GET_PRIVATE_DATA (widget);
974 ///
975 /// if (private_data->suggested_action)
976 /// {
977 /// private_data->suggested_action = 0;
978 ///
979 /// // We are getting this data due to a request in drag_motion,
980 /// // rather than due to a request in drag_drop, so we are just
981 /// // supposed to call gdk_drag_status(), not actually paste in
982 /// // the data.
983 ///
984 /// str = gtk_selection_data_get_text (selection_data);
985 /// if (!data_is_acceptable (str))
986 /// gdk_drag_status (context, 0, time);
987 /// else
988 /// gdk_drag_status (context,
989 /// private_data->suggested_action,
990 /// time);
991 /// }
992 /// else
993 /// {
994 /// // accept the drop
995 /// }
996 /// }
997 /// ```
998 ///
999 ///
1000 ///
1001 ///
1002 /// #### `draw`
1003 /// This signal is emitted when a widget is supposed to render itself.
1004 /// The `widget`'s top left corner must be painted at the origin of
1005 /// the passed in context and be sized to the values returned by
1006 /// [`WidgetExt::allocated_width()`][crate::prelude::WidgetExt::allocated_width()] and
1007 /// [`WidgetExt::allocated_height()`][crate::prelude::WidgetExt::allocated_height()].
1008 ///
1009 /// Signal handlers connected to this signal can modify the cairo
1010 /// context passed as `cr` in any way they like and don't need to
1011 /// restore it. The signal emission takes care of calling `cairo_save()`
1012 /// before and `cairo_restore()` after invoking the handler.
1013 ///
1014 /// The signal handler will get a `cr` with a clip region already set to the
1015 /// widget's dirty region, i.e. to the area that needs repainting. Complicated
1016 /// widgets that want to avoid redrawing themselves completely can get the full
1017 /// extents of the clip region with `gdk_cairo_get_clip_rectangle()`, or they can
1018 /// get a finer-grained representation of the dirty region with
1019 /// `cairo_copy_clip_rectangle_list()`.
1020 ///
1021 ///
1022 ///
1023 ///
1024 /// #### `enter-notify-event`
1025 /// The ::enter-notify-event will be emitted when the pointer enters
1026 /// the `widget`'s window.
1027 ///
1028 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
1029 /// to enable the [`gdk::EventMask::ENTER_NOTIFY_MASK`][crate::gdk::EventMask::ENTER_NOTIFY_MASK] mask.
1030 ///
1031 /// This signal will be sent to the grab widget if there is one.
1032 ///
1033 ///
1034 ///
1035 ///
1036 /// #### `event`
1037 /// The GTK+ main loop will emit three signals for each GDK event delivered
1038 /// to a widget: one generic ::event signal, another, more specific,
1039 /// signal that matches the type of event delivered (e.g.
1040 /// [`key-press-event`][struct@crate::Widget#key-press-event]) and finally a generic
1041 /// [`event-after`][struct@crate::Widget#event-after] signal.
1042 ///
1043 ///
1044 ///
1045 ///
1046 /// #### `event-after`
1047 /// After the emission of the [`event`][struct@crate::Widget#event] signal and (optionally)
1048 /// the second more specific signal, ::event-after will be emitted
1049 /// regardless of the previous two signals handlers return values.
1050 ///
1051 ///
1052 ///
1053 ///
1054 /// #### `focus`
1055 ///
1056 ///
1057 ///
1058 /// #### `focus-in-event`
1059 /// The ::focus-in-event signal will be emitted when the keyboard focus
1060 /// enters the `widget`'s window.
1061 ///
1062 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
1063 /// to enable the [`gdk::EventMask::FOCUS_CHANGE_MASK`][crate::gdk::EventMask::FOCUS_CHANGE_MASK] mask.
1064 ///
1065 ///
1066 ///
1067 ///
1068 /// #### `focus-out-event`
1069 /// The ::focus-out-event signal will be emitted when the keyboard focus
1070 /// leaves the `widget`'s window.
1071 ///
1072 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
1073 /// to enable the [`gdk::EventMask::FOCUS_CHANGE_MASK`][crate::gdk::EventMask::FOCUS_CHANGE_MASK] mask.
1074 ///
1075 ///
1076 ///
1077 ///
1078 /// #### `grab-broken-event`
1079 /// Emitted when a pointer or keyboard grab on a window belonging
1080 /// to `widget` gets broken.
1081 ///
1082 /// On X11, this happens when the grab window becomes unviewable
1083 /// (i.e. it or one of its ancestors is unmapped), or if the same
1084 /// application grabs the pointer or keyboard again.
1085 ///
1086 ///
1087 ///
1088 ///
1089 /// #### `grab-focus`
1090 /// Action
1091 ///
1092 ///
1093 /// #### `grab-notify`
1094 /// The ::grab-notify signal is emitted when a widget becomes
1095 /// shadowed by a GTK+ grab (not a pointer or keyboard grab) on
1096 /// another widget, or when it becomes unshadowed due to a grab
1097 /// being removed.
1098 ///
1099 /// A widget is shadowed by a [`WidgetExt::grab_add()`][crate::prelude::WidgetExt::grab_add()] when the topmost
1100 /// grab widget in the grab stack of its window group is not
1101 /// its ancestor.
1102 ///
1103 ///
1104 ///
1105 ///
1106 /// #### `hide`
1107 /// The ::hide signal is emitted when `widget` is hidden, for example with
1108 /// [`WidgetExt::hide()`][crate::prelude::WidgetExt::hide()].
1109 ///
1110 ///
1111 ///
1112 ///
1113 /// #### `hierarchy-changed`
1114 /// The ::hierarchy-changed signal is emitted when the
1115 /// anchored state of a widget changes. A widget is
1116 /// “anchored” when its toplevel
1117 /// ancestor is a [`Window`][crate::Window]. This signal is emitted when
1118 /// a widget changes from un-anchored to anchored or vice-versa.
1119 ///
1120 ///
1121 ///
1122 ///
1123 /// #### `key-press-event`
1124 /// The ::key-press-event signal is emitted when a key is pressed. The signal
1125 /// emission will reoccur at the key-repeat rate when the key is kept pressed.
1126 ///
1127 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
1128 /// to enable the [`gdk::EventMask::KEY_PRESS_MASK`][crate::gdk::EventMask::KEY_PRESS_MASK] mask.
1129 ///
1130 /// This signal will be sent to the grab widget if there is one.
1131 ///
1132 ///
1133 ///
1134 ///
1135 /// #### `key-release-event`
1136 /// The ::key-release-event signal is emitted when a key is released.
1137 ///
1138 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
1139 /// to enable the [`gdk::EventMask::KEY_RELEASE_MASK`][crate::gdk::EventMask::KEY_RELEASE_MASK] mask.
1140 ///
1141 /// This signal will be sent to the grab widget if there is one.
1142 ///
1143 ///
1144 ///
1145 ///
1146 /// #### `keynav-failed`
1147 /// Gets emitted if keyboard navigation fails.
1148 /// See [`WidgetExt::keynav_failed()`][crate::prelude::WidgetExt::keynav_failed()] for details.
1149 ///
1150 ///
1151 ///
1152 ///
1153 /// #### `leave-notify-event`
1154 /// The ::leave-notify-event will be emitted when the pointer leaves
1155 /// the `widget`'s window.
1156 ///
1157 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
1158 /// to enable the [`gdk::EventMask::LEAVE_NOTIFY_MASK`][crate::gdk::EventMask::LEAVE_NOTIFY_MASK] mask.
1159 ///
1160 /// This signal will be sent to the grab widget if there is one.
1161 ///
1162 ///
1163 ///
1164 ///
1165 /// #### `map`
1166 /// The ::map signal is emitted when `widget` is going to be mapped, that is
1167 /// when the widget is visible (which is controlled with
1168 /// [`WidgetExt::set_visible()`][crate::prelude::WidgetExt::set_visible()]) and all its parents up to the toplevel widget
1169 /// are also visible. Once the map has occurred, [`map-event`][struct@crate::Widget#map-event] will
1170 /// be emitted.
1171 ///
1172 /// The ::map signal can be used to determine whether a widget will be drawn,
1173 /// for instance it can resume an animation that was stopped during the
1174 /// emission of [`unmap`][struct@crate::Widget#unmap].
1175 ///
1176 ///
1177 ///
1178 ///
1179 /// #### `map-event`
1180 /// The ::map-event signal will be emitted when the `widget`'s window is
1181 /// mapped. A window is mapped when it becomes visible on the screen.
1182 ///
1183 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
1184 /// to enable the [`gdk::EventMask::STRUCTURE_MASK`][crate::gdk::EventMask::STRUCTURE_MASK] mask. GDK will enable this mask
1185 /// automatically for all new windows.
1186 ///
1187 ///
1188 ///
1189 ///
1190 /// #### `mnemonic-activate`
1191 /// The default handler for this signal activates `widget` if `group_cycling`
1192 /// is [`false`], or just makes `widget` grab focus if `group_cycling` is [`true`].
1193 ///
1194 ///
1195 ///
1196 ///
1197 /// #### `motion-notify-event`
1198 /// The ::motion-notify-event signal is emitted when the pointer moves
1199 /// over the widget's [`gdk::Window`][crate::gdk::Window].
1200 ///
1201 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget
1202 /// needs to enable the [`gdk::EventMask::POINTER_MOTION_MASK`][crate::gdk::EventMask::POINTER_MOTION_MASK] mask.
1203 ///
1204 /// This signal will be sent to the grab widget if there is one.
1205 ///
1206 ///
1207 ///
1208 ///
1209 /// #### `move-focus`
1210 /// Action
1211 ///
1212 ///
1213 /// #### `parent-set`
1214 /// The ::parent-set signal is emitted when a new parent
1215 /// has been set on a widget.
1216 ///
1217 ///
1218 ///
1219 ///
1220 /// #### `popup-menu`
1221 /// This signal gets emitted whenever a widget should pop up a context
1222 /// menu. This usually happens through the standard key binding mechanism;
1223 /// by pressing a certain key while a widget is focused, the user can cause
1224 /// the widget to pop up a menu. For example, the [`Entry`][crate::Entry] widget creates
1225 /// a menu with clipboard commands. See the
1226 /// [Popup Menu Migration Checklist][checklist-popup-menu]
1227 /// for an example of how to use this signal.
1228 ///
1229 /// Action
1230 ///
1231 ///
1232 /// #### `property-notify-event`
1233 /// The ::property-notify-event signal will be emitted when a property on
1234 /// the `widget`'s window has been changed or deleted.
1235 ///
1236 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
1237 /// to enable the [`gdk::EventMask::PROPERTY_CHANGE_MASK`][crate::gdk::EventMask::PROPERTY_CHANGE_MASK] mask.
1238 ///
1239 ///
1240 ///
1241 ///
1242 /// #### `proximity-in-event`
1243 /// To receive this signal the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
1244 /// to enable the [`gdk::EventMask::PROXIMITY_IN_MASK`][crate::gdk::EventMask::PROXIMITY_IN_MASK] mask.
1245 ///
1246 /// This signal will be sent to the grab widget if there is one.
1247 ///
1248 ///
1249 ///
1250 ///
1251 /// #### `proximity-out-event`
1252 /// To receive this signal the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
1253 /// to enable the [`gdk::EventMask::PROXIMITY_OUT_MASK`][crate::gdk::EventMask::PROXIMITY_OUT_MASK] mask.
1254 ///
1255 /// This signal will be sent to the grab widget if there is one.
1256 ///
1257 ///
1258 ///
1259 ///
1260 /// #### `query-tooltip`
1261 /// Emitted when [`has-tooltip`][struct@crate::Widget#has-tooltip] is [`true`] and the hover timeout
1262 /// has expired with the cursor hovering "above" `widget`; or emitted when `widget` got
1263 /// focus in keyboard mode.
1264 ///
1265 /// Using the given coordinates, the signal handler should determine
1266 /// whether a tooltip should be shown for `widget`. If this is the case
1267 /// [`true`] should be returned, [`false`] otherwise. Note that if
1268 /// `keyboard_mode` is [`true`], the values of `x` and `y` are undefined and
1269 /// should not be used.
1270 ///
1271 /// The signal handler is free to manipulate `tooltip` with the therefore
1272 /// destined function calls.
1273 ///
1274 ///
1275 ///
1276 ///
1277 /// #### `realize`
1278 /// The ::realize signal is emitted when `widget` is associated with a
1279 /// [`gdk::Window`][crate::gdk::Window], which means that [`WidgetExt::realize()`][crate::prelude::WidgetExt::realize()] has been called or the
1280 /// widget has been mapped (that is, it is going to be drawn).
1281 ///
1282 ///
1283 ///
1284 ///
1285 /// #### `screen-changed`
1286 /// The ::screen-changed signal gets emitted when the
1287 /// screen of a widget has changed.
1288 ///
1289 ///
1290 ///
1291 ///
1292 /// #### `scroll-event`
1293 /// The ::scroll-event signal is emitted when a button in the 4 to 7
1294 /// range is pressed. Wheel mice are usually configured to generate
1295 /// button press events for buttons 4 and 5 when the wheel is turned.
1296 ///
1297 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
1298 /// to enable the [`gdk::EventMask::SCROLL_MASK`][crate::gdk::EventMask::SCROLL_MASK] mask.
1299 ///
1300 /// This signal will be sent to the grab widget if there is one.
1301 ///
1302 ///
1303 ///
1304 ///
1305 /// #### `selection-clear-event`
1306 /// The ::selection-clear-event signal will be emitted when the
1307 /// the `widget`'s window has lost ownership of a selection.
1308 ///
1309 ///
1310 ///
1311 ///
1312 /// #### `selection-get`
1313 ///
1314 ///
1315 ///
1316 /// #### `selection-notify-event`
1317 ///
1318 ///
1319 ///
1320 /// #### `selection-received`
1321 ///
1322 ///
1323 ///
1324 /// #### `selection-request-event`
1325 /// The ::selection-request-event signal will be emitted when
1326 /// another client requests ownership of the selection owned by
1327 /// the `widget`'s window.
1328 ///
1329 ///
1330 ///
1331 ///
1332 /// #### `show`
1333 /// The ::show signal is emitted when `widget` is shown, for example with
1334 /// [`WidgetExt::show()`][crate::prelude::WidgetExt::show()].
1335 ///
1336 ///
1337 ///
1338 ///
1339 /// #### `show-help`
1340 /// Action
1341 ///
1342 ///
1343 /// #### `size-allocate`
1344 ///
1345 ///
1346 ///
1347 /// #### `state-changed`
1348 /// The ::state-changed signal is emitted when the widget state changes.
1349 /// See `gtk_widget_get_state()`.
1350 ///
1351 ///
1352 ///
1353 ///
1354 /// #### `state-flags-changed`
1355 /// The ::state-flags-changed signal is emitted when the widget state
1356 /// changes, see [`WidgetExt::state_flags()`][crate::prelude::WidgetExt::state_flags()].
1357 ///
1358 ///
1359 ///
1360 ///
1361 /// #### `style-set`
1362 /// The ::style-set signal is emitted when a new style has been set
1363 /// on a widget. Note that style-modifying functions like
1364 /// `gtk_widget_modify_base()` also cause this signal to be emitted.
1365 ///
1366 /// Note that this signal is emitted for changes to the deprecated
1367 /// `GtkStyle`. To track changes to the [`StyleContext`][crate::StyleContext] associated
1368 /// with a widget, use the [`style-updated`][struct@crate::Widget#style-updated] signal.
1369 ///
1370 ///
1371 ///
1372 ///
1373 /// #### `style-updated`
1374 /// The ::style-updated signal is a convenience signal that is emitted when the
1375 /// [`changed`][struct@crate::StyleContext#changed] signal is emitted on the `widget`'s associated
1376 /// [`StyleContext`][crate::StyleContext] as returned by [`WidgetExt::style_context()`][crate::prelude::WidgetExt::style_context()].
1377 ///
1378 /// Note that style-modifying functions like `gtk_widget_override_color()` also
1379 /// cause this signal to be emitted.
1380 ///
1381 ///
1382 ///
1383 ///
1384 /// #### `touch-event`
1385 ///
1386 ///
1387 ///
1388 /// #### `unmap`
1389 /// The ::unmap signal is emitted when `widget` is going to be unmapped, which
1390 /// means that either it or any of its parents up to the toplevel widget have
1391 /// been set as hidden.
1392 ///
1393 /// As ::unmap indicates that a widget will not be shown any longer, it can be
1394 /// used to, for example, stop an animation on the widget.
1395 ///
1396 ///
1397 ///
1398 ///
1399 /// #### `unmap-event`
1400 /// The ::unmap-event signal will be emitted when the `widget`'s window is
1401 /// unmapped. A window is unmapped when it becomes invisible on the screen.
1402 ///
1403 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
1404 /// to enable the [`gdk::EventMask::STRUCTURE_MASK`][crate::gdk::EventMask::STRUCTURE_MASK] mask. GDK will enable this mask
1405 /// automatically for all new windows.
1406 ///
1407 ///
1408 ///
1409 ///
1410 /// #### `unrealize`
1411 /// The ::unrealize signal is emitted when the [`gdk::Window`][crate::gdk::Window] associated with
1412 /// `widget` is destroyed, which means that [`WidgetExt::unrealize()`][crate::prelude::WidgetExt::unrealize()] has been
1413 /// called or the widget has been unmapped (that is, it is going to be
1414 /// hidden).
1415 ///
1416 ///
1417 ///
1418 ///
1419 /// #### `visibility-notify-event`
1420 /// The ::visibility-notify-event will be emitted when the `widget`'s
1421 /// window is obscured or unobscured.
1422 ///
1423 /// To receive this signal the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
1424 /// to enable the [`gdk::EventMask::VISIBILITY_NOTIFY_MASK`][crate::gdk::EventMask::VISIBILITY_NOTIFY_MASK] mask.
1425 ///
1426 ///
1427 ///
1428 ///
1429 /// #### `window-state-event`
1430 /// The ::window-state-event will be emitted when the state of the
1431 /// toplevel window associated to the `widget` changes.
1432 ///
1433 /// To receive this signal the [`gdk::Window`][crate::gdk::Window] associated to the widget
1434 /// needs to enable the [`gdk::EventMask::STRUCTURE_MASK`][crate::gdk::EventMask::STRUCTURE_MASK] mask. GDK will enable
1435 /// this mask automatically for all new windows.
1436 ///
1437 ///
1438 /// </details>
1439 ///
1440 /// # Implements
1441 ///
1442 /// [`ShortcutsWindowExt`][trait@crate::prelude::ShortcutsWindowExt], [`GtkWindowExt`][trait@crate::prelude::GtkWindowExt], [`BinExt`][trait@crate::prelude::BinExt], [`ContainerExt`][trait@crate::prelude::ContainerExt], [`WidgetExt`][trait@crate::prelude::WidgetExt], [`trait@glib::ObjectExt`], [`BuildableExt`][trait@crate::prelude::BuildableExt], [`GtkWindowExtManual`][trait@crate::prelude::GtkWindowExtManual], [`ContainerExtManual`][trait@crate::prelude::ContainerExtManual], [`WidgetExtManual`][trait@crate::prelude::WidgetExtManual], [`BuildableExtManual`][trait@crate::prelude::BuildableExtManual]
1443 #[doc(alias = "GtkShortcutsWindow")]
1444 pub struct ShortcutsWindow(Object<ffi::GtkShortcutsWindow, ffi::GtkShortcutsWindowClass>) @extends Window, Bin, Container, Widget, @implements Buildable;
1445
1446 match fn {
1447 type_ => || ffi::gtk_shortcuts_window_get_type(),
1448 }
1449}
1450
1451impl ShortcutsWindow {
1452 pub const NONE: Option<&'static ShortcutsWindow> = None;
1453
1454 // rustdoc-stripper-ignore-next
1455 /// Creates a new builder-pattern struct instance to construct [`ShortcutsWindow`] objects.
1456 ///
1457 /// This method returns an instance of [`ShortcutsWindowBuilder`](crate::builders::ShortcutsWindowBuilder) which can be used to create [`ShortcutsWindow`] objects.
1458 pub fn builder() -> ShortcutsWindowBuilder {
1459 ShortcutsWindowBuilder::new()
1460 }
1461}
1462
1463// rustdoc-stripper-ignore-next
1464/// A [builder-pattern] type to construct [`ShortcutsWindow`] objects.
1465///
1466/// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html
1467#[must_use = "The builder must be built to be used"]
1468pub struct ShortcutsWindowBuilder {
1469 builder: glib::object::ObjectBuilder<'static, ShortcutsWindow>,
1470}
1471
1472impl ShortcutsWindowBuilder {
1473 fn new() -> Self {
1474 Self {
1475 builder: glib::object::Object::builder(),
1476 }
1477 }
1478
1479 /// The name of the section to show.
1480 ///
1481 /// This should be the section-name of one of the [`ShortcutsSection`][crate::ShortcutsSection]
1482 /// objects that are in this shortcuts window.
1483 pub fn section_name(self, section_name: impl Into<glib::GString>) -> Self {
1484 Self {
1485 builder: self.builder.property("section-name", section_name.into()),
1486 }
1487 }
1488
1489 /// The view name by which to filter the contents.
1490 ///
1491 /// This should correspond to the [`view`][struct@crate::ShortcutsGroup#view] property of some of
1492 /// the [`ShortcutsGroup`][crate::ShortcutsGroup] objects that are inside this shortcuts window.
1493 ///
1494 /// Set this to [`None`] to show all groups.
1495 pub fn view_name(self, view_name: impl Into<glib::GString>) -> Self {
1496 Self {
1497 builder: self.builder.property("view-name", view_name.into()),
1498 }
1499 }
1500
1501 /// Whether the window should receive the input focus.
1502 pub fn accept_focus(self, accept_focus: bool) -> Self {
1503 Self {
1504 builder: self.builder.property("accept-focus", accept_focus),
1505 }
1506 }
1507
1508 /// The [`Application`][crate::Application] associated with the window.
1509 ///
1510 /// The application will be kept alive for at least as long as it
1511 /// has any windows associated with it (see [`ApplicationExtManual::hold()`][crate::gio::prelude::ApplicationExtManual::hold()]
1512 /// for a way to keep it alive without windows).
1513 ///
1514 /// Normally, the connection between the application and the window
1515 /// will remain until the window is destroyed, but you can explicitly
1516 /// remove it by setting the :application property to [`None`].
1517 pub fn application(self, application: &impl IsA<Application>) -> Self {
1518 Self {
1519 builder: self
1520 .builder
1521 .property("application", application.clone().upcast()),
1522 }
1523 }
1524
1525 /// The widget to which this window is attached.
1526 /// See [`GtkWindowExt::set_attached_to()`][crate::prelude::GtkWindowExt::set_attached_to()].
1527 ///
1528 /// Examples of places where specifying this relation is useful are
1529 /// for instance a [`Menu`][crate::Menu] created by a [`ComboBox`][crate::ComboBox], a completion
1530 /// popup window created by [`Entry`][crate::Entry] or a typeahead search entry
1531 /// created by [`TreeView`][crate::TreeView].
1532 pub fn attached_to(self, attached_to: &impl IsA<Widget>) -> Self {
1533 Self {
1534 builder: self
1535 .builder
1536 .property("attached-to", attached_to.clone().upcast()),
1537 }
1538 }
1539
1540 /// Whether the window should be decorated by the window manager.
1541 pub fn decorated(self, decorated: bool) -> Self {
1542 Self {
1543 builder: self.builder.property("decorated", decorated),
1544 }
1545 }
1546
1547 pub fn default_height(self, default_height: i32) -> Self {
1548 Self {
1549 builder: self.builder.property("default-height", default_height),
1550 }
1551 }
1552
1553 pub fn default_width(self, default_width: i32) -> Self {
1554 Self {
1555 builder: self.builder.property("default-width", default_width),
1556 }
1557 }
1558
1559 /// Whether the window frame should have a close button.
1560 pub fn deletable(self, deletable: bool) -> Self {
1561 Self {
1562 builder: self.builder.property("deletable", deletable),
1563 }
1564 }
1565
1566 pub fn destroy_with_parent(self, destroy_with_parent: bool) -> Self {
1567 Self {
1568 builder: self
1569 .builder
1570 .property("destroy-with-parent", destroy_with_parent),
1571 }
1572 }
1573
1574 /// Whether the window should receive the input focus when mapped.
1575 pub fn focus_on_map(self, focus_on_map: bool) -> Self {
1576 Self {
1577 builder: self.builder.property("focus-on-map", focus_on_map),
1578 }
1579 }
1580
1581 /// Whether 'focus rectangles' are currently visible in this window.
1582 ///
1583 /// This property is maintained by GTK+ based on user input
1584 /// and should not be set by applications.
1585 pub fn focus_visible(self, focus_visible: bool) -> Self {
1586 Self {
1587 builder: self.builder.property("focus-visible", focus_visible),
1588 }
1589 }
1590
1591 /// The window gravity of the window. See [`GtkWindowExt::move_()`][crate::prelude::GtkWindowExt::move_()] and [`gdk::Gravity`][crate::gdk::Gravity] for
1592 /// more details about window gravity.
1593 pub fn gravity(self, gravity: gdk::Gravity) -> Self {
1594 Self {
1595 builder: self.builder.property("gravity", gravity),
1596 }
1597 }
1598
1599 /// Whether the titlebar should be hidden during maximization.
1600 pub fn hide_titlebar_when_maximized(self, hide_titlebar_when_maximized: bool) -> Self {
1601 Self {
1602 builder: self
1603 .builder
1604 .property("hide-titlebar-when-maximized", hide_titlebar_when_maximized),
1605 }
1606 }
1607
1608 pub fn icon(self, icon: &gdk_pixbuf::Pixbuf) -> Self {
1609 Self {
1610 builder: self.builder.property("icon", icon.clone()),
1611 }
1612 }
1613
1614 /// The :icon-name property specifies the name of the themed icon to
1615 /// use as the window icon. See [`IconTheme`][crate::IconTheme] for more details.
1616 pub fn icon_name(self, icon_name: impl Into<glib::GString>) -> Self {
1617 Self {
1618 builder: self.builder.property("icon-name", icon_name.into()),
1619 }
1620 }
1621
1622 /// Whether mnemonics are currently visible in this window.
1623 ///
1624 /// This property is maintained by GTK+ based on user input,
1625 /// and should not be set by applications.
1626 pub fn mnemonics_visible(self, mnemonics_visible: bool) -> Self {
1627 Self {
1628 builder: self
1629 .builder
1630 .property("mnemonics-visible", mnemonics_visible),
1631 }
1632 }
1633
1634 pub fn modal(self, modal: bool) -> Self {
1635 Self {
1636 builder: self.builder.property("modal", modal),
1637 }
1638 }
1639
1640 pub fn resizable(self, resizable: bool) -> Self {
1641 Self {
1642 builder: self.builder.property("resizable", resizable),
1643 }
1644 }
1645
1646 pub fn role(self, role: impl Into<glib::GString>) -> Self {
1647 Self {
1648 builder: self.builder.property("role", role.into()),
1649 }
1650 }
1651
1652 pub fn screen(self, screen: &gdk::Screen) -> Self {
1653 Self {
1654 builder: self.builder.property("screen", screen.clone()),
1655 }
1656 }
1657
1658 pub fn skip_pager_hint(self, skip_pager_hint: bool) -> Self {
1659 Self {
1660 builder: self.builder.property("skip-pager-hint", skip_pager_hint),
1661 }
1662 }
1663
1664 pub fn skip_taskbar_hint(self, skip_taskbar_hint: bool) -> Self {
1665 Self {
1666 builder: self
1667 .builder
1668 .property("skip-taskbar-hint", skip_taskbar_hint),
1669 }
1670 }
1671
1672 /// The :startup-id is a write-only property for setting window's
1673 /// startup notification identifier. See [`GtkWindowExt::set_startup_id()`][crate::prelude::GtkWindowExt::set_startup_id()]
1674 /// for more details.
1675 pub fn startup_id(self, startup_id: impl Into<glib::GString>) -> Self {
1676 Self {
1677 builder: self.builder.property("startup-id", startup_id.into()),
1678 }
1679 }
1680
1681 pub fn title(self, title: impl Into<glib::GString>) -> Self {
1682 Self {
1683 builder: self.builder.property("title", title.into()),
1684 }
1685 }
1686
1687 /// The transient parent of the window. See [`GtkWindowExt::set_transient_for()`][crate::prelude::GtkWindowExt::set_transient_for()] for
1688 /// more details about transient windows.
1689 pub fn transient_for(self, transient_for: &impl IsA<Window>) -> Self {
1690 Self {
1691 builder: self
1692 .builder
1693 .property("transient-for", transient_for.clone().upcast()),
1694 }
1695 }
1696
1697 pub fn type_(self, type_: WindowType) -> Self {
1698 Self {
1699 builder: self.builder.property("type", type_),
1700 }
1701 }
1702
1703 pub fn type_hint(self, type_hint: gdk::WindowTypeHint) -> Self {
1704 Self {
1705 builder: self.builder.property("type-hint", type_hint),
1706 }
1707 }
1708
1709 pub fn urgency_hint(self, urgency_hint: bool) -> Self {
1710 Self {
1711 builder: self.builder.property("urgency-hint", urgency_hint),
1712 }
1713 }
1714
1715 pub fn window_position(self, window_position: WindowPosition) -> Self {
1716 Self {
1717 builder: self.builder.property("window-position", window_position),
1718 }
1719 }
1720
1721 pub fn border_width(self, border_width: u32) -> Self {
1722 Self {
1723 builder: self.builder.property("border-width", border_width),
1724 }
1725 }
1726
1727 pub fn child(self, child: &impl IsA<Widget>) -> Self {
1728 Self {
1729 builder: self.builder.property("child", child.clone().upcast()),
1730 }
1731 }
1732
1733 pub fn resize_mode(self, resize_mode: ResizeMode) -> Self {
1734 Self {
1735 builder: self.builder.property("resize-mode", resize_mode),
1736 }
1737 }
1738
1739 pub fn app_paintable(self, app_paintable: bool) -> Self {
1740 Self {
1741 builder: self.builder.property("app-paintable", app_paintable),
1742 }
1743 }
1744
1745 pub fn can_default(self, can_default: bool) -> Self {
1746 Self {
1747 builder: self.builder.property("can-default", can_default),
1748 }
1749 }
1750
1751 pub fn can_focus(self, can_focus: bool) -> Self {
1752 Self {
1753 builder: self.builder.property("can-focus", can_focus),
1754 }
1755 }
1756
1757 pub fn events(self, events: gdk::EventMask) -> Self {
1758 Self {
1759 builder: self.builder.property("events", events),
1760 }
1761 }
1762
1763 /// Whether to expand in both directions. Setting this sets both [`hexpand`][struct@crate::Widget#hexpand] and [`vexpand`][struct@crate::Widget#vexpand]
1764 pub fn expand(self, expand: bool) -> Self {
1765 Self {
1766 builder: self.builder.property("expand", expand),
1767 }
1768 }
1769
1770 /// Whether the widget should grab focus when it is clicked with the mouse.
1771 ///
1772 /// This property is only relevant for widgets that can take focus.
1773 ///
1774 /// Before 3.20, several widgets (GtkButton, GtkFileChooserButton,
1775 /// GtkComboBox) implemented this property individually.
1776 pub fn focus_on_click(self, focus_on_click: bool) -> Self {
1777 Self {
1778 builder: self.builder.property("focus-on-click", focus_on_click),
1779 }
1780 }
1781
1782 /// How to distribute horizontal space if widget gets extra space, see [`Align`][crate::Align]
1783 pub fn halign(self, halign: Align) -> Self {
1784 Self {
1785 builder: self.builder.property("halign", halign),
1786 }
1787 }
1788
1789 pub fn has_default(self, has_default: bool) -> Self {
1790 Self {
1791 builder: self.builder.property("has-default", has_default),
1792 }
1793 }
1794
1795 pub fn has_focus(self, has_focus: bool) -> Self {
1796 Self {
1797 builder: self.builder.property("has-focus", has_focus),
1798 }
1799 }
1800
1801 /// Enables or disables the emission of [`query-tooltip`][struct@crate::Widget#query-tooltip] on `widget`.
1802 /// A value of [`true`] indicates that `widget` can have a tooltip, in this case
1803 /// the widget will be queried using [`query-tooltip`][struct@crate::Widget#query-tooltip] to determine
1804 /// whether it will provide a tooltip or not.
1805 ///
1806 /// Note that setting this property to [`true`] for the first time will change
1807 /// the event masks of the GdkWindows of this widget to include leave-notify
1808 /// and motion-notify events. This cannot and will not be undone when the
1809 /// property is set to [`false`] again.
1810 pub fn has_tooltip(self, has_tooltip: bool) -> Self {
1811 Self {
1812 builder: self.builder.property("has-tooltip", has_tooltip),
1813 }
1814 }
1815
1816 pub fn height_request(self, height_request: i32) -> Self {
1817 Self {
1818 builder: self.builder.property("height-request", height_request),
1819 }
1820 }
1821
1822 /// Whether to expand horizontally. See [`WidgetExt::set_hexpand()`][crate::prelude::WidgetExt::set_hexpand()].
1823 pub fn hexpand(self, hexpand: bool) -> Self {
1824 Self {
1825 builder: self.builder.property("hexpand", hexpand),
1826 }
1827 }
1828
1829 /// Whether to use the [`hexpand`][struct@crate::Widget#hexpand] property. See [`WidgetExt::is_hexpand_set()`][crate::prelude::WidgetExt::is_hexpand_set()].
1830 pub fn hexpand_set(self, hexpand_set: bool) -> Self {
1831 Self {
1832 builder: self.builder.property("hexpand-set", hexpand_set),
1833 }
1834 }
1835
1836 pub fn is_focus(self, is_focus: bool) -> Self {
1837 Self {
1838 builder: self.builder.property("is-focus", is_focus),
1839 }
1840 }
1841
1842 /// Sets all four sides' margin at once. If read, returns max
1843 /// margin on any side.
1844 pub fn margin(self, margin: i32) -> Self {
1845 Self {
1846 builder: self.builder.property("margin", margin),
1847 }
1848 }
1849
1850 /// Margin on bottom side of widget.
1851 ///
1852 /// This property adds margin outside of the widget's normal size
1853 /// request, the margin will be added in addition to the size from
1854 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1855 pub fn margin_bottom(self, margin_bottom: i32) -> Self {
1856 Self {
1857 builder: self.builder.property("margin-bottom", margin_bottom),
1858 }
1859 }
1860
1861 /// Margin on end of widget, horizontally. This property supports
1862 /// left-to-right and right-to-left text directions.
1863 ///
1864 /// This property adds margin outside of the widget's normal size
1865 /// request, the margin will be added in addition to the size from
1866 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1867 pub fn margin_end(self, margin_end: i32) -> Self {
1868 Self {
1869 builder: self.builder.property("margin-end", margin_end),
1870 }
1871 }
1872
1873 /// Margin on start of widget, horizontally. This property supports
1874 /// left-to-right and right-to-left text directions.
1875 ///
1876 /// This property adds margin outside of the widget's normal size
1877 /// request, the margin will be added in addition to the size from
1878 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1879 pub fn margin_start(self, margin_start: i32) -> Self {
1880 Self {
1881 builder: self.builder.property("margin-start", margin_start),
1882 }
1883 }
1884
1885 /// Margin on top side of widget.
1886 ///
1887 /// This property adds margin outside of the widget's normal size
1888 /// request, the margin will be added in addition to the size from
1889 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1890 pub fn margin_top(self, margin_top: i32) -> Self {
1891 Self {
1892 builder: self.builder.property("margin-top", margin_top),
1893 }
1894 }
1895
1896 pub fn name(self, name: impl Into<glib::GString>) -> Self {
1897 Self {
1898 builder: self.builder.property("name", name.into()),
1899 }
1900 }
1901
1902 pub fn no_show_all(self, no_show_all: bool) -> Self {
1903 Self {
1904 builder: self.builder.property("no-show-all", no_show_all),
1905 }
1906 }
1907
1908 /// The requested opacity of the widget. See [`WidgetExt::set_opacity()`][crate::prelude::WidgetExt::set_opacity()] for
1909 /// more details about window opacity.
1910 ///
1911 /// Before 3.8 this was only available in GtkWindow
1912 pub fn opacity(self, opacity: f64) -> Self {
1913 Self {
1914 builder: self.builder.property("opacity", opacity),
1915 }
1916 }
1917
1918 pub fn parent(self, parent: &impl IsA<Container>) -> Self {
1919 Self {
1920 builder: self.builder.property("parent", parent.clone().upcast()),
1921 }
1922 }
1923
1924 pub fn receives_default(self, receives_default: bool) -> Self {
1925 Self {
1926 builder: self.builder.property("receives-default", receives_default),
1927 }
1928 }
1929
1930 pub fn sensitive(self, sensitive: bool) -> Self {
1931 Self {
1932 builder: self.builder.property("sensitive", sensitive),
1933 }
1934 }
1935
1936 /// Sets the text of tooltip to be the given string, which is marked up
1937 /// with the [Pango text markup language][PangoMarkupFormat].
1938 /// Also see [`Tooltip::set_markup()`][crate::Tooltip::set_markup()].
1939 ///
1940 /// This is a convenience property which will take care of getting the
1941 /// tooltip shown if the given string is not [`None`]: [`has-tooltip`][struct@crate::Widget#has-tooltip]
1942 /// will automatically be set to [`true`] and there will be taken care of
1943 /// [`query-tooltip`][struct@crate::Widget#query-tooltip] in the default signal handler.
1944 ///
1945 /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and [`tooltip-markup`][struct@crate::Widget#tooltip-markup]
1946 /// are set, the last one wins.
1947 pub fn tooltip_markup(self, tooltip_markup: impl Into<glib::GString>) -> Self {
1948 Self {
1949 builder: self
1950 .builder
1951 .property("tooltip-markup", tooltip_markup.into()),
1952 }
1953 }
1954
1955 /// Sets the text of tooltip to be the given string.
1956 ///
1957 /// Also see [`Tooltip::set_text()`][crate::Tooltip::set_text()].
1958 ///
1959 /// This is a convenience property which will take care of getting the
1960 /// tooltip shown if the given string is not [`None`]: [`has-tooltip`][struct@crate::Widget#has-tooltip]
1961 /// will automatically be set to [`true`] and there will be taken care of
1962 /// [`query-tooltip`][struct@crate::Widget#query-tooltip] in the default signal handler.
1963 ///
1964 /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and [`tooltip-markup`][struct@crate::Widget#tooltip-markup]
1965 /// are set, the last one wins.
1966 pub fn tooltip_text(self, tooltip_text: impl Into<glib::GString>) -> Self {
1967 Self {
1968 builder: self.builder.property("tooltip-text", tooltip_text.into()),
1969 }
1970 }
1971
1972 /// How to distribute vertical space if widget gets extra space, see [`Align`][crate::Align]
1973 pub fn valign(self, valign: Align) -> Self {
1974 Self {
1975 builder: self.builder.property("valign", valign),
1976 }
1977 }
1978
1979 /// Whether to expand vertically. See [`WidgetExt::set_vexpand()`][crate::prelude::WidgetExt::set_vexpand()].
1980 pub fn vexpand(self, vexpand: bool) -> Self {
1981 Self {
1982 builder: self.builder.property("vexpand", vexpand),
1983 }
1984 }
1985
1986 /// Whether to use the [`vexpand`][struct@crate::Widget#vexpand] property. See [`WidgetExt::is_vexpand_set()`][crate::prelude::WidgetExt::is_vexpand_set()].
1987 pub fn vexpand_set(self, vexpand_set: bool) -> Self {
1988 Self {
1989 builder: self.builder.property("vexpand-set", vexpand_set),
1990 }
1991 }
1992
1993 pub fn visible(self, visible: bool) -> Self {
1994 Self {
1995 builder: self.builder.property("visible", visible),
1996 }
1997 }
1998
1999 pub fn width_request(self, width_request: i32) -> Self {
2000 Self {
2001 builder: self.builder.property("width-request", width_request),
2002 }
2003 }
2004
2005 // rustdoc-stripper-ignore-next
2006 /// Build the [`ShortcutsWindow`].
2007 #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"]
2008 pub fn build(self) -> ShortcutsWindow {
2009 assert_initialized_main_thread!();
2010 self.builder.build()
2011 }
2012}
2013
2014/// Trait containing all [`struct@ShortcutsWindow`] methods.
2015///
2016/// # Implementors
2017///
2018/// [`ShortcutsWindow`][struct@crate::ShortcutsWindow]
2019pub trait ShortcutsWindowExt: IsA<ShortcutsWindow> + 'static {
2020 /// The name of the section to show.
2021 ///
2022 /// This should be the section-name of one of the [`ShortcutsSection`][crate::ShortcutsSection]
2023 /// objects that are in this shortcuts window.
2024 #[doc(alias = "section-name")]
2025 fn section_name(&self) -> Option<glib::GString> {
2026 ObjectExt::property(self.as_ref(), "section-name")
2027 }
2028
2029 /// The name of the section to show.
2030 ///
2031 /// This should be the section-name of one of the [`ShortcutsSection`][crate::ShortcutsSection]
2032 /// objects that are in this shortcuts window.
2033 #[doc(alias = "section-name")]
2034 fn set_section_name(&self, section_name: Option<&str>) {
2035 ObjectExt::set_property(self.as_ref(), "section-name", section_name)
2036 }
2037
2038 /// The view name by which to filter the contents.
2039 ///
2040 /// This should correspond to the [`view`][struct@crate::ShortcutsGroup#view] property of some of
2041 /// the [`ShortcutsGroup`][crate::ShortcutsGroup] objects that are inside this shortcuts window.
2042 ///
2043 /// Set this to [`None`] to show all groups.
2044 #[doc(alias = "view-name")]
2045 fn view_name(&self) -> Option<glib::GString> {
2046 ObjectExt::property(self.as_ref(), "view-name")
2047 }
2048
2049 /// The view name by which to filter the contents.
2050 ///
2051 /// This should correspond to the [`view`][struct@crate::ShortcutsGroup#view] property of some of
2052 /// the [`ShortcutsGroup`][crate::ShortcutsGroup] objects that are inside this shortcuts window.
2053 ///
2054 /// Set this to [`None`] to show all groups.
2055 #[doc(alias = "view-name")]
2056 fn set_view_name(&self, view_name: Option<&str>) {
2057 ObjectExt::set_property(self.as_ref(), "view-name", view_name)
2058 }
2059
2060 /// The ::close signal is a
2061 /// [keybinding signal][GtkBindingSignal]
2062 /// which gets emitted when the user uses a keybinding to close
2063 /// the window.
2064 ///
2065 /// The default binding for this signal is the Escape key.
2066 #[doc(alias = "close")]
2067 fn connect_close<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
2068 unsafe extern "C" fn close_trampoline<P: IsA<ShortcutsWindow>, F: Fn(&P) + 'static>(
2069 this: *mut ffi::GtkShortcutsWindow,
2070 f: glib::ffi::gpointer,
2071 ) {
2072 unsafe {
2073 let f: &F = &*(f as *const F);
2074 f(ShortcutsWindow::from_glib_borrow(this).unsafe_cast_ref())
2075 }
2076 }
2077 unsafe {
2078 let f: Box_<F> = Box_::new(f);
2079 connect_raw(
2080 self.as_ptr() as *mut _,
2081 c"close".as_ptr(),
2082 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2083 close_trampoline::<Self, F> as *const (),
2084 )),
2085 Box_::into_raw(f),
2086 )
2087 }
2088 }
2089
2090 fn emit_close(&self) {
2091 self.emit_by_name::<()>("close", &[]);
2092 }
2093
2094 /// The ::search signal is a
2095 /// [keybinding signal][GtkBindingSignal]
2096 /// which gets emitted when the user uses a keybinding to start a search.
2097 ///
2098 /// The default binding for this signal is Control-F.
2099 #[doc(alias = "search")]
2100 fn connect_search<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
2101 unsafe extern "C" fn search_trampoline<P: IsA<ShortcutsWindow>, F: Fn(&P) + 'static>(
2102 this: *mut ffi::GtkShortcutsWindow,
2103 f: glib::ffi::gpointer,
2104 ) {
2105 unsafe {
2106 let f: &F = &*(f as *const F);
2107 f(ShortcutsWindow::from_glib_borrow(this).unsafe_cast_ref())
2108 }
2109 }
2110 unsafe {
2111 let f: Box_<F> = Box_::new(f);
2112 connect_raw(
2113 self.as_ptr() as *mut _,
2114 c"search".as_ptr(),
2115 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2116 search_trampoline::<Self, F> as *const (),
2117 )),
2118 Box_::into_raw(f),
2119 )
2120 }
2121 }
2122
2123 fn emit_search(&self) {
2124 self.emit_by_name::<()>("search", &[]);
2125 }
2126
2127 #[doc(alias = "section-name")]
2128 fn connect_section_name_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
2129 unsafe extern "C" fn notify_section_name_trampoline<
2130 P: IsA<ShortcutsWindow>,
2131 F: Fn(&P) + 'static,
2132 >(
2133 this: *mut ffi::GtkShortcutsWindow,
2134 _param_spec: glib::ffi::gpointer,
2135 f: glib::ffi::gpointer,
2136 ) {
2137 unsafe {
2138 let f: &F = &*(f as *const F);
2139 f(ShortcutsWindow::from_glib_borrow(this).unsafe_cast_ref())
2140 }
2141 }
2142 unsafe {
2143 let f: Box_<F> = Box_::new(f);
2144 connect_raw(
2145 self.as_ptr() as *mut _,
2146 c"notify::section-name".as_ptr(),
2147 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2148 notify_section_name_trampoline::<Self, F> as *const (),
2149 )),
2150 Box_::into_raw(f),
2151 )
2152 }
2153 }
2154
2155 #[doc(alias = "view-name")]
2156 fn connect_view_name_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
2157 unsafe extern "C" fn notify_view_name_trampoline<
2158 P: IsA<ShortcutsWindow>,
2159 F: Fn(&P) + 'static,
2160 >(
2161 this: *mut ffi::GtkShortcutsWindow,
2162 _param_spec: glib::ffi::gpointer,
2163 f: glib::ffi::gpointer,
2164 ) {
2165 unsafe {
2166 let f: &F = &*(f as *const F);
2167 f(ShortcutsWindow::from_glib_borrow(this).unsafe_cast_ref())
2168 }
2169 }
2170 unsafe {
2171 let f: Box_<F> = Box_::new(f);
2172 connect_raw(
2173 self.as_ptr() as *mut _,
2174 c"notify::view-name".as_ptr(),
2175 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2176 notify_view_name_trampoline::<Self, F> as *const (),
2177 )),
2178 Box_::into_raw(f),
2179 )
2180 }
2181 }
2182}
2183
2184impl<O: IsA<ShortcutsWindow>> ShortcutsWindowExt for O {}