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