gtk/auto/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 AccelGroup, Align, Application, Bin, Buildable, Container, ResizeMode, Widget, WindowGroup,
7 WindowPosition, WindowType,
8};
9use glib::{
10 prelude::*,
11 signal::{connect_raw, SignalHandlerId},
12 translate::*,
13};
14use std::{boxed::Box as Box_, fmt, mem, mem::transmute, ptr};
15
16glib::wrapper! {
17 /// A GtkWindow is a toplevel window which can contain other widgets.
18 /// Windows normally have decorations that are under the control
19 /// of the windowing system and allow the user to manipulate the window
20 /// (resize it, move it, close it,...).
21 ///
22 /// # GtkWindow as GtkBuildable
23 ///
24 /// The GtkWindow implementation of the [`Buildable`][crate::Buildable] interface supports a
25 /// custom ``<accel-groups>`` element, which supports any number of ``<group>``
26 /// elements representing the [`AccelGroup`][crate::AccelGroup] objects you want to add to
27 /// your window (synonymous with [`GtkWindowExt::add_accel_group()`][crate::prelude::GtkWindowExt::add_accel_group()].
28 ///
29 /// It also supports the ``<initial-focus>`` element, whose name property names
30 /// the widget to receive the focus when the window is mapped.
31 ///
32 /// An example of a UI definition fragment with accel groups:
33 ///
34 ///
35 ///
36 /// **⚠️ The following code is in xml ⚠️**
37 ///
38 /// ```xml
39 /// <object class="GtkWindow">
40 /// <accel-groups>
41 /// <group name="accelgroup1"/>
42 /// </accel-groups>
43 /// <initial-focus name="thunderclap"/>
44 /// </object>
45 ///
46 /// ...
47 ///
48 /// <object class="GtkAccelGroup" id="accelgroup1"/>
49 /// ```
50 ///
51 /// The GtkWindow implementation of the [`Buildable`][crate::Buildable] interface supports
52 /// setting a child as the titlebar by specifying “titlebar” as the “type”
53 /// attribute of a ``<child>`` element.
54 ///
55 /// # CSS nodes
56 ///
57 ///
58 ///
59 /// **⚠️ The following code is in plain ⚠️**
60 ///
61 /// ```plain
62 /// window.background
63 /// ├── decoration
64 /// ├── <titlebar child>.titlebar [.default-decoration]
65 /// ╰── <child>
66 /// ```
67 ///
68 /// GtkWindow has a main CSS node with name window and style class .background,
69 /// and a subnode with name decoration.
70 ///
71 /// Style classes that are typically used with the main CSS node are .csd (when
72 /// client-side decorations are in use), .solid-csd (for client-side decorations
73 /// without invisible borders), .ssd (used by mutter when rendering server-side
74 /// decorations). GtkWindow also represents window states with the following
75 /// style classes on the main node: .tiled, .maximized, .fullscreen. Specialized
76 /// types of window often add their own discriminating style classes, such as
77 /// .popup or .tooltip.
78 ///
79 /// GtkWindow adds the .titlebar and .default-decoration style classes to the
80 /// widget that is added as a titlebar child.
81 ///
82 /// ## Properties
83 ///
84 ///
85 /// #### `accept-focus`
86 /// Whether the window should receive the input focus.
87 ///
88 /// Readable | Writeable
89 ///
90 ///
91 /// #### `application`
92 /// The [`Application`][crate::Application] associated with the window.
93 ///
94 /// The application will be kept alive for at least as long as it
95 /// has any windows associated with it (see [`ApplicationExtManual::hold()`][crate::gio::prelude::ApplicationExtManual::hold()]
96 /// for a way to keep it alive without windows).
97 ///
98 /// Normally, the connection between the application and the window
99 /// will remain until the window is destroyed, but you can explicitly
100 /// remove it by setting the :application property to [`None`].
101 ///
102 /// Readable | Writeable
103 ///
104 ///
105 /// #### `attached-to`
106 /// The widget to which this window is attached.
107 /// See [`GtkWindowExt::set_attached_to()`][crate::prelude::GtkWindowExt::set_attached_to()].
108 ///
109 /// Examples of places where specifying this relation is useful are
110 /// for instance a [`Menu`][crate::Menu] created by a [`ComboBox`][crate::ComboBox], a completion
111 /// popup window created by [`Entry`][crate::Entry] or a typeahead search entry
112 /// created by [`TreeView`][crate::TreeView].
113 ///
114 /// Readable | Writeable | Construct
115 ///
116 ///
117 /// #### `decorated`
118 /// Whether the window should be decorated by the window manager.
119 ///
120 /// Readable | Writeable
121 ///
122 ///
123 /// #### `default-height`
124 /// Readable | Writeable
125 ///
126 ///
127 /// #### `default-width`
128 /// Readable | Writeable
129 ///
130 ///
131 /// #### `deletable`
132 /// Whether the window frame should have a close button.
133 ///
134 /// Readable | Writeable
135 ///
136 ///
137 /// #### `destroy-with-parent`
138 /// Readable | Writeable
139 ///
140 ///
141 /// #### `focus-on-map`
142 /// Whether the window should receive the input focus when mapped.
143 ///
144 /// Readable | Writeable
145 ///
146 ///
147 /// #### `focus-visible`
148 /// Whether 'focus rectangles' are currently visible in this window.
149 ///
150 /// This property is maintained by GTK+ based on user input
151 /// and should not be set by applications.
152 ///
153 /// Readable | Writeable
154 ///
155 ///
156 /// #### `gravity`
157 /// The window gravity of the window. See [`GtkWindowExt::move_()`][crate::prelude::GtkWindowExt::move_()] and [`gdk::Gravity`][crate::gdk::Gravity] for
158 /// more details about window gravity.
159 ///
160 /// Readable | Writeable
161 ///
162 ///
163 /// #### `has-resize-grip`
164 /// Whether the window has a corner resize grip.
165 ///
166 /// Note that the resize grip is only shown if the window is
167 /// actually resizable and not maximized. Use
168 /// [`resize-grip-visible`][struct@crate::Window#resize-grip-visible] to find out if the resize
169 /// grip is currently shown.
170 ///
171 /// Readable | Writeable
172 ///
173 ///
174 /// #### `has-toplevel-focus`
175 /// Readable
176 ///
177 ///
178 /// #### `hide-titlebar-when-maximized`
179 /// Whether the titlebar should be hidden during maximization.
180 ///
181 /// Readable | Writeable
182 ///
183 ///
184 /// #### `icon`
185 /// Readable | Writeable
186 ///
187 ///
188 /// #### `icon-name`
189 /// The :icon-name property specifies the name of the themed icon to
190 /// use as the window icon. See [`IconTheme`][crate::IconTheme] for more details.
191 ///
192 /// Readable | Writeable
193 ///
194 ///
195 /// #### `is-active`
196 /// Readable
197 ///
198 ///
199 /// #### `is-maximized`
200 /// Readable
201 ///
202 ///
203 /// #### `mnemonics-visible`
204 /// Whether mnemonics are currently visible in this window.
205 ///
206 /// This property is maintained by GTK+ based on user input,
207 /// and should not be set by applications.
208 ///
209 /// Readable | Writeable
210 ///
211 ///
212 /// #### `modal`
213 /// Readable | Writeable
214 ///
215 ///
216 /// #### `resizable`
217 /// Readable | Writeable
218 ///
219 ///
220 /// #### `resize-grip-visible`
221 /// Whether a corner resize grip is currently shown.
222 ///
223 /// Readable
224 ///
225 ///
226 /// #### `role`
227 /// Readable | Writeable
228 ///
229 ///
230 /// #### `screen`
231 /// Readable | Writeable
232 ///
233 ///
234 /// #### `skip-pager-hint`
235 /// Readable | Writeable
236 ///
237 ///
238 /// #### `skip-taskbar-hint`
239 /// Readable | Writeable
240 ///
241 ///
242 /// #### `startup-id`
243 /// The :startup-id is a write-only property for setting window's
244 /// startup notification identifier. See [`GtkWindowExt::set_startup_id()`][crate::prelude::GtkWindowExt::set_startup_id()]
245 /// for more details.
246 ///
247 /// Writeable
248 ///
249 ///
250 /// #### `title`
251 /// Readable | Writeable
252 ///
253 ///
254 /// #### `transient-for`
255 /// The transient parent of the window. See [`GtkWindowExt::set_transient_for()`][crate::prelude::GtkWindowExt::set_transient_for()] for
256 /// more details about transient windows.
257 ///
258 /// Readable | Writeable | Construct
259 ///
260 ///
261 /// #### `type`
262 /// Readable | Writeable | Construct Only
263 ///
264 ///
265 /// #### `type-hint`
266 /// Readable | Writeable
267 ///
268 ///
269 /// #### `urgency-hint`
270 /// Readable | Writeable
271 ///
272 ///
273 /// #### `window-position`
274 /// Readable | Writeable
275 /// <details><summary><h4>Container</h4></summary>
276 ///
277 ///
278 /// #### `border-width`
279 /// Readable | Writeable
280 ///
281 ///
282 /// #### `child`
283 /// Writeable
284 ///
285 ///
286 /// #### `resize-mode`
287 /// Readable | Writeable
288 /// </details>
289 /// <details><summary><h4>Widget</h4></summary>
290 ///
291 ///
292 /// #### `app-paintable`
293 /// Readable | Writeable
294 ///
295 ///
296 /// #### `can-default`
297 /// Readable | Writeable
298 ///
299 ///
300 /// #### `can-focus`
301 /// Readable | Writeable
302 ///
303 ///
304 /// #### `composite-child`
305 /// Readable
306 ///
307 ///
308 /// #### `double-buffered`
309 /// Whether the widget is double buffered.
310 ///
311 /// Readable | Writeable
312 ///
313 ///
314 /// #### `events`
315 /// Readable | Writeable
316 ///
317 ///
318 /// #### `expand`
319 /// Whether to expand in both directions. Setting this sets both [`hexpand`][struct@crate::Widget#hexpand] and [`vexpand`][struct@crate::Widget#vexpand]
320 ///
321 /// Readable | Writeable
322 ///
323 ///
324 /// #### `focus-on-click`
325 /// Whether the widget should grab focus when it is clicked with the mouse.
326 ///
327 /// This property is only relevant for widgets that can take focus.
328 ///
329 /// Before 3.20, several widgets (GtkButton, GtkFileChooserButton,
330 /// GtkComboBox) implemented this property individually.
331 ///
332 /// Readable | Writeable
333 ///
334 ///
335 /// #### `halign`
336 /// How to distribute horizontal space if widget gets extra space, see [`Align`][crate::Align]
337 ///
338 /// Readable | Writeable
339 ///
340 ///
341 /// #### `has-default`
342 /// Readable | Writeable
343 ///
344 ///
345 /// #### `has-focus`
346 /// Readable | Writeable
347 ///
348 ///
349 /// #### `has-tooltip`
350 /// Enables or disables the emission of [`query-tooltip`][struct@crate::Widget#query-tooltip] on `widget`.
351 /// A value of [`true`] indicates that `widget` can have a tooltip, in this case
352 /// the widget will be queried using [`query-tooltip`][struct@crate::Widget#query-tooltip] to determine
353 /// whether it will provide a tooltip or not.
354 ///
355 /// Note that setting this property to [`true`] for the first time will change
356 /// the event masks of the GdkWindows of this widget to include leave-notify
357 /// and motion-notify events. This cannot and will not be undone when the
358 /// property is set to [`false`] again.
359 ///
360 /// Readable | Writeable
361 ///
362 ///
363 /// #### `height-request`
364 /// Readable | Writeable
365 ///
366 ///
367 /// #### `hexpand`
368 /// Whether to expand horizontally. See [`WidgetExt::set_hexpand()`][crate::prelude::WidgetExt::set_hexpand()].
369 ///
370 /// Readable | Writeable
371 ///
372 ///
373 /// #### `hexpand-set`
374 /// Whether to use the [`hexpand`][struct@crate::Widget#hexpand] property. See [`WidgetExt::is_hexpand_set()`][crate::prelude::WidgetExt::is_hexpand_set()].
375 ///
376 /// Readable | Writeable
377 ///
378 ///
379 /// #### `is-focus`
380 /// Readable | Writeable
381 ///
382 ///
383 /// #### `margin`
384 /// Sets all four sides' margin at once. If read, returns max
385 /// margin on any side.
386 ///
387 /// Readable | Writeable
388 ///
389 ///
390 /// #### `margin-bottom`
391 /// Margin on bottom side of widget.
392 ///
393 /// This property adds margin outside of the widget's normal size
394 /// request, the margin will be added in addition to the size from
395 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
396 ///
397 /// Readable | Writeable
398 ///
399 ///
400 /// #### `margin-end`
401 /// Margin on end of widget, horizontally. This property supports
402 /// left-to-right and right-to-left text 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 | Writeable
409 ///
410 ///
411 /// #### `margin-left`
412 /// Margin on left side of widget.
413 ///
414 /// This property adds margin outside of the widget's normal size
415 /// request, the margin will be added in addition to the size from
416 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
417 ///
418 /// Readable | Writeable
419 ///
420 ///
421 /// #### `margin-right`
422 /// Margin on right side of widget.
423 ///
424 /// This property adds margin outside of the widget's normal size
425 /// request, the margin will be added in addition to the size from
426 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
427 ///
428 /// Readable | Writeable
429 ///
430 ///
431 /// #### `margin-start`
432 /// Margin on start of widget, horizontally. This property supports
433 /// left-to-right and right-to-left text directions.
434 ///
435 /// This property adds margin outside of the widget's normal size
436 /// request, the margin will be added in addition to the size from
437 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
438 ///
439 /// Readable | Writeable
440 ///
441 ///
442 /// #### `margin-top`
443 /// Margin on top side of widget.
444 ///
445 /// This property adds margin outside of the widget's normal size
446 /// request, the margin will be added in addition to the size from
447 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
448 ///
449 /// Readable | Writeable
450 ///
451 ///
452 /// #### `name`
453 /// Readable | Writeable
454 ///
455 ///
456 /// #### `no-show-all`
457 /// Readable | Writeable
458 ///
459 ///
460 /// #### `opacity`
461 /// The requested opacity of the widget. See [`WidgetExt::set_opacity()`][crate::prelude::WidgetExt::set_opacity()] for
462 /// more details about window opacity.
463 ///
464 /// Before 3.8 this was only available in GtkWindow
465 ///
466 /// Readable | Writeable
467 ///
468 ///
469 /// #### `parent`
470 /// Readable | Writeable
471 ///
472 ///
473 /// #### `receives-default`
474 /// Readable | Writeable
475 ///
476 ///
477 /// #### `scale-factor`
478 /// The scale factor of the widget. See [`WidgetExt::scale_factor()`][crate::prelude::WidgetExt::scale_factor()] for
479 /// more details about widget scaling.
480 ///
481 /// Readable
482 ///
483 ///
484 /// #### `sensitive`
485 /// Readable | Writeable
486 ///
487 ///
488 /// #### `style`
489 /// The style of the widget, which contains information about how it will look (colors, etc).
490 ///
491 /// Readable | Writeable
492 ///
493 ///
494 /// #### `tooltip-markup`
495 /// Sets the text of tooltip to be the given string, which is marked up
496 /// with the [Pango text markup language][PangoMarkupFormat].
497 /// Also see [`Tooltip::set_markup()`][crate::Tooltip::set_markup()].
498 ///
499 /// This is a convenience property which will take care of getting the
500 /// tooltip shown if the given string is not [`None`]: [`has-tooltip`][struct@crate::Widget#has-tooltip]
501 /// will automatically be set to [`true`] and there will be taken care of
502 /// [`query-tooltip`][struct@crate::Widget#query-tooltip] in the default signal handler.
503 ///
504 /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and [`tooltip-markup`][struct@crate::Widget#tooltip-markup]
505 /// are set, the last one wins.
506 ///
507 /// Readable | Writeable
508 ///
509 ///
510 /// #### `tooltip-text`
511 /// Sets the text of tooltip to be the given string.
512 ///
513 /// Also see [`Tooltip::set_text()`][crate::Tooltip::set_text()].
514 ///
515 /// This is a convenience property which will take care of getting the
516 /// tooltip shown if the given string is not [`None`]: [`has-tooltip`][struct@crate::Widget#has-tooltip]
517 /// will automatically be set to [`true`] and there will be taken care of
518 /// [`query-tooltip`][struct@crate::Widget#query-tooltip] in the default signal handler.
519 ///
520 /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and [`tooltip-markup`][struct@crate::Widget#tooltip-markup]
521 /// are set, the last one wins.
522 ///
523 /// Readable | Writeable
524 ///
525 ///
526 /// #### `valign`
527 /// How to distribute vertical space if widget gets extra space, see [`Align`][crate::Align]
528 ///
529 /// Readable | Writeable
530 ///
531 ///
532 /// #### `vexpand`
533 /// Whether to expand vertically. See [`WidgetExt::set_vexpand()`][crate::prelude::WidgetExt::set_vexpand()].
534 ///
535 /// Readable | Writeable
536 ///
537 ///
538 /// #### `vexpand-set`
539 /// Whether to use the [`vexpand`][struct@crate::Widget#vexpand] property. See [`WidgetExt::is_vexpand_set()`][crate::prelude::WidgetExt::is_vexpand_set()].
540 ///
541 /// Readable | Writeable
542 ///
543 ///
544 /// #### `visible`
545 /// Readable | Writeable
546 ///
547 ///
548 /// #### `width-request`
549 /// Readable | Writeable
550 ///
551 ///
552 /// #### `window`
553 /// The widget's window if it is realized, [`None`] otherwise.
554 ///
555 /// Readable
556 /// </details>
557 ///
558 /// ## Signals
559 ///
560 ///
561 /// #### `activate-default`
562 /// The ::activate-default signal is a
563 /// [keybinding signal][GtkBindingSignal]
564 /// which gets emitted when the user activates the default widget
565 /// of `window`.
566 ///
567 /// Action
568 ///
569 ///
570 /// #### `activate-focus`
571 /// The ::activate-focus signal is a
572 /// [keybinding signal][GtkBindingSignal]
573 /// which gets emitted when the user activates the currently
574 /// focused widget of `window`.
575 ///
576 /// Action
577 ///
578 ///
579 /// #### `enable-debugging`
580 /// The ::enable-debugging signal is a [keybinding signal][GtkBindingSignal]
581 /// which gets emitted when the user enables or disables interactive
582 /// debugging. When `toggle` is [`true`], interactive debugging is toggled
583 /// on or off, when it is [`false`], the debugger will be pointed at the
584 /// widget under the pointer.
585 ///
586 /// The default bindings for this signal are Ctrl-Shift-I
587 /// and Ctrl-Shift-D.
588 ///
589 /// Action
590 ///
591 ///
592 /// #### `keys-changed`
593 /// The ::keys-changed signal gets emitted when the set of accelerators
594 /// or mnemonics that are associated with `window` changes.
595 ///
596 ///
597 ///
598 ///
599 /// #### `set-focus`
600 /// This signal is emitted whenever the currently focused widget in
601 /// this window changes.
602 ///
603 ///
604 /// <details><summary><h4>Container</h4></summary>
605 ///
606 ///
607 /// #### `add`
608 ///
609 ///
610 ///
611 /// #### `check-resize`
612 ///
613 ///
614 ///
615 /// #### `remove`
616 ///
617 ///
618 ///
619 /// #### `set-focus-child`
620 ///
621 /// </details>
622 /// <details><summary><h4>Widget</h4></summary>
623 ///
624 ///
625 /// #### `accel-closures-changed`
626 ///
627 ///
628 ///
629 /// #### `button-press-event`
630 /// The ::button-press-event signal will be emitted when a button
631 /// (typically from a mouse) is pressed.
632 ///
633 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the
634 /// widget needs to enable the [`gdk::EventMask::BUTTON_PRESS_MASK`][crate::gdk::EventMask::BUTTON_PRESS_MASK] mask.
635 ///
636 /// This signal will be sent to the grab widget if there is one.
637 ///
638 ///
639 ///
640 ///
641 /// #### `button-release-event`
642 /// The ::button-release-event signal will be emitted when a button
643 /// (typically from a mouse) is released.
644 ///
645 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the
646 /// widget needs to enable the [`gdk::EventMask::BUTTON_RELEASE_MASK`][crate::gdk::EventMask::BUTTON_RELEASE_MASK] mask.
647 ///
648 /// This signal will be sent to the grab widget if there is one.
649 ///
650 ///
651 ///
652 ///
653 /// #### `can-activate-accel`
654 /// Determines whether an accelerator that activates the signal
655 /// identified by `signal_id` can currently be activated.
656 /// This signal is present to allow applications and derived
657 /// widgets to override the default [`Widget`][crate::Widget] handling
658 /// for determining whether an accelerator can be activated.
659 ///
660 ///
661 ///
662 ///
663 /// #### `child-notify`
664 /// The ::child-notify signal is emitted for each
665 /// [child property][child-properties] that has
666 /// changed on an object. The signal's detail holds the property name.
667 ///
668 /// Detailed
669 ///
670 ///
671 /// #### `composited-changed`
672 /// The ::composited-changed signal is emitted when the composited
673 /// status of `widgets` screen changes.
674 /// See [`Screen::is_composited()`][crate::gdk::Screen::is_composited()].
675 ///
676 /// Action
677 ///
678 ///
679 /// #### `configure-event`
680 /// The ::configure-event signal will be emitted when the size, position or
681 /// stacking of the `widget`'s window has changed.
682 ///
683 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
684 /// to enable the [`gdk::EventMask::STRUCTURE_MASK`][crate::gdk::EventMask::STRUCTURE_MASK] mask. GDK will enable this mask
685 /// automatically for all new windows.
686 ///
687 ///
688 ///
689 ///
690 /// #### `damage-event`
691 /// Emitted when a redirected window belonging to `widget` gets drawn into.
692 /// The region/area members of the event shows what area of the redirected
693 /// drawable was drawn into.
694 ///
695 ///
696 ///
697 ///
698 /// #### `delete-event`
699 /// The ::delete-event signal is emitted if a user requests that
700 /// a toplevel window is closed. The default handler for this signal
701 /// destroys the window. Connecting [`WidgetExtManual::hide_on_delete()`][crate::prelude::WidgetExtManual::hide_on_delete()] to
702 /// this signal will cause the window to be hidden instead, so that
703 /// it can later be shown again without reconstructing it.
704 ///
705 ///
706 ///
707 ///
708 /// #### `destroy`
709 /// Signals that all holders of a reference to the widget should release
710 /// the reference that they hold. May result in finalization of the widget
711 /// if all references are released.
712 ///
713 /// This signal is not suitable for saving widget state.
714 ///
715 ///
716 ///
717 ///
718 /// #### `destroy-event`
719 /// The ::destroy-event signal is emitted when a [`gdk::Window`][crate::gdk::Window] is destroyed.
720 /// You rarely get this signal, because most widgets disconnect themselves
721 /// from their window before they destroy it, so no widget owns the
722 /// window at destroy time.
723 ///
724 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
725 /// to enable the [`gdk::EventMask::STRUCTURE_MASK`][crate::gdk::EventMask::STRUCTURE_MASK] mask. GDK will enable this mask
726 /// automatically for all new windows.
727 ///
728 ///
729 ///
730 ///
731 /// #### `direction-changed`
732 /// The ::direction-changed signal is emitted when the text direction
733 /// of a widget changes.
734 ///
735 ///
736 ///
737 ///
738 /// #### `drag-begin`
739 /// The ::drag-begin signal is emitted on the drag source when a drag is
740 /// started. A typical reason to connect to this signal is to set up a
741 /// custom drag icon with e.g. [`WidgetExt::drag_source_set_icon_pixbuf()`][crate::prelude::WidgetExt::drag_source_set_icon_pixbuf()].
742 ///
743 /// Note that some widgets set up a drag icon in the default handler of
744 /// this signal, so you may have to use `g_signal_connect_after()` to
745 /// override what the default handler did.
746 ///
747 ///
748 ///
749 ///
750 /// #### `drag-data-delete`
751 /// The ::drag-data-delete signal is emitted on the drag source when a drag
752 /// with the action [`gdk::DragAction::MOVE`][crate::gdk::DragAction::MOVE] is successfully completed. The signal
753 /// handler is responsible for deleting the data that has been dropped. What
754 /// "delete" means depends on the context of the drag operation.
755 ///
756 ///
757 ///
758 ///
759 /// #### `drag-data-get`
760 /// The ::drag-data-get signal is emitted on the drag source when the drop
761 /// site requests the data which is dragged. It is the responsibility of
762 /// the signal handler to fill `data` with the data in the format which
763 /// is indicated by `info`. See [`SelectionData::set()`][crate::SelectionData::set()] and
764 /// [`SelectionData::set_text()`][crate::SelectionData::set_text()].
765 ///
766 ///
767 ///
768 ///
769 /// #### `drag-data-received`
770 /// The ::drag-data-received signal is emitted on the drop site when the
771 /// dragged data has been received. If the data was received in order to
772 /// determine whether the drop will be accepted, the handler is expected
773 /// to call `gdk_drag_status()` and not finish the drag.
774 /// If the data was received in response to a [`drag-drop`][struct@crate::Widget#drag-drop] signal
775 /// (and this is the last target to be received), the handler for this
776 /// signal is expected to process the received data and then call
777 /// `gtk_drag_finish()`, setting the `success` parameter depending on
778 /// whether the data was processed successfully.
779 ///
780 /// Applications must create some means to determine why the signal was emitted
781 /// and therefore whether to call `gdk_drag_status()` or `gtk_drag_finish()`.
782 ///
783 /// The handler may inspect the selected action with
784 /// [`DragContext::selected_action()`][crate::gdk::DragContext::selected_action()] before calling
785 /// `gtk_drag_finish()`, e.g. to implement [`gdk::DragAction::ASK`][crate::gdk::DragAction::ASK] as
786 /// shown in the following example:
787 ///
788 ///
789 /// **⚠️ The following code is in C ⚠️**
790 ///
791 /// ```C
792 /// void
793 /// drag_data_received (GtkWidget *widget,
794 /// GdkDragContext *context,
795 /// gint x,
796 /// gint y,
797 /// GtkSelectionData *data,
798 /// guint info,
799 /// guint time)
800 /// {
801 /// if ((data->length >= 0) && (data->format == 8))
802 /// {
803 /// GdkDragAction action;
804 ///
805 /// // handle data here
806 ///
807 /// action = gdk_drag_context_get_selected_action (context);
808 /// if (action == GDK_ACTION_ASK)
809 /// {
810 /// GtkWidget *dialog;
811 /// gint response;
812 ///
813 /// dialog = gtk_message_dialog_new (NULL,
814 /// GTK_DIALOG_MODAL |
815 /// GTK_DIALOG_DESTROY_WITH_PARENT,
816 /// GTK_MESSAGE_INFO,
817 /// GTK_BUTTONS_YES_NO,
818 /// "Move the data ?\n");
819 /// response = gtk_dialog_run (GTK_DIALOG (dialog));
820 /// gtk_widget_destroy (dialog);
821 ///
822 /// if (response == GTK_RESPONSE_YES)
823 /// action = GDK_ACTION_MOVE;
824 /// else
825 /// action = GDK_ACTION_COPY;
826 /// }
827 ///
828 /// gtk_drag_finish (context, TRUE, action == GDK_ACTION_MOVE, time);
829 /// }
830 /// else
831 /// gtk_drag_finish (context, FALSE, FALSE, time);
832 /// }
833 /// ```
834 ///
835 ///
836 ///
837 ///
838 /// #### `drag-drop`
839 /// The ::drag-drop signal is emitted on the drop site when the user drops
840 /// the data onto the widget. The signal handler must determine whether
841 /// the cursor position is in a drop zone or not. If it is not in a drop
842 /// zone, it returns [`false`] and no further processing is necessary.
843 /// Otherwise, the handler returns [`true`]. In this case, the handler must
844 /// ensure that `gtk_drag_finish()` is called to let the source know that
845 /// the drop is done. The call to `gtk_drag_finish()` can be done either
846 /// directly or in a [`drag-data-received`][struct@crate::Widget#drag-data-received] handler which gets
847 /// triggered by calling [`WidgetExt::drag_get_data()`][crate::prelude::WidgetExt::drag_get_data()] to receive the data for one
848 /// or more of the supported targets.
849 ///
850 ///
851 ///
852 ///
853 /// #### `drag-end`
854 /// The ::drag-end signal is emitted on the drag source when a drag is
855 /// finished. A typical reason to connect to this signal is to undo
856 /// things done in [`drag-begin`][struct@crate::Widget#drag-begin].
857 ///
858 ///
859 ///
860 ///
861 /// #### `drag-failed`
862 /// The ::drag-failed signal is emitted on the drag source when a drag has
863 /// failed. The signal handler may hook custom code to handle a failed DnD
864 /// operation based on the type of error, it returns [`true`] is the failure has
865 /// been already handled (not showing the default "drag operation failed"
866 /// animation), otherwise it returns [`false`].
867 ///
868 ///
869 ///
870 ///
871 /// #### `drag-leave`
872 /// The ::drag-leave signal is emitted on the drop site when the cursor
873 /// leaves the widget. A typical reason to connect to this signal is to
874 /// undo things done in [`drag-motion`][struct@crate::Widget#drag-motion], e.g. undo highlighting
875 /// with [`WidgetExt::drag_unhighlight()`][crate::prelude::WidgetExt::drag_unhighlight()].
876 ///
877 ///
878 /// Likewise, the [`drag-leave`][struct@crate::Widget#drag-leave] signal is also emitted before the
879 /// ::drag-drop signal, for instance to allow cleaning up of a preview item
880 /// created in the [`drag-motion`][struct@crate::Widget#drag-motion] signal handler.
881 ///
882 ///
883 ///
884 ///
885 /// #### `drag-motion`
886 /// The ::drag-motion signal is emitted on the drop site when the user
887 /// moves the cursor over the widget during a drag. The signal handler
888 /// must determine whether the cursor position is in a drop zone or not.
889 /// If it is not in a drop zone, it returns [`false`] and no further processing
890 /// is necessary. Otherwise, the handler returns [`true`]. In this case, the
891 /// handler is responsible for providing the necessary information for
892 /// displaying feedback to the user, by calling `gdk_drag_status()`.
893 ///
894 /// If the decision whether the drop will be accepted or rejected can't be
895 /// made based solely on the cursor position and the type of the data, the
896 /// handler may inspect the dragged data by calling [`WidgetExt::drag_get_data()`][crate::prelude::WidgetExt::drag_get_data()] and
897 /// defer the `gdk_drag_status()` call to the [`drag-data-received`][struct@crate::Widget#drag-data-received]
898 /// handler. Note that you must pass [`DestDefaults::DROP`][crate::DestDefaults::DROP],
899 /// [`DestDefaults::MOTION`][crate::DestDefaults::MOTION] or [`DestDefaults::ALL`][crate::DestDefaults::ALL] to [`WidgetExtManual::drag_dest_set()`][crate::prelude::WidgetExtManual::drag_dest_set()]
900 /// when using the drag-motion signal that way.
901 ///
902 /// Also note that there is no drag-enter signal. The drag receiver has to
903 /// keep track of whether he has received any drag-motion signals since the
904 /// last [`drag-leave`][struct@crate::Widget#drag-leave] and if not, treat the drag-motion signal as
905 /// an "enter" signal. Upon an "enter", the handler will typically highlight
906 /// the drop site with [`WidgetExt::drag_highlight()`][crate::prelude::WidgetExt::drag_highlight()].
907 ///
908 ///
909 /// **⚠️ The following code is in C ⚠️**
910 ///
911 /// ```C
912 /// static void
913 /// drag_motion (GtkWidget *widget,
914 /// GdkDragContext *context,
915 /// gint x,
916 /// gint y,
917 /// guint time)
918 /// {
919 /// GdkAtom target;
920 ///
921 /// PrivateData *private_data = GET_PRIVATE_DATA (widget);
922 ///
923 /// if (!private_data->drag_highlight)
924 /// {
925 /// private_data->drag_highlight = 1;
926 /// gtk_drag_highlight (widget);
927 /// }
928 ///
929 /// target = gtk_drag_dest_find_target (widget, context, NULL);
930 /// if (target == GDK_NONE)
931 /// gdk_drag_status (context, 0, time);
932 /// else
933 /// {
934 /// private_data->pending_status
935 /// = gdk_drag_context_get_suggested_action (context);
936 /// gtk_drag_get_data (widget, context, target, time);
937 /// }
938 ///
939 /// return TRUE;
940 /// }
941 ///
942 /// static void
943 /// drag_data_received (GtkWidget *widget,
944 /// GdkDragContext *context,
945 /// gint x,
946 /// gint y,
947 /// GtkSelectionData *selection_data,
948 /// guint info,
949 /// guint time)
950 /// {
951 /// PrivateData *private_data = GET_PRIVATE_DATA (widget);
952 ///
953 /// if (private_data->suggested_action)
954 /// {
955 /// private_data->suggested_action = 0;
956 ///
957 /// // We are getting this data due to a request in drag_motion,
958 /// // rather than due to a request in drag_drop, so we are just
959 /// // supposed to call gdk_drag_status(), not actually paste in
960 /// // the data.
961 ///
962 /// str = gtk_selection_data_get_text (selection_data);
963 /// if (!data_is_acceptable (str))
964 /// gdk_drag_status (context, 0, time);
965 /// else
966 /// gdk_drag_status (context,
967 /// private_data->suggested_action,
968 /// time);
969 /// }
970 /// else
971 /// {
972 /// // accept the drop
973 /// }
974 /// }
975 /// ```
976 ///
977 ///
978 ///
979 ///
980 /// #### `draw`
981 /// This signal is emitted when a widget is supposed to render itself.
982 /// The `widget`'s top left corner must be painted at the origin of
983 /// the passed in context and be sized to the values returned by
984 /// [`WidgetExt::allocated_width()`][crate::prelude::WidgetExt::allocated_width()] and
985 /// [`WidgetExt::allocated_height()`][crate::prelude::WidgetExt::allocated_height()].
986 ///
987 /// Signal handlers connected to this signal can modify the cairo
988 /// context passed as `cr` in any way they like and don't need to
989 /// restore it. The signal emission takes care of calling `cairo_save()`
990 /// before and `cairo_restore()` after invoking the handler.
991 ///
992 /// The signal handler will get a `cr` with a clip region already set to the
993 /// widget's dirty region, i.e. to the area that needs repainting. Complicated
994 /// widgets that want to avoid redrawing themselves completely can get the full
995 /// extents of the clip region with `gdk_cairo_get_clip_rectangle()`, or they can
996 /// get a finer-grained representation of the dirty region with
997 /// `cairo_copy_clip_rectangle_list()`.
998 ///
999 ///
1000 ///
1001 ///
1002 /// #### `enter-notify-event`
1003 /// The ::enter-notify-event will be emitted when the pointer enters
1004 /// the `widget`'s window.
1005 ///
1006 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
1007 /// to enable the [`gdk::EventMask::ENTER_NOTIFY_MASK`][crate::gdk::EventMask::ENTER_NOTIFY_MASK] mask.
1008 ///
1009 /// This signal will be sent to the grab widget if there is one.
1010 ///
1011 ///
1012 ///
1013 ///
1014 /// #### `event`
1015 /// The GTK+ main loop will emit three signals for each GDK event delivered
1016 /// to a widget: one generic ::event signal, another, more specific,
1017 /// signal that matches the type of event delivered (e.g.
1018 /// [`key-press-event`][struct@crate::Widget#key-press-event]) and finally a generic
1019 /// [`event-after`][struct@crate::Widget#event-after] signal.
1020 ///
1021 ///
1022 ///
1023 ///
1024 /// #### `event-after`
1025 /// After the emission of the [`event`][struct@crate::Widget#event] signal and (optionally)
1026 /// the second more specific signal, ::event-after will be emitted
1027 /// regardless of the previous two signals handlers return values.
1028 ///
1029 ///
1030 ///
1031 ///
1032 /// #### `focus`
1033 ///
1034 ///
1035 ///
1036 /// #### `focus-in-event`
1037 /// The ::focus-in-event signal will be emitted when the keyboard focus
1038 /// enters the `widget`'s window.
1039 ///
1040 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
1041 /// to enable the [`gdk::EventMask::FOCUS_CHANGE_MASK`][crate::gdk::EventMask::FOCUS_CHANGE_MASK] mask.
1042 ///
1043 ///
1044 ///
1045 ///
1046 /// #### `focus-out-event`
1047 /// The ::focus-out-event signal will be emitted when the keyboard focus
1048 /// leaves the `widget`'s window.
1049 ///
1050 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
1051 /// to enable the [`gdk::EventMask::FOCUS_CHANGE_MASK`][crate::gdk::EventMask::FOCUS_CHANGE_MASK] mask.
1052 ///
1053 ///
1054 ///
1055 ///
1056 /// #### `grab-broken-event`
1057 /// Emitted when a pointer or keyboard grab on a window belonging
1058 /// to `widget` gets broken.
1059 ///
1060 /// On X11, this happens when the grab window becomes unviewable
1061 /// (i.e. it or one of its ancestors is unmapped), or if the same
1062 /// application grabs the pointer or keyboard again.
1063 ///
1064 ///
1065 ///
1066 ///
1067 /// #### `grab-focus`
1068 /// Action
1069 ///
1070 ///
1071 /// #### `grab-notify`
1072 /// The ::grab-notify signal is emitted when a widget becomes
1073 /// shadowed by a GTK+ grab (not a pointer or keyboard grab) on
1074 /// another widget, or when it becomes unshadowed due to a grab
1075 /// being removed.
1076 ///
1077 /// A widget is shadowed by a [`WidgetExt::grab_add()`][crate::prelude::WidgetExt::grab_add()] when the topmost
1078 /// grab widget in the grab stack of its window group is not
1079 /// its ancestor.
1080 ///
1081 ///
1082 ///
1083 ///
1084 /// #### `hide`
1085 /// The ::hide signal is emitted when `widget` is hidden, for example with
1086 /// [`WidgetExt::hide()`][crate::prelude::WidgetExt::hide()].
1087 ///
1088 ///
1089 ///
1090 ///
1091 /// #### `hierarchy-changed`
1092 /// The ::hierarchy-changed signal is emitted when the
1093 /// anchored state of a widget changes. A widget is
1094 /// “anchored” when its toplevel
1095 /// ancestor is a [`Window`][crate::Window]. This signal is emitted when
1096 /// a widget changes from un-anchored to anchored or vice-versa.
1097 ///
1098 ///
1099 ///
1100 ///
1101 /// #### `key-press-event`
1102 /// The ::key-press-event signal is emitted when a key is pressed. The signal
1103 /// emission will reoccur at the key-repeat rate when the key is kept pressed.
1104 ///
1105 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
1106 /// to enable the [`gdk::EventMask::KEY_PRESS_MASK`][crate::gdk::EventMask::KEY_PRESS_MASK] mask.
1107 ///
1108 /// This signal will be sent to the grab widget if there is one.
1109 ///
1110 ///
1111 ///
1112 ///
1113 /// #### `key-release-event`
1114 /// The ::key-release-event signal is emitted when a key is released.
1115 ///
1116 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
1117 /// to enable the [`gdk::EventMask::KEY_RELEASE_MASK`][crate::gdk::EventMask::KEY_RELEASE_MASK] mask.
1118 ///
1119 /// This signal will be sent to the grab widget if there is one.
1120 ///
1121 ///
1122 ///
1123 ///
1124 /// #### `keynav-failed`
1125 /// Gets emitted if keyboard navigation fails.
1126 /// See [`WidgetExt::keynav_failed()`][crate::prelude::WidgetExt::keynav_failed()] for details.
1127 ///
1128 ///
1129 ///
1130 ///
1131 /// #### `leave-notify-event`
1132 /// The ::leave-notify-event will be emitted when the pointer leaves
1133 /// the `widget`'s window.
1134 ///
1135 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
1136 /// to enable the [`gdk::EventMask::LEAVE_NOTIFY_MASK`][crate::gdk::EventMask::LEAVE_NOTIFY_MASK] mask.
1137 ///
1138 /// This signal will be sent to the grab widget if there is one.
1139 ///
1140 ///
1141 ///
1142 ///
1143 /// #### `map`
1144 /// The ::map signal is emitted when `widget` is going to be mapped, that is
1145 /// when the widget is visible (which is controlled with
1146 /// [`WidgetExt::set_visible()`][crate::prelude::WidgetExt::set_visible()]) and all its parents up to the toplevel widget
1147 /// are also visible. Once the map has occurred, [`map-event`][struct@crate::Widget#map-event] will
1148 /// be emitted.
1149 ///
1150 /// The ::map signal can be used to determine whether a widget will be drawn,
1151 /// for instance it can resume an animation that was stopped during the
1152 /// emission of [`unmap`][struct@crate::Widget#unmap].
1153 ///
1154 ///
1155 ///
1156 ///
1157 /// #### `map-event`
1158 /// The ::map-event signal will be emitted when the `widget`'s window is
1159 /// mapped. A window is mapped when it becomes visible on the screen.
1160 ///
1161 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
1162 /// to enable the [`gdk::EventMask::STRUCTURE_MASK`][crate::gdk::EventMask::STRUCTURE_MASK] mask. GDK will enable this mask
1163 /// automatically for all new windows.
1164 ///
1165 ///
1166 ///
1167 ///
1168 /// #### `mnemonic-activate`
1169 /// The default handler for this signal activates `widget` if `group_cycling`
1170 /// is [`false`], or just makes `widget` grab focus if `group_cycling` is [`true`].
1171 ///
1172 ///
1173 ///
1174 ///
1175 /// #### `motion-notify-event`
1176 /// The ::motion-notify-event signal is emitted when the pointer moves
1177 /// over the widget's [`gdk::Window`][crate::gdk::Window].
1178 ///
1179 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget
1180 /// needs to enable the [`gdk::EventMask::POINTER_MOTION_MASK`][crate::gdk::EventMask::POINTER_MOTION_MASK] mask.
1181 ///
1182 /// This signal will be sent to the grab widget if there is one.
1183 ///
1184 ///
1185 ///
1186 ///
1187 /// #### `move-focus`
1188 /// Action
1189 ///
1190 ///
1191 /// #### `parent-set`
1192 /// The ::parent-set signal is emitted when a new parent
1193 /// has been set on a widget.
1194 ///
1195 ///
1196 ///
1197 ///
1198 /// #### `popup-menu`
1199 /// This signal gets emitted whenever a widget should pop up a context
1200 /// menu. This usually happens through the standard key binding mechanism;
1201 /// by pressing a certain key while a widget is focused, the user can cause
1202 /// the widget to pop up a menu. For example, the [`Entry`][crate::Entry] widget creates
1203 /// a menu with clipboard commands. See the
1204 /// [Popup Menu Migration Checklist][checklist-popup-menu]
1205 /// for an example of how to use this signal.
1206 ///
1207 /// Action
1208 ///
1209 ///
1210 /// #### `property-notify-event`
1211 /// The ::property-notify-event signal will be emitted when a property on
1212 /// the `widget`'s window has been changed or deleted.
1213 ///
1214 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
1215 /// to enable the [`gdk::EventMask::PROPERTY_CHANGE_MASK`][crate::gdk::EventMask::PROPERTY_CHANGE_MASK] mask.
1216 ///
1217 ///
1218 ///
1219 ///
1220 /// #### `proximity-in-event`
1221 /// To receive this signal the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
1222 /// to enable the [`gdk::EventMask::PROXIMITY_IN_MASK`][crate::gdk::EventMask::PROXIMITY_IN_MASK] mask.
1223 ///
1224 /// This signal will be sent to the grab widget if there is one.
1225 ///
1226 ///
1227 ///
1228 ///
1229 /// #### `proximity-out-event`
1230 /// To receive this signal the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
1231 /// to enable the [`gdk::EventMask::PROXIMITY_OUT_MASK`][crate::gdk::EventMask::PROXIMITY_OUT_MASK] mask.
1232 ///
1233 /// This signal will be sent to the grab widget if there is one.
1234 ///
1235 ///
1236 ///
1237 ///
1238 /// #### `query-tooltip`
1239 /// Emitted when [`has-tooltip`][struct@crate::Widget#has-tooltip] is [`true`] and the hover timeout
1240 /// has expired with the cursor hovering "above" `widget`; or emitted when `widget` got
1241 /// focus in keyboard mode.
1242 ///
1243 /// Using the given coordinates, the signal handler should determine
1244 /// whether a tooltip should be shown for `widget`. If this is the case
1245 /// [`true`] should be returned, [`false`] otherwise. Note that if
1246 /// `keyboard_mode` is [`true`], the values of `x` and `y` are undefined and
1247 /// should not be used.
1248 ///
1249 /// The signal handler is free to manipulate `tooltip` with the therefore
1250 /// destined function calls.
1251 ///
1252 ///
1253 ///
1254 ///
1255 /// #### `realize`
1256 /// The ::realize signal is emitted when `widget` is associated with a
1257 /// [`gdk::Window`][crate::gdk::Window], which means that [`WidgetExt::realize()`][crate::prelude::WidgetExt::realize()] has been called or the
1258 /// widget has been mapped (that is, it is going to be drawn).
1259 ///
1260 ///
1261 ///
1262 ///
1263 /// #### `screen-changed`
1264 /// The ::screen-changed signal gets emitted when the
1265 /// screen of a widget has changed.
1266 ///
1267 ///
1268 ///
1269 ///
1270 /// #### `scroll-event`
1271 /// The ::scroll-event signal is emitted when a button in the 4 to 7
1272 /// range is pressed. Wheel mice are usually configured to generate
1273 /// button press events for buttons 4 and 5 when the wheel is turned.
1274 ///
1275 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
1276 /// to enable the [`gdk::EventMask::SCROLL_MASK`][crate::gdk::EventMask::SCROLL_MASK] mask.
1277 ///
1278 /// This signal will be sent to the grab widget if there is one.
1279 ///
1280 ///
1281 ///
1282 ///
1283 /// #### `selection-clear-event`
1284 /// The ::selection-clear-event signal will be emitted when the
1285 /// the `widget`'s window has lost ownership of a selection.
1286 ///
1287 ///
1288 ///
1289 ///
1290 /// #### `selection-get`
1291 ///
1292 ///
1293 ///
1294 /// #### `selection-notify-event`
1295 ///
1296 ///
1297 ///
1298 /// #### `selection-received`
1299 ///
1300 ///
1301 ///
1302 /// #### `selection-request-event`
1303 /// The ::selection-request-event signal will be emitted when
1304 /// another client requests ownership of the selection owned by
1305 /// the `widget`'s window.
1306 ///
1307 ///
1308 ///
1309 ///
1310 /// #### `show`
1311 /// The ::show signal is emitted when `widget` is shown, for example with
1312 /// [`WidgetExt::show()`][crate::prelude::WidgetExt::show()].
1313 ///
1314 ///
1315 ///
1316 ///
1317 /// #### `show-help`
1318 /// Action
1319 ///
1320 ///
1321 /// #### `size-allocate`
1322 ///
1323 ///
1324 ///
1325 /// #### `state-changed`
1326 /// The ::state-changed signal is emitted when the widget state changes.
1327 /// See `gtk_widget_get_state()`.
1328 ///
1329 ///
1330 ///
1331 ///
1332 /// #### `state-flags-changed`
1333 /// The ::state-flags-changed signal is emitted when the widget state
1334 /// changes, see [`WidgetExt::state_flags()`][crate::prelude::WidgetExt::state_flags()].
1335 ///
1336 ///
1337 ///
1338 ///
1339 /// #### `style-set`
1340 /// The ::style-set signal is emitted when a new style has been set
1341 /// on a widget. Note that style-modifying functions like
1342 /// `gtk_widget_modify_base()` also cause this signal to be emitted.
1343 ///
1344 /// Note that this signal is emitted for changes to the deprecated
1345 /// `GtkStyle`. To track changes to the [`StyleContext`][crate::StyleContext] associated
1346 /// with a widget, use the [`style-updated`][struct@crate::Widget#style-updated] signal.
1347 ///
1348 ///
1349 ///
1350 ///
1351 /// #### `style-updated`
1352 /// The ::style-updated signal is a convenience signal that is emitted when the
1353 /// [`changed`][struct@crate::StyleContext#changed] signal is emitted on the `widget`'s associated
1354 /// [`StyleContext`][crate::StyleContext] as returned by [`WidgetExt::style_context()`][crate::prelude::WidgetExt::style_context()].
1355 ///
1356 /// Note that style-modifying functions like `gtk_widget_override_color()` also
1357 /// cause this signal to be emitted.
1358 ///
1359 ///
1360 ///
1361 ///
1362 /// #### `touch-event`
1363 ///
1364 ///
1365 ///
1366 /// #### `unmap`
1367 /// The ::unmap signal is emitted when `widget` is going to be unmapped, which
1368 /// means that either it or any of its parents up to the toplevel widget have
1369 /// been set as hidden.
1370 ///
1371 /// As ::unmap indicates that a widget will not be shown any longer, it can be
1372 /// used to, for example, stop an animation on the widget.
1373 ///
1374 ///
1375 ///
1376 ///
1377 /// #### `unmap-event`
1378 /// The ::unmap-event signal will be emitted when the `widget`'s window is
1379 /// unmapped. A window is unmapped when it becomes invisible on the screen.
1380 ///
1381 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
1382 /// to enable the [`gdk::EventMask::STRUCTURE_MASK`][crate::gdk::EventMask::STRUCTURE_MASK] mask. GDK will enable this mask
1383 /// automatically for all new windows.
1384 ///
1385 ///
1386 ///
1387 ///
1388 /// #### `unrealize`
1389 /// The ::unrealize signal is emitted when the [`gdk::Window`][crate::gdk::Window] associated with
1390 /// `widget` is destroyed, which means that [`WidgetExt::unrealize()`][crate::prelude::WidgetExt::unrealize()] has been
1391 /// called or the widget has been unmapped (that is, it is going to be
1392 /// hidden).
1393 ///
1394 ///
1395 ///
1396 ///
1397 /// #### `visibility-notify-event`
1398 /// The ::visibility-notify-event will be emitted when the `widget`'s
1399 /// window is obscured or unobscured.
1400 ///
1401 /// To receive this signal the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
1402 /// to enable the [`gdk::EventMask::VISIBILITY_NOTIFY_MASK`][crate::gdk::EventMask::VISIBILITY_NOTIFY_MASK] mask.
1403 ///
1404 ///
1405 ///
1406 ///
1407 /// #### `window-state-event`
1408 /// The ::window-state-event will be emitted when the state of the
1409 /// toplevel window associated to the `widget` changes.
1410 ///
1411 /// To receive this signal the [`gdk::Window`][crate::gdk::Window] associated to the widget
1412 /// needs to enable the [`gdk::EventMask::STRUCTURE_MASK`][crate::gdk::EventMask::STRUCTURE_MASK] mask. GDK will enable
1413 /// this mask automatically for all new windows.
1414 ///
1415 ///
1416 /// </details>
1417 ///
1418 /// # Implements
1419 ///
1420 /// [`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]
1421 #[doc(alias = "GtkWindow")]
1422 pub struct Window(Object<ffi::GtkWindow, ffi::GtkWindowClass>) @extends Bin, Container, Widget, @implements Buildable;
1423
1424 match fn {
1425 type_ => || ffi::gtk_window_get_type(),
1426 }
1427}
1428
1429impl Window {
1430 pub const NONE: Option<&'static Window> = None;
1431
1432 /// Creates a new [`Window`][crate::Window], which is a toplevel window that can
1433 /// contain other widgets. Nearly always, the type of the window should
1434 /// be [`WindowType::Toplevel`][crate::WindowType::Toplevel]. If you’re implementing something like a
1435 /// popup menu from scratch (which is a bad idea, just use [`Menu`][crate::Menu]),
1436 /// you might use [`WindowType::Popup`][crate::WindowType::Popup]. [`WindowType::Popup`][crate::WindowType::Popup] is not for
1437 /// dialogs, though in some other toolkits dialogs are called “popups”.
1438 /// In GTK+, [`WindowType::Popup`][crate::WindowType::Popup] means a pop-up menu or pop-up tooltip.
1439 /// On X11, popup windows are not controlled by the
1440 /// [window manager][gtk-X11-arch].
1441 ///
1442 /// If you simply want an undecorated window (no window borders), use
1443 /// [`GtkWindowExt::set_decorated()`][crate::prelude::GtkWindowExt::set_decorated()], don’t use [`WindowType::Popup`][crate::WindowType::Popup].
1444 ///
1445 /// All top-level windows created by [`new()`][Self::new()] are stored in
1446 /// an internal top-level window list. This list can be obtained from
1447 /// [`list_toplevels()`][Self::list_toplevels()]. Due to Gtk+ keeping a reference to
1448 /// the window internally, [`new()`][Self::new()] does not return a reference
1449 /// to the caller.
1450 ///
1451 /// To delete a [`Window`][crate::Window], call `gtk_widget_destroy()`.
1452 /// ## `type_`
1453 /// type of window
1454 ///
1455 /// # Returns
1456 ///
1457 /// a new [`Window`][crate::Window].
1458 #[doc(alias = "gtk_window_new")]
1459 pub fn new(type_: WindowType) -> Window {
1460 assert_initialized_main_thread!();
1461 unsafe { Widget::from_glib_none(ffi::gtk_window_new(type_.into_glib())).unsafe_cast() }
1462 }
1463
1464 // rustdoc-stripper-ignore-next
1465 /// Creates a new builder-pattern struct instance to construct [`Window`] objects.
1466 ///
1467 /// This method returns an instance of [`WindowBuilder`](crate::builders::WindowBuilder) which can be used to create [`Window`] objects.
1468 pub fn builder() -> WindowBuilder {
1469 WindowBuilder::new()
1470 }
1471
1472 /// Gets the value set by [`set_default_icon_list()`][Self::set_default_icon_list()].
1473 /// The list is a copy and should be freed with `g_list_free()`,
1474 /// but the pixbufs in the list have not had their reference count
1475 /// incremented.
1476 ///
1477 /// # Returns
1478 ///
1479 /// copy of default icon list
1480 #[doc(alias = "gtk_window_get_default_icon_list")]
1481 #[doc(alias = "get_default_icon_list")]
1482 pub fn default_icon_list() -> Vec<gdk_pixbuf::Pixbuf> {
1483 assert_initialized_main_thread!();
1484 unsafe {
1485 FromGlibPtrContainer::from_glib_container(ffi::gtk_window_get_default_icon_list())
1486 }
1487 }
1488
1489 /// Returns the fallback icon name for windows that has been set
1490 /// with [`set_default_icon_name()`][Self::set_default_icon_name()]. The returned
1491 /// string is owned by GTK+ and should not be modified. It
1492 /// is only valid until the next call to
1493 /// [`set_default_icon_name()`][Self::set_default_icon_name()].
1494 ///
1495 /// # Returns
1496 ///
1497 /// the fallback icon name for windows
1498 #[doc(alias = "gtk_window_get_default_icon_name")]
1499 #[doc(alias = "get_default_icon_name")]
1500 pub fn default_icon_name() -> Option<glib::GString> {
1501 assert_initialized_main_thread!();
1502 unsafe { from_glib_none(ffi::gtk_window_get_default_icon_name()) }
1503 }
1504
1505 /// Returns a list of all existing toplevel windows. The widgets
1506 /// in the list are not individually referenced. If you want
1507 /// to iterate through the list and perform actions involving
1508 /// callbacks that might destroy the widgets, you must call
1509 /// `g_list_foreach (result, (GFunc)g_object_ref, NULL)` first, and
1510 /// then unref all the widgets afterwards.
1511 ///
1512 /// # Returns
1513 ///
1514 /// list of toplevel widgets
1515 #[doc(alias = "gtk_window_list_toplevels")]
1516 pub fn list_toplevels() -> Vec<Widget> {
1517 assert_initialized_main_thread!();
1518 unsafe { FromGlibPtrContainer::from_glib_container(ffi::gtk_window_list_toplevels()) }
1519 }
1520
1521 /// By default, after showing the first [`Window`][crate::Window], GTK+ calls
1522 /// `gdk_notify_startup_complete()`. Call this function to disable
1523 /// the automatic startup notification. You might do this if your
1524 /// first window is a splash screen, and you want to delay notification
1525 /// until after your real main window has been shown, for example.
1526 ///
1527 /// In that example, you would disable startup notification
1528 /// temporarily, show your splash screen, then re-enable it so that
1529 /// showing the main window would automatically result in notification.
1530 /// ## `setting`
1531 /// [`true`] to automatically do startup notification
1532 #[doc(alias = "gtk_window_set_auto_startup_notification")]
1533 pub fn set_auto_startup_notification(setting: bool) {
1534 assert_initialized_main_thread!();
1535 unsafe {
1536 ffi::gtk_window_set_auto_startup_notification(setting.into_glib());
1537 }
1538 }
1539
1540 /// Sets an icon to be used as fallback for windows that haven't
1541 /// had [`GtkWindowExt::set_icon()`][crate::prelude::GtkWindowExt::set_icon()] called on them from a pixbuf.
1542 /// ## `icon`
1543 /// the icon
1544 #[doc(alias = "gtk_window_set_default_icon")]
1545 pub fn set_default_icon(icon: &gdk_pixbuf::Pixbuf) {
1546 assert_initialized_main_thread!();
1547 unsafe {
1548 ffi::gtk_window_set_default_icon(icon.to_glib_none().0);
1549 }
1550 }
1551
1552 /// Sets an icon to be used as fallback for windows that haven't
1553 /// had [`GtkWindowExt::set_icon_list()`][crate::prelude::GtkWindowExt::set_icon_list()] called on them from a file
1554 /// on disk. Warns on failure if `err` is [`None`].
1555 /// ## `filename`
1556 /// location of icon file
1557 ///
1558 /// # Returns
1559 ///
1560 /// [`true`] if setting the icon succeeded.
1561 #[doc(alias = "gtk_window_set_default_icon_from_file")]
1562 pub fn set_default_icon_from_file(
1563 filename: impl AsRef<std::path::Path>,
1564 ) -> Result<(), glib::Error> {
1565 assert_initialized_main_thread!();
1566 unsafe {
1567 let mut error = ptr::null_mut();
1568 let is_ok = ffi::gtk_window_set_default_icon_from_file(
1569 filename.as_ref().to_glib_none().0,
1570 &mut error,
1571 );
1572 debug_assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null());
1573 if error.is_null() {
1574 Ok(())
1575 } else {
1576 Err(from_glib_full(error))
1577 }
1578 }
1579 }
1580
1581 /// Sets an icon list to be used as fallback for windows that haven't
1582 /// had [`GtkWindowExt::set_icon_list()`][crate::prelude::GtkWindowExt::set_icon_list()] called on them to set up a
1583 /// window-specific icon list. This function allows you to set up the
1584 /// icon for all windows in your app at once.
1585 ///
1586 /// See [`GtkWindowExt::set_icon_list()`][crate::prelude::GtkWindowExt::set_icon_list()] for more details.
1587 /// ## `list`
1588 /// a list of [`gdk_pixbuf::Pixbuf`][crate::gdk_pixbuf::Pixbuf]
1589 #[doc(alias = "gtk_window_set_default_icon_list")]
1590 pub fn set_default_icon_list(list: &[gdk_pixbuf::Pixbuf]) {
1591 assert_initialized_main_thread!();
1592 unsafe {
1593 ffi::gtk_window_set_default_icon_list(list.to_glib_container().0);
1594 }
1595 }
1596
1597 /// Sets an icon to be used as fallback for windows that haven't
1598 /// had [`GtkWindowExt::set_icon_list()`][crate::prelude::GtkWindowExt::set_icon_list()] called on them from a named
1599 /// themed icon, see [`GtkWindowExt::set_icon_name()`][crate::prelude::GtkWindowExt::set_icon_name()].
1600 /// ## `name`
1601 /// the name of the themed icon
1602 #[doc(alias = "gtk_window_set_default_icon_name")]
1603 pub fn set_default_icon_name(name: &str) {
1604 assert_initialized_main_thread!();
1605 unsafe {
1606 ffi::gtk_window_set_default_icon_name(name.to_glib_none().0);
1607 }
1608 }
1609
1610 /// Opens or closes the [interactive debugger][interactive-debugging],
1611 /// which offers access to the widget hierarchy of the application
1612 /// and to useful debugging tools.
1613 /// ## `enable`
1614 /// [`true`] to enable interactive debugging
1615 #[doc(alias = "gtk_window_set_interactive_debugging")]
1616 pub fn set_interactive_debugging(enable: bool) {
1617 assert_initialized_main_thread!();
1618 unsafe {
1619 ffi::gtk_window_set_interactive_debugging(enable.into_glib());
1620 }
1621 }
1622}
1623
1624impl Default for Window {
1625 fn default() -> Self {
1626 glib::object::Object::new::<Self>()
1627 }
1628}
1629
1630// rustdoc-stripper-ignore-next
1631/// A [builder-pattern] type to construct [`Window`] objects.
1632///
1633/// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html
1634#[must_use = "The builder must be built to be used"]
1635pub struct WindowBuilder {
1636 builder: glib::object::ObjectBuilder<'static, Window>,
1637}
1638
1639impl WindowBuilder {
1640 fn new() -> Self {
1641 Self {
1642 builder: glib::object::Object::builder(),
1643 }
1644 }
1645
1646 /// Whether the window should receive the input focus.
1647 pub fn accept_focus(self, accept_focus: bool) -> Self {
1648 Self {
1649 builder: self.builder.property("accept-focus", accept_focus),
1650 }
1651 }
1652
1653 /// The [`Application`][crate::Application] associated with the window.
1654 ///
1655 /// The application will be kept alive for at least as long as it
1656 /// has any windows associated with it (see [`ApplicationExtManual::hold()`][crate::gio::prelude::ApplicationExtManual::hold()]
1657 /// for a way to keep it alive without windows).
1658 ///
1659 /// Normally, the connection between the application and the window
1660 /// will remain until the window is destroyed, but you can explicitly
1661 /// remove it by setting the :application property to [`None`].
1662 pub fn application(self, application: &impl IsA<Application>) -> Self {
1663 Self {
1664 builder: self
1665 .builder
1666 .property("application", application.clone().upcast()),
1667 }
1668 }
1669
1670 /// The widget to which this window is attached.
1671 /// See [`GtkWindowExt::set_attached_to()`][crate::prelude::GtkWindowExt::set_attached_to()].
1672 ///
1673 /// Examples of places where specifying this relation is useful are
1674 /// for instance a [`Menu`][crate::Menu] created by a [`ComboBox`][crate::ComboBox], a completion
1675 /// popup window created by [`Entry`][crate::Entry] or a typeahead search entry
1676 /// created by [`TreeView`][crate::TreeView].
1677 pub fn attached_to(self, attached_to: &impl IsA<Widget>) -> Self {
1678 Self {
1679 builder: self
1680 .builder
1681 .property("attached-to", attached_to.clone().upcast()),
1682 }
1683 }
1684
1685 /// Whether the window should be decorated by the window manager.
1686 pub fn decorated(self, decorated: bool) -> Self {
1687 Self {
1688 builder: self.builder.property("decorated", decorated),
1689 }
1690 }
1691
1692 pub fn default_height(self, default_height: i32) -> Self {
1693 Self {
1694 builder: self.builder.property("default-height", default_height),
1695 }
1696 }
1697
1698 pub fn default_width(self, default_width: i32) -> Self {
1699 Self {
1700 builder: self.builder.property("default-width", default_width),
1701 }
1702 }
1703
1704 /// Whether the window frame should have a close button.
1705 pub fn deletable(self, deletable: bool) -> Self {
1706 Self {
1707 builder: self.builder.property("deletable", deletable),
1708 }
1709 }
1710
1711 pub fn destroy_with_parent(self, destroy_with_parent: bool) -> Self {
1712 Self {
1713 builder: self
1714 .builder
1715 .property("destroy-with-parent", destroy_with_parent),
1716 }
1717 }
1718
1719 /// Whether the window should receive the input focus when mapped.
1720 pub fn focus_on_map(self, focus_on_map: bool) -> Self {
1721 Self {
1722 builder: self.builder.property("focus-on-map", focus_on_map),
1723 }
1724 }
1725
1726 /// Whether 'focus rectangles' are currently visible in this window.
1727 ///
1728 /// This property is maintained by GTK+ based on user input
1729 /// and should not be set by applications.
1730 pub fn focus_visible(self, focus_visible: bool) -> Self {
1731 Self {
1732 builder: self.builder.property("focus-visible", focus_visible),
1733 }
1734 }
1735
1736 /// The window gravity of the window. See [`GtkWindowExt::move_()`][crate::prelude::GtkWindowExt::move_()] and [`gdk::Gravity`][crate::gdk::Gravity] for
1737 /// more details about window gravity.
1738 pub fn gravity(self, gravity: gdk::Gravity) -> Self {
1739 Self {
1740 builder: self.builder.property("gravity", gravity),
1741 }
1742 }
1743
1744 /// Whether the titlebar should be hidden during maximization.
1745 pub fn hide_titlebar_when_maximized(self, hide_titlebar_when_maximized: bool) -> Self {
1746 Self {
1747 builder: self
1748 .builder
1749 .property("hide-titlebar-when-maximized", hide_titlebar_when_maximized),
1750 }
1751 }
1752
1753 pub fn icon(self, icon: &gdk_pixbuf::Pixbuf) -> Self {
1754 Self {
1755 builder: self.builder.property("icon", icon.clone()),
1756 }
1757 }
1758
1759 /// The :icon-name property specifies the name of the themed icon to
1760 /// use as the window icon. See [`IconTheme`][crate::IconTheme] for more details.
1761 pub fn icon_name(self, icon_name: impl Into<glib::GString>) -> Self {
1762 Self {
1763 builder: self.builder.property("icon-name", icon_name.into()),
1764 }
1765 }
1766
1767 /// Whether mnemonics are currently visible in this window.
1768 ///
1769 /// This property is maintained by GTK+ based on user input,
1770 /// and should not be set by applications.
1771 pub fn mnemonics_visible(self, mnemonics_visible: bool) -> Self {
1772 Self {
1773 builder: self
1774 .builder
1775 .property("mnemonics-visible", mnemonics_visible),
1776 }
1777 }
1778
1779 pub fn modal(self, modal: bool) -> Self {
1780 Self {
1781 builder: self.builder.property("modal", modal),
1782 }
1783 }
1784
1785 pub fn resizable(self, resizable: bool) -> Self {
1786 Self {
1787 builder: self.builder.property("resizable", resizable),
1788 }
1789 }
1790
1791 pub fn role(self, role: impl Into<glib::GString>) -> Self {
1792 Self {
1793 builder: self.builder.property("role", role.into()),
1794 }
1795 }
1796
1797 pub fn screen(self, screen: &gdk::Screen) -> Self {
1798 Self {
1799 builder: self.builder.property("screen", screen.clone()),
1800 }
1801 }
1802
1803 pub fn skip_pager_hint(self, skip_pager_hint: bool) -> Self {
1804 Self {
1805 builder: self.builder.property("skip-pager-hint", skip_pager_hint),
1806 }
1807 }
1808
1809 pub fn skip_taskbar_hint(self, skip_taskbar_hint: bool) -> Self {
1810 Self {
1811 builder: self
1812 .builder
1813 .property("skip-taskbar-hint", skip_taskbar_hint),
1814 }
1815 }
1816
1817 /// The :startup-id is a write-only property for setting window's
1818 /// startup notification identifier. See [`GtkWindowExt::set_startup_id()`][crate::prelude::GtkWindowExt::set_startup_id()]
1819 /// for more details.
1820 pub fn startup_id(self, startup_id: impl Into<glib::GString>) -> Self {
1821 Self {
1822 builder: self.builder.property("startup-id", startup_id.into()),
1823 }
1824 }
1825
1826 pub fn title(self, title: impl Into<glib::GString>) -> Self {
1827 Self {
1828 builder: self.builder.property("title", title.into()),
1829 }
1830 }
1831
1832 /// The transient parent of the window. See [`GtkWindowExt::set_transient_for()`][crate::prelude::GtkWindowExt::set_transient_for()] for
1833 /// more details about transient windows.
1834 pub fn transient_for(self, transient_for: &impl IsA<Window>) -> Self {
1835 Self {
1836 builder: self
1837 .builder
1838 .property("transient-for", transient_for.clone().upcast()),
1839 }
1840 }
1841
1842 pub fn type_(self, type_: WindowType) -> Self {
1843 Self {
1844 builder: self.builder.property("type", type_),
1845 }
1846 }
1847
1848 pub fn type_hint(self, type_hint: gdk::WindowTypeHint) -> Self {
1849 Self {
1850 builder: self.builder.property("type-hint", type_hint),
1851 }
1852 }
1853
1854 pub fn urgency_hint(self, urgency_hint: bool) -> Self {
1855 Self {
1856 builder: self.builder.property("urgency-hint", urgency_hint),
1857 }
1858 }
1859
1860 pub fn window_position(self, window_position: WindowPosition) -> Self {
1861 Self {
1862 builder: self.builder.property("window-position", window_position),
1863 }
1864 }
1865
1866 pub fn border_width(self, border_width: u32) -> Self {
1867 Self {
1868 builder: self.builder.property("border-width", border_width),
1869 }
1870 }
1871
1872 pub fn child(self, child: &impl IsA<Widget>) -> Self {
1873 Self {
1874 builder: self.builder.property("child", child.clone().upcast()),
1875 }
1876 }
1877
1878 pub fn resize_mode(self, resize_mode: ResizeMode) -> Self {
1879 Self {
1880 builder: self.builder.property("resize-mode", resize_mode),
1881 }
1882 }
1883
1884 pub fn app_paintable(self, app_paintable: bool) -> Self {
1885 Self {
1886 builder: self.builder.property("app-paintable", app_paintable),
1887 }
1888 }
1889
1890 pub fn can_default(self, can_default: bool) -> Self {
1891 Self {
1892 builder: self.builder.property("can-default", can_default),
1893 }
1894 }
1895
1896 pub fn can_focus(self, can_focus: bool) -> Self {
1897 Self {
1898 builder: self.builder.property("can-focus", can_focus),
1899 }
1900 }
1901
1902 pub fn events(self, events: gdk::EventMask) -> Self {
1903 Self {
1904 builder: self.builder.property("events", events),
1905 }
1906 }
1907
1908 /// Whether to expand in both directions. Setting this sets both [`hexpand`][struct@crate::Widget#hexpand] and [`vexpand`][struct@crate::Widget#vexpand]
1909 pub fn expand(self, expand: bool) -> Self {
1910 Self {
1911 builder: self.builder.property("expand", expand),
1912 }
1913 }
1914
1915 /// Whether the widget should grab focus when it is clicked with the mouse.
1916 ///
1917 /// This property is only relevant for widgets that can take focus.
1918 ///
1919 /// Before 3.20, several widgets (GtkButton, GtkFileChooserButton,
1920 /// GtkComboBox) implemented this property individually.
1921 pub fn focus_on_click(self, focus_on_click: bool) -> Self {
1922 Self {
1923 builder: self.builder.property("focus-on-click", focus_on_click),
1924 }
1925 }
1926
1927 /// How to distribute horizontal space if widget gets extra space, see [`Align`][crate::Align]
1928 pub fn halign(self, halign: Align) -> Self {
1929 Self {
1930 builder: self.builder.property("halign", halign),
1931 }
1932 }
1933
1934 pub fn has_default(self, has_default: bool) -> Self {
1935 Self {
1936 builder: self.builder.property("has-default", has_default),
1937 }
1938 }
1939
1940 pub fn has_focus(self, has_focus: bool) -> Self {
1941 Self {
1942 builder: self.builder.property("has-focus", has_focus),
1943 }
1944 }
1945
1946 /// Enables or disables the emission of [`query-tooltip`][struct@crate::Widget#query-tooltip] on `widget`.
1947 /// A value of [`true`] indicates that `widget` can have a tooltip, in this case
1948 /// the widget will be queried using [`query-tooltip`][struct@crate::Widget#query-tooltip] to determine
1949 /// whether it will provide a tooltip or not.
1950 ///
1951 /// Note that setting this property to [`true`] for the first time will change
1952 /// the event masks of the GdkWindows of this widget to include leave-notify
1953 /// and motion-notify events. This cannot and will not be undone when the
1954 /// property is set to [`false`] again.
1955 pub fn has_tooltip(self, has_tooltip: bool) -> Self {
1956 Self {
1957 builder: self.builder.property("has-tooltip", has_tooltip),
1958 }
1959 }
1960
1961 pub fn height_request(self, height_request: i32) -> Self {
1962 Self {
1963 builder: self.builder.property("height-request", height_request),
1964 }
1965 }
1966
1967 /// Whether to expand horizontally. See [`WidgetExt::set_hexpand()`][crate::prelude::WidgetExt::set_hexpand()].
1968 pub fn hexpand(self, hexpand: bool) -> Self {
1969 Self {
1970 builder: self.builder.property("hexpand", hexpand),
1971 }
1972 }
1973
1974 /// Whether to use the [`hexpand`][struct@crate::Widget#hexpand] property. See [`WidgetExt::is_hexpand_set()`][crate::prelude::WidgetExt::is_hexpand_set()].
1975 pub fn hexpand_set(self, hexpand_set: bool) -> Self {
1976 Self {
1977 builder: self.builder.property("hexpand-set", hexpand_set),
1978 }
1979 }
1980
1981 pub fn is_focus(self, is_focus: bool) -> Self {
1982 Self {
1983 builder: self.builder.property("is-focus", is_focus),
1984 }
1985 }
1986
1987 /// Sets all four sides' margin at once. If read, returns max
1988 /// margin on any side.
1989 pub fn margin(self, margin: i32) -> Self {
1990 Self {
1991 builder: self.builder.property("margin", margin),
1992 }
1993 }
1994
1995 /// Margin on bottom side of widget.
1996 ///
1997 /// This property adds margin outside of the widget's normal size
1998 /// request, the margin will be added in addition to the size from
1999 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
2000 pub fn margin_bottom(self, margin_bottom: i32) -> Self {
2001 Self {
2002 builder: self.builder.property("margin-bottom", margin_bottom),
2003 }
2004 }
2005
2006 /// Margin on end of widget, horizontally. This property supports
2007 /// left-to-right and right-to-left text directions.
2008 ///
2009 /// This property adds margin outside of the widget's normal size
2010 /// request, the margin will be added in addition to the size from
2011 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
2012 pub fn margin_end(self, margin_end: i32) -> Self {
2013 Self {
2014 builder: self.builder.property("margin-end", margin_end),
2015 }
2016 }
2017
2018 /// Margin on start of widget, horizontally. This property supports
2019 /// left-to-right and right-to-left text directions.
2020 ///
2021 /// This property adds margin outside of the widget's normal size
2022 /// request, the margin will be added in addition to the size from
2023 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
2024 pub fn margin_start(self, margin_start: i32) -> Self {
2025 Self {
2026 builder: self.builder.property("margin-start", margin_start),
2027 }
2028 }
2029
2030 /// Margin on top side of widget.
2031 ///
2032 /// This property adds margin outside of the widget's normal size
2033 /// request, the margin will be added in addition to the size from
2034 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
2035 pub fn margin_top(self, margin_top: i32) -> Self {
2036 Self {
2037 builder: self.builder.property("margin-top", margin_top),
2038 }
2039 }
2040
2041 pub fn name(self, name: impl Into<glib::GString>) -> Self {
2042 Self {
2043 builder: self.builder.property("name", name.into()),
2044 }
2045 }
2046
2047 pub fn no_show_all(self, no_show_all: bool) -> Self {
2048 Self {
2049 builder: self.builder.property("no-show-all", no_show_all),
2050 }
2051 }
2052
2053 /// The requested opacity of the widget. See [`WidgetExt::set_opacity()`][crate::prelude::WidgetExt::set_opacity()] for
2054 /// more details about window opacity.
2055 ///
2056 /// Before 3.8 this was only available in GtkWindow
2057 pub fn opacity(self, opacity: f64) -> Self {
2058 Self {
2059 builder: self.builder.property("opacity", opacity),
2060 }
2061 }
2062
2063 pub fn parent(self, parent: &impl IsA<Container>) -> Self {
2064 Self {
2065 builder: self.builder.property("parent", parent.clone().upcast()),
2066 }
2067 }
2068
2069 pub fn receives_default(self, receives_default: bool) -> Self {
2070 Self {
2071 builder: self.builder.property("receives-default", receives_default),
2072 }
2073 }
2074
2075 pub fn sensitive(self, sensitive: bool) -> Self {
2076 Self {
2077 builder: self.builder.property("sensitive", sensitive),
2078 }
2079 }
2080
2081 /// Sets the text of tooltip to be the given string, which is marked up
2082 /// with the [Pango text markup language][PangoMarkupFormat].
2083 /// Also see [`Tooltip::set_markup()`][crate::Tooltip::set_markup()].
2084 ///
2085 /// This is a convenience property which will take care of getting the
2086 /// tooltip shown if the given string is not [`None`]: [`has-tooltip`][struct@crate::Widget#has-tooltip]
2087 /// will automatically be set to [`true`] and there will be taken care of
2088 /// [`query-tooltip`][struct@crate::Widget#query-tooltip] in the default signal handler.
2089 ///
2090 /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and [`tooltip-markup`][struct@crate::Widget#tooltip-markup]
2091 /// are set, the last one wins.
2092 pub fn tooltip_markup(self, tooltip_markup: impl Into<glib::GString>) -> Self {
2093 Self {
2094 builder: self
2095 .builder
2096 .property("tooltip-markup", tooltip_markup.into()),
2097 }
2098 }
2099
2100 /// Sets the text of tooltip to be the given string.
2101 ///
2102 /// Also see [`Tooltip::set_text()`][crate::Tooltip::set_text()].
2103 ///
2104 /// This is a convenience property which will take care of getting the
2105 /// tooltip shown if the given string is not [`None`]: [`has-tooltip`][struct@crate::Widget#has-tooltip]
2106 /// will automatically be set to [`true`] and there will be taken care of
2107 /// [`query-tooltip`][struct@crate::Widget#query-tooltip] in the default signal handler.
2108 ///
2109 /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and [`tooltip-markup`][struct@crate::Widget#tooltip-markup]
2110 /// are set, the last one wins.
2111 pub fn tooltip_text(self, tooltip_text: impl Into<glib::GString>) -> Self {
2112 Self {
2113 builder: self.builder.property("tooltip-text", tooltip_text.into()),
2114 }
2115 }
2116
2117 /// How to distribute vertical space if widget gets extra space, see [`Align`][crate::Align]
2118 pub fn valign(self, valign: Align) -> Self {
2119 Self {
2120 builder: self.builder.property("valign", valign),
2121 }
2122 }
2123
2124 /// Whether to expand vertically. See [`WidgetExt::set_vexpand()`][crate::prelude::WidgetExt::set_vexpand()].
2125 pub fn vexpand(self, vexpand: bool) -> Self {
2126 Self {
2127 builder: self.builder.property("vexpand", vexpand),
2128 }
2129 }
2130
2131 /// Whether to use the [`vexpand`][struct@crate::Widget#vexpand] property. See [`WidgetExt::is_vexpand_set()`][crate::prelude::WidgetExt::is_vexpand_set()].
2132 pub fn vexpand_set(self, vexpand_set: bool) -> Self {
2133 Self {
2134 builder: self.builder.property("vexpand-set", vexpand_set),
2135 }
2136 }
2137
2138 pub fn visible(self, visible: bool) -> Self {
2139 Self {
2140 builder: self.builder.property("visible", visible),
2141 }
2142 }
2143
2144 pub fn width_request(self, width_request: i32) -> Self {
2145 Self {
2146 builder: self.builder.property("width-request", width_request),
2147 }
2148 }
2149
2150 // rustdoc-stripper-ignore-next
2151 /// Build the [`Window`].
2152 #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"]
2153 pub fn build(self) -> Window {
2154 self.builder.build()
2155 }
2156}
2157
2158mod sealed {
2159 pub trait Sealed {}
2160 impl<T: super::IsA<super::Window>> Sealed for T {}
2161}
2162
2163/// Trait containing all [`struct@Window`] methods.
2164///
2165/// # Implementors
2166///
2167/// [`ApplicationWindow`][struct@crate::ApplicationWindow], [`Assistant`][struct@crate::Assistant], [`Dialog`][struct@crate::Dialog], [`OffscreenWindow`][struct@crate::OffscreenWindow], [`Plug`][struct@crate::Plug], [`ShortcutsWindow`][struct@crate::ShortcutsWindow], [`Window`][struct@crate::Window]
2168pub trait GtkWindowExt: IsA<Window> + sealed::Sealed + 'static {
2169 /// Activates the default widget for the window, unless the current
2170 /// focused widget has been configured to receive the default action
2171 /// (see [`WidgetExt::set_receives_default()`][crate::prelude::WidgetExt::set_receives_default()]), in which case the
2172 /// focused widget is activated.
2173 ///
2174 /// # Returns
2175 ///
2176 /// [`true`] if a widget got activated.
2177 #[doc(alias = "gtk_window_activate_default")]
2178 fn activate_default(&self) -> bool {
2179 unsafe {
2180 from_glib(ffi::gtk_window_activate_default(
2181 self.as_ref().to_glib_none().0,
2182 ))
2183 }
2184 }
2185
2186 /// Activates the current focused widget within the window.
2187 ///
2188 /// # Returns
2189 ///
2190 /// [`true`] if a widget got activated.
2191 #[doc(alias = "gtk_window_activate_focus")]
2192 fn activate_focus(&self) -> bool {
2193 unsafe {
2194 from_glib(ffi::gtk_window_activate_focus(
2195 self.as_ref().to_glib_none().0,
2196 ))
2197 }
2198 }
2199
2200 /// Activates mnemonics and accelerators for this [`Window`][crate::Window]. This is normally
2201 /// called by the default ::key_press_event handler for toplevel windows,
2202 /// however in some cases it may be useful to call this directly when
2203 /// overriding the standard key handling for a toplevel window.
2204 /// ## `event`
2205 /// a [`gdk::EventKey`][crate::gdk::EventKey]
2206 ///
2207 /// # Returns
2208 ///
2209 /// [`true`] if a mnemonic or accelerator was found and activated.
2210 #[doc(alias = "gtk_window_activate_key")]
2211 fn activate_key(&self, event: &gdk::EventKey) -> bool {
2212 unsafe {
2213 from_glib(ffi::gtk_window_activate_key(
2214 self.as_ref().to_glib_none().0,
2215 mut_override(event.to_glib_none().0),
2216 ))
2217 }
2218 }
2219
2220 /// Associate `accel_group` with `self`, such that calling
2221 /// [`accel_groups_activate()`][crate::accel_groups_activate()] on `self` will activate accelerators
2222 /// in `accel_group`.
2223 /// ## `accel_group`
2224 /// a [`AccelGroup`][crate::AccelGroup]
2225 #[doc(alias = "gtk_window_add_accel_group")]
2226 fn add_accel_group(&self, accel_group: &impl IsA<AccelGroup>) {
2227 unsafe {
2228 ffi::gtk_window_add_accel_group(
2229 self.as_ref().to_glib_none().0,
2230 accel_group.as_ref().to_glib_none().0,
2231 );
2232 }
2233 }
2234
2235 /// Adds a mnemonic to this window.
2236 /// ## `keyval`
2237 /// the mnemonic
2238 /// ## `target`
2239 /// the widget that gets activated by the mnemonic
2240 #[doc(alias = "gtk_window_add_mnemonic")]
2241 fn add_mnemonic(&self, keyval: u32, target: &impl IsA<Widget>) {
2242 unsafe {
2243 ffi::gtk_window_add_mnemonic(
2244 self.as_ref().to_glib_none().0,
2245 keyval,
2246 target.as_ref().to_glib_none().0,
2247 );
2248 }
2249 }
2250
2251 /// Starts moving a window. This function is used if an application has
2252 /// window movement grips. When GDK can support it, the window movement
2253 /// will be done using the standard mechanism for the
2254 /// [window manager][gtk-X11-arch] or windowing
2255 /// system. Otherwise, GDK will try to emulate window movement,
2256 /// potentially not all that well, depending on the windowing system.
2257 /// ## `button`
2258 /// mouse button that initiated the drag
2259 /// ## `root_x`
2260 /// X position where the user clicked to initiate the drag, in root window coordinates
2261 /// ## `root_y`
2262 /// Y position where the user clicked to initiate the drag
2263 /// ## `timestamp`
2264 /// timestamp from the click event that initiated the drag
2265 #[doc(alias = "gtk_window_begin_move_drag")]
2266 fn begin_move_drag(&self, button: i32, root_x: i32, root_y: i32, timestamp: u32) {
2267 unsafe {
2268 ffi::gtk_window_begin_move_drag(
2269 self.as_ref().to_glib_none().0,
2270 button,
2271 root_x,
2272 root_y,
2273 timestamp,
2274 );
2275 }
2276 }
2277
2278 /// Starts resizing a window. This function is used if an application
2279 /// has window resizing controls. When GDK can support it, the resize
2280 /// will be done using the standard mechanism for the
2281 /// [window manager][gtk-X11-arch] or windowing
2282 /// system. Otherwise, GDK will try to emulate window resizing,
2283 /// potentially not all that well, depending on the windowing system.
2284 /// ## `edge`
2285 /// position of the resize control
2286 /// ## `button`
2287 /// mouse button that initiated the drag
2288 /// ## `root_x`
2289 /// X position where the user clicked to initiate the drag, in root window coordinates
2290 /// ## `root_y`
2291 /// Y position where the user clicked to initiate the drag
2292 /// ## `timestamp`
2293 /// timestamp from the click event that initiated the drag
2294 #[doc(alias = "gtk_window_begin_resize_drag")]
2295 fn begin_resize_drag(
2296 &self,
2297 edge: gdk::WindowEdge,
2298 button: i32,
2299 root_x: i32,
2300 root_y: i32,
2301 timestamp: u32,
2302 ) {
2303 unsafe {
2304 ffi::gtk_window_begin_resize_drag(
2305 self.as_ref().to_glib_none().0,
2306 edge.into_glib(),
2307 button,
2308 root_x,
2309 root_y,
2310 timestamp,
2311 );
2312 }
2313 }
2314
2315 /// Requests that the window is closed, similar to what happens
2316 /// when a window manager close button is clicked.
2317 ///
2318 /// This function can be used with close buttons in custom
2319 /// titlebars.
2320 #[doc(alias = "gtk_window_close")]
2321 fn close(&self) {
2322 unsafe {
2323 ffi::gtk_window_close(self.as_ref().to_glib_none().0);
2324 }
2325 }
2326
2327 /// Asks to deiconify (i.e. unminimize) the specified `self`. Note
2328 /// that you shouldn’t assume the window is definitely deiconified
2329 /// afterward, because other entities (e.g. the user or
2330 /// [window manager][gtk-X11-arch])) could iconify it
2331 /// again before your code which assumes deiconification gets to run.
2332 ///
2333 /// You can track iconification via the “window-state-event” signal
2334 /// on [`Widget`][crate::Widget].
2335 #[doc(alias = "gtk_window_deiconify")]
2336 fn deiconify(&self) {
2337 unsafe {
2338 ffi::gtk_window_deiconify(self.as_ref().to_glib_none().0);
2339 }
2340 }
2341
2342 /// Asks to place `self` in the fullscreen state. Note that you
2343 /// shouldn’t assume the window is definitely full screen afterward,
2344 /// because other entities (e.g. the user or
2345 /// [window manager][gtk-X11-arch]) could unfullscreen it
2346 /// again, and not all window managers honor requests to fullscreen
2347 /// windows. But normally the window will end up fullscreen. Just
2348 /// don’t write code that crashes if not.
2349 ///
2350 /// You can track the fullscreen state via the “window-state-event” signal
2351 /// on [`Widget`][crate::Widget].
2352 #[doc(alias = "gtk_window_fullscreen")]
2353 fn fullscreen(&self) {
2354 unsafe {
2355 ffi::gtk_window_fullscreen(self.as_ref().to_glib_none().0);
2356 }
2357 }
2358
2359 /// Asks to place `self` in the fullscreen state. Note that you shouldn't assume
2360 /// the window is definitely full screen afterward.
2361 ///
2362 /// You can track the fullscreen state via the "window-state-event" signal
2363 /// on [`Widget`][crate::Widget].
2364 /// ## `screen`
2365 /// a [`gdk::Screen`][crate::gdk::Screen] to draw to
2366 /// ## `monitor`
2367 /// which monitor to go fullscreen on
2368 #[doc(alias = "gtk_window_fullscreen_on_monitor")]
2369 fn fullscreen_on_monitor(&self, screen: &gdk::Screen, monitor: i32) {
2370 unsafe {
2371 ffi::gtk_window_fullscreen_on_monitor(
2372 self.as_ref().to_glib_none().0,
2373 screen.to_glib_none().0,
2374 monitor,
2375 );
2376 }
2377 }
2378
2379 /// Gets the value set by [`set_accept_focus()`][Self::set_accept_focus()].
2380 ///
2381 /// # Returns
2382 ///
2383 /// [`true`] if window should receive the input focus
2384 #[doc(alias = "gtk_window_get_accept_focus")]
2385 #[doc(alias = "get_accept_focus")]
2386 fn accepts_focus(&self) -> bool {
2387 unsafe {
2388 from_glib(ffi::gtk_window_get_accept_focus(
2389 self.as_ref().to_glib_none().0,
2390 ))
2391 }
2392 }
2393
2394 /// Gets the [`Application`][crate::Application] associated with the window (if any).
2395 ///
2396 /// # Returns
2397 ///
2398 /// a [`Application`][crate::Application], or [`None`]
2399 #[doc(alias = "gtk_window_get_application")]
2400 #[doc(alias = "get_application")]
2401 fn application(&self) -> Option<Application> {
2402 unsafe {
2403 from_glib_none(ffi::gtk_window_get_application(
2404 self.as_ref().to_glib_none().0,
2405 ))
2406 }
2407 }
2408
2409 /// Fetches the attach widget for this window. See
2410 /// [`set_attached_to()`][Self::set_attached_to()].
2411 ///
2412 /// # Returns
2413 ///
2414 /// the widget where the window
2415 /// is attached, or [`None`] if the window is not attached to any widget.
2416 #[doc(alias = "gtk_window_get_attached_to")]
2417 #[doc(alias = "get_attached_to")]
2418 fn attached_to(&self) -> Option<Widget> {
2419 unsafe {
2420 from_glib_none(ffi::gtk_window_get_attached_to(
2421 self.as_ref().to_glib_none().0,
2422 ))
2423 }
2424 }
2425
2426 /// Returns whether the window has been set to have decorations
2427 /// such as a title bar via [`set_decorated()`][Self::set_decorated()].
2428 ///
2429 /// # Returns
2430 ///
2431 /// [`true`] if the window has been set to have decorations
2432 #[doc(alias = "gtk_window_get_decorated")]
2433 #[doc(alias = "get_decorated")]
2434 fn is_decorated(&self) -> bool {
2435 unsafe {
2436 from_glib(ffi::gtk_window_get_decorated(
2437 self.as_ref().to_glib_none().0,
2438 ))
2439 }
2440 }
2441
2442 /// Gets the default size of the window. A value of -1 for the width or
2443 /// height indicates that a default size has not been explicitly set
2444 /// for that dimension, so the “natural” size of the window will be
2445 /// used.
2446 ///
2447 /// # Returns
2448 ///
2449 ///
2450 /// ## `width`
2451 /// location to store the default width, or [`None`]
2452 ///
2453 /// ## `height`
2454 /// location to store the default height, or [`None`]
2455 #[doc(alias = "gtk_window_get_default_size")]
2456 #[doc(alias = "get_default_size")]
2457 fn default_size(&self) -> (i32, i32) {
2458 unsafe {
2459 let mut width = mem::MaybeUninit::uninit();
2460 let mut height = mem::MaybeUninit::uninit();
2461 ffi::gtk_window_get_default_size(
2462 self.as_ref().to_glib_none().0,
2463 width.as_mut_ptr(),
2464 height.as_mut_ptr(),
2465 );
2466 (width.assume_init(), height.assume_init())
2467 }
2468 }
2469
2470 /// Returns the default widget for `self`. See
2471 /// [`set_default()`][Self::set_default()] for more details.
2472 ///
2473 /// # Returns
2474 ///
2475 /// the default widget, or [`None`]
2476 /// if there is none.
2477 #[doc(alias = "gtk_window_get_default_widget")]
2478 #[doc(alias = "get_default_widget")]
2479 fn default_widget(&self) -> Option<Widget> {
2480 unsafe {
2481 from_glib_none(ffi::gtk_window_get_default_widget(
2482 self.as_ref().to_glib_none().0,
2483 ))
2484 }
2485 }
2486
2487 /// Returns whether the window has been set to have a close button
2488 /// via [`set_deletable()`][Self::set_deletable()].
2489 ///
2490 /// # Returns
2491 ///
2492 /// [`true`] if the window has been set to have a close button
2493 #[doc(alias = "gtk_window_get_deletable")]
2494 #[doc(alias = "get_deletable")]
2495 fn is_deletable(&self) -> bool {
2496 unsafe {
2497 from_glib(ffi::gtk_window_get_deletable(
2498 self.as_ref().to_glib_none().0,
2499 ))
2500 }
2501 }
2502
2503 /// Returns whether the window will be destroyed with its transient parent. See
2504 /// gtk_window_set_destroy_with_parent ().
2505 ///
2506 /// # Returns
2507 ///
2508 /// [`true`] if the window will be destroyed with its transient parent.
2509 #[doc(alias = "gtk_window_get_destroy_with_parent")]
2510 #[doc(alias = "get_destroy_with_parent")]
2511 fn must_destroy_with_parent(&self) -> bool {
2512 unsafe {
2513 from_glib(ffi::gtk_window_get_destroy_with_parent(
2514 self.as_ref().to_glib_none().0,
2515 ))
2516 }
2517 }
2518
2519 /// Retrieves the current focused widget within the window.
2520 /// Note that this is the widget that would have the focus
2521 /// if the toplevel window focused; if the toplevel window
2522 /// is not focused then `gtk_widget_has_focus (widget)` will
2523 /// not be [`true`] for the widget.
2524 ///
2525 /// # Returns
2526 ///
2527 /// the currently focused widget,
2528 /// or [`None`] if there is none.
2529 #[doc(alias = "gtk_window_get_focus")]
2530 #[doc(alias = "get_focus")]
2531 fn focused_widget(&self) -> Option<Widget> {
2532 unsafe { from_glib_none(ffi::gtk_window_get_focus(self.as_ref().to_glib_none().0)) }
2533 }
2534
2535 /// Gets the value set by [`set_focus_on_map()`][Self::set_focus_on_map()].
2536 ///
2537 /// # Returns
2538 ///
2539 /// [`true`] if window should receive the input focus when
2540 /// mapped.
2541 #[doc(alias = "gtk_window_get_focus_on_map")]
2542 #[doc(alias = "get_focus_on_map")]
2543 fn gets_focus_on_map(&self) -> bool {
2544 unsafe {
2545 from_glib(ffi::gtk_window_get_focus_on_map(
2546 self.as_ref().to_glib_none().0,
2547 ))
2548 }
2549 }
2550
2551 /// Gets the value of the [`focus-visible`][struct@crate::Window#focus-visible] property.
2552 ///
2553 /// # Returns
2554 ///
2555 /// [`true`] if “focus rectangles” are supposed to be visible
2556 /// in this window.
2557 #[doc(alias = "gtk_window_get_focus_visible")]
2558 #[doc(alias = "get_focus_visible")]
2559 fn gets_focus_visible(&self) -> bool {
2560 unsafe {
2561 from_glib(ffi::gtk_window_get_focus_visible(
2562 self.as_ref().to_glib_none().0,
2563 ))
2564 }
2565 }
2566
2567 /// Gets the value set by [`set_gravity()`][Self::set_gravity()].
2568 ///
2569 /// # Returns
2570 ///
2571 /// window gravity
2572 #[doc(alias = "gtk_window_get_gravity")]
2573 #[doc(alias = "get_gravity")]
2574 fn gravity(&self) -> gdk::Gravity {
2575 unsafe { from_glib(ffi::gtk_window_get_gravity(self.as_ref().to_glib_none().0)) }
2576 }
2577
2578 /// Returns the group for `self` or the default group, if
2579 /// `self` is [`None`] or if `self` does not have an explicit
2580 /// window group.
2581 ///
2582 /// # Returns
2583 ///
2584 /// the [`WindowGroup`][crate::WindowGroup] for a window or the default group
2585 #[doc(alias = "gtk_window_get_group")]
2586 #[doc(alias = "get_group")]
2587 fn group(&self) -> Option<WindowGroup> {
2588 unsafe { from_glib_none(ffi::gtk_window_get_group(self.as_ref().to_glib_none().0)) }
2589 }
2590
2591 /// Returns whether the window has requested to have its titlebar hidden
2592 /// when maximized. See gtk_window_set_hide_titlebar_when_maximized ().
2593 ///
2594 /// # Returns
2595 ///
2596 /// [`true`] if the window has requested to have its titlebar
2597 /// hidden when maximized
2598 #[doc(alias = "gtk_window_get_hide_titlebar_when_maximized")]
2599 #[doc(alias = "get_hide_titlebar_when_maximized")]
2600 fn hides_titlebar_when_maximized(&self) -> bool {
2601 unsafe {
2602 from_glib(ffi::gtk_window_get_hide_titlebar_when_maximized(
2603 self.as_ref().to_glib_none().0,
2604 ))
2605 }
2606 }
2607
2608 /// Gets the value set by [`set_icon()`][Self::set_icon()] (or if you've
2609 /// called [`set_icon_list()`][Self::set_icon_list()], gets the first icon in
2610 /// the icon list).
2611 ///
2612 /// # Returns
2613 ///
2614 /// icon for window or [`None`] if none
2615 #[doc(alias = "gtk_window_get_icon")]
2616 #[doc(alias = "get_icon")]
2617 fn icon(&self) -> Option<gdk_pixbuf::Pixbuf> {
2618 unsafe { from_glib_none(ffi::gtk_window_get_icon(self.as_ref().to_glib_none().0)) }
2619 }
2620
2621 /// Retrieves the list of icons set by [`set_icon_list()`][Self::set_icon_list()].
2622 /// The list is copied, but the reference count on each
2623 /// member won’t be incremented.
2624 ///
2625 /// # Returns
2626 ///
2627 /// copy of window’s icon list
2628 #[doc(alias = "gtk_window_get_icon_list")]
2629 #[doc(alias = "get_icon_list")]
2630 fn icon_list(&self) -> Vec<gdk_pixbuf::Pixbuf> {
2631 unsafe {
2632 FromGlibPtrContainer::from_glib_container(ffi::gtk_window_get_icon_list(
2633 self.as_ref().to_glib_none().0,
2634 ))
2635 }
2636 }
2637
2638 /// Returns the name of the themed icon for the window,
2639 /// see [`set_icon_name()`][Self::set_icon_name()].
2640 ///
2641 /// # Returns
2642 ///
2643 /// the icon name or [`None`] if the window has
2644 /// no themed icon
2645 #[doc(alias = "gtk_window_get_icon_name")]
2646 #[doc(alias = "get_icon_name")]
2647 fn icon_name(&self) -> Option<glib::GString> {
2648 unsafe {
2649 from_glib_none(ffi::gtk_window_get_icon_name(
2650 self.as_ref().to_glib_none().0,
2651 ))
2652 }
2653 }
2654
2655 /// Returns the mnemonic modifier for this window. See
2656 /// [`set_mnemonic_modifier()`][Self::set_mnemonic_modifier()].
2657 ///
2658 /// # Returns
2659 ///
2660 /// the modifier mask used to activate
2661 /// mnemonics on this window.
2662 #[doc(alias = "gtk_window_get_mnemonic_modifier")]
2663 #[doc(alias = "get_mnemonic_modifier")]
2664 fn mnemonic_modifier(&self) -> gdk::ModifierType {
2665 unsafe {
2666 from_glib(ffi::gtk_window_get_mnemonic_modifier(
2667 self.as_ref().to_glib_none().0,
2668 ))
2669 }
2670 }
2671
2672 /// Gets the value of the [`mnemonics-visible`][struct@crate::Window#mnemonics-visible] property.
2673 ///
2674 /// # Returns
2675 ///
2676 /// [`true`] if mnemonics are supposed to be visible
2677 /// in this window.
2678 #[doc(alias = "gtk_window_get_mnemonics_visible")]
2679 #[doc(alias = "get_mnemonics_visible")]
2680 fn is_mnemonics_visible(&self) -> bool {
2681 unsafe {
2682 from_glib(ffi::gtk_window_get_mnemonics_visible(
2683 self.as_ref().to_glib_none().0,
2684 ))
2685 }
2686 }
2687
2688 /// Returns whether the window is modal. See [`set_modal()`][Self::set_modal()].
2689 ///
2690 /// # Returns
2691 ///
2692 /// [`true`] if the window is set to be modal and
2693 /// establishes a grab when shown
2694 #[doc(alias = "gtk_window_get_modal")]
2695 #[doc(alias = "get_modal")]
2696 fn is_modal(&self) -> bool {
2697 unsafe { from_glib(ffi::gtk_window_get_modal(self.as_ref().to_glib_none().0)) }
2698 }
2699
2700 /// This function returns the position you need to pass to
2701 /// [`move_()`][Self::move_()] to keep `self` in its current position.
2702 /// This means that the meaning of the returned value varies with
2703 /// window gravity. See [`move_()`][Self::move_()] for more details.
2704 ///
2705 /// The reliability of this function depends on the windowing system
2706 /// currently in use. Some windowing systems, such as Wayland, do not
2707 /// support a global coordinate system, and thus the position of the
2708 /// window will always be (0, 0). Others, like X11, do not have a reliable
2709 /// way to obtain the geometry of the decorations of a window if they are
2710 /// provided by the window manager. Additionally, on X11, window manager
2711 /// have been known to mismanage window gravity, which result in windows
2712 /// moving even if you use the coordinates of the current position as
2713 /// returned by this function.
2714 ///
2715 /// If you haven’t changed the window gravity, its gravity will be
2716 /// [`gdk::Gravity::NorthWest`][crate::gdk::Gravity::NorthWest]. This means that [`position()`][Self::position()]
2717 /// gets the position of the top-left corner of the window manager
2718 /// frame for the window. [`move_()`][Self::move_()] sets the position of this
2719 /// same top-left corner.
2720 ///
2721 /// If a window has gravity [`gdk::Gravity::Static`][crate::gdk::Gravity::Static] the window manager
2722 /// frame is not relevant, and thus [`position()`][Self::position()] will
2723 /// always produce accurate results. However you can’t use static
2724 /// gravity to do things like place a window in a corner of the screen,
2725 /// because static gravity ignores the window manager decorations.
2726 ///
2727 /// Ideally, this function should return appropriate values if the
2728 /// window has client side decorations, assuming that the windowing
2729 /// system supports global coordinates.
2730 ///
2731 /// In practice, saving the window position should not be left to
2732 /// applications, as they lack enough knowledge of the windowing
2733 /// system and the window manager state to effectively do so. The
2734 /// appropriate way to implement saving the window position is to
2735 /// use a platform-specific protocol, wherever that is available.
2736 ///
2737 /// # Returns
2738 ///
2739 ///
2740 /// ## `root_x`
2741 /// return location for X coordinate of
2742 /// gravity-determined reference point, or [`None`]
2743 ///
2744 /// ## `root_y`
2745 /// return location for Y coordinate of
2746 /// gravity-determined reference point, or [`None`]
2747 #[doc(alias = "gtk_window_get_position")]
2748 #[doc(alias = "get_position")]
2749 fn position(&self) -> (i32, i32) {
2750 unsafe {
2751 let mut root_x = mem::MaybeUninit::uninit();
2752 let mut root_y = mem::MaybeUninit::uninit();
2753 ffi::gtk_window_get_position(
2754 self.as_ref().to_glib_none().0,
2755 root_x.as_mut_ptr(),
2756 root_y.as_mut_ptr(),
2757 );
2758 (root_x.assume_init(), root_y.assume_init())
2759 }
2760 }
2761
2762 /// Gets the value set by [`set_resizable()`][Self::set_resizable()].
2763 ///
2764 /// # Returns
2765 ///
2766 /// [`true`] if the user can resize the window
2767 #[doc(alias = "gtk_window_get_resizable")]
2768 #[doc(alias = "get_resizable")]
2769 fn is_resizable(&self) -> bool {
2770 unsafe {
2771 from_glib(ffi::gtk_window_get_resizable(
2772 self.as_ref().to_glib_none().0,
2773 ))
2774 }
2775 }
2776
2777 /// Returns the role of the window. See [`set_role()`][Self::set_role()] for
2778 /// further explanation.
2779 ///
2780 /// # Returns
2781 ///
2782 /// the role of the window if set, or [`None`]. The
2783 /// returned is owned by the widget and must not be modified or freed.
2784 #[doc(alias = "gtk_window_get_role")]
2785 #[doc(alias = "get_role")]
2786 fn role(&self) -> Option<glib::GString> {
2787 unsafe { from_glib_none(ffi::gtk_window_get_role(self.as_ref().to_glib_none().0)) }
2788 }
2789
2790 /// Returns the [`gdk::Screen`][crate::gdk::Screen] associated with `self`.
2791 ///
2792 /// # Returns
2793 ///
2794 /// a [`gdk::Screen`][crate::gdk::Screen].
2795 #[doc(alias = "gtk_window_get_screen")]
2796 #[doc(alias = "get_screen")]
2797 fn screen(&self) -> Option<gdk::Screen> {
2798 unsafe { from_glib_none(ffi::gtk_window_get_screen(self.as_ref().to_glib_none().0)) }
2799 }
2800
2801 /// Obtains the current size of `self`.
2802 ///
2803 /// If `self` is not visible on screen, this function return the size GTK+
2804 /// will suggest to the [window manager][gtk-X11-arch] for the initial window
2805 /// size (but this is not reliably the same as the size the window manager
2806 /// will actually select). See: [`set_default_size()`][Self::set_default_size()].
2807 ///
2808 /// Depending on the windowing system and the window manager constraints,
2809 /// the size returned by this function may not match the size set using
2810 /// [`resize()`][Self::resize()]; additionally, since [`resize()`][Self::resize()] may be
2811 /// implemented as an asynchronous operation, GTK+ cannot guarantee in any
2812 /// way that this code:
2813 ///
2814 ///
2815 ///
2816 /// **⚠️ The following code is in C ⚠️**
2817 ///
2818 /// ```C
2819 /// // width and height are set elsewhere
2820 /// gtk_window_resize (window, width, height);
2821 ///
2822 /// int new_width, new_height;
2823 /// gtk_window_get_size (window, &new_width, &new_height);
2824 /// ```
2825 ///
2826 /// will result in `new_width` and `new_height` matching `width` and
2827 /// `height`, respectively.
2828 ///
2829 /// This function will return the logical size of the [`Window`][crate::Window],
2830 /// excluding the widgets used in client side decorations; there is,
2831 /// however, no guarantee that the result will be completely accurate
2832 /// because client side decoration may include widgets that depend on
2833 /// the user preferences and that may not be visibile at the time you
2834 /// call this function.
2835 ///
2836 /// The dimensions returned by this function are suitable for being
2837 /// stored across sessions; use [`set_default_size()`][Self::set_default_size()] to
2838 /// restore them when before showing the window.
2839 ///
2840 /// To avoid potential race conditions, you should only call this
2841 /// function in response to a size change notification, for instance
2842 /// inside a handler for the [`size-allocate`][struct@crate::Widget#size-allocate] signal, or
2843 /// inside a handler for the [`configure-event`][struct@crate::Widget#configure-event] signal:
2844 ///
2845 ///
2846 ///
2847 /// **⚠️ The following code is in C ⚠️**
2848 ///
2849 /// ```C
2850 /// static void
2851 /// on_size_allocate (GtkWidget *widget, GtkAllocation *allocation)
2852 /// {
2853 /// int new_width, new_height;
2854 ///
2855 /// gtk_window_get_size (GTK_WINDOW (widget), &new_width, &new_height);
2856 ///
2857 /// ...
2858 /// }
2859 /// ```
2860 ///
2861 /// Note that, if you connect to the [`size-allocate`][struct@crate::Widget#size-allocate] signal,
2862 /// you should not use the dimensions of the `GtkAllocation` passed to
2863 /// the signal handler, as the allocation may contain client side
2864 /// decorations added by GTK+, depending on the windowing system in
2865 /// use.
2866 ///
2867 /// If you are getting a window size in order to position the window
2868 /// on the screen, you should, instead, simply set the window’s semantic
2869 /// type with [`set_type_hint()`][Self::set_type_hint()], which allows the window manager
2870 /// to e.g. center dialogs. Also, if you set the transient parent of
2871 /// dialogs with [`set_transient_for()`][Self::set_transient_for()] window managers will
2872 /// often center the dialog over its parent window. It's much preferred
2873 /// to let the window manager handle these cases rather than doing it
2874 /// yourself, because all apps will behave consistently and according to
2875 /// user or system preferences, if the window manager handles it. Also,
2876 /// the window manager can take into account the size of the window
2877 /// decorations and border that it may add, and of which GTK+ has no
2878 /// knowledge. Additionally, positioning windows in global screen coordinates
2879 /// may not be allowed by the windowing system. For more information,
2880 /// see: [`set_position()`][Self::set_position()].
2881 ///
2882 /// # Returns
2883 ///
2884 ///
2885 /// ## `width`
2886 /// return location for width, or [`None`]
2887 ///
2888 /// ## `height`
2889 /// return location for height, or [`None`]
2890 #[doc(alias = "gtk_window_get_size")]
2891 #[doc(alias = "get_size")]
2892 fn size(&self) -> (i32, i32) {
2893 unsafe {
2894 let mut width = mem::MaybeUninit::uninit();
2895 let mut height = mem::MaybeUninit::uninit();
2896 ffi::gtk_window_get_size(
2897 self.as_ref().to_glib_none().0,
2898 width.as_mut_ptr(),
2899 height.as_mut_ptr(),
2900 );
2901 (width.assume_init(), height.assume_init())
2902 }
2903 }
2904
2905 /// Gets the value set by [`set_skip_pager_hint()`][Self::set_skip_pager_hint()].
2906 ///
2907 /// # Returns
2908 ///
2909 /// [`true`] if window shouldn’t be in pager
2910 #[doc(alias = "gtk_window_get_skip_pager_hint")]
2911 #[doc(alias = "get_skip_pager_hint")]
2912 fn skips_pager_hint(&self) -> bool {
2913 unsafe {
2914 from_glib(ffi::gtk_window_get_skip_pager_hint(
2915 self.as_ref().to_glib_none().0,
2916 ))
2917 }
2918 }
2919
2920 /// Gets the value set by [`set_skip_taskbar_hint()`][Self::set_skip_taskbar_hint()]
2921 ///
2922 /// # Returns
2923 ///
2924 /// [`true`] if window shouldn’t be in taskbar
2925 #[doc(alias = "gtk_window_get_skip_taskbar_hint")]
2926 #[doc(alias = "get_skip_taskbar_hint")]
2927 fn skips_taskbar_hint(&self) -> bool {
2928 unsafe {
2929 from_glib(ffi::gtk_window_get_skip_taskbar_hint(
2930 self.as_ref().to_glib_none().0,
2931 ))
2932 }
2933 }
2934
2935 /// Retrieves the title of the window. See [`set_title()`][Self::set_title()].
2936 ///
2937 /// # Returns
2938 ///
2939 /// the title of the window, or [`None`] if none has
2940 /// been set explicitly. The returned string is owned by the widget
2941 /// and must not be modified or freed.
2942 #[doc(alias = "gtk_window_get_title")]
2943 #[doc(alias = "get_title")]
2944 fn title(&self) -> Option<glib::GString> {
2945 unsafe { from_glib_none(ffi::gtk_window_get_title(self.as_ref().to_glib_none().0)) }
2946 }
2947
2948 /// Returns the custom titlebar that has been set with
2949 /// [`set_titlebar()`][Self::set_titlebar()].
2950 ///
2951 /// # Returns
2952 ///
2953 /// the custom titlebar, or [`None`]
2954 #[doc(alias = "gtk_window_get_titlebar")]
2955 #[doc(alias = "get_titlebar")]
2956 fn titlebar(&self) -> Option<Widget> {
2957 unsafe { from_glib_none(ffi::gtk_window_get_titlebar(self.as_ref().to_glib_none().0)) }
2958 }
2959
2960 /// Fetches the transient parent for this window. See
2961 /// [`set_transient_for()`][Self::set_transient_for()].
2962 ///
2963 /// # Returns
2964 ///
2965 /// the transient parent for this
2966 /// window, or [`None`] if no transient parent has been set.
2967 #[doc(alias = "gtk_window_get_transient_for")]
2968 #[doc(alias = "get_transient_for")]
2969 #[must_use]
2970 fn transient_for(&self) -> Option<Window> {
2971 unsafe {
2972 from_glib_none(ffi::gtk_window_get_transient_for(
2973 self.as_ref().to_glib_none().0,
2974 ))
2975 }
2976 }
2977
2978 /// Gets the type hint for this window. See [`set_type_hint()`][Self::set_type_hint()].
2979 ///
2980 /// # Returns
2981 ///
2982 /// the type hint for `self`.
2983 #[doc(alias = "gtk_window_get_type_hint")]
2984 #[doc(alias = "get_type_hint")]
2985 fn type_hint(&self) -> gdk::WindowTypeHint {
2986 unsafe {
2987 from_glib(ffi::gtk_window_get_type_hint(
2988 self.as_ref().to_glib_none().0,
2989 ))
2990 }
2991 }
2992
2993 /// Gets the value set by [`set_urgency_hint()`][Self::set_urgency_hint()]
2994 ///
2995 /// # Returns
2996 ///
2997 /// [`true`] if window is urgent
2998 #[doc(alias = "gtk_window_get_urgency_hint")]
2999 #[doc(alias = "get_urgency_hint")]
3000 fn is_urgency_hint(&self) -> bool {
3001 unsafe {
3002 from_glib(ffi::gtk_window_get_urgency_hint(
3003 self.as_ref().to_glib_none().0,
3004 ))
3005 }
3006 }
3007
3008 /// Gets the type of the window. See [`WindowType`][crate::WindowType].
3009 ///
3010 /// # Returns
3011 ///
3012 /// the type of the window
3013 #[doc(alias = "gtk_window_get_window_type")]
3014 #[doc(alias = "get_window_type")]
3015 fn window_type(&self) -> WindowType {
3016 unsafe {
3017 from_glib(ffi::gtk_window_get_window_type(
3018 self.as_ref().to_glib_none().0,
3019 ))
3020 }
3021 }
3022
3023 /// Returns whether `self` has an explicit window group.
3024 ///
3025 /// # Returns
3026 ///
3027 /// [`true`] if `self` has an explicit window group.
3028 ///
3029 /// Since 2.22
3030 #[doc(alias = "gtk_window_has_group")]
3031 fn has_group(&self) -> bool {
3032 unsafe { from_glib(ffi::gtk_window_has_group(self.as_ref().to_glib_none().0)) }
3033 }
3034
3035 /// Returns whether the input focus is within this GtkWindow.
3036 /// For real toplevel windows, this is identical to [`is_active()`][Self::is_active()],
3037 /// but for embedded windows, like [`Plug`][crate::Plug], the results will differ.
3038 ///
3039 /// # Returns
3040 ///
3041 /// [`true`] if the input focus is within this GtkWindow
3042 #[doc(alias = "gtk_window_has_toplevel_focus")]
3043 fn has_toplevel_focus(&self) -> bool {
3044 unsafe {
3045 from_glib(ffi::gtk_window_has_toplevel_focus(
3046 self.as_ref().to_glib_none().0,
3047 ))
3048 }
3049 }
3050
3051 /// Asks to iconify (i.e. minimize) the specified `self`. Note that
3052 /// you shouldn’t assume the window is definitely iconified afterward,
3053 /// because other entities (e.g. the user or
3054 /// [window manager][gtk-X11-arch]) could deiconify it
3055 /// again, or there may not be a window manager in which case
3056 /// iconification isn’t possible, etc. But normally the window will end
3057 /// up iconified. Just don’t write code that crashes if not.
3058 ///
3059 /// It’s permitted to call this function before showing a window,
3060 /// in which case the window will be iconified before it ever appears
3061 /// onscreen.
3062 ///
3063 /// You can track iconification via the “window-state-event” signal
3064 /// on [`Widget`][crate::Widget].
3065 #[doc(alias = "gtk_window_iconify")]
3066 fn iconify(&self) {
3067 unsafe {
3068 ffi::gtk_window_iconify(self.as_ref().to_glib_none().0);
3069 }
3070 }
3071
3072 /// Returns whether the window is part of the current active toplevel.
3073 /// (That is, the toplevel window receiving keystrokes.)
3074 /// The return value is [`true`] if the window is active toplevel
3075 /// itself, but also if it is, say, a [`Plug`][crate::Plug] embedded in the active toplevel.
3076 /// You might use this function if you wanted to draw a widget
3077 /// differently in an active window from a widget in an inactive window.
3078 /// See [`has_toplevel_focus()`][Self::has_toplevel_focus()]
3079 ///
3080 /// # Returns
3081 ///
3082 /// [`true`] if the window part of the current active window.
3083 #[doc(alias = "gtk_window_is_active")]
3084 fn is_active(&self) -> bool {
3085 unsafe { from_glib(ffi::gtk_window_is_active(self.as_ref().to_glib_none().0)) }
3086 }
3087
3088 /// Retrieves the current maximized state of `self`.
3089 ///
3090 /// Note that since maximization is ultimately handled by the window
3091 /// manager and happens asynchronously to an application request, you
3092 /// shouldn’t assume the return value of this function changing
3093 /// immediately (or at all), as an effect of calling
3094 /// [`maximize()`][Self::maximize()] or [`unmaximize()`][Self::unmaximize()].
3095 ///
3096 /// # Returns
3097 ///
3098 /// whether the window has a maximized state.
3099 #[doc(alias = "gtk_window_is_maximized")]
3100 fn is_maximized(&self) -> bool {
3101 unsafe { from_glib(ffi::gtk_window_is_maximized(self.as_ref().to_glib_none().0)) }
3102 }
3103
3104 /// Asks to maximize `self`, so that it becomes full-screen. Note that
3105 /// you shouldn’t assume the window is definitely maximized afterward,
3106 /// because other entities (e.g. the user or
3107 /// [window manager][gtk-X11-arch]) could unmaximize it
3108 /// again, and not all window managers support maximization. But
3109 /// normally the window will end up maximized. Just don’t write code
3110 /// that crashes if not.
3111 ///
3112 /// It’s permitted to call this function before showing a window,
3113 /// in which case the window will be maximized when it appears onscreen
3114 /// initially.
3115 ///
3116 /// You can track maximization via the “window-state-event” signal
3117 /// on [`Widget`][crate::Widget], or by listening to notifications on the
3118 /// [`is-maximized`][struct@crate::Window#is-maximized] property.
3119 #[doc(alias = "gtk_window_maximize")]
3120 fn maximize(&self) {
3121 unsafe {
3122 ffi::gtk_window_maximize(self.as_ref().to_glib_none().0);
3123 }
3124 }
3125
3126 /// Activates the targets associated with the mnemonic.
3127 /// ## `keyval`
3128 /// the mnemonic
3129 /// ## `modifier`
3130 /// the modifiers
3131 ///
3132 /// # Returns
3133 ///
3134 /// [`true`] if the activation is done.
3135 #[doc(alias = "gtk_window_mnemonic_activate")]
3136 fn mnemonic_activate(&self, keyval: u32, modifier: gdk::ModifierType) -> bool {
3137 unsafe {
3138 from_glib(ffi::gtk_window_mnemonic_activate(
3139 self.as_ref().to_glib_none().0,
3140 keyval,
3141 modifier.into_glib(),
3142 ))
3143 }
3144 }
3145
3146 #[doc(alias = "gtk_window_move")]
3147 #[doc(alias = "move")]
3148 fn move_(&self, x: i32, y: i32) {
3149 unsafe {
3150 ffi::gtk_window_move(self.as_ref().to_glib_none().0, x, y);
3151 }
3152 }
3153
3154 /// Presents a window to the user. This function should not be used
3155 /// as when it is called, it is too late to gather a valid timestamp
3156 /// to allow focus stealing prevention to work correctly.
3157 #[doc(alias = "gtk_window_present")]
3158 fn present(&self) {
3159 unsafe {
3160 ffi::gtk_window_present(self.as_ref().to_glib_none().0);
3161 }
3162 }
3163
3164 /// Presents a window to the user. This may mean raising the window
3165 /// in the stacking order, deiconifying it, moving it to the current
3166 /// desktop, and/or giving it the keyboard focus, possibly dependent
3167 /// on the user’s platform, window manager, and preferences.
3168 ///
3169 /// If `self` is hidden, this function calls [`WidgetExt::show()`][crate::prelude::WidgetExt::show()]
3170 /// as well.
3171 ///
3172 /// This function should be used when the user tries to open a window
3173 /// that’s already open. Say for example the preferences dialog is
3174 /// currently open, and the user chooses Preferences from the menu
3175 /// a second time; use [`present()`][Self::present()] to move the already-open dialog
3176 /// where the user can see it.
3177 ///
3178 /// Presents a window to the user in response to a user interaction. The
3179 /// timestamp should be gathered when the window was requested to be shown
3180 /// (when clicking a link for example), rather than once the window is
3181 /// ready to be shown.
3182 /// ## `timestamp`
3183 /// the timestamp of the user interaction (typically a
3184 /// button or key press event) which triggered this call
3185 #[doc(alias = "gtk_window_present_with_time")]
3186 fn present_with_time(&self, timestamp: u32) {
3187 unsafe {
3188 ffi::gtk_window_present_with_time(self.as_ref().to_glib_none().0, timestamp);
3189 }
3190 }
3191
3192 /// Propagate a key press or release event to the focus widget and
3193 /// up the focus container chain until a widget handles `event`.
3194 /// This is normally called by the default ::key_press_event and
3195 /// ::key_release_event handlers for toplevel windows,
3196 /// however in some cases it may be useful to call this directly when
3197 /// overriding the standard key handling for a toplevel window.
3198 /// ## `event`
3199 /// a [`gdk::EventKey`][crate::gdk::EventKey]
3200 ///
3201 /// # Returns
3202 ///
3203 /// [`true`] if a widget in the focus chain handled the event.
3204 #[doc(alias = "gtk_window_propagate_key_event")]
3205 fn propagate_key_event(&self, event: &gdk::EventKey) -> bool {
3206 unsafe {
3207 from_glib(ffi::gtk_window_propagate_key_event(
3208 self.as_ref().to_glib_none().0,
3209 mut_override(event.to_glib_none().0),
3210 ))
3211 }
3212 }
3213
3214 /// Reverses the effects of [`add_accel_group()`][Self::add_accel_group()].
3215 /// ## `accel_group`
3216 /// a [`AccelGroup`][crate::AccelGroup]
3217 #[doc(alias = "gtk_window_remove_accel_group")]
3218 fn remove_accel_group(&self, accel_group: &impl IsA<AccelGroup>) {
3219 unsafe {
3220 ffi::gtk_window_remove_accel_group(
3221 self.as_ref().to_glib_none().0,
3222 accel_group.as_ref().to_glib_none().0,
3223 );
3224 }
3225 }
3226
3227 /// Removes a mnemonic from this window.
3228 /// ## `keyval`
3229 /// the mnemonic
3230 /// ## `target`
3231 /// the widget that gets activated by the mnemonic
3232 #[doc(alias = "gtk_window_remove_mnemonic")]
3233 fn remove_mnemonic(&self, keyval: u32, target: &impl IsA<Widget>) {
3234 unsafe {
3235 ffi::gtk_window_remove_mnemonic(
3236 self.as_ref().to_glib_none().0,
3237 keyval,
3238 target.as_ref().to_glib_none().0,
3239 );
3240 }
3241 }
3242
3243 /// Resizes the window as if the user had done so, obeying geometry
3244 /// constraints. The default geometry constraint is that windows may
3245 /// not be smaller than their size request; to override this
3246 /// constraint, call [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] to set the window's
3247 /// request to a smaller value.
3248 ///
3249 /// If [`resize()`][Self::resize()] is called before showing a window for the
3250 /// first time, it overrides any default size set with
3251 /// [`set_default_size()`][Self::set_default_size()].
3252 ///
3253 /// Windows may not be resized smaller than 1 by 1 pixels.
3254 ///
3255 /// When using client side decorations, GTK+ will do its best to adjust
3256 /// the given size so that the resulting window size matches the
3257 /// requested size without the title bar, borders and shadows added for
3258 /// the client side decorations, but there is no guarantee that the
3259 /// result will be totally accurate because these widgets added for
3260 /// client side decorations depend on the theme and may not be realized
3261 /// or visible at the time [`resize()`][Self::resize()] is issued.
3262 ///
3263 /// If the GtkWindow has a titlebar widget (see [`set_titlebar()`][Self::set_titlebar()]), then
3264 /// typically, [`resize()`][Self::resize()] will compensate for the height of the titlebar
3265 /// widget only if the height is known when the resulting GtkWindow configuration
3266 /// is issued.
3267 /// For example, if new widgets are added after the GtkWindow configuration
3268 /// and cause the titlebar widget to grow in height, this will result in a
3269 /// window content smaller that specified by [`resize()`][Self::resize()] and not
3270 /// a larger window.
3271 /// ## `width`
3272 /// width in pixels to resize the window to
3273 /// ## `height`
3274 /// height in pixels to resize the window to
3275 #[doc(alias = "gtk_window_resize")]
3276 fn resize(&self, width: i32, height: i32) {
3277 unsafe {
3278 ffi::gtk_window_resize(self.as_ref().to_glib_none().0, width, height);
3279 }
3280 }
3281
3282 /// Windows may set a hint asking the desktop environment not to receive
3283 /// the input focus. This function sets this hint.
3284 /// ## `setting`
3285 /// [`true`] to let this window receive input focus
3286 #[doc(alias = "gtk_window_set_accept_focus")]
3287 fn set_accept_focus(&self, setting: bool) {
3288 unsafe {
3289 ffi::gtk_window_set_accept_focus(self.as_ref().to_glib_none().0, setting.into_glib());
3290 }
3291 }
3292
3293 /// Sets or unsets the [`Application`][crate::Application] associated with the window.
3294 ///
3295 /// The application will be kept alive for at least as long as it has any windows
3296 /// associated with it (see [`ApplicationExtManual::hold()`][crate::gio::prelude::ApplicationExtManual::hold()] for a way to keep it alive
3297 /// without windows).
3298 ///
3299 /// Normally, the connection between the application and the window will remain
3300 /// until the window is destroyed, but you can explicitly remove it by setting
3301 /// the `application` to [`None`].
3302 ///
3303 /// This is equivalent to calling [`GtkApplicationExt::remove_window()`][crate::prelude::GtkApplicationExt::remove_window()] and/or
3304 /// [`GtkApplicationExt::add_window()`][crate::prelude::GtkApplicationExt::add_window()] on the old/new applications as relevant.
3305 /// ## `application`
3306 /// a [`Application`][crate::Application], or [`None`] to unset
3307 #[doc(alias = "gtk_window_set_application")]
3308 fn set_application(&self, application: Option<&impl IsA<Application>>) {
3309 unsafe {
3310 ffi::gtk_window_set_application(
3311 self.as_ref().to_glib_none().0,
3312 application.map(|p| p.as_ref()).to_glib_none().0,
3313 );
3314 }
3315 }
3316
3317 /// Marks `self` as attached to `attach_widget`. This creates a logical binding
3318 /// between the window and the widget it belongs to, which is used by GTK+ to
3319 /// propagate information such as styling or accessibility to `self` as if it
3320 /// was a children of `attach_widget`.
3321 ///
3322 /// Examples of places where specifying this relation is useful are for instance
3323 /// a [`Menu`][crate::Menu] created by a [`ComboBox`][crate::ComboBox], a completion popup window
3324 /// created by [`Entry`][crate::Entry] or a typeahead search entry created by [`TreeView`][crate::TreeView].
3325 ///
3326 /// Note that this function should not be confused with
3327 /// [`set_transient_for()`][Self::set_transient_for()], which specifies a window manager relation
3328 /// between two toplevels instead.
3329 ///
3330 /// Passing [`None`] for `attach_widget` detaches the window.
3331 /// ## `attach_widget`
3332 /// a [`Widget`][crate::Widget], or [`None`]
3333 #[doc(alias = "gtk_window_set_attached_to")]
3334 fn set_attached_to(&self, attach_widget: Option<&impl IsA<Widget>>) {
3335 unsafe {
3336 ffi::gtk_window_set_attached_to(
3337 self.as_ref().to_glib_none().0,
3338 attach_widget.map(|p| p.as_ref()).to_glib_none().0,
3339 );
3340 }
3341 }
3342
3343 /// By default, windows are decorated with a title bar, resize
3344 /// controls, etc. Some [window managers][gtk-X11-arch]
3345 /// allow GTK+ to disable these decorations, creating a
3346 /// borderless window. If you set the decorated property to [`false`]
3347 /// using this function, GTK+ will do its best to convince the window
3348 /// manager not to decorate the window. Depending on the system, this
3349 /// function may not have any effect when called on a window that is
3350 /// already visible, so you should call it before calling [`WidgetExt::show()`][crate::prelude::WidgetExt::show()].
3351 ///
3352 /// On Windows, this function always works, since there’s no window manager
3353 /// policy involved.
3354 /// ## `setting`
3355 /// [`true`] to decorate the window
3356 #[doc(alias = "gtk_window_set_decorated")]
3357 fn set_decorated(&self, setting: bool) {
3358 unsafe {
3359 ffi::gtk_window_set_decorated(self.as_ref().to_glib_none().0, setting.into_glib());
3360 }
3361 }
3362
3363 /// The default widget is the widget that’s activated when the user
3364 /// presses Enter in a dialog (for example). This function sets or
3365 /// unsets the default widget for a [`Window`][crate::Window]. When setting (rather
3366 /// than unsetting) the default widget it’s generally easier to call
3367 /// [`WidgetExt::grab_default()`][crate::prelude::WidgetExt::grab_default()] on the widget. Before making a widget
3368 /// the default widget, you must call [`WidgetExt::set_can_default()`][crate::prelude::WidgetExt::set_can_default()] on
3369 /// the widget you’d like to make the default.
3370 /// ## `default_widget`
3371 /// widget to be the default, or [`None`]
3372 /// to unset the default widget for the toplevel
3373 #[doc(alias = "gtk_window_set_default")]
3374 fn set_default(&self, default_widget: Option<&impl IsA<Widget>>) {
3375 unsafe {
3376 ffi::gtk_window_set_default(
3377 self.as_ref().to_glib_none().0,
3378 default_widget.map(|p| p.as_ref()).to_glib_none().0,
3379 );
3380 }
3381 }
3382
3383 /// Sets the default size of a window. If the window’s “natural” size
3384 /// (its size request) is larger than the default, the default will be
3385 /// ignored. More generally, if the default size does not obey the
3386 /// geometry hints for the window ([`set_geometry_hints()`][Self::set_geometry_hints()] can
3387 /// be used to set these explicitly), the default size will be clamped
3388 /// to the nearest permitted size.
3389 ///
3390 /// Unlike [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()], which sets a size request for
3391 /// a widget and thus would keep users from shrinking the window, this
3392 /// function only sets the initial size, just as if the user had
3393 /// resized the window themselves. Users can still shrink the window
3394 /// again as they normally would. Setting a default size of -1 means to
3395 /// use the “natural” default size (the size request of the window).
3396 ///
3397 /// For more control over a window’s initial size and how resizing works,
3398 /// investigate [`set_geometry_hints()`][Self::set_geometry_hints()].
3399 ///
3400 /// For some uses, [`resize()`][Self::resize()] is a more appropriate function.
3401 /// [`resize()`][Self::resize()] changes the current size of the window, rather
3402 /// than the size to be used on initial display. [`resize()`][Self::resize()] always
3403 /// affects the window itself, not the geometry widget.
3404 ///
3405 /// The default size of a window only affects the first time a window is
3406 /// shown; if a window is hidden and re-shown, it will remember the size
3407 /// it had prior to hiding, rather than using the default size.
3408 ///
3409 /// Windows can’t actually be 0x0 in size, they must be at least 1x1, but
3410 /// passing 0 for `width` and `height` is OK, resulting in a 1x1 default size.
3411 ///
3412 /// If you use this function to reestablish a previously saved window size,
3413 /// note that the appropriate size to save is the one returned by
3414 /// [`size()`][Self::size()]. Using the window allocation directly will not
3415 /// work in all circumstances and can lead to growing or shrinking windows.
3416 /// ## `width`
3417 /// width in pixels, or -1 to unset the default width
3418 /// ## `height`
3419 /// height in pixels, or -1 to unset the default height
3420 #[doc(alias = "gtk_window_set_default_size")]
3421 fn set_default_size(&self, width: i32, height: i32) {
3422 unsafe {
3423 ffi::gtk_window_set_default_size(self.as_ref().to_glib_none().0, width, height);
3424 }
3425 }
3426
3427 /// By default, windows have a close button in the window frame. Some
3428 /// [window managers][gtk-X11-arch] allow GTK+ to
3429 /// disable this button. If you set the deletable property to [`false`]
3430 /// using this function, GTK+ will do its best to convince the window
3431 /// manager not to show a close button. Depending on the system, this
3432 /// function may not have any effect when called on a window that is
3433 /// already visible, so you should call it before calling [`WidgetExt::show()`][crate::prelude::WidgetExt::show()].
3434 ///
3435 /// On Windows, this function always works, since there’s no window manager
3436 /// policy involved.
3437 /// ## `setting`
3438 /// [`true`] to decorate the window as deletable
3439 #[doc(alias = "gtk_window_set_deletable")]
3440 fn set_deletable(&self, setting: bool) {
3441 unsafe {
3442 ffi::gtk_window_set_deletable(self.as_ref().to_glib_none().0, setting.into_glib());
3443 }
3444 }
3445
3446 /// If `setting` is [`true`], then destroying the transient parent of `self`
3447 /// will also destroy `self` itself. This is useful for dialogs that
3448 /// shouldn’t persist beyond the lifetime of the main window they're
3449 /// associated with, for example.
3450 /// ## `setting`
3451 /// whether to destroy `self` with its transient parent
3452 #[doc(alias = "gtk_window_set_destroy_with_parent")]
3453 fn set_destroy_with_parent(&self, setting: bool) {
3454 unsafe {
3455 ffi::gtk_window_set_destroy_with_parent(
3456 self.as_ref().to_glib_none().0,
3457 setting.into_glib(),
3458 );
3459 }
3460 }
3461
3462 /// If `focus` is not the current focus widget, and is focusable, sets
3463 /// it as the focus widget for the window. If `focus` is [`None`], unsets
3464 /// the focus widget for this window. To set the focus to a particular
3465 /// widget in the toplevel, it is usually more convenient to use
3466 /// [`WidgetExt::grab_focus()`][crate::prelude::WidgetExt::grab_focus()] instead of this function.
3467 /// ## `focus`
3468 /// widget to be the new focus widget, or [`None`] to unset
3469 /// any focus widget for the toplevel window.
3470 #[doc(alias = "gtk_window_set_focus")]
3471 fn set_focus(&self, focus: Option<&impl IsA<Widget>>) {
3472 unsafe {
3473 ffi::gtk_window_set_focus(
3474 self.as_ref().to_glib_none().0,
3475 focus.map(|p| p.as_ref()).to_glib_none().0,
3476 );
3477 }
3478 }
3479
3480 /// Windows may set a hint asking the desktop environment not to receive
3481 /// the input focus when the window is mapped. This function sets this
3482 /// hint.
3483 /// ## `setting`
3484 /// [`true`] to let this window receive input focus on map
3485 #[doc(alias = "gtk_window_set_focus_on_map")]
3486 fn set_focus_on_map(&self, setting: bool) {
3487 unsafe {
3488 ffi::gtk_window_set_focus_on_map(self.as_ref().to_glib_none().0, setting.into_glib());
3489 }
3490 }
3491
3492 /// Sets the [`focus-visible`][struct@crate::Window#focus-visible] property.
3493 /// ## `setting`
3494 /// the new value
3495 #[doc(alias = "gtk_window_set_focus_visible")]
3496 fn set_focus_visible(&self, setting: bool) {
3497 unsafe {
3498 ffi::gtk_window_set_focus_visible(self.as_ref().to_glib_none().0, setting.into_glib());
3499 }
3500 }
3501
3502 /// This function sets up hints about how a window can be resized by
3503 /// the user. You can set a minimum and maximum size; allowed resize
3504 /// increments (e.g. for xterm, you can only resize by the size of a
3505 /// character); aspect ratios; and more. See the [`gdk::Geometry`][crate::gdk::Geometry] struct.
3506 /// ## `geometry_widget`
3507 /// widget the geometry hints used to be applied to
3508 /// or [`None`]. Since 3.20 this argument is ignored and GTK behaves as if [`None`] was
3509 /// set.
3510 /// ## `geometry`
3511 /// struct containing geometry information or [`None`]
3512 /// ## `geom_mask`
3513 /// mask indicating which struct fields should be paid attention to
3514 #[doc(alias = "gtk_window_set_geometry_hints")]
3515 fn set_geometry_hints(
3516 &self,
3517 geometry_widget: Option<&impl IsA<Widget>>,
3518 geometry: Option<&gdk::Geometry>,
3519 geom_mask: gdk::WindowHints,
3520 ) {
3521 unsafe {
3522 ffi::gtk_window_set_geometry_hints(
3523 self.as_ref().to_glib_none().0,
3524 geometry_widget.map(|p| p.as_ref()).to_glib_none().0,
3525 mut_override(geometry.to_glib_none().0),
3526 geom_mask.into_glib(),
3527 );
3528 }
3529 }
3530
3531 /// Window gravity defines the meaning of coordinates passed to
3532 /// [`move_()`][Self::move_()]. See [`move_()`][Self::move_()] and [`gdk::Gravity`][crate::gdk::Gravity] for
3533 /// more details.
3534 ///
3535 /// The default window gravity is [`gdk::Gravity::NorthWest`][crate::gdk::Gravity::NorthWest] which will
3536 /// typically “do what you mean.”
3537 /// ## `gravity`
3538 /// window gravity
3539 #[doc(alias = "gtk_window_set_gravity")]
3540 fn set_gravity(&self, gravity: gdk::Gravity) {
3541 unsafe {
3542 ffi::gtk_window_set_gravity(self.as_ref().to_glib_none().0, gravity.into_glib());
3543 }
3544 }
3545
3546 /// Tells GTK+ whether to drop its extra reference to the window
3547 /// when `gtk_widget_destroy()` is called.
3548 ///
3549 /// This function is only exported for the benefit of language
3550 /// bindings which may need to keep the window alive until their
3551 /// wrapper object is garbage collected. There is no justification
3552 /// for ever calling this function in an application.
3553 /// ## `setting`
3554 /// the new value
3555 #[doc(alias = "gtk_window_set_has_user_ref_count")]
3556 fn set_has_user_ref_count(&self, setting: bool) {
3557 unsafe {
3558 ffi::gtk_window_set_has_user_ref_count(
3559 self.as_ref().to_glib_none().0,
3560 setting.into_glib(),
3561 );
3562 }
3563 }
3564
3565 /// If `setting` is [`true`], then `self` will request that it’s titlebar
3566 /// should be hidden when maximized.
3567 /// This is useful for windows that don’t convey any information other
3568 /// than the application name in the titlebar, to put the available
3569 /// screen space to better use. If the underlying window system does not
3570 /// support the request, the setting will not have any effect.
3571 ///
3572 /// Note that custom titlebars set with [`set_titlebar()`][Self::set_titlebar()] are
3573 /// not affected by this. The application is in full control of their
3574 /// content and visibility anyway.
3575 /// ## `setting`
3576 /// whether to hide the titlebar when `self` is maximized
3577 #[doc(alias = "gtk_window_set_hide_titlebar_when_maximized")]
3578 fn set_hide_titlebar_when_maximized(&self, setting: bool) {
3579 unsafe {
3580 ffi::gtk_window_set_hide_titlebar_when_maximized(
3581 self.as_ref().to_glib_none().0,
3582 setting.into_glib(),
3583 );
3584 }
3585 }
3586
3587 /// Sets up the icon representing a [`Window`][crate::Window]. This icon is used when
3588 /// the window is minimized (also known as iconified). Some window
3589 /// managers or desktop environments may also place it in the window
3590 /// frame, or display it in other contexts. On others, the icon is not
3591 /// used at all, so your mileage may vary.
3592 ///
3593 /// The icon should be provided in whatever size it was naturally
3594 /// drawn; that is, don’t scale the image before passing it to
3595 /// GTK+. Scaling is postponed until the last minute, when the desired
3596 /// final size is known, to allow best quality.
3597 ///
3598 /// If you have your icon hand-drawn in multiple sizes, use
3599 /// [`set_icon_list()`][Self::set_icon_list()]. Then the best size will be used.
3600 ///
3601 /// This function is equivalent to calling [`set_icon_list()`][Self::set_icon_list()]
3602 /// with a 1-element list.
3603 ///
3604 /// See also [`Window::set_default_icon_list()`][crate::Window::set_default_icon_list()] to set the icon
3605 /// for all windows in your application in one go.
3606 /// ## `icon`
3607 /// icon image, or [`None`]
3608 #[doc(alias = "gtk_window_set_icon")]
3609 fn set_icon(&self, icon: Option<&gdk_pixbuf::Pixbuf>) {
3610 unsafe {
3611 ffi::gtk_window_set_icon(self.as_ref().to_glib_none().0, icon.to_glib_none().0);
3612 }
3613 }
3614
3615 /// Sets the icon for `self`.
3616 /// Warns on failure if `err` is [`None`].
3617 ///
3618 /// This function is equivalent to calling [`set_icon()`][Self::set_icon()]
3619 /// with a pixbuf created by loading the image from `filename`.
3620 /// ## `filename`
3621 /// location of icon file
3622 ///
3623 /// # Returns
3624 ///
3625 /// [`true`] if setting the icon succeeded.
3626 #[doc(alias = "gtk_window_set_icon_from_file")]
3627 fn set_icon_from_file(&self, filename: impl AsRef<std::path::Path>) -> Result<(), glib::Error> {
3628 unsafe {
3629 let mut error = ptr::null_mut();
3630 let is_ok = ffi::gtk_window_set_icon_from_file(
3631 self.as_ref().to_glib_none().0,
3632 filename.as_ref().to_glib_none().0,
3633 &mut error,
3634 );
3635 debug_assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null());
3636 if error.is_null() {
3637 Ok(())
3638 } else {
3639 Err(from_glib_full(error))
3640 }
3641 }
3642 }
3643
3644 /// Sets up the icon representing a [`Window`][crate::Window]. The icon is used when
3645 /// the window is minimized (also known as iconified). Some window
3646 /// managers or desktop environments may also place it in the window
3647 /// frame, or display it in other contexts. On others, the icon is not
3648 /// used at all, so your mileage may vary.
3649 ///
3650 /// [`set_icon_list()`][Self::set_icon_list()] allows you to pass in the same icon in
3651 /// several hand-drawn sizes. The list should contain the natural sizes
3652 /// your icon is available in; that is, don’t scale the image before
3653 /// passing it to GTK+. Scaling is postponed until the last minute,
3654 /// when the desired final size is known, to allow best quality.
3655 ///
3656 /// By passing several sizes, you may improve the final image quality
3657 /// of the icon, by reducing or eliminating automatic image scaling.
3658 ///
3659 /// Recommended sizes to provide: 16x16, 32x32, 48x48 at minimum, and
3660 /// larger images (64x64, 128x128) if you have them.
3661 ///
3662 /// See also [`Window::set_default_icon_list()`][crate::Window::set_default_icon_list()] to set the icon
3663 /// for all windows in your application in one go.
3664 ///
3665 /// Note that transient windows (those who have been set transient for another
3666 /// window using [`set_transient_for()`][Self::set_transient_for()]) will inherit their
3667 /// icon from their transient parent. So there’s no need to explicitly
3668 /// set the icon on transient windows.
3669 /// ## `list`
3670 /// list of [`gdk_pixbuf::Pixbuf`][crate::gdk_pixbuf::Pixbuf]
3671 #[doc(alias = "gtk_window_set_icon_list")]
3672 fn set_icon_list(&self, list: &[gdk_pixbuf::Pixbuf]) {
3673 unsafe {
3674 ffi::gtk_window_set_icon_list(self.as_ref().to_glib_none().0, list.to_glib_none().0);
3675 }
3676 }
3677
3678 /// Sets the icon for the window from a named themed icon.
3679 /// See the docs for [`IconTheme`][crate::IconTheme] for more details.
3680 /// On some platforms, the window icon is not used at all.
3681 ///
3682 /// Note that this has nothing to do with the WM_ICON_NAME
3683 /// property which is mentioned in the ICCCM.
3684 /// ## `name`
3685 /// the name of the themed icon
3686 #[doc(alias = "gtk_window_set_icon_name")]
3687 fn set_icon_name(&self, name: Option<&str>) {
3688 unsafe {
3689 ffi::gtk_window_set_icon_name(self.as_ref().to_glib_none().0, name.to_glib_none().0);
3690 }
3691 }
3692
3693 /// Asks to keep `self` above, so that it stays on top. Note that
3694 /// you shouldn’t assume the window is definitely above afterward,
3695 /// because other entities (e.g. the user or
3696 /// [window manager][gtk-X11-arch]) could not keep it above,
3697 /// and not all window managers support keeping windows above. But
3698 /// normally the window will end kept above. Just don’t write code
3699 /// that crashes if not.
3700 ///
3701 /// It’s permitted to call this function before showing a window,
3702 /// in which case the window will be kept above when it appears onscreen
3703 /// initially.
3704 ///
3705 /// You can track the above state via the “window-state-event” signal
3706 /// on [`Widget`][crate::Widget].
3707 ///
3708 /// Note that, according to the
3709 /// [Extended Window Manager Hints Specification](http://www.freedesktop.org/Standards/wm-spec),
3710 /// the above state is mainly meant for user preferences and should not
3711 /// be used by applications e.g. for drawing attention to their
3712 /// dialogs.
3713 /// ## `setting`
3714 /// whether to keep `self` above other windows
3715 #[doc(alias = "gtk_window_set_keep_above")]
3716 fn set_keep_above(&self, setting: bool) {
3717 unsafe {
3718 ffi::gtk_window_set_keep_above(self.as_ref().to_glib_none().0, setting.into_glib());
3719 }
3720 }
3721
3722 /// Asks to keep `self` below, so that it stays in bottom. Note that
3723 /// you shouldn’t assume the window is definitely below afterward,
3724 /// because other entities (e.g. the user or
3725 /// [window manager][gtk-X11-arch]) could not keep it below,
3726 /// and not all window managers support putting windows below. But
3727 /// normally the window will be kept below. Just don’t write code
3728 /// that crashes if not.
3729 ///
3730 /// It’s permitted to call this function before showing a window,
3731 /// in which case the window will be kept below when it appears onscreen
3732 /// initially.
3733 ///
3734 /// You can track the below state via the “window-state-event” signal
3735 /// on [`Widget`][crate::Widget].
3736 ///
3737 /// Note that, according to the
3738 /// [Extended Window Manager Hints Specification](http://www.freedesktop.org/Standards/wm-spec),
3739 /// the above state is mainly meant for user preferences and should not
3740 /// be used by applications e.g. for drawing attention to their
3741 /// dialogs.
3742 /// ## `setting`
3743 /// whether to keep `self` below other windows
3744 #[doc(alias = "gtk_window_set_keep_below")]
3745 fn set_keep_below(&self, setting: bool) {
3746 unsafe {
3747 ffi::gtk_window_set_keep_below(self.as_ref().to_glib_none().0, setting.into_glib());
3748 }
3749 }
3750
3751 /// Sets the mnemonic modifier for this window.
3752 /// ## `modifier`
3753 /// the modifier mask used to activate
3754 /// mnemonics on this window.
3755 #[doc(alias = "gtk_window_set_mnemonic_modifier")]
3756 fn set_mnemonic_modifier(&self, modifier: gdk::ModifierType) {
3757 unsafe {
3758 ffi::gtk_window_set_mnemonic_modifier(
3759 self.as_ref().to_glib_none().0,
3760 modifier.into_glib(),
3761 );
3762 }
3763 }
3764
3765 /// Sets the [`mnemonics-visible`][struct@crate::Window#mnemonics-visible] property.
3766 /// ## `setting`
3767 /// the new value
3768 #[doc(alias = "gtk_window_set_mnemonics_visible")]
3769 fn set_mnemonics_visible(&self, setting: bool) {
3770 unsafe {
3771 ffi::gtk_window_set_mnemonics_visible(
3772 self.as_ref().to_glib_none().0,
3773 setting.into_glib(),
3774 );
3775 }
3776 }
3777
3778 /// Sets a window modal or non-modal. Modal windows prevent interaction
3779 /// with other windows in the same application. To keep modal dialogs
3780 /// on top of main application windows, use
3781 /// [`set_transient_for()`][Self::set_transient_for()] to make the dialog transient for the
3782 /// parent; most [window managers][gtk-X11-arch]
3783 /// will then disallow lowering the dialog below the parent.
3784 /// ## `modal`
3785 /// whether the window is modal
3786 #[doc(alias = "gtk_window_set_modal")]
3787 fn set_modal(&self, modal: bool) {
3788 unsafe {
3789 ffi::gtk_window_set_modal(self.as_ref().to_glib_none().0, modal.into_glib());
3790 }
3791 }
3792
3793 /// Sets a position constraint for this window. If the old or new
3794 /// constraint is [`WindowPosition::CenterAlways`][crate::WindowPosition::CenterAlways], this will also cause
3795 /// the window to be repositioned to satisfy the new constraint.
3796 /// ## `position`
3797 /// a position constraint.
3798 #[doc(alias = "gtk_window_set_position")]
3799 fn set_position(&self, position: WindowPosition) {
3800 unsafe {
3801 ffi::gtk_window_set_position(self.as_ref().to_glib_none().0, position.into_glib());
3802 }
3803 }
3804
3805 /// Sets whether the user can resize a window. Windows are user resizable
3806 /// by default.
3807 /// ## `resizable`
3808 /// [`true`] if the user can resize this window
3809 #[doc(alias = "gtk_window_set_resizable")]
3810 fn set_resizable(&self, resizable: bool) {
3811 unsafe {
3812 ffi::gtk_window_set_resizable(self.as_ref().to_glib_none().0, resizable.into_glib());
3813 }
3814 }
3815
3816 /// This function is only useful on X11, not with other GTK+ targets.
3817 ///
3818 /// In combination with the window title, the window role allows a
3819 /// [window manager][gtk-X11-arch] to identify "the
3820 /// same" window when an application is restarted. So for example you
3821 /// might set the “toolbox” role on your app’s toolbox window, so that
3822 /// when the user restarts their session, the window manager can put
3823 /// the toolbox back in the same place.
3824 ///
3825 /// If a window already has a unique title, you don’t need to set the
3826 /// role, since the WM can use the title to identify the window when
3827 /// restoring the session.
3828 /// ## `role`
3829 /// unique identifier for the window to be used when restoring a session
3830 #[doc(alias = "gtk_window_set_role")]
3831 fn set_role(&self, role: &str) {
3832 unsafe {
3833 ffi::gtk_window_set_role(self.as_ref().to_glib_none().0, role.to_glib_none().0);
3834 }
3835 }
3836
3837 /// Sets the [`gdk::Screen`][crate::gdk::Screen] where the `self` is displayed; if
3838 /// the window is already mapped, it will be unmapped, and
3839 /// then remapped on the new screen.
3840 /// ## `screen`
3841 /// a [`gdk::Screen`][crate::gdk::Screen].
3842 #[doc(alias = "gtk_window_set_screen")]
3843 fn set_screen(&self, screen: &gdk::Screen) {
3844 unsafe {
3845 ffi::gtk_window_set_screen(self.as_ref().to_glib_none().0, screen.to_glib_none().0);
3846 }
3847 }
3848
3849 /// Windows may set a hint asking the desktop environment not to display
3850 /// the window in the pager. This function sets this hint.
3851 /// (A "pager" is any desktop navigation tool such as a workspace
3852 /// switcher that displays a thumbnail representation of the windows
3853 /// on the screen.)
3854 /// ## `setting`
3855 /// [`true`] to keep this window from appearing in the pager
3856 #[doc(alias = "gtk_window_set_skip_pager_hint")]
3857 fn set_skip_pager_hint(&self, setting: bool) {
3858 unsafe {
3859 ffi::gtk_window_set_skip_pager_hint(
3860 self.as_ref().to_glib_none().0,
3861 setting.into_glib(),
3862 );
3863 }
3864 }
3865
3866 /// Windows may set a hint asking the desktop environment not to display
3867 /// the window in the task bar. This function sets this hint.
3868 /// ## `setting`
3869 /// [`true`] to keep this window from appearing in the task bar
3870 #[doc(alias = "gtk_window_set_skip_taskbar_hint")]
3871 fn set_skip_taskbar_hint(&self, setting: bool) {
3872 unsafe {
3873 ffi::gtk_window_set_skip_taskbar_hint(
3874 self.as_ref().to_glib_none().0,
3875 setting.into_glib(),
3876 );
3877 }
3878 }
3879
3880 /// Startup notification identifiers are used by desktop environment to
3881 /// track application startup, to provide user feedback and other
3882 /// features. This function changes the corresponding property on the
3883 /// underlying GdkWindow. Normally, startup identifier is managed
3884 /// automatically and you should only use this function in special cases
3885 /// like transferring focus from other processes. You should use this
3886 /// function before calling [`present()`][Self::present()] or any equivalent
3887 /// function generating a window map event.
3888 ///
3889 /// This function is only useful on X11, not with other GTK+ targets.
3890 /// ## `startup_id`
3891 /// a string with startup-notification identifier
3892 #[doc(alias = "gtk_window_set_startup_id")]
3893 fn set_startup_id(&self, startup_id: &str) {
3894 unsafe {
3895 ffi::gtk_window_set_startup_id(
3896 self.as_ref().to_glib_none().0,
3897 startup_id.to_glib_none().0,
3898 );
3899 }
3900 }
3901
3902 /// Sets the title of the [`Window`][crate::Window]. The title of a window will be
3903 /// displayed in its title bar; on the X Window System, the title bar
3904 /// is rendered by the [window manager][gtk-X11-arch],
3905 /// so exactly how the title appears to users may vary
3906 /// according to a user’s exact configuration. The title should help a
3907 /// user distinguish this window from other windows they may have
3908 /// open. A good title might include the application name and current
3909 /// document filename, for example.
3910 /// ## `title`
3911 /// title of the window
3912 #[doc(alias = "gtk_window_set_title")]
3913 fn set_title(&self, title: &str) {
3914 unsafe {
3915 ffi::gtk_window_set_title(self.as_ref().to_glib_none().0, title.to_glib_none().0);
3916 }
3917 }
3918
3919 /// Sets a custom titlebar for `self`.
3920 ///
3921 /// A typical widget used here is [`HeaderBar`][crate::HeaderBar], as it provides various features
3922 /// expected of a titlebar while allowing the addition of child widgets to it.
3923 ///
3924 /// If you set a custom titlebar, GTK+ will do its best to convince
3925 /// the window manager not to put its own titlebar on the window.
3926 /// Depending on the system, this function may not work for a window
3927 /// that is already visible, so you set the titlebar before calling
3928 /// [`WidgetExt::show()`][crate::prelude::WidgetExt::show()].
3929 /// ## `titlebar`
3930 /// the widget to use as titlebar
3931 #[doc(alias = "gtk_window_set_titlebar")]
3932 fn set_titlebar(&self, titlebar: Option<&impl IsA<Widget>>) {
3933 unsafe {
3934 ffi::gtk_window_set_titlebar(
3935 self.as_ref().to_glib_none().0,
3936 titlebar.map(|p| p.as_ref()).to_glib_none().0,
3937 );
3938 }
3939 }
3940
3941 /// Dialog windows should be set transient for the main application
3942 /// window they were spawned from. This allows
3943 /// [window managers][gtk-X11-arch] to e.g. keep the
3944 /// dialog on top of the main window, or center the dialog over the
3945 /// main window. `gtk_dialog_new_with_buttons()` and other convenience
3946 /// functions in GTK+ will sometimes call
3947 /// [`set_transient_for()`][Self::set_transient_for()] on your behalf.
3948 ///
3949 /// Passing [`None`] for `parent` unsets the current transient window.
3950 ///
3951 /// On Wayland, this function can also be used to attach a new
3952 /// [`WindowType::Popup`][crate::WindowType::Popup] to a [`WindowType::Toplevel`][crate::WindowType::Toplevel] parent already mapped
3953 /// on screen so that the [`WindowType::Popup`][crate::WindowType::Popup] will be created as a
3954 /// subsurface-based window `GDK_WINDOW_SUBSURFACE` which can be
3955 /// positioned at will relatively to the [`WindowType::Toplevel`][crate::WindowType::Toplevel] surface.
3956 ///
3957 /// On Windows, this function puts the child window on top of the parent,
3958 /// much as the window manager would have done on X.
3959 /// ## `parent`
3960 /// parent window, or [`None`]
3961 #[doc(alias = "gtk_window_set_transient_for")]
3962 fn set_transient_for(&self, parent: Option<&impl IsA<Window>>) {
3963 unsafe {
3964 ffi::gtk_window_set_transient_for(
3965 self.as_ref().to_glib_none().0,
3966 parent.map(|p| p.as_ref()).to_glib_none().0,
3967 );
3968 }
3969 }
3970
3971 /// By setting the type hint for the window, you allow the window
3972 /// manager to decorate and handle the window in a way which is
3973 /// suitable to the function of the window in your application.
3974 ///
3975 /// This function should be called before the window becomes visible.
3976 ///
3977 /// `gtk_dialog_new_with_buttons()` and other convenience functions in GTK+
3978 /// will sometimes call [`set_type_hint()`][Self::set_type_hint()] on your behalf.
3979 /// ## `hint`
3980 /// the window type
3981 #[doc(alias = "gtk_window_set_type_hint")]
3982 fn set_type_hint(&self, hint: gdk::WindowTypeHint) {
3983 unsafe {
3984 ffi::gtk_window_set_type_hint(self.as_ref().to_glib_none().0, hint.into_glib());
3985 }
3986 }
3987
3988 /// Windows may set a hint asking the desktop environment to draw
3989 /// the users attention to the window. This function sets this hint.
3990 /// ## `setting`
3991 /// [`true`] to mark this window as urgent
3992 #[doc(alias = "gtk_window_set_urgency_hint")]
3993 fn set_urgency_hint(&self, setting: bool) {
3994 unsafe {
3995 ffi::gtk_window_set_urgency_hint(self.as_ref().to_glib_none().0, setting.into_glib());
3996 }
3997 }
3998
3999 /// Asks to stick `self`, which means that it will appear on all user
4000 /// desktops. Note that you shouldn’t assume the window is definitely
4001 /// stuck afterward, because other entities (e.g. the user or
4002 /// [window manager][gtk-X11-arch] could unstick it
4003 /// again, and some window managers do not support sticking
4004 /// windows. But normally the window will end up stuck. Just don't
4005 /// write code that crashes if not.
4006 ///
4007 /// It’s permitted to call this function before showing a window.
4008 ///
4009 /// You can track stickiness via the “window-state-event” signal
4010 /// on [`Widget`][crate::Widget].
4011 #[doc(alias = "gtk_window_stick")]
4012 fn stick(&self) {
4013 unsafe {
4014 ffi::gtk_window_stick(self.as_ref().to_glib_none().0);
4015 }
4016 }
4017
4018 /// Asks to toggle off the fullscreen state for `self`. Note that you
4019 /// shouldn’t assume the window is definitely not full screen
4020 /// afterward, because other entities (e.g. the user or
4021 /// [window manager][gtk-X11-arch]) could fullscreen it
4022 /// again, and not all window managers honor requests to unfullscreen
4023 /// windows. But normally the window will end up restored to its normal
4024 /// state. Just don’t write code that crashes if not.
4025 ///
4026 /// You can track the fullscreen state via the “window-state-event” signal
4027 /// on [`Widget`][crate::Widget].
4028 #[doc(alias = "gtk_window_unfullscreen")]
4029 fn unfullscreen(&self) {
4030 unsafe {
4031 ffi::gtk_window_unfullscreen(self.as_ref().to_glib_none().0);
4032 }
4033 }
4034
4035 /// Asks to unmaximize `self`. Note that you shouldn’t assume the
4036 /// window is definitely unmaximized afterward, because other entities
4037 /// (e.g. the user or [window manager][gtk-X11-arch])
4038 /// could maximize it again, and not all window
4039 /// managers honor requests to unmaximize. But normally the window will
4040 /// end up unmaximized. Just don’t write code that crashes if not.
4041 ///
4042 /// You can track maximization via the “window-state-event” signal
4043 /// on [`Widget`][crate::Widget].
4044 #[doc(alias = "gtk_window_unmaximize")]
4045 fn unmaximize(&self) {
4046 unsafe {
4047 ffi::gtk_window_unmaximize(self.as_ref().to_glib_none().0);
4048 }
4049 }
4050
4051 /// Asks to unstick `self`, which means that it will appear on only
4052 /// one of the user’s desktops. Note that you shouldn’t assume the
4053 /// window is definitely unstuck afterward, because other entities
4054 /// (e.g. the user or [window manager][gtk-X11-arch]) could
4055 /// stick it again. But normally the window will
4056 /// end up unstuck. Just don’t write code that crashes if not.
4057 ///
4058 /// You can track stickiness via the “window-state-event” signal
4059 /// on [`Widget`][crate::Widget].
4060 #[doc(alias = "gtk_window_unstick")]
4061 fn unstick(&self) {
4062 unsafe {
4063 ffi::gtk_window_unstick(self.as_ref().to_glib_none().0);
4064 }
4065 }
4066
4067 #[doc(alias = "default-height")]
4068 fn default_height(&self) -> i32 {
4069 ObjectExt::property(self.as_ref(), "default-height")
4070 }
4071
4072 #[doc(alias = "default-height")]
4073 fn set_default_height(&self, default_height: i32) {
4074 ObjectExt::set_property(self.as_ref(), "default-height", default_height)
4075 }
4076
4077 #[doc(alias = "default-width")]
4078 fn default_width(&self) -> i32 {
4079 ObjectExt::property(self.as_ref(), "default-width")
4080 }
4081
4082 #[doc(alias = "default-width")]
4083 fn set_default_width(&self, default_width: i32) {
4084 ObjectExt::set_property(self.as_ref(), "default-width", default_width)
4085 }
4086
4087 #[doc(alias = "type")]
4088 fn type_(&self) -> WindowType {
4089 ObjectExt::property(self.as_ref(), "type")
4090 }
4091
4092 #[doc(alias = "window-position")]
4093 fn window_position(&self) -> WindowPosition {
4094 ObjectExt::property(self.as_ref(), "window-position")
4095 }
4096
4097 #[doc(alias = "window-position")]
4098 fn set_window_position(&self, window_position: WindowPosition) {
4099 ObjectExt::set_property(self.as_ref(), "window-position", window_position)
4100 }
4101
4102 /// The ::activate-default signal is a
4103 /// [keybinding signal][GtkBindingSignal]
4104 /// which gets emitted when the user activates the default widget
4105 /// of `window`.
4106 #[doc(alias = "activate-default")]
4107 fn connect_activate_default<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
4108 unsafe extern "C" fn activate_default_trampoline<P: IsA<Window>, F: Fn(&P) + 'static>(
4109 this: *mut ffi::GtkWindow,
4110 f: glib::ffi::gpointer,
4111 ) {
4112 let f: &F = &*(f as *const F);
4113 f(Window::from_glib_borrow(this).unsafe_cast_ref())
4114 }
4115 unsafe {
4116 let f: Box_<F> = Box_::new(f);
4117 connect_raw(
4118 self.as_ptr() as *mut _,
4119 b"activate-default\0".as_ptr() as *const _,
4120 Some(transmute::<_, unsafe extern "C" fn()>(
4121 activate_default_trampoline::<Self, F> as *const (),
4122 )),
4123 Box_::into_raw(f),
4124 )
4125 }
4126 }
4127
4128 fn emit_activate_default(&self) {
4129 self.emit_by_name::<()>("activate-default", &[]);
4130 }
4131
4132 /// The ::activate-focus signal is a
4133 /// [keybinding signal][GtkBindingSignal]
4134 /// which gets emitted when the user activates the currently
4135 /// focused widget of `window`.
4136 #[doc(alias = "activate-focus")]
4137 fn connect_activate_focus<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
4138 unsafe extern "C" fn activate_focus_trampoline<P: IsA<Window>, F: Fn(&P) + 'static>(
4139 this: *mut ffi::GtkWindow,
4140 f: glib::ffi::gpointer,
4141 ) {
4142 let f: &F = &*(f as *const F);
4143 f(Window::from_glib_borrow(this).unsafe_cast_ref())
4144 }
4145 unsafe {
4146 let f: Box_<F> = Box_::new(f);
4147 connect_raw(
4148 self.as_ptr() as *mut _,
4149 b"activate-focus\0".as_ptr() as *const _,
4150 Some(transmute::<_, unsafe extern "C" fn()>(
4151 activate_focus_trampoline::<Self, F> as *const (),
4152 )),
4153 Box_::into_raw(f),
4154 )
4155 }
4156 }
4157
4158 fn emit_activate_focus(&self) {
4159 self.emit_by_name::<()>("activate-focus", &[]);
4160 }
4161
4162 /// The ::enable-debugging signal is a [keybinding signal][GtkBindingSignal]
4163 /// which gets emitted when the user enables or disables interactive
4164 /// debugging. When `toggle` is [`true`], interactive debugging is toggled
4165 /// on or off, when it is [`false`], the debugger will be pointed at the
4166 /// widget under the pointer.
4167 ///
4168 /// The default bindings for this signal are Ctrl-Shift-I
4169 /// and Ctrl-Shift-D.
4170 /// ## `toggle`
4171 /// toggle the debugger
4172 ///
4173 /// # Returns
4174 ///
4175 /// [`true`] if the key binding was handled
4176 #[doc(alias = "enable-debugging")]
4177 fn connect_enable_debugging<F: Fn(&Self, bool) -> bool + 'static>(
4178 &self,
4179 f: F,
4180 ) -> SignalHandlerId {
4181 unsafe extern "C" fn enable_debugging_trampoline<
4182 P: IsA<Window>,
4183 F: Fn(&P, bool) -> bool + 'static,
4184 >(
4185 this: *mut ffi::GtkWindow,
4186 toggle: glib::ffi::gboolean,
4187 f: glib::ffi::gpointer,
4188 ) -> glib::ffi::gboolean {
4189 let f: &F = &*(f as *const F);
4190 f(
4191 Window::from_glib_borrow(this).unsafe_cast_ref(),
4192 from_glib(toggle),
4193 )
4194 .into_glib()
4195 }
4196 unsafe {
4197 let f: Box_<F> = Box_::new(f);
4198 connect_raw(
4199 self.as_ptr() as *mut _,
4200 b"enable-debugging\0".as_ptr() as *const _,
4201 Some(transmute::<_, unsafe extern "C" fn()>(
4202 enable_debugging_trampoline::<Self, F> as *const (),
4203 )),
4204 Box_::into_raw(f),
4205 )
4206 }
4207 }
4208
4209 fn emit_enable_debugging(&self, toggle: bool) -> bool {
4210 self.emit_by_name("enable-debugging", &[&toggle])
4211 }
4212
4213 /// The ::keys-changed signal gets emitted when the set of accelerators
4214 /// or mnemonics that are associated with `window` changes.
4215 #[doc(alias = "keys-changed")]
4216 fn connect_keys_changed<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
4217 unsafe extern "C" fn keys_changed_trampoline<P: IsA<Window>, F: Fn(&P) + 'static>(
4218 this: *mut ffi::GtkWindow,
4219 f: glib::ffi::gpointer,
4220 ) {
4221 let f: &F = &*(f as *const F);
4222 f(Window::from_glib_borrow(this).unsafe_cast_ref())
4223 }
4224 unsafe {
4225 let f: Box_<F> = Box_::new(f);
4226 connect_raw(
4227 self.as_ptr() as *mut _,
4228 b"keys-changed\0".as_ptr() as *const _,
4229 Some(transmute::<_, unsafe extern "C" fn()>(
4230 keys_changed_trampoline::<Self, F> as *const (),
4231 )),
4232 Box_::into_raw(f),
4233 )
4234 }
4235 }
4236
4237 /// This signal is emitted whenever the currently focused widget in
4238 /// this window changes.
4239 /// ## `widget`
4240 /// the newly focused widget (or [`None`] for no focus)
4241 #[doc(alias = "set-focus")]
4242 fn connect_set_focus<F: Fn(&Self, Option<&Widget>) + 'static>(&self, f: F) -> SignalHandlerId {
4243 unsafe extern "C" fn set_focus_trampoline<
4244 P: IsA<Window>,
4245 F: Fn(&P, Option<&Widget>) + 'static,
4246 >(
4247 this: *mut ffi::GtkWindow,
4248 widget: *mut ffi::GtkWidget,
4249 f: glib::ffi::gpointer,
4250 ) {
4251 let f: &F = &*(f as *const F);
4252 f(
4253 Window::from_glib_borrow(this).unsafe_cast_ref(),
4254 Option::<Widget>::from_glib_borrow(widget).as_ref().as_ref(),
4255 )
4256 }
4257 unsafe {
4258 let f: Box_<F> = Box_::new(f);
4259 connect_raw(
4260 self.as_ptr() as *mut _,
4261 b"set-focus\0".as_ptr() as *const _,
4262 Some(transmute::<_, unsafe extern "C" fn()>(
4263 set_focus_trampoline::<Self, F> as *const (),
4264 )),
4265 Box_::into_raw(f),
4266 )
4267 }
4268 }
4269
4270 #[doc(alias = "accept-focus")]
4271 fn connect_accept_focus_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
4272 unsafe extern "C" fn notify_accept_focus_trampoline<P: IsA<Window>, F: Fn(&P) + 'static>(
4273 this: *mut ffi::GtkWindow,
4274 _param_spec: glib::ffi::gpointer,
4275 f: glib::ffi::gpointer,
4276 ) {
4277 let f: &F = &*(f as *const F);
4278 f(Window::from_glib_borrow(this).unsafe_cast_ref())
4279 }
4280 unsafe {
4281 let f: Box_<F> = Box_::new(f);
4282 connect_raw(
4283 self.as_ptr() as *mut _,
4284 b"notify::accept-focus\0".as_ptr() as *const _,
4285 Some(transmute::<_, unsafe extern "C" fn()>(
4286 notify_accept_focus_trampoline::<Self, F> as *const (),
4287 )),
4288 Box_::into_raw(f),
4289 )
4290 }
4291 }
4292
4293 #[doc(alias = "application")]
4294 fn connect_application_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
4295 unsafe extern "C" fn notify_application_trampoline<P: IsA<Window>, F: Fn(&P) + 'static>(
4296 this: *mut ffi::GtkWindow,
4297 _param_spec: glib::ffi::gpointer,
4298 f: glib::ffi::gpointer,
4299 ) {
4300 let f: &F = &*(f as *const F);
4301 f(Window::from_glib_borrow(this).unsafe_cast_ref())
4302 }
4303 unsafe {
4304 let f: Box_<F> = Box_::new(f);
4305 connect_raw(
4306 self.as_ptr() as *mut _,
4307 b"notify::application\0".as_ptr() as *const _,
4308 Some(transmute::<_, unsafe extern "C" fn()>(
4309 notify_application_trampoline::<Self, F> as *const (),
4310 )),
4311 Box_::into_raw(f),
4312 )
4313 }
4314 }
4315
4316 #[doc(alias = "attached-to")]
4317 fn connect_attached_to_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
4318 unsafe extern "C" fn notify_attached_to_trampoline<P: IsA<Window>, F: Fn(&P) + 'static>(
4319 this: *mut ffi::GtkWindow,
4320 _param_spec: glib::ffi::gpointer,
4321 f: glib::ffi::gpointer,
4322 ) {
4323 let f: &F = &*(f as *const F);
4324 f(Window::from_glib_borrow(this).unsafe_cast_ref())
4325 }
4326 unsafe {
4327 let f: Box_<F> = Box_::new(f);
4328 connect_raw(
4329 self.as_ptr() as *mut _,
4330 b"notify::attached-to\0".as_ptr() as *const _,
4331 Some(transmute::<_, unsafe extern "C" fn()>(
4332 notify_attached_to_trampoline::<Self, F> as *const (),
4333 )),
4334 Box_::into_raw(f),
4335 )
4336 }
4337 }
4338
4339 #[doc(alias = "decorated")]
4340 fn connect_decorated_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
4341 unsafe extern "C" fn notify_decorated_trampoline<P: IsA<Window>, F: Fn(&P) + 'static>(
4342 this: *mut ffi::GtkWindow,
4343 _param_spec: glib::ffi::gpointer,
4344 f: glib::ffi::gpointer,
4345 ) {
4346 let f: &F = &*(f as *const F);
4347 f(Window::from_glib_borrow(this).unsafe_cast_ref())
4348 }
4349 unsafe {
4350 let f: Box_<F> = Box_::new(f);
4351 connect_raw(
4352 self.as_ptr() as *mut _,
4353 b"notify::decorated\0".as_ptr() as *const _,
4354 Some(transmute::<_, unsafe extern "C" fn()>(
4355 notify_decorated_trampoline::<Self, F> as *const (),
4356 )),
4357 Box_::into_raw(f),
4358 )
4359 }
4360 }
4361
4362 #[doc(alias = "default-height")]
4363 fn connect_default_height_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
4364 unsafe extern "C" fn notify_default_height_trampoline<
4365 P: IsA<Window>,
4366 F: Fn(&P) + 'static,
4367 >(
4368 this: *mut ffi::GtkWindow,
4369 _param_spec: glib::ffi::gpointer,
4370 f: glib::ffi::gpointer,
4371 ) {
4372 let f: &F = &*(f as *const F);
4373 f(Window::from_glib_borrow(this).unsafe_cast_ref())
4374 }
4375 unsafe {
4376 let f: Box_<F> = Box_::new(f);
4377 connect_raw(
4378 self.as_ptr() as *mut _,
4379 b"notify::default-height\0".as_ptr() as *const _,
4380 Some(transmute::<_, unsafe extern "C" fn()>(
4381 notify_default_height_trampoline::<Self, F> as *const (),
4382 )),
4383 Box_::into_raw(f),
4384 )
4385 }
4386 }
4387
4388 #[doc(alias = "default-width")]
4389 fn connect_default_width_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
4390 unsafe extern "C" fn notify_default_width_trampoline<
4391 P: IsA<Window>,
4392 F: Fn(&P) + 'static,
4393 >(
4394 this: *mut ffi::GtkWindow,
4395 _param_spec: glib::ffi::gpointer,
4396 f: glib::ffi::gpointer,
4397 ) {
4398 let f: &F = &*(f as *const F);
4399 f(Window::from_glib_borrow(this).unsafe_cast_ref())
4400 }
4401 unsafe {
4402 let f: Box_<F> = Box_::new(f);
4403 connect_raw(
4404 self.as_ptr() as *mut _,
4405 b"notify::default-width\0".as_ptr() as *const _,
4406 Some(transmute::<_, unsafe extern "C" fn()>(
4407 notify_default_width_trampoline::<Self, F> as *const (),
4408 )),
4409 Box_::into_raw(f),
4410 )
4411 }
4412 }
4413
4414 #[doc(alias = "deletable")]
4415 fn connect_deletable_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
4416 unsafe extern "C" fn notify_deletable_trampoline<P: IsA<Window>, F: Fn(&P) + 'static>(
4417 this: *mut ffi::GtkWindow,
4418 _param_spec: glib::ffi::gpointer,
4419 f: glib::ffi::gpointer,
4420 ) {
4421 let f: &F = &*(f as *const F);
4422 f(Window::from_glib_borrow(this).unsafe_cast_ref())
4423 }
4424 unsafe {
4425 let f: Box_<F> = Box_::new(f);
4426 connect_raw(
4427 self.as_ptr() as *mut _,
4428 b"notify::deletable\0".as_ptr() as *const _,
4429 Some(transmute::<_, unsafe extern "C" fn()>(
4430 notify_deletable_trampoline::<Self, F> as *const (),
4431 )),
4432 Box_::into_raw(f),
4433 )
4434 }
4435 }
4436
4437 #[doc(alias = "destroy-with-parent")]
4438 fn connect_destroy_with_parent_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
4439 unsafe extern "C" fn notify_destroy_with_parent_trampoline<
4440 P: IsA<Window>,
4441 F: Fn(&P) + 'static,
4442 >(
4443 this: *mut ffi::GtkWindow,
4444 _param_spec: glib::ffi::gpointer,
4445 f: glib::ffi::gpointer,
4446 ) {
4447 let f: &F = &*(f as *const F);
4448 f(Window::from_glib_borrow(this).unsafe_cast_ref())
4449 }
4450 unsafe {
4451 let f: Box_<F> = Box_::new(f);
4452 connect_raw(
4453 self.as_ptr() as *mut _,
4454 b"notify::destroy-with-parent\0".as_ptr() as *const _,
4455 Some(transmute::<_, unsafe extern "C" fn()>(
4456 notify_destroy_with_parent_trampoline::<Self, F> as *const (),
4457 )),
4458 Box_::into_raw(f),
4459 )
4460 }
4461 }
4462
4463 #[doc(alias = "focus-on-map")]
4464 fn connect_focus_on_map_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
4465 unsafe extern "C" fn notify_focus_on_map_trampoline<P: IsA<Window>, F: Fn(&P) + 'static>(
4466 this: *mut ffi::GtkWindow,
4467 _param_spec: glib::ffi::gpointer,
4468 f: glib::ffi::gpointer,
4469 ) {
4470 let f: &F = &*(f as *const F);
4471 f(Window::from_glib_borrow(this).unsafe_cast_ref())
4472 }
4473 unsafe {
4474 let f: Box_<F> = Box_::new(f);
4475 connect_raw(
4476 self.as_ptr() as *mut _,
4477 b"notify::focus-on-map\0".as_ptr() as *const _,
4478 Some(transmute::<_, unsafe extern "C" fn()>(
4479 notify_focus_on_map_trampoline::<Self, F> as *const (),
4480 )),
4481 Box_::into_raw(f),
4482 )
4483 }
4484 }
4485
4486 #[doc(alias = "focus-visible")]
4487 fn connect_focus_visible_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
4488 unsafe extern "C" fn notify_focus_visible_trampoline<
4489 P: IsA<Window>,
4490 F: Fn(&P) + 'static,
4491 >(
4492 this: *mut ffi::GtkWindow,
4493 _param_spec: glib::ffi::gpointer,
4494 f: glib::ffi::gpointer,
4495 ) {
4496 let f: &F = &*(f as *const F);
4497 f(Window::from_glib_borrow(this).unsafe_cast_ref())
4498 }
4499 unsafe {
4500 let f: Box_<F> = Box_::new(f);
4501 connect_raw(
4502 self.as_ptr() as *mut _,
4503 b"notify::focus-visible\0".as_ptr() as *const _,
4504 Some(transmute::<_, unsafe extern "C" fn()>(
4505 notify_focus_visible_trampoline::<Self, F> as *const (),
4506 )),
4507 Box_::into_raw(f),
4508 )
4509 }
4510 }
4511
4512 #[doc(alias = "gravity")]
4513 fn connect_gravity_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
4514 unsafe extern "C" fn notify_gravity_trampoline<P: IsA<Window>, F: Fn(&P) + 'static>(
4515 this: *mut ffi::GtkWindow,
4516 _param_spec: glib::ffi::gpointer,
4517 f: glib::ffi::gpointer,
4518 ) {
4519 let f: &F = &*(f as *const F);
4520 f(Window::from_glib_borrow(this).unsafe_cast_ref())
4521 }
4522 unsafe {
4523 let f: Box_<F> = Box_::new(f);
4524 connect_raw(
4525 self.as_ptr() as *mut _,
4526 b"notify::gravity\0".as_ptr() as *const _,
4527 Some(transmute::<_, unsafe extern "C" fn()>(
4528 notify_gravity_trampoline::<Self, F> as *const (),
4529 )),
4530 Box_::into_raw(f),
4531 )
4532 }
4533 }
4534
4535 #[doc(alias = "has-toplevel-focus")]
4536 fn connect_has_toplevel_focus_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
4537 unsafe extern "C" fn notify_has_toplevel_focus_trampoline<
4538 P: IsA<Window>,
4539 F: Fn(&P) + 'static,
4540 >(
4541 this: *mut ffi::GtkWindow,
4542 _param_spec: glib::ffi::gpointer,
4543 f: glib::ffi::gpointer,
4544 ) {
4545 let f: &F = &*(f as *const F);
4546 f(Window::from_glib_borrow(this).unsafe_cast_ref())
4547 }
4548 unsafe {
4549 let f: Box_<F> = Box_::new(f);
4550 connect_raw(
4551 self.as_ptr() as *mut _,
4552 b"notify::has-toplevel-focus\0".as_ptr() as *const _,
4553 Some(transmute::<_, unsafe extern "C" fn()>(
4554 notify_has_toplevel_focus_trampoline::<Self, F> as *const (),
4555 )),
4556 Box_::into_raw(f),
4557 )
4558 }
4559 }
4560
4561 #[doc(alias = "hide-titlebar-when-maximized")]
4562 fn connect_hide_titlebar_when_maximized_notify<F: Fn(&Self) + 'static>(
4563 &self,
4564 f: F,
4565 ) -> SignalHandlerId {
4566 unsafe extern "C" fn notify_hide_titlebar_when_maximized_trampoline<
4567 P: IsA<Window>,
4568 F: Fn(&P) + 'static,
4569 >(
4570 this: *mut ffi::GtkWindow,
4571 _param_spec: glib::ffi::gpointer,
4572 f: glib::ffi::gpointer,
4573 ) {
4574 let f: &F = &*(f as *const F);
4575 f(Window::from_glib_borrow(this).unsafe_cast_ref())
4576 }
4577 unsafe {
4578 let f: Box_<F> = Box_::new(f);
4579 connect_raw(
4580 self.as_ptr() as *mut _,
4581 b"notify::hide-titlebar-when-maximized\0".as_ptr() as *const _,
4582 Some(transmute::<_, unsafe extern "C" fn()>(
4583 notify_hide_titlebar_when_maximized_trampoline::<Self, F> as *const (),
4584 )),
4585 Box_::into_raw(f),
4586 )
4587 }
4588 }
4589
4590 #[doc(alias = "icon")]
4591 fn connect_icon_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
4592 unsafe extern "C" fn notify_icon_trampoline<P: IsA<Window>, F: Fn(&P) + 'static>(
4593 this: *mut ffi::GtkWindow,
4594 _param_spec: glib::ffi::gpointer,
4595 f: glib::ffi::gpointer,
4596 ) {
4597 let f: &F = &*(f as *const F);
4598 f(Window::from_glib_borrow(this).unsafe_cast_ref())
4599 }
4600 unsafe {
4601 let f: Box_<F> = Box_::new(f);
4602 connect_raw(
4603 self.as_ptr() as *mut _,
4604 b"notify::icon\0".as_ptr() as *const _,
4605 Some(transmute::<_, unsafe extern "C" fn()>(
4606 notify_icon_trampoline::<Self, F> as *const (),
4607 )),
4608 Box_::into_raw(f),
4609 )
4610 }
4611 }
4612
4613 #[doc(alias = "icon-name")]
4614 fn connect_icon_name_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
4615 unsafe extern "C" fn notify_icon_name_trampoline<P: IsA<Window>, F: Fn(&P) + 'static>(
4616 this: *mut ffi::GtkWindow,
4617 _param_spec: glib::ffi::gpointer,
4618 f: glib::ffi::gpointer,
4619 ) {
4620 let f: &F = &*(f as *const F);
4621 f(Window::from_glib_borrow(this).unsafe_cast_ref())
4622 }
4623 unsafe {
4624 let f: Box_<F> = Box_::new(f);
4625 connect_raw(
4626 self.as_ptr() as *mut _,
4627 b"notify::icon-name\0".as_ptr() as *const _,
4628 Some(transmute::<_, unsafe extern "C" fn()>(
4629 notify_icon_name_trampoline::<Self, F> as *const (),
4630 )),
4631 Box_::into_raw(f),
4632 )
4633 }
4634 }
4635
4636 #[doc(alias = "is-active")]
4637 fn connect_is_active_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
4638 unsafe extern "C" fn notify_is_active_trampoline<P: IsA<Window>, F: Fn(&P) + 'static>(
4639 this: *mut ffi::GtkWindow,
4640 _param_spec: glib::ffi::gpointer,
4641 f: glib::ffi::gpointer,
4642 ) {
4643 let f: &F = &*(f as *const F);
4644 f(Window::from_glib_borrow(this).unsafe_cast_ref())
4645 }
4646 unsafe {
4647 let f: Box_<F> = Box_::new(f);
4648 connect_raw(
4649 self.as_ptr() as *mut _,
4650 b"notify::is-active\0".as_ptr() as *const _,
4651 Some(transmute::<_, unsafe extern "C" fn()>(
4652 notify_is_active_trampoline::<Self, F> as *const (),
4653 )),
4654 Box_::into_raw(f),
4655 )
4656 }
4657 }
4658
4659 #[doc(alias = "is-maximized")]
4660 fn connect_is_maximized_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
4661 unsafe extern "C" fn notify_is_maximized_trampoline<P: IsA<Window>, F: Fn(&P) + 'static>(
4662 this: *mut ffi::GtkWindow,
4663 _param_spec: glib::ffi::gpointer,
4664 f: glib::ffi::gpointer,
4665 ) {
4666 let f: &F = &*(f as *const F);
4667 f(Window::from_glib_borrow(this).unsafe_cast_ref())
4668 }
4669 unsafe {
4670 let f: Box_<F> = Box_::new(f);
4671 connect_raw(
4672 self.as_ptr() as *mut _,
4673 b"notify::is-maximized\0".as_ptr() as *const _,
4674 Some(transmute::<_, unsafe extern "C" fn()>(
4675 notify_is_maximized_trampoline::<Self, F> as *const (),
4676 )),
4677 Box_::into_raw(f),
4678 )
4679 }
4680 }
4681
4682 #[doc(alias = "mnemonics-visible")]
4683 fn connect_mnemonics_visible_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
4684 unsafe extern "C" fn notify_mnemonics_visible_trampoline<
4685 P: IsA<Window>,
4686 F: Fn(&P) + 'static,
4687 >(
4688 this: *mut ffi::GtkWindow,
4689 _param_spec: glib::ffi::gpointer,
4690 f: glib::ffi::gpointer,
4691 ) {
4692 let f: &F = &*(f as *const F);
4693 f(Window::from_glib_borrow(this).unsafe_cast_ref())
4694 }
4695 unsafe {
4696 let f: Box_<F> = Box_::new(f);
4697 connect_raw(
4698 self.as_ptr() as *mut _,
4699 b"notify::mnemonics-visible\0".as_ptr() as *const _,
4700 Some(transmute::<_, unsafe extern "C" fn()>(
4701 notify_mnemonics_visible_trampoline::<Self, F> as *const (),
4702 )),
4703 Box_::into_raw(f),
4704 )
4705 }
4706 }
4707
4708 #[doc(alias = "modal")]
4709 fn connect_modal_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
4710 unsafe extern "C" fn notify_modal_trampoline<P: IsA<Window>, F: Fn(&P) + 'static>(
4711 this: *mut ffi::GtkWindow,
4712 _param_spec: glib::ffi::gpointer,
4713 f: glib::ffi::gpointer,
4714 ) {
4715 let f: &F = &*(f as *const F);
4716 f(Window::from_glib_borrow(this).unsafe_cast_ref())
4717 }
4718 unsafe {
4719 let f: Box_<F> = Box_::new(f);
4720 connect_raw(
4721 self.as_ptr() as *mut _,
4722 b"notify::modal\0".as_ptr() as *const _,
4723 Some(transmute::<_, unsafe extern "C" fn()>(
4724 notify_modal_trampoline::<Self, F> as *const (),
4725 )),
4726 Box_::into_raw(f),
4727 )
4728 }
4729 }
4730
4731 #[doc(alias = "resizable")]
4732 fn connect_resizable_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
4733 unsafe extern "C" fn notify_resizable_trampoline<P: IsA<Window>, F: Fn(&P) + 'static>(
4734 this: *mut ffi::GtkWindow,
4735 _param_spec: glib::ffi::gpointer,
4736 f: glib::ffi::gpointer,
4737 ) {
4738 let f: &F = &*(f as *const F);
4739 f(Window::from_glib_borrow(this).unsafe_cast_ref())
4740 }
4741 unsafe {
4742 let f: Box_<F> = Box_::new(f);
4743 connect_raw(
4744 self.as_ptr() as *mut _,
4745 b"notify::resizable\0".as_ptr() as *const _,
4746 Some(transmute::<_, unsafe extern "C" fn()>(
4747 notify_resizable_trampoline::<Self, F> as *const (),
4748 )),
4749 Box_::into_raw(f),
4750 )
4751 }
4752 }
4753
4754 #[doc(alias = "role")]
4755 fn connect_role_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
4756 unsafe extern "C" fn notify_role_trampoline<P: IsA<Window>, F: Fn(&P) + 'static>(
4757 this: *mut ffi::GtkWindow,
4758 _param_spec: glib::ffi::gpointer,
4759 f: glib::ffi::gpointer,
4760 ) {
4761 let f: &F = &*(f as *const F);
4762 f(Window::from_glib_borrow(this).unsafe_cast_ref())
4763 }
4764 unsafe {
4765 let f: Box_<F> = Box_::new(f);
4766 connect_raw(
4767 self.as_ptr() as *mut _,
4768 b"notify::role\0".as_ptr() as *const _,
4769 Some(transmute::<_, unsafe extern "C" fn()>(
4770 notify_role_trampoline::<Self, F> as *const (),
4771 )),
4772 Box_::into_raw(f),
4773 )
4774 }
4775 }
4776
4777 #[doc(alias = "screen")]
4778 fn connect_screen_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
4779 unsafe extern "C" fn notify_screen_trampoline<P: IsA<Window>, F: Fn(&P) + 'static>(
4780 this: *mut ffi::GtkWindow,
4781 _param_spec: glib::ffi::gpointer,
4782 f: glib::ffi::gpointer,
4783 ) {
4784 let f: &F = &*(f as *const F);
4785 f(Window::from_glib_borrow(this).unsafe_cast_ref())
4786 }
4787 unsafe {
4788 let f: Box_<F> = Box_::new(f);
4789 connect_raw(
4790 self.as_ptr() as *mut _,
4791 b"notify::screen\0".as_ptr() as *const _,
4792 Some(transmute::<_, unsafe extern "C" fn()>(
4793 notify_screen_trampoline::<Self, F> as *const (),
4794 )),
4795 Box_::into_raw(f),
4796 )
4797 }
4798 }
4799
4800 #[doc(alias = "skip-pager-hint")]
4801 fn connect_skip_pager_hint_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
4802 unsafe extern "C" fn notify_skip_pager_hint_trampoline<
4803 P: IsA<Window>,
4804 F: Fn(&P) + 'static,
4805 >(
4806 this: *mut ffi::GtkWindow,
4807 _param_spec: glib::ffi::gpointer,
4808 f: glib::ffi::gpointer,
4809 ) {
4810 let f: &F = &*(f as *const F);
4811 f(Window::from_glib_borrow(this).unsafe_cast_ref())
4812 }
4813 unsafe {
4814 let f: Box_<F> = Box_::new(f);
4815 connect_raw(
4816 self.as_ptr() as *mut _,
4817 b"notify::skip-pager-hint\0".as_ptr() as *const _,
4818 Some(transmute::<_, unsafe extern "C" fn()>(
4819 notify_skip_pager_hint_trampoline::<Self, F> as *const (),
4820 )),
4821 Box_::into_raw(f),
4822 )
4823 }
4824 }
4825
4826 #[doc(alias = "skip-taskbar-hint")]
4827 fn connect_skip_taskbar_hint_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
4828 unsafe extern "C" fn notify_skip_taskbar_hint_trampoline<
4829 P: IsA<Window>,
4830 F: Fn(&P) + 'static,
4831 >(
4832 this: *mut ffi::GtkWindow,
4833 _param_spec: glib::ffi::gpointer,
4834 f: glib::ffi::gpointer,
4835 ) {
4836 let f: &F = &*(f as *const F);
4837 f(Window::from_glib_borrow(this).unsafe_cast_ref())
4838 }
4839 unsafe {
4840 let f: Box_<F> = Box_::new(f);
4841 connect_raw(
4842 self.as_ptr() as *mut _,
4843 b"notify::skip-taskbar-hint\0".as_ptr() as *const _,
4844 Some(transmute::<_, unsafe extern "C" fn()>(
4845 notify_skip_taskbar_hint_trampoline::<Self, F> as *const (),
4846 )),
4847 Box_::into_raw(f),
4848 )
4849 }
4850 }
4851
4852 #[doc(alias = "startup-id")]
4853 fn connect_startup_id_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
4854 unsafe extern "C" fn notify_startup_id_trampoline<P: IsA<Window>, F: Fn(&P) + 'static>(
4855 this: *mut ffi::GtkWindow,
4856 _param_spec: glib::ffi::gpointer,
4857 f: glib::ffi::gpointer,
4858 ) {
4859 let f: &F = &*(f as *const F);
4860 f(Window::from_glib_borrow(this).unsafe_cast_ref())
4861 }
4862 unsafe {
4863 let f: Box_<F> = Box_::new(f);
4864 connect_raw(
4865 self.as_ptr() as *mut _,
4866 b"notify::startup-id\0".as_ptr() as *const _,
4867 Some(transmute::<_, unsafe extern "C" fn()>(
4868 notify_startup_id_trampoline::<Self, F> as *const (),
4869 )),
4870 Box_::into_raw(f),
4871 )
4872 }
4873 }
4874
4875 #[doc(alias = "title")]
4876 fn connect_title_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
4877 unsafe extern "C" fn notify_title_trampoline<P: IsA<Window>, F: Fn(&P) + 'static>(
4878 this: *mut ffi::GtkWindow,
4879 _param_spec: glib::ffi::gpointer,
4880 f: glib::ffi::gpointer,
4881 ) {
4882 let f: &F = &*(f as *const F);
4883 f(Window::from_glib_borrow(this).unsafe_cast_ref())
4884 }
4885 unsafe {
4886 let f: Box_<F> = Box_::new(f);
4887 connect_raw(
4888 self.as_ptr() as *mut _,
4889 b"notify::title\0".as_ptr() as *const _,
4890 Some(transmute::<_, unsafe extern "C" fn()>(
4891 notify_title_trampoline::<Self, F> as *const (),
4892 )),
4893 Box_::into_raw(f),
4894 )
4895 }
4896 }
4897
4898 #[doc(alias = "transient-for")]
4899 fn connect_transient_for_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
4900 unsafe extern "C" fn notify_transient_for_trampoline<
4901 P: IsA<Window>,
4902 F: Fn(&P) + 'static,
4903 >(
4904 this: *mut ffi::GtkWindow,
4905 _param_spec: glib::ffi::gpointer,
4906 f: glib::ffi::gpointer,
4907 ) {
4908 let f: &F = &*(f as *const F);
4909 f(Window::from_glib_borrow(this).unsafe_cast_ref())
4910 }
4911 unsafe {
4912 let f: Box_<F> = Box_::new(f);
4913 connect_raw(
4914 self.as_ptr() as *mut _,
4915 b"notify::transient-for\0".as_ptr() as *const _,
4916 Some(transmute::<_, unsafe extern "C" fn()>(
4917 notify_transient_for_trampoline::<Self, F> as *const (),
4918 )),
4919 Box_::into_raw(f),
4920 )
4921 }
4922 }
4923
4924 #[doc(alias = "type-hint")]
4925 fn connect_type_hint_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
4926 unsafe extern "C" fn notify_type_hint_trampoline<P: IsA<Window>, F: Fn(&P) + 'static>(
4927 this: *mut ffi::GtkWindow,
4928 _param_spec: glib::ffi::gpointer,
4929 f: glib::ffi::gpointer,
4930 ) {
4931 let f: &F = &*(f as *const F);
4932 f(Window::from_glib_borrow(this).unsafe_cast_ref())
4933 }
4934 unsafe {
4935 let f: Box_<F> = Box_::new(f);
4936 connect_raw(
4937 self.as_ptr() as *mut _,
4938 b"notify::type-hint\0".as_ptr() as *const _,
4939 Some(transmute::<_, unsafe extern "C" fn()>(
4940 notify_type_hint_trampoline::<Self, F> as *const (),
4941 )),
4942 Box_::into_raw(f),
4943 )
4944 }
4945 }
4946
4947 #[doc(alias = "urgency-hint")]
4948 fn connect_urgency_hint_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
4949 unsafe extern "C" fn notify_urgency_hint_trampoline<P: IsA<Window>, F: Fn(&P) + 'static>(
4950 this: *mut ffi::GtkWindow,
4951 _param_spec: glib::ffi::gpointer,
4952 f: glib::ffi::gpointer,
4953 ) {
4954 let f: &F = &*(f as *const F);
4955 f(Window::from_glib_borrow(this).unsafe_cast_ref())
4956 }
4957 unsafe {
4958 let f: Box_<F> = Box_::new(f);
4959 connect_raw(
4960 self.as_ptr() as *mut _,
4961 b"notify::urgency-hint\0".as_ptr() as *const _,
4962 Some(transmute::<_, unsafe extern "C" fn()>(
4963 notify_urgency_hint_trampoline::<Self, F> as *const (),
4964 )),
4965 Box_::into_raw(f),
4966 )
4967 }
4968 }
4969
4970 #[doc(alias = "window-position")]
4971 fn connect_window_position_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
4972 unsafe extern "C" fn notify_window_position_trampoline<
4973 P: IsA<Window>,
4974 F: Fn(&P) + 'static,
4975 >(
4976 this: *mut ffi::GtkWindow,
4977 _param_spec: glib::ffi::gpointer,
4978 f: glib::ffi::gpointer,
4979 ) {
4980 let f: &F = &*(f as *const F);
4981 f(Window::from_glib_borrow(this).unsafe_cast_ref())
4982 }
4983 unsafe {
4984 let f: Box_<F> = Box_::new(f);
4985 connect_raw(
4986 self.as_ptr() as *mut _,
4987 b"notify::window-position\0".as_ptr() as *const _,
4988 Some(transmute::<_, unsafe extern "C" fn()>(
4989 notify_window_position_trampoline::<Self, F> as *const (),
4990 )),
4991 Box_::into_raw(f),
4992 )
4993 }
4994 }
4995}
4996
4997impl<O: IsA<Window>> GtkWindowExt for O {}
4998
4999impl fmt::Display for Window {
5000 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
5001 f.write_str("Window")
5002 }
5003}