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 /// The ::drag-data-received signal is emitted on the drop site when the
748 /// dragged data has been received. If the data was received in order to
749 /// determine whether the drop will be accepted, the handler is expected
750 /// to call `gdk_drag_status()` and not finish the drag.
751 /// If the data was received in response to a [`drag-drop`][struct@crate::Widget#drag-drop] signal
752 /// (and this is the last target to be received), the handler for this
753 /// signal is expected to process the received data and then call
754 /// `gtk_drag_finish()`, setting the `success` parameter depending on
755 /// whether the data was processed successfully.
756 ///
757 /// Applications must create some means to determine why the signal was emitted
758 /// and therefore whether to call `gdk_drag_status()` or `gtk_drag_finish()`.
759 ///
760 /// The handler may inspect the selected action with
761 /// [`DragContext::selected_action()`][crate::gdk::DragContext::selected_action()] before calling
762 /// `gtk_drag_finish()`, e.g. to implement [`gdk::DragAction::ASK`][crate::gdk::DragAction::ASK] as
763 /// shown in the following example:
764 ///
765 ///
766 /// **⚠️ The following code is in C ⚠️**
767 ///
768 /// ```C
769 /// void
770 /// drag_data_received (GtkWidget *widget,
771 /// GdkDragContext *context,
772 /// gint x,
773 /// gint y,
774 /// GtkSelectionData *data,
775 /// guint info,
776 /// guint time)
777 /// {
778 /// if ((data->length >= 0) && (data->format == 8))
779 /// {
780 /// GdkDragAction action;
781 ///
782 /// // handle data here
783 ///
784 /// action = gdk_drag_context_get_selected_action (context);
785 /// if (action == GDK_ACTION_ASK)
786 /// {
787 /// GtkWidget *dialog;
788 /// gint response;
789 ///
790 /// dialog = gtk_message_dialog_new (NULL,
791 /// GTK_DIALOG_MODAL |
792 /// GTK_DIALOG_DESTROY_WITH_PARENT,
793 /// GTK_MESSAGE_INFO,
794 /// GTK_BUTTONS_YES_NO,
795 /// "Move the data ?\n");
796 /// response = gtk_dialog_run (GTK_DIALOG (dialog));
797 /// gtk_widget_destroy (dialog);
798 ///
799 /// if (response == GTK_RESPONSE_YES)
800 /// action = GDK_ACTION_MOVE;
801 /// else
802 /// action = GDK_ACTION_COPY;
803 /// }
804 ///
805 /// gtk_drag_finish (context, TRUE, action == GDK_ACTION_MOVE, time);
806 /// }
807 /// else
808 /// gtk_drag_finish (context, FALSE, FALSE, time);
809 /// }
810 /// ```
811 ///
812 ///
813 ///
814 ///
815 /// #### `drag-drop`
816 /// The ::drag-drop signal is emitted on the drop site when the user drops
817 /// the data onto the widget. The signal handler must determine whether
818 /// the cursor position is in a drop zone or not. If it is not in a drop
819 /// zone, it returns [`false`] and no further processing is necessary.
820 /// Otherwise, the handler returns [`true`]. In this case, the handler must
821 /// ensure that `gtk_drag_finish()` is called to let the source know that
822 /// the drop is done. The call to `gtk_drag_finish()` can be done either
823 /// directly or in a [`drag-data-received`][struct@crate::Widget#drag-data-received] handler which gets
824 /// triggered by calling [`WidgetExt::drag_get_data()`][crate::prelude::WidgetExt::drag_get_data()] to receive the data for one
825 /// or more of the supported targets.
826 ///
827 ///
828 ///
829 ///
830 /// #### `drag-end`
831 /// The ::drag-end signal is emitted on the drag source when a drag is
832 /// finished. A typical reason to connect to this signal is to undo
833 /// things done in [`drag-begin`][struct@crate::Widget#drag-begin].
834 ///
835 ///
836 ///
837 ///
838 /// #### `drag-failed`
839 /// The ::drag-failed signal is emitted on the drag source when a drag has
840 /// failed. The signal handler may hook custom code to handle a failed DnD
841 /// operation based on the type of error, it returns [`true`] is the failure has
842 /// been already handled (not showing the default "drag operation failed"
843 /// animation), otherwise it returns [`false`].
844 ///
845 ///
846 ///
847 ///
848 /// #### `drag-leave`
849 /// The ::drag-leave signal is emitted on the drop site when the cursor
850 /// leaves the widget. A typical reason to connect to this signal is to
851 /// undo things done in [`drag-motion`][struct@crate::Widget#drag-motion], e.g. undo highlighting
852 /// with [`WidgetExt::drag_unhighlight()`][crate::prelude::WidgetExt::drag_unhighlight()].
853 ///
854 ///
855 /// Likewise, the [`drag-leave`][struct@crate::Widget#drag-leave] signal is also emitted before the
856 /// ::drag-drop signal, for instance to allow cleaning up of a preview item
857 /// created in the [`drag-motion`][struct@crate::Widget#drag-motion] signal handler.
858 ///
859 ///
860 ///
861 ///
862 /// #### `drag-motion`
863 /// The ::drag-motion signal is emitted on the drop site when the user
864 /// moves the cursor over the widget during a drag. The signal handler
865 /// must determine whether the cursor position is in a drop zone or not.
866 /// If it is not in a drop zone, it returns [`false`] and no further processing
867 /// is necessary. Otherwise, the handler returns [`true`]. In this case, the
868 /// handler is responsible for providing the necessary information for
869 /// displaying feedback to the user, by calling `gdk_drag_status()`.
870 ///
871 /// If the decision whether the drop will be accepted or rejected can't be
872 /// made based solely on the cursor position and the type of the data, the
873 /// handler may inspect the dragged data by calling [`WidgetExt::drag_get_data()`][crate::prelude::WidgetExt::drag_get_data()] and
874 /// defer the `gdk_drag_status()` call to the [`drag-data-received`][struct@crate::Widget#drag-data-received]
875 /// handler. Note that you must pass [`DestDefaults::DROP`][crate::DestDefaults::DROP],
876 /// [`DestDefaults::MOTION`][crate::DestDefaults::MOTION] or [`DestDefaults::ALL`][crate::DestDefaults::ALL] to [`WidgetExtManual::drag_dest_set()`][crate::prelude::WidgetExtManual::drag_dest_set()]
877 /// when using the drag-motion signal that way.
878 ///
879 /// Also note that there is no drag-enter signal. The drag receiver has to
880 /// keep track of whether he has received any drag-motion signals since the
881 /// last [`drag-leave`][struct@crate::Widget#drag-leave] and if not, treat the drag-motion signal as
882 /// an "enter" signal. Upon an "enter", the handler will typically highlight
883 /// the drop site with [`WidgetExt::drag_highlight()`][crate::prelude::WidgetExt::drag_highlight()].
884 ///
885 ///
886 /// **⚠️ The following code is in C ⚠️**
887 ///
888 /// ```C
889 /// static void
890 /// drag_motion (GtkWidget *widget,
891 /// GdkDragContext *context,
892 /// gint x,
893 /// gint y,
894 /// guint time)
895 /// {
896 /// GdkAtom target;
897 ///
898 /// PrivateData *private_data = GET_PRIVATE_DATA (widget);
899 ///
900 /// if (!private_data->drag_highlight)
901 /// {
902 /// private_data->drag_highlight = 1;
903 /// gtk_drag_highlight (widget);
904 /// }
905 ///
906 /// target = gtk_drag_dest_find_target (widget, context, NULL);
907 /// if (target == GDK_NONE)
908 /// gdk_drag_status (context, 0, time);
909 /// else
910 /// {
911 /// private_data->pending_status
912 /// = gdk_drag_context_get_suggested_action (context);
913 /// gtk_drag_get_data (widget, context, target, time);
914 /// }
915 ///
916 /// return TRUE;
917 /// }
918 ///
919 /// static void
920 /// drag_data_received (GtkWidget *widget,
921 /// GdkDragContext *context,
922 /// gint x,
923 /// gint y,
924 /// GtkSelectionData *selection_data,
925 /// guint info,
926 /// guint time)
927 /// {
928 /// PrivateData *private_data = GET_PRIVATE_DATA (widget);
929 ///
930 /// if (private_data->suggested_action)
931 /// {
932 /// private_data->suggested_action = 0;
933 ///
934 /// // We are getting this data due to a request in drag_motion,
935 /// // rather than due to a request in drag_drop, so we are just
936 /// // supposed to call gdk_drag_status(), not actually paste in
937 /// // the data.
938 ///
939 /// str = gtk_selection_data_get_text (selection_data);
940 /// if (!data_is_acceptable (str))
941 /// gdk_drag_status (context, 0, time);
942 /// else
943 /// gdk_drag_status (context,
944 /// private_data->suggested_action,
945 /// time);
946 /// }
947 /// else
948 /// {
949 /// // accept the drop
950 /// }
951 /// }
952 /// ```
953 ///
954 ///
955 ///
956 ///
957 /// #### `draw`
958 /// This signal is emitted when a widget is supposed to render itself.
959 /// The `widget`'s top left corner must be painted at the origin of
960 /// the passed in context and be sized to the values returned by
961 /// [`WidgetExt::allocated_width()`][crate::prelude::WidgetExt::allocated_width()] and
962 /// [`WidgetExt::allocated_height()`][crate::prelude::WidgetExt::allocated_height()].
963 ///
964 /// Signal handlers connected to this signal can modify the cairo
965 /// context passed as `cr` in any way they like and don't need to
966 /// restore it. The signal emission takes care of calling `cairo_save()`
967 /// before and `cairo_restore()` after invoking the handler.
968 ///
969 /// The signal handler will get a `cr` with a clip region already set to the
970 /// widget's dirty region, i.e. to the area that needs repainting. Complicated
971 /// widgets that want to avoid redrawing themselves completely can get the full
972 /// extents of the clip region with `gdk_cairo_get_clip_rectangle()`, or they can
973 /// get a finer-grained representation of the dirty region with
974 /// `cairo_copy_clip_rectangle_list()`.
975 ///
976 ///
977 ///
978 ///
979 /// #### `enter-notify-event`
980 /// The ::enter-notify-event will be emitted when the pointer enters
981 /// the `widget`'s window.
982 ///
983 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
984 /// to enable the [`gdk::EventMask::ENTER_NOTIFY_MASK`][crate::gdk::EventMask::ENTER_NOTIFY_MASK] mask.
985 ///
986 /// This signal will be sent to the grab widget if there is one.
987 ///
988 ///
989 ///
990 ///
991 /// #### `event`
992 /// The GTK+ main loop will emit three signals for each GDK event delivered
993 /// to a widget: one generic ::event signal, another, more specific,
994 /// signal that matches the type of event delivered (e.g.
995 /// [`key-press-event`][struct@crate::Widget#key-press-event]) and finally a generic
996 /// [`event-after`][struct@crate::Widget#event-after] signal.
997 ///
998 ///
999 ///
1000 ///
1001 /// #### `event-after`
1002 /// After the emission of the [`event`][struct@crate::Widget#event] signal and (optionally)
1003 /// the second more specific signal, ::event-after will be emitted
1004 /// regardless of the previous two signals handlers return values.
1005 ///
1006 ///
1007 ///
1008 ///
1009 /// #### `focus`
1010 ///
1011 ///
1012 ///
1013 /// #### `focus-in-event`
1014 /// The ::focus-in-event signal will be emitted when the keyboard focus
1015 /// enters the `widget`'s window.
1016 ///
1017 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
1018 /// to enable the [`gdk::EventMask::FOCUS_CHANGE_MASK`][crate::gdk::EventMask::FOCUS_CHANGE_MASK] mask.
1019 ///
1020 ///
1021 ///
1022 ///
1023 /// #### `focus-out-event`
1024 /// The ::focus-out-event signal will be emitted when the keyboard focus
1025 /// leaves the `widget`'s window.
1026 ///
1027 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
1028 /// to enable the [`gdk::EventMask::FOCUS_CHANGE_MASK`][crate::gdk::EventMask::FOCUS_CHANGE_MASK] mask.
1029 ///
1030 ///
1031 ///
1032 ///
1033 /// #### `grab-broken-event`
1034 /// Emitted when a pointer or keyboard grab on a window belonging
1035 /// to `widget` gets broken.
1036 ///
1037 /// On X11, this happens when the grab window becomes unviewable
1038 /// (i.e. it or one of its ancestors is unmapped), or if the same
1039 /// application grabs the pointer or keyboard again.
1040 ///
1041 ///
1042 ///
1043 ///
1044 /// #### `grab-focus`
1045 /// Action
1046 ///
1047 ///
1048 /// #### `grab-notify`
1049 /// The ::grab-notify signal is emitted when a widget becomes
1050 /// shadowed by a GTK+ grab (not a pointer or keyboard grab) on
1051 /// another widget, or when it becomes unshadowed due to a grab
1052 /// being removed.
1053 ///
1054 /// A widget is shadowed by a [`WidgetExt::grab_add()`][crate::prelude::WidgetExt::grab_add()] when the topmost
1055 /// grab widget in the grab stack of its window group is not
1056 /// its ancestor.
1057 ///
1058 ///
1059 ///
1060 ///
1061 /// #### `hide`
1062 /// The ::hide signal is emitted when `widget` is hidden, for example with
1063 /// [`WidgetExt::hide()`][crate::prelude::WidgetExt::hide()].
1064 ///
1065 ///
1066 ///
1067 ///
1068 /// #### `hierarchy-changed`
1069 /// The ::hierarchy-changed signal is emitted when the
1070 /// anchored state of a widget changes. A widget is
1071 /// “anchored” when its toplevel
1072 /// ancestor is a [`Window`][crate::Window]. This signal is emitted when
1073 /// a widget changes from un-anchored to anchored or vice-versa.
1074 ///
1075 ///
1076 ///
1077 ///
1078 /// #### `key-press-event`
1079 /// The ::key-press-event signal is emitted when a key is pressed. The signal
1080 /// emission will reoccur at the key-repeat rate when the key is kept pressed.
1081 ///
1082 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
1083 /// to enable the [`gdk::EventMask::KEY_PRESS_MASK`][crate::gdk::EventMask::KEY_PRESS_MASK] mask.
1084 ///
1085 /// This signal will be sent to the grab widget if there is one.
1086 ///
1087 ///
1088 ///
1089 ///
1090 /// #### `key-release-event`
1091 /// The ::key-release-event signal is emitted when a key is released.
1092 ///
1093 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
1094 /// to enable the [`gdk::EventMask::KEY_RELEASE_MASK`][crate::gdk::EventMask::KEY_RELEASE_MASK] mask.
1095 ///
1096 /// This signal will be sent to the grab widget if there is one.
1097 ///
1098 ///
1099 ///
1100 ///
1101 /// #### `keynav-failed`
1102 /// Gets emitted if keyboard navigation fails.
1103 /// See [`WidgetExt::keynav_failed()`][crate::prelude::WidgetExt::keynav_failed()] for details.
1104 ///
1105 ///
1106 ///
1107 ///
1108 /// #### `leave-notify-event`
1109 /// The ::leave-notify-event will be emitted when the pointer leaves
1110 /// the `widget`'s window.
1111 ///
1112 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
1113 /// to enable the [`gdk::EventMask::LEAVE_NOTIFY_MASK`][crate::gdk::EventMask::LEAVE_NOTIFY_MASK] mask.
1114 ///
1115 /// This signal will be sent to the grab widget if there is one.
1116 ///
1117 ///
1118 ///
1119 ///
1120 /// #### `map`
1121 /// The ::map signal is emitted when `widget` is going to be mapped, that is
1122 /// when the widget is visible (which is controlled with
1123 /// [`WidgetExt::set_visible()`][crate::prelude::WidgetExt::set_visible()]) and all its parents up to the toplevel widget
1124 /// are also visible. Once the map has occurred, [`map-event`][struct@crate::Widget#map-event] will
1125 /// be emitted.
1126 ///
1127 /// The ::map signal can be used to determine whether a widget will be drawn,
1128 /// for instance it can resume an animation that was stopped during the
1129 /// emission of [`unmap`][struct@crate::Widget#unmap].
1130 ///
1131 ///
1132 ///
1133 ///
1134 /// #### `map-event`
1135 /// The ::map-event signal will be emitted when the `widget`'s window is
1136 /// mapped. A window is mapped when it becomes visible on the screen.
1137 ///
1138 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
1139 /// to enable the [`gdk::EventMask::STRUCTURE_MASK`][crate::gdk::EventMask::STRUCTURE_MASK] mask. GDK will enable this mask
1140 /// automatically for all new windows.
1141 ///
1142 ///
1143 ///
1144 ///
1145 /// #### `mnemonic-activate`
1146 /// The default handler for this signal activates `widget` if `group_cycling`
1147 /// is [`false`], or just makes `widget` grab focus if `group_cycling` is [`true`].
1148 ///
1149 ///
1150 ///
1151 ///
1152 /// #### `motion-notify-event`
1153 /// The ::motion-notify-event signal is emitted when the pointer moves
1154 /// over the widget's [`gdk::Window`][crate::gdk::Window].
1155 ///
1156 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget
1157 /// needs to enable the [`gdk::EventMask::POINTER_MOTION_MASK`][crate::gdk::EventMask::POINTER_MOTION_MASK] mask.
1158 ///
1159 /// This signal will be sent to the grab widget if there is one.
1160 ///
1161 ///
1162 ///
1163 ///
1164 /// #### `move-focus`
1165 /// Action
1166 ///
1167 ///
1168 /// #### `parent-set`
1169 /// The ::parent-set signal is emitted when a new parent
1170 /// has been set on a widget.
1171 ///
1172 ///
1173 ///
1174 ///
1175 /// #### `popup-menu`
1176 /// This signal gets emitted whenever a widget should pop up a context
1177 /// menu. This usually happens through the standard key binding mechanism;
1178 /// by pressing a certain key while a widget is focused, the user can cause
1179 /// the widget to pop up a menu. For example, the [`Entry`][crate::Entry] widget creates
1180 /// a menu with clipboard commands. See the
1181 /// [Popup Menu Migration Checklist][checklist-popup-menu]
1182 /// for an example of how to use this signal.
1183 ///
1184 /// Action
1185 ///
1186 ///
1187 /// #### `property-notify-event`
1188 /// The ::property-notify-event signal will be emitted when a property on
1189 /// the `widget`'s window has been changed or deleted.
1190 ///
1191 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
1192 /// to enable the [`gdk::EventMask::PROPERTY_CHANGE_MASK`][crate::gdk::EventMask::PROPERTY_CHANGE_MASK] mask.
1193 ///
1194 ///
1195 ///
1196 ///
1197 /// #### `proximity-in-event`
1198 /// To receive this signal the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
1199 /// to enable the [`gdk::EventMask::PROXIMITY_IN_MASK`][crate::gdk::EventMask::PROXIMITY_IN_MASK] mask.
1200 ///
1201 /// This signal will be sent to the grab widget if there is one.
1202 ///
1203 ///
1204 ///
1205 ///
1206 /// #### `proximity-out-event`
1207 /// To receive this signal the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
1208 /// to enable the [`gdk::EventMask::PROXIMITY_OUT_MASK`][crate::gdk::EventMask::PROXIMITY_OUT_MASK] mask.
1209 ///
1210 /// This signal will be sent to the grab widget if there is one.
1211 ///
1212 ///
1213 ///
1214 ///
1215 /// #### `query-tooltip`
1216 /// Emitted when [`has-tooltip`][struct@crate::Widget#has-tooltip] is [`true`] and the hover timeout
1217 /// has expired with the cursor hovering "above" `widget`; or emitted when `widget` got
1218 /// focus in keyboard mode.
1219 ///
1220 /// Using the given coordinates, the signal handler should determine
1221 /// whether a tooltip should be shown for `widget`. If this is the case
1222 /// [`true`] should be returned, [`false`] otherwise. Note that if
1223 /// `keyboard_mode` is [`true`], the values of `x` and `y` are undefined and
1224 /// should not be used.
1225 ///
1226 /// The signal handler is free to manipulate `tooltip` with the therefore
1227 /// destined function calls.
1228 ///
1229 ///
1230 ///
1231 ///
1232 /// #### `realize`
1233 /// The ::realize signal is emitted when `widget` is associated with a
1234 /// [`gdk::Window`][crate::gdk::Window], which means that [`WidgetExt::realize()`][crate::prelude::WidgetExt::realize()] has been called or the
1235 /// widget has been mapped (that is, it is going to be drawn).
1236 ///
1237 ///
1238 ///
1239 ///
1240 /// #### `screen-changed`
1241 /// The ::screen-changed signal gets emitted when the
1242 /// screen of a widget has changed.
1243 ///
1244 ///
1245 ///
1246 ///
1247 /// #### `scroll-event`
1248 /// The ::scroll-event signal is emitted when a button in the 4 to 7
1249 /// range is pressed. Wheel mice are usually configured to generate
1250 /// button press events for buttons 4 and 5 when the wheel is turned.
1251 ///
1252 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
1253 /// to enable the [`gdk::EventMask::SCROLL_MASK`][crate::gdk::EventMask::SCROLL_MASK] mask.
1254 ///
1255 /// This signal will be sent to the grab widget if there is one.
1256 ///
1257 ///
1258 ///
1259 ///
1260 /// #### `selection-clear-event`
1261 /// The ::selection-clear-event signal will be emitted when the
1262 /// the `widget`'s window has lost ownership of a selection.
1263 ///
1264 ///
1265 ///
1266 ///
1267 /// #### `selection-get`
1268 ///
1269 ///
1270 ///
1271 /// #### `selection-notify-event`
1272 ///
1273 ///
1274 ///
1275 /// #### `selection-received`
1276 ///
1277 ///
1278 ///
1279 /// #### `selection-request-event`
1280 /// The ::selection-request-event signal will be emitted when
1281 /// another client requests ownership of the selection owned by
1282 /// the `widget`'s window.
1283 ///
1284 ///
1285 ///
1286 ///
1287 /// #### `show`
1288 /// The ::show signal is emitted when `widget` is shown, for example with
1289 /// [`WidgetExt::show()`][crate::prelude::WidgetExt::show()].
1290 ///
1291 ///
1292 ///
1293 ///
1294 /// #### `show-help`
1295 /// Action
1296 ///
1297 ///
1298 /// #### `size-allocate`
1299 ///
1300 ///
1301 ///
1302 /// #### `state-changed`
1303 /// The ::state-changed signal is emitted when the widget state changes.
1304 /// See `gtk_widget_get_state()`.
1305 ///
1306 ///
1307 ///
1308 ///
1309 /// #### `state-flags-changed`
1310 /// The ::state-flags-changed signal is emitted when the widget state
1311 /// changes, see [`WidgetExt::state_flags()`][crate::prelude::WidgetExt::state_flags()].
1312 ///
1313 ///
1314 ///
1315 ///
1316 /// #### `style-set`
1317 /// The ::style-set signal is emitted when a new style has been set
1318 /// on a widget. Note that style-modifying functions like
1319 /// `gtk_widget_modify_base()` also cause this signal to be emitted.
1320 ///
1321 /// Note that this signal is emitted for changes to the deprecated
1322 /// `GtkStyle`. To track changes to the [`StyleContext`][crate::StyleContext] associated
1323 /// with a widget, use the [`style-updated`][struct@crate::Widget#style-updated] signal.
1324 ///
1325 ///
1326 ///
1327 ///
1328 /// #### `style-updated`
1329 /// The ::style-updated signal is a convenience signal that is emitted when the
1330 /// [`changed`][struct@crate::StyleContext#changed] signal is emitted on the `widget`'s associated
1331 /// [`StyleContext`][crate::StyleContext] as returned by [`WidgetExt::style_context()`][crate::prelude::WidgetExt::style_context()].
1332 ///
1333 /// Note that style-modifying functions like `gtk_widget_override_color()` also
1334 /// cause this signal to be emitted.
1335 ///
1336 ///
1337 ///
1338 ///
1339 /// #### `touch-event`
1340 ///
1341 ///
1342 ///
1343 /// #### `unmap`
1344 /// The ::unmap signal is emitted when `widget` is going to be unmapped, which
1345 /// means that either it or any of its parents up to the toplevel widget have
1346 /// been set as hidden.
1347 ///
1348 /// As ::unmap indicates that a widget will not be shown any longer, it can be
1349 /// used to, for example, stop an animation on the widget.
1350 ///
1351 ///
1352 ///
1353 ///
1354 /// #### `unmap-event`
1355 /// The ::unmap-event signal will be emitted when the `widget`'s window is
1356 /// unmapped. A window is unmapped when it becomes invisible on the screen.
1357 ///
1358 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
1359 /// to enable the [`gdk::EventMask::STRUCTURE_MASK`][crate::gdk::EventMask::STRUCTURE_MASK] mask. GDK will enable this mask
1360 /// automatically for all new windows.
1361 ///
1362 ///
1363 ///
1364 ///
1365 /// #### `unrealize`
1366 /// The ::unrealize signal is emitted when the [`gdk::Window`][crate::gdk::Window] associated with
1367 /// `widget` is destroyed, which means that [`WidgetExt::unrealize()`][crate::prelude::WidgetExt::unrealize()] has been
1368 /// called or the widget has been unmapped (that is, it is going to be
1369 /// hidden).
1370 ///
1371 ///
1372 ///
1373 ///
1374 /// #### `visibility-notify-event`
1375 /// The ::visibility-notify-event will be emitted when the `widget`'s
1376 /// window is obscured or unobscured.
1377 ///
1378 /// To receive this signal the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
1379 /// to enable the [`gdk::EventMask::VISIBILITY_NOTIFY_MASK`][crate::gdk::EventMask::VISIBILITY_NOTIFY_MASK] mask.
1380 ///
1381 ///
1382 ///
1383 ///
1384 /// #### `window-state-event`
1385 /// The ::window-state-event will be emitted when the state of the
1386 /// toplevel window associated to the `widget` changes.
1387 ///
1388 /// To receive this signal the [`gdk::Window`][crate::gdk::Window] associated to the widget
1389 /// needs to enable the [`gdk::EventMask::STRUCTURE_MASK`][crate::gdk::EventMask::STRUCTURE_MASK] mask. GDK will enable
1390 /// this mask automatically for all new windows.
1391 ///
1392 ///
1393 /// </details>
1394 ///
1395 /// # Implements
1396 ///
1397 /// [`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]
1398 #[doc(alias = "GtkPlug")]
1399 pub struct Plug(Object<ffi::GtkPlug, ffi::GtkPlugClass>) @extends Window, Bin, Container, Widget, @implements Buildable;
1400
1401 match fn {
1402 type_ => || ffi::gtk_plug_get_type(),
1403 }
1404}
1405
1406impl Plug {
1407 pub const NONE: Option<&'static Plug> = None;
1408
1409 /// Creates a new plug widget inside the [`Socket`][crate::Socket] identified
1410 /// by `socket_id`. If `socket_id` is 0, the plug is left “unplugged” and
1411 /// can later be plugged into a [`Socket`][crate::Socket] by [`GtkSocketExt::add_id()`][crate::prelude::GtkSocketExt::add_id()].
1412 /// ## `socket_id`
1413 /// the window ID of the socket, or 0.
1414 ///
1415 /// # Returns
1416 ///
1417 /// the new [`Plug`][crate::Plug] widget.
1418 #[doc(alias = "gtk_plug_new")]
1419 pub fn new(socket_id: xlib::Window) -> Plug {
1420 assert_initialized_main_thread!();
1421 unsafe { Widget::from_glib_none(ffi::gtk_plug_new(socket_id)).unsafe_cast() }
1422 }
1423
1424 /// Create a new plug widget inside the [`Socket`][crate::Socket] identified by socket_id.
1425 /// ## `display`
1426 /// the [`gdk::Display`][crate::gdk::Display] on which `socket_id` is displayed
1427 /// ## `socket_id`
1428 /// the XID of the socket’s window.
1429 ///
1430 /// # Returns
1431 ///
1432 /// the new [`Plug`][crate::Plug] widget.
1433 #[doc(alias = "gtk_plug_new_for_display")]
1434 #[doc(alias = "new_for_display")]
1435 pub fn for_display(display: &gdk::Display, socket_id: xlib::Window) -> Plug {
1436 assert_initialized_main_thread!();
1437 unsafe {
1438 Widget::from_glib_none(ffi::gtk_plug_new_for_display(
1439 display.to_glib_none().0,
1440 socket_id,
1441 ))
1442 .unsafe_cast()
1443 }
1444 }
1445
1446 // rustdoc-stripper-ignore-next
1447 /// Creates a new builder-pattern struct instance to construct [`Plug`] objects.
1448 ///
1449 /// This method returns an instance of [`PlugBuilder`](crate::builders::PlugBuilder) which can be used to create [`Plug`] objects.
1450 pub fn builder() -> PlugBuilder {
1451 PlugBuilder::new()
1452 }
1453}
1454
1455impl Default for Plug {
1456 fn default() -> Self {
1457 glib::object::Object::new::<Self>()
1458 }
1459}
1460
1461// rustdoc-stripper-ignore-next
1462/// A [builder-pattern] type to construct [`Plug`] objects.
1463///
1464/// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html
1465#[must_use = "The builder must be built to be used"]
1466pub struct PlugBuilder {
1467 builder: glib::object::ObjectBuilder<'static, Plug>,
1468}
1469
1470impl PlugBuilder {
1471 fn new() -> Self {
1472 Self {
1473 builder: glib::object::Object::builder(),
1474 }
1475 }
1476
1477 /// Whether the window should receive the input focus.
1478 pub fn accept_focus(self, accept_focus: bool) -> Self {
1479 Self {
1480 builder: self.builder.property("accept-focus", accept_focus),
1481 }
1482 }
1483
1484 /// The [`Application`][crate::Application] associated with the window.
1485 ///
1486 /// The application will be kept alive for at least as long as it
1487 /// has any windows associated with it (see [`ApplicationExtManual::hold()`][crate::gio::prelude::ApplicationExtManual::hold()]
1488 /// for a way to keep it alive without windows).
1489 ///
1490 /// Normally, the connection between the application and the window
1491 /// will remain until the window is destroyed, but you can explicitly
1492 /// remove it by setting the :application property to [`None`].
1493 pub fn application(self, application: &impl IsA<Application>) -> Self {
1494 Self {
1495 builder: self
1496 .builder
1497 .property("application", application.clone().upcast()),
1498 }
1499 }
1500
1501 /// The widget to which this window is attached.
1502 /// See [`GtkWindowExt::set_attached_to()`][crate::prelude::GtkWindowExt::set_attached_to()].
1503 ///
1504 /// Examples of places where specifying this relation is useful are
1505 /// for instance a [`Menu`][crate::Menu] created by a [`ComboBox`][crate::ComboBox], a completion
1506 /// popup window created by [`Entry`][crate::Entry] or a typeahead search entry
1507 /// created by [`TreeView`][crate::TreeView].
1508 pub fn attached_to(self, attached_to: &impl IsA<Widget>) -> Self {
1509 Self {
1510 builder: self
1511 .builder
1512 .property("attached-to", attached_to.clone().upcast()),
1513 }
1514 }
1515
1516 /// Whether the window should be decorated by the window manager.
1517 pub fn decorated(self, decorated: bool) -> Self {
1518 Self {
1519 builder: self.builder.property("decorated", decorated),
1520 }
1521 }
1522
1523 pub fn default_height(self, default_height: i32) -> Self {
1524 Self {
1525 builder: self.builder.property("default-height", default_height),
1526 }
1527 }
1528
1529 pub fn default_width(self, default_width: i32) -> Self {
1530 Self {
1531 builder: self.builder.property("default-width", default_width),
1532 }
1533 }
1534
1535 /// Whether the window frame should have a close button.
1536 pub fn deletable(self, deletable: bool) -> Self {
1537 Self {
1538 builder: self.builder.property("deletable", deletable),
1539 }
1540 }
1541
1542 pub fn destroy_with_parent(self, destroy_with_parent: bool) -> Self {
1543 Self {
1544 builder: self
1545 .builder
1546 .property("destroy-with-parent", destroy_with_parent),
1547 }
1548 }
1549
1550 /// Whether the window should receive the input focus when mapped.
1551 pub fn focus_on_map(self, focus_on_map: bool) -> Self {
1552 Self {
1553 builder: self.builder.property("focus-on-map", focus_on_map),
1554 }
1555 }
1556
1557 /// Whether 'focus rectangles' are currently visible in this window.
1558 ///
1559 /// This property is maintained by GTK+ based on user input
1560 /// and should not be set by applications.
1561 pub fn focus_visible(self, focus_visible: bool) -> Self {
1562 Self {
1563 builder: self.builder.property("focus-visible", focus_visible),
1564 }
1565 }
1566
1567 /// The window gravity of the window. See [`GtkWindowExt::move_()`][crate::prelude::GtkWindowExt::move_()] and [`gdk::Gravity`][crate::gdk::Gravity] for
1568 /// more details about window gravity.
1569 pub fn gravity(self, gravity: gdk::Gravity) -> Self {
1570 Self {
1571 builder: self.builder.property("gravity", gravity),
1572 }
1573 }
1574
1575 /// Whether the titlebar should be hidden during maximization.
1576 pub fn hide_titlebar_when_maximized(self, hide_titlebar_when_maximized: bool) -> Self {
1577 Self {
1578 builder: self
1579 .builder
1580 .property("hide-titlebar-when-maximized", hide_titlebar_when_maximized),
1581 }
1582 }
1583
1584 pub fn icon(self, icon: &gdk_pixbuf::Pixbuf) -> Self {
1585 Self {
1586 builder: self.builder.property("icon", icon.clone()),
1587 }
1588 }
1589
1590 /// The :icon-name property specifies the name of the themed icon to
1591 /// use as the window icon. See [`IconTheme`][crate::IconTheme] for more details.
1592 pub fn icon_name(self, icon_name: impl Into<glib::GString>) -> Self {
1593 Self {
1594 builder: self.builder.property("icon-name", icon_name.into()),
1595 }
1596 }
1597
1598 /// Whether mnemonics are currently visible in this window.
1599 ///
1600 /// This property is maintained by GTK+ based on user input,
1601 /// and should not be set by applications.
1602 pub fn mnemonics_visible(self, mnemonics_visible: bool) -> Self {
1603 Self {
1604 builder: self
1605 .builder
1606 .property("mnemonics-visible", mnemonics_visible),
1607 }
1608 }
1609
1610 pub fn modal(self, modal: bool) -> Self {
1611 Self {
1612 builder: self.builder.property("modal", modal),
1613 }
1614 }
1615
1616 pub fn resizable(self, resizable: bool) -> Self {
1617 Self {
1618 builder: self.builder.property("resizable", resizable),
1619 }
1620 }
1621
1622 pub fn role(self, role: impl Into<glib::GString>) -> Self {
1623 Self {
1624 builder: self.builder.property("role", role.into()),
1625 }
1626 }
1627
1628 pub fn screen(self, screen: &gdk::Screen) -> Self {
1629 Self {
1630 builder: self.builder.property("screen", screen.clone()),
1631 }
1632 }
1633
1634 pub fn skip_pager_hint(self, skip_pager_hint: bool) -> Self {
1635 Self {
1636 builder: self.builder.property("skip-pager-hint", skip_pager_hint),
1637 }
1638 }
1639
1640 pub fn skip_taskbar_hint(self, skip_taskbar_hint: bool) -> Self {
1641 Self {
1642 builder: self
1643 .builder
1644 .property("skip-taskbar-hint", skip_taskbar_hint),
1645 }
1646 }
1647
1648 /// The :startup-id is a write-only property for setting window's
1649 /// startup notification identifier. See [`GtkWindowExt::set_startup_id()`][crate::prelude::GtkWindowExt::set_startup_id()]
1650 /// for more details.
1651 pub fn startup_id(self, startup_id: impl Into<glib::GString>) -> Self {
1652 Self {
1653 builder: self.builder.property("startup-id", startup_id.into()),
1654 }
1655 }
1656
1657 pub fn title(self, title: impl Into<glib::GString>) -> Self {
1658 Self {
1659 builder: self.builder.property("title", title.into()),
1660 }
1661 }
1662
1663 /// The transient parent of the window. See [`GtkWindowExt::set_transient_for()`][crate::prelude::GtkWindowExt::set_transient_for()] for
1664 /// more details about transient windows.
1665 pub fn transient_for(self, transient_for: &impl IsA<Window>) -> Self {
1666 Self {
1667 builder: self
1668 .builder
1669 .property("transient-for", transient_for.clone().upcast()),
1670 }
1671 }
1672
1673 pub fn type_(self, type_: WindowType) -> Self {
1674 Self {
1675 builder: self.builder.property("type", type_),
1676 }
1677 }
1678
1679 pub fn type_hint(self, type_hint: gdk::WindowTypeHint) -> Self {
1680 Self {
1681 builder: self.builder.property("type-hint", type_hint),
1682 }
1683 }
1684
1685 pub fn urgency_hint(self, urgency_hint: bool) -> Self {
1686 Self {
1687 builder: self.builder.property("urgency-hint", urgency_hint),
1688 }
1689 }
1690
1691 pub fn window_position(self, window_position: WindowPosition) -> Self {
1692 Self {
1693 builder: self.builder.property("window-position", window_position),
1694 }
1695 }
1696
1697 pub fn border_width(self, border_width: u32) -> Self {
1698 Self {
1699 builder: self.builder.property("border-width", border_width),
1700 }
1701 }
1702
1703 pub fn child(self, child: &impl IsA<Widget>) -> Self {
1704 Self {
1705 builder: self.builder.property("child", child.clone().upcast()),
1706 }
1707 }
1708
1709 pub fn resize_mode(self, resize_mode: ResizeMode) -> Self {
1710 Self {
1711 builder: self.builder.property("resize-mode", resize_mode),
1712 }
1713 }
1714
1715 pub fn app_paintable(self, app_paintable: bool) -> Self {
1716 Self {
1717 builder: self.builder.property("app-paintable", app_paintable),
1718 }
1719 }
1720
1721 pub fn can_default(self, can_default: bool) -> Self {
1722 Self {
1723 builder: self.builder.property("can-default", can_default),
1724 }
1725 }
1726
1727 pub fn can_focus(self, can_focus: bool) -> Self {
1728 Self {
1729 builder: self.builder.property("can-focus", can_focus),
1730 }
1731 }
1732
1733 pub fn events(self, events: gdk::EventMask) -> Self {
1734 Self {
1735 builder: self.builder.property("events", events),
1736 }
1737 }
1738
1739 /// Whether to expand in both directions. Setting this sets both [`hexpand`][struct@crate::Widget#hexpand] and [`vexpand`][struct@crate::Widget#vexpand]
1740 pub fn expand(self, expand: bool) -> Self {
1741 Self {
1742 builder: self.builder.property("expand", expand),
1743 }
1744 }
1745
1746 /// Whether the widget should grab focus when it is clicked with the mouse.
1747 ///
1748 /// This property is only relevant for widgets that can take focus.
1749 ///
1750 /// Before 3.20, several widgets (GtkButton, GtkFileChooserButton,
1751 /// GtkComboBox) implemented this property individually.
1752 pub fn focus_on_click(self, focus_on_click: bool) -> Self {
1753 Self {
1754 builder: self.builder.property("focus-on-click", focus_on_click),
1755 }
1756 }
1757
1758 /// How to distribute horizontal space if widget gets extra space, see [`Align`][crate::Align]
1759 pub fn halign(self, halign: Align) -> Self {
1760 Self {
1761 builder: self.builder.property("halign", halign),
1762 }
1763 }
1764
1765 pub fn has_default(self, has_default: bool) -> Self {
1766 Self {
1767 builder: self.builder.property("has-default", has_default),
1768 }
1769 }
1770
1771 pub fn has_focus(self, has_focus: bool) -> Self {
1772 Self {
1773 builder: self.builder.property("has-focus", has_focus),
1774 }
1775 }
1776
1777 /// Enables or disables the emission of [`query-tooltip`][struct@crate::Widget#query-tooltip] on `widget`.
1778 /// A value of [`true`] indicates that `widget` can have a tooltip, in this case
1779 /// the widget will be queried using [`query-tooltip`][struct@crate::Widget#query-tooltip] to determine
1780 /// whether it will provide a tooltip or not.
1781 ///
1782 /// Note that setting this property to [`true`] for the first time will change
1783 /// the event masks of the GdkWindows of this widget to include leave-notify
1784 /// and motion-notify events. This cannot and will not be undone when the
1785 /// property is set to [`false`] again.
1786 pub fn has_tooltip(self, has_tooltip: bool) -> Self {
1787 Self {
1788 builder: self.builder.property("has-tooltip", has_tooltip),
1789 }
1790 }
1791
1792 pub fn height_request(self, height_request: i32) -> Self {
1793 Self {
1794 builder: self.builder.property("height-request", height_request),
1795 }
1796 }
1797
1798 /// Whether to expand horizontally. See [`WidgetExt::set_hexpand()`][crate::prelude::WidgetExt::set_hexpand()].
1799 pub fn hexpand(self, hexpand: bool) -> Self {
1800 Self {
1801 builder: self.builder.property("hexpand", hexpand),
1802 }
1803 }
1804
1805 /// Whether to use the [`hexpand`][struct@crate::Widget#hexpand] property. See [`WidgetExt::is_hexpand_set()`][crate::prelude::WidgetExt::is_hexpand_set()].
1806 pub fn hexpand_set(self, hexpand_set: bool) -> Self {
1807 Self {
1808 builder: self.builder.property("hexpand-set", hexpand_set),
1809 }
1810 }
1811
1812 pub fn is_focus(self, is_focus: bool) -> Self {
1813 Self {
1814 builder: self.builder.property("is-focus", is_focus),
1815 }
1816 }
1817
1818 /// Sets all four sides' margin at once. If read, returns max
1819 /// margin on any side.
1820 pub fn margin(self, margin: i32) -> Self {
1821 Self {
1822 builder: self.builder.property("margin", margin),
1823 }
1824 }
1825
1826 /// Margin on bottom side of widget.
1827 ///
1828 /// This property adds margin outside of the widget's normal size
1829 /// request, the margin will be added in addition to the size from
1830 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1831 pub fn margin_bottom(self, margin_bottom: i32) -> Self {
1832 Self {
1833 builder: self.builder.property("margin-bottom", margin_bottom),
1834 }
1835 }
1836
1837 /// Margin on end of widget, horizontally. This property supports
1838 /// left-to-right and right-to-left text directions.
1839 ///
1840 /// This property adds margin outside of the widget's normal size
1841 /// request, the margin will be added in addition to the size from
1842 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1843 pub fn margin_end(self, margin_end: i32) -> Self {
1844 Self {
1845 builder: self.builder.property("margin-end", margin_end),
1846 }
1847 }
1848
1849 /// Margin on start of widget, horizontally. This property supports
1850 /// left-to-right and right-to-left text directions.
1851 ///
1852 /// This property adds margin outside of the widget's normal size
1853 /// request, the margin will be added in addition to the size from
1854 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1855 pub fn margin_start(self, margin_start: i32) -> Self {
1856 Self {
1857 builder: self.builder.property("margin-start", margin_start),
1858 }
1859 }
1860
1861 /// Margin on top side of widget.
1862 ///
1863 /// This property adds margin outside of the widget's normal size
1864 /// request, the margin will be added in addition to the size from
1865 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1866 pub fn margin_top(self, margin_top: i32) -> Self {
1867 Self {
1868 builder: self.builder.property("margin-top", margin_top),
1869 }
1870 }
1871
1872 pub fn name(self, name: impl Into<glib::GString>) -> Self {
1873 Self {
1874 builder: self.builder.property("name", name.into()),
1875 }
1876 }
1877
1878 pub fn no_show_all(self, no_show_all: bool) -> Self {
1879 Self {
1880 builder: self.builder.property("no-show-all", no_show_all),
1881 }
1882 }
1883
1884 /// The requested opacity of the widget. See [`WidgetExt::set_opacity()`][crate::prelude::WidgetExt::set_opacity()] for
1885 /// more details about window opacity.
1886 ///
1887 /// Before 3.8 this was only available in GtkWindow
1888 pub fn opacity(self, opacity: f64) -> Self {
1889 Self {
1890 builder: self.builder.property("opacity", opacity),
1891 }
1892 }
1893
1894 pub fn parent(self, parent: &impl IsA<Container>) -> Self {
1895 Self {
1896 builder: self.builder.property("parent", parent.clone().upcast()),
1897 }
1898 }
1899
1900 pub fn receives_default(self, receives_default: bool) -> Self {
1901 Self {
1902 builder: self.builder.property("receives-default", receives_default),
1903 }
1904 }
1905
1906 pub fn sensitive(self, sensitive: bool) -> Self {
1907 Self {
1908 builder: self.builder.property("sensitive", sensitive),
1909 }
1910 }
1911
1912 /// Sets the text of tooltip to be the given string, which is marked up
1913 /// with the [Pango text markup language][PangoMarkupFormat].
1914 /// Also see [`Tooltip::set_markup()`][crate::Tooltip::set_markup()].
1915 ///
1916 /// This is a convenience property which will take care of getting the
1917 /// tooltip shown if the given string is not [`None`]: [`has-tooltip`][struct@crate::Widget#has-tooltip]
1918 /// will automatically be set to [`true`] and there will be taken care of
1919 /// [`query-tooltip`][struct@crate::Widget#query-tooltip] in the default signal handler.
1920 ///
1921 /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and [`tooltip-markup`][struct@crate::Widget#tooltip-markup]
1922 /// are set, the last one wins.
1923 pub fn tooltip_markup(self, tooltip_markup: impl Into<glib::GString>) -> Self {
1924 Self {
1925 builder: self
1926 .builder
1927 .property("tooltip-markup", tooltip_markup.into()),
1928 }
1929 }
1930
1931 /// Sets the text of tooltip to be the given string.
1932 ///
1933 /// Also see [`Tooltip::set_text()`][crate::Tooltip::set_text()].
1934 ///
1935 /// This is a convenience property which will take care of getting the
1936 /// tooltip shown if the given string is not [`None`]: [`has-tooltip`][struct@crate::Widget#has-tooltip]
1937 /// will automatically be set to [`true`] and there will be taken care of
1938 /// [`query-tooltip`][struct@crate::Widget#query-tooltip] in the default signal handler.
1939 ///
1940 /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and [`tooltip-markup`][struct@crate::Widget#tooltip-markup]
1941 /// are set, the last one wins.
1942 pub fn tooltip_text(self, tooltip_text: impl Into<glib::GString>) -> Self {
1943 Self {
1944 builder: self.builder.property("tooltip-text", tooltip_text.into()),
1945 }
1946 }
1947
1948 /// How to distribute vertical space if widget gets extra space, see [`Align`][crate::Align]
1949 pub fn valign(self, valign: Align) -> Self {
1950 Self {
1951 builder: self.builder.property("valign", valign),
1952 }
1953 }
1954
1955 /// Whether to expand vertically. See [`WidgetExt::set_vexpand()`][crate::prelude::WidgetExt::set_vexpand()].
1956 pub fn vexpand(self, vexpand: bool) -> Self {
1957 Self {
1958 builder: self.builder.property("vexpand", vexpand),
1959 }
1960 }
1961
1962 /// Whether to use the [`vexpand`][struct@crate::Widget#vexpand] property. See [`WidgetExt::is_vexpand_set()`][crate::prelude::WidgetExt::is_vexpand_set()].
1963 pub fn vexpand_set(self, vexpand_set: bool) -> Self {
1964 Self {
1965 builder: self.builder.property("vexpand-set", vexpand_set),
1966 }
1967 }
1968
1969 pub fn visible(self, visible: bool) -> Self {
1970 Self {
1971 builder: self.builder.property("visible", visible),
1972 }
1973 }
1974
1975 pub fn width_request(self, width_request: i32) -> Self {
1976 Self {
1977 builder: self.builder.property("width-request", width_request),
1978 }
1979 }
1980
1981 // rustdoc-stripper-ignore-next
1982 /// Build the [`Plug`].
1983 #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"]
1984 pub fn build(self) -> Plug {
1985 assert_initialized_main_thread!();
1986 self.builder.build()
1987 }
1988}
1989
1990/// Trait containing all [`struct@Plug`] methods.
1991///
1992/// # Implementors
1993///
1994/// [`Plug`][struct@crate::Plug]
1995pub trait PlugExt: IsA<Plug> + 'static {
1996 /// Finish the initialization of `self` for a given [`Socket`][crate::Socket] identified by
1997 /// `socket_id`. This function will generally only be used by classes deriving from [`Plug`][crate::Plug].
1998 /// ## `socket_id`
1999 /// the XID of the socket’s window.
2000 #[doc(alias = "gtk_plug_construct")]
2001 fn construct(&self, socket_id: xlib::Window) {
2002 unsafe {
2003 ffi::gtk_plug_construct(self.as_ref().to_glib_none().0, socket_id);
2004 }
2005 }
2006
2007 /// Finish the initialization of `self` for a given [`Socket`][crate::Socket] identified by
2008 /// `socket_id` which is currently displayed on `display`.
2009 /// This function will generally only be used by classes deriving from [`Plug`][crate::Plug].
2010 /// ## `display`
2011 /// the [`gdk::Display`][crate::gdk::Display] associated with `socket_id`’s
2012 /// [`Socket`][crate::Socket].
2013 /// ## `socket_id`
2014 /// the XID of the socket’s window.
2015 #[doc(alias = "gtk_plug_construct_for_display")]
2016 fn construct_for_display(&self, display: &gdk::Display, socket_id: xlib::Window) {
2017 unsafe {
2018 ffi::gtk_plug_construct_for_display(
2019 self.as_ref().to_glib_none().0,
2020 display.to_glib_none().0,
2021 socket_id,
2022 );
2023 }
2024 }
2025
2026 /// Determines whether the plug is embedded in a socket.
2027 ///
2028 /// # Returns
2029 ///
2030 /// [`true`] if the plug is embedded in a socket
2031 #[doc(alias = "gtk_plug_get_embedded")]
2032 #[doc(alias = "get_embedded")]
2033 #[doc(alias = "embedded")]
2034 fn is_embedded(&self) -> bool {
2035 unsafe { from_glib(ffi::gtk_plug_get_embedded(self.as_ref().to_glib_none().0)) }
2036 }
2037
2038 /// Gets the window ID of a [`Plug`][crate::Plug] widget, which can then
2039 /// be used to embed this window inside another window, for
2040 /// instance with [`GtkSocketExt::add_id()`][crate::prelude::GtkSocketExt::add_id()].
2041 ///
2042 /// # Returns
2043 ///
2044 /// the window ID for the plug
2045 #[doc(alias = "gtk_plug_get_id")]
2046 #[doc(alias = "get_id")]
2047 fn id(&self) -> xlib::Window {
2048 unsafe { ffi::gtk_plug_get_id(self.as_ref().to_glib_none().0) }
2049 }
2050
2051 /// Retrieves the socket the plug is embedded in.
2052 ///
2053 /// # Returns
2054 ///
2055 /// the window of the socket, or [`None`]
2056 #[doc(alias = "gtk_plug_get_socket_window")]
2057 #[doc(alias = "get_socket_window")]
2058 #[doc(alias = "socket-window")]
2059 fn socket_window(&self) -> Option<gdk::Window> {
2060 unsafe {
2061 from_glib_none(ffi::gtk_plug_get_socket_window(
2062 self.as_ref().to_glib_none().0,
2063 ))
2064 }
2065 }
2066
2067 /// Gets emitted when the plug becomes embedded in a socket.
2068 #[doc(alias = "embedded")]
2069 fn connect_embedded<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
2070 unsafe extern "C" fn embedded_trampoline<P: IsA<Plug>, F: Fn(&P) + 'static>(
2071 this: *mut ffi::GtkPlug,
2072 f: glib::ffi::gpointer,
2073 ) {
2074 unsafe {
2075 let f: &F = &*(f as *const F);
2076 f(Plug::from_glib_borrow(this).unsafe_cast_ref())
2077 }
2078 }
2079 unsafe {
2080 let f: Box_<F> = Box_::new(f);
2081 connect_raw(
2082 self.as_ptr() as *mut _,
2083 c"embedded".as_ptr(),
2084 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2085 embedded_trampoline::<Self, F> as *const (),
2086 )),
2087 Box_::into_raw(f),
2088 )
2089 }
2090 }
2091
2092 #[doc(alias = "embedded")]
2093 fn connect_embedded_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
2094 unsafe extern "C" fn notify_embedded_trampoline<P: IsA<Plug>, F: Fn(&P) + 'static>(
2095 this: *mut ffi::GtkPlug,
2096 _param_spec: glib::ffi::gpointer,
2097 f: glib::ffi::gpointer,
2098 ) {
2099 unsafe {
2100 let f: &F = &*(f as *const F);
2101 f(Plug::from_glib_borrow(this).unsafe_cast_ref())
2102 }
2103 }
2104 unsafe {
2105 let f: Box_<F> = Box_::new(f);
2106 connect_raw(
2107 self.as_ptr() as *mut _,
2108 c"notify::embedded".as_ptr(),
2109 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2110 notify_embedded_trampoline::<Self, F> as *const (),
2111 )),
2112 Box_::into_raw(f),
2113 )
2114 }
2115 }
2116
2117 #[doc(alias = "socket-window")]
2118 fn connect_socket_window_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
2119 unsafe extern "C" fn notify_socket_window_trampoline<P: IsA<Plug>, F: Fn(&P) + 'static>(
2120 this: *mut ffi::GtkPlug,
2121 _param_spec: glib::ffi::gpointer,
2122 f: glib::ffi::gpointer,
2123 ) {
2124 unsafe {
2125 let f: &F = &*(f as *const F);
2126 f(Plug::from_glib_borrow(this).unsafe_cast_ref())
2127 }
2128 }
2129 unsafe {
2130 let f: Box_<F> = Box_::new(f);
2131 connect_raw(
2132 self.as_ptr() as *mut _,
2133 c"notify::socket-window".as_ptr(),
2134 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2135 notify_socket_window_trampoline::<Self, F> as *const (),
2136 )),
2137 Box_::into_raw(f),
2138 )
2139 }
2140 }
2141}
2142
2143impl<O: IsA<Plug>> PlugExt for O {}