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