gtk4/auto/popover.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
5#[cfg(feature = "v4_10")]
6#[cfg_attr(docsrs, doc(cfg(feature = "v4_10")))]
7use crate::Accessible;
8use crate::{
9 AccessibleRole, Align, Buildable, ConstraintTarget, LayoutManager, Native, Overflow,
10 PositionType, ShortcutManager, Widget, ffi,
11};
12use glib::{
13 object::ObjectType as _,
14 prelude::*,
15 signal::{SignalHandlerId, connect_raw},
16 translate::*,
17};
18use std::boxed::Box as Box_;
19
20#[cfg(feature = "v4_10")]
21#[cfg_attr(docsrs, doc(cfg(feature = "v4_10")))]
22glib::wrapper! {
23 ///
24 /// ```text
25 ///
26 /// [`Popover`][crate::Popover] has a main node with name `popover`, an arrow with name `arrow`,
27 /// and another node for the content named `contents`. The `popover` node always
28 /// gets the `.background` style class. It also gets the `.menu` style class
29 /// if the popover is menu-like, e.g. is a [`PopoverMenu`][crate::PopoverMenu].
30 ///
31 /// Particular uses of [`Popover`][crate::Popover], such as touch selection popups or
32 /// magnifiers in [`Entry`][crate::Entry] or [`TextView`][crate::TextView] get style classes like
33 /// `.touch-selection` or `.magnifier` to differentiate from plain popovers.
34 ///
35 /// When styling a popover directly, the `popover` node should usually
36 /// not have any background. The visible part of the popover can have
37 /// a shadow. To specify it in CSS, set the box-shadow of the `contents` node.
38 ///
39 /// Note that, in order to accomplish appropriate arrow visuals, [`Popover`][crate::Popover]
40 /// uses custom drawing for the `arrow` node. This makes it possible for the
41 /// arrow to change its shape dynamically, but it also limits the possibilities
42 /// of styling it using CSS. In particular, the `arrow` gets drawn over the
43 /// `content` node's border and shadow, so they look like one shape, which
44 /// means that the border width of the `content` node and the `arrow` node should
45 /// be the same. The arrow also does not support any border shape other than
46 /// solid, no border-radius, only one border width (border-bottom-width is
47 /// used) and no box-shadow.
48 ///
49 /// ## Properties
50 ///
51 ///
52 /// #### `autohide`
53 /// Whether to dismiss the popover on outside clicks.
54 ///
55 /// Readable | Writable
56 ///
57 ///
58 /// #### `cascade-popdown`
59 /// Whether the popover pops down after a child popover.
60 ///
61 /// This is used to implement the expected behavior of submenus.
62 ///
63 /// Readable | Writable
64 ///
65 ///
66 /// #### `child`
67 /// The child widget.
68 ///
69 /// Readable | Writable
70 ///
71 ///
72 /// #### `default-widget`
73 /// The default widget inside the popover.
74 ///
75 /// Readable | Writable
76 ///
77 ///
78 /// #### `has-arrow`
79 /// Whether to draw an arrow.
80 ///
81 /// Readable | Writable
82 ///
83 ///
84 /// #### `mnemonics-visible`
85 /// Whether mnemonics are currently visible in this popover.
86 ///
87 /// Readable | Writable
88 ///
89 ///
90 /// #### `pointing-to`
91 /// Rectangle in the parent widget that the popover points to.
92 ///
93 /// Readable | Writable
94 ///
95 ///
96 /// #### `position`
97 /// How to place the popover, relative to its parent.
98 ///
99 /// Readable | Writable
100 /// <details><summary><h4>Widget</h4></summary>
101 ///
102 ///
103 /// #### `can-focus`
104 /// Whether the widget or any of its descendents can accept
105 /// the input focus.
106 ///
107 /// This property is meant to be set by widget implementations,
108 /// typically in their instance init function.
109 ///
110 /// Readable | Writable
111 ///
112 ///
113 /// #### `can-target`
114 /// Whether the widget can receive pointer events.
115 ///
116 /// Readable | Writable
117 ///
118 ///
119 /// #### `css-classes`
120 /// A list of css classes applied to this widget.
121 ///
122 /// Readable | Writable
123 ///
124 ///
125 /// #### `css-name`
126 /// The name of this widget in the CSS tree.
127 ///
128 /// This property is meant to be set by widget implementations,
129 /// typically in their instance init function.
130 ///
131 /// Readable | Writable | Construct Only
132 ///
133 ///
134 /// #### `cursor`
135 /// The cursor used by @widget.
136 ///
137 /// Readable | Writable
138 ///
139 ///
140 /// #### `focus-on-click`
141 /// Whether the widget should grab focus when it is clicked with the mouse.
142 ///
143 /// This property is only relevant for widgets that can take focus.
144 ///
145 /// Readable | Writable
146 ///
147 ///
148 /// #### `focusable`
149 /// Whether this widget itself will accept the input focus.
150 ///
151 /// Readable | Writable
152 ///
153 ///
154 /// #### `halign`
155 /// How to distribute horizontal space if widget gets extra space.
156 ///
157 /// Readable | Writable
158 ///
159 ///
160 /// #### `has-default`
161 /// Whether the widget is the default widget.
162 ///
163 /// Readable
164 ///
165 ///
166 /// #### `has-focus`
167 /// Whether the widget has the input focus.
168 ///
169 /// Readable
170 ///
171 ///
172 /// #### `has-tooltip`
173 /// Enables or disables the emission of the [`query-tooltip`][struct@crate::Widget#query-tooltip]
174 /// signal on @widget.
175 ///
176 /// A true value indicates that @widget can have a tooltip, in this case
177 /// the widget will be queried using [`query-tooltip`][struct@crate::Widget#query-tooltip] to
178 /// determine whether it will provide a tooltip or not.
179 ///
180 /// Readable | Writable
181 ///
182 ///
183 /// #### `height-request`
184 /// Overrides for height request of the widget.
185 ///
186 /// If this is -1, the natural request will be used.
187 ///
188 /// Readable | Writable
189 ///
190 ///
191 /// #### `hexpand`
192 /// Whether to expand horizontally.
193 ///
194 /// Readable | Writable
195 ///
196 ///
197 /// #### `hexpand-set`
198 /// Whether to use the `hexpand` property.
199 ///
200 /// Readable | Writable
201 ///
202 ///
203 /// #### `layout-manager`
204 /// The [`LayoutManager`][crate::LayoutManager] instance to use to compute
205 /// the preferred size of the widget, and allocate its children.
206 ///
207 /// This property is meant to be set by widget implementations,
208 /// typically in their instance init function.
209 ///
210 /// Readable | Writable
211 ///
212 ///
213 /// #### `limit-events`
214 /// Makes this widget act like a modal dialog, with respect to
215 /// event delivery.
216 ///
217 /// Global event controllers will not handle events with targets
218 /// inside the widget, unless they are set up to ignore propagation
219 /// limits. See [`EventControllerExt::set_propagation_limit()`][crate::prelude::EventControllerExt::set_propagation_limit()].
220 ///
221 /// Readable | Writable
222 ///
223 ///
224 /// #### `margin-bottom`
225 /// Margin on bottom side of widget.
226 ///
227 /// This property adds margin outside of the widget's normal size
228 /// request, the margin will be added in addition to the size from
229 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
230 ///
231 /// Readable | Writable
232 ///
233 ///
234 /// #### `margin-end`
235 /// Margin on end of widget, horizontally.
236 ///
237 /// This property supports left-to-right and right-to-left text
238 /// directions.
239 ///
240 /// This property adds margin outside of the widget's normal size
241 /// request, the margin will be added in addition to the size from
242 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
243 ///
244 /// Readable | Writable
245 ///
246 ///
247 /// #### `margin-start`
248 /// Margin on start of widget, horizontally.
249 ///
250 /// This property supports left-to-right and right-to-left text
251 /// directions.
252 ///
253 /// This property adds margin outside of the widget's normal size
254 /// request, the margin will be added in addition to the size from
255 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
256 ///
257 /// Readable | Writable
258 ///
259 ///
260 /// #### `margin-top`
261 /// Margin on top side of widget.
262 ///
263 /// This property adds margin outside of the widget's normal size
264 /// request, the margin will be added in addition to the size from
265 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
266 ///
267 /// Readable | Writable
268 ///
269 ///
270 /// #### `name`
271 /// The name of the widget.
272 ///
273 /// Readable | Writable
274 ///
275 ///
276 /// #### `opacity`
277 /// The requested opacity of the widget.
278 ///
279 /// Readable | Writable
280 ///
281 ///
282 /// #### `overflow`
283 /// How content outside the widget's content area is treated.
284 ///
285 /// This property is meant to be set by widget implementations,
286 /// typically in their instance init function.
287 ///
288 /// Readable | Writable
289 ///
290 ///
291 /// #### `parent`
292 /// The parent widget of this widget.
293 ///
294 /// Readable
295 ///
296 ///
297 /// #### `receives-default`
298 /// Whether the widget will receive the default action when it is focused.
299 ///
300 /// Readable | Writable
301 ///
302 ///
303 /// #### `root`
304 /// The [`Root`][crate::Root] widget of the widget tree containing this widget.
305 ///
306 /// This will be `NULL` if the widget is not contained in a root widget.
307 ///
308 /// Readable
309 ///
310 ///
311 /// #### `scale-factor`
312 /// The scale factor of the widget.
313 ///
314 /// Readable
315 ///
316 ///
317 /// #### `sensitive`
318 /// Whether the widget responds to input.
319 ///
320 /// Readable | Writable
321 ///
322 ///
323 /// #### `tooltip-markup`
324 /// Sets the text of tooltip to be the given string, which is marked up
325 /// with Pango markup.
326 ///
327 /// Also see [`Tooltip::set_markup()`][crate::Tooltip::set_markup()].
328 ///
329 /// This is a convenience property which will take care of getting the
330 /// tooltip shown if the given string is not `NULL`:
331 /// [`has-tooltip`][struct@crate::Widget#has-tooltip] will automatically be set to true
332 /// and there will be taken care of [`query-tooltip`][struct@crate::Widget#query-tooltip] in
333 /// the default signal handler.
334 ///
335 /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and
336 /// [`tooltip-markup`][struct@crate::Widget#tooltip-markup] are set, the last one wins.
337 ///
338 /// Readable | Writable
339 ///
340 ///
341 /// #### `tooltip-text`
342 /// Sets the text of tooltip to be the given string.
343 ///
344 /// Also see [`Tooltip::set_text()`][crate::Tooltip::set_text()].
345 ///
346 /// This is a convenience property which will take care of getting the
347 /// tooltip shown if the given string is not `NULL`:
348 /// [`has-tooltip`][struct@crate::Widget#has-tooltip] will automatically be set to true
349 /// and there will be taken care of [`query-tooltip`][struct@crate::Widget#query-tooltip] in
350 /// the default signal handler.
351 ///
352 /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and
353 /// [`tooltip-markup`][struct@crate::Widget#tooltip-markup] are set, the last one wins.
354 ///
355 /// Readable | Writable
356 ///
357 ///
358 /// #### `valign`
359 /// How to distribute vertical space if widget gets extra space.
360 ///
361 /// Readable | Writable
362 ///
363 ///
364 /// #### `vexpand`
365 /// Whether to expand vertically.
366 ///
367 /// Readable | Writable
368 ///
369 ///
370 /// #### `vexpand-set`
371 /// Whether to use the `vexpand` property.
372 ///
373 /// Readable | Writable
374 ///
375 ///
376 /// #### `visible`
377 /// Whether the widget is visible.
378 ///
379 /// Readable | Writable
380 ///
381 ///
382 /// #### `width-request`
383 /// Overrides for width request of the widget.
384 ///
385 /// If this is -1, the natural request will be used.
386 ///
387 /// Readable | Writable
388 /// </details>
389 /// <details><summary><h4>Accessible</h4></summary>
390 ///
391 ///
392 /// #### `accessible-role`
393 /// The accessible role of the given [`Accessible`][crate::Accessible] implementation.
394 ///
395 /// The accessible role cannot be changed once set.
396 ///
397 /// Readable | Writable
398 /// </details>
399 ///
400 /// ## Signals
401 ///
402 ///
403 /// #### `activate-default`
404 /// .
405 ///
406 /// Action
407 ///
408 ///
409 /// #### `closed`
410 /// Emitted when the popover is closed.
411 ///
412 ///
413 /// <details><summary><h4>Widget</h4></summary>
414 ///
415 ///
416 /// #### `destroy`
417 /// Signals that all holders of a reference to the widget should release
418 /// the reference that they hold.
419 ///
420 /// May result in finalization of the widget if all references are released.
421 ///
422 /// This signal is not suitable for saving widget state.
423 ///
424 ///
425 ///
426 ///
427 /// #### `direction-changed`
428 /// Emitted when the text direction of a widget changes.
429 ///
430 ///
431 ///
432 ///
433 /// #### `hide`
434 /// Emitted when @widget is hidden.
435 ///
436 ///
437 ///
438 ///
439 /// #### `keynav-failed`
440 /// Emitted if keyboard navigation fails.
441 ///
442 /// See [`WidgetExt::keynav_failed()`][crate::prelude::WidgetExt::keynav_failed()] for details.
443 ///
444 ///
445 ///
446 ///
447 /// #### `map`
448 /// Emitted when @widget is going to be mapped.
449 ///
450 /// A widget is mapped when the widget is visible (which is controlled with
451 /// [`visible`][struct@crate::Widget#visible]) and all its parents up to the toplevel widget
452 /// are also visible.
453 ///
454 /// The `::map` signal can be used to determine whether a widget will be drawn,
455 /// for instance it can resume an animation that was stopped during the
456 /// emission of [`unmap`][struct@crate::Widget#unmap].
457 ///
458 ///
459 ///
460 ///
461 /// #### `mnemonic-activate`
462 /// Emitted when a widget is activated via a mnemonic.
463 ///
464 /// The default handler for this signal activates @widget if @group_cycling
465 /// is false, or just makes @widget grab focus if @group_cycling is true.
466 ///
467 ///
468 ///
469 ///
470 /// #### `move-focus`
471 /// to move backward.
472 ///
473 /// Action
474 ///
475 ///
476 /// #### `query-tooltip`
477 /// s tooltip is about to be shown.
478 ///
479 /// This happens when the [`has-tooltip`][struct@crate::Widget#has-tooltip] property
480 /// is true and the hover timeout has expired with the cursor hovering
481 /// above @widget; or emitted when @widget got focus in keyboard mode.
482 ///
483 /// Using the given coordinates, the signal handler should determine
484 /// whether a tooltip should be shown for @widget. If this is the case
485 /// true should be returned, false otherwise. Note that if @keyboard_mode
486 /// is true, the values of @x and @y are undefined and should not be used.
487 ///
488 /// The signal handler is free to manipulate @tooltip with the therefore
489 /// destined function calls.
490 ///
491 ///
492 ///
493 ///
494 /// #### `realize`
495 /// Emitted when @widget is associated with a [`gdk::Surface`][crate::gdk::Surface].
496 ///
497 /// This means that [`WidgetExt::realize()`][crate::prelude::WidgetExt::realize()] has been called
498 /// or the widget has been mapped (that is, it is going to be drawn).
499 ///
500 ///
501 ///
502 ///
503 /// #### `show`
504 /// Emitted when @widget is shown.
505 ///
506 ///
507 ///
508 ///
509 /// #### `state-flags-changed`
510 /// Emitted when the widget state changes.
511 ///
512 /// See [`WidgetExt::state_flags()`][crate::prelude::WidgetExt::state_flags()].
513 ///
514 ///
515 ///
516 ///
517 /// #### `unmap`
518 /// Emitted when @widget is going to be unmapped.
519 ///
520 /// A widget is unmapped when either it or any of its parents up to the
521 /// toplevel widget have been set as hidden.
522 ///
523 /// As `::unmap` indicates that a widget will not be shown any longer,
524 /// it can be used to, for example, stop an animation on the widget.
525 ///
526 ///
527 ///
528 ///
529 /// #### `unrealize`
530 /// Emitted when the [`gdk::Surface`][crate::gdk::Surface] associated with @widget is destroyed.
531 ///
532 /// This means that [`WidgetExt::unrealize()`][crate::prelude::WidgetExt::unrealize()] has been called
533 /// or the widget has been unmapped (that is, it is going to be hidden).
534 ///
535 ///
536 /// </details>
537 ///
538 /// # Implements
539 ///
540 /// [`PopoverExt`][trait@crate::prelude::PopoverExt], [`WidgetExt`][trait@crate::prelude::WidgetExt], [`trait@glib::ObjectExt`], [`AccessibleExt`][trait@crate::prelude::AccessibleExt], [`BuildableExt`][trait@crate::prelude::BuildableExt], [`ConstraintTargetExt`][trait@crate::prelude::ConstraintTargetExt], [`NativeExt`][trait@crate::prelude::NativeExt], [`ShortcutManagerExt`][trait@crate::prelude::ShortcutManagerExt], [`WidgetExtManual`][trait@crate::prelude::WidgetExtManual], [`AccessibleExtManual`][trait@crate::prelude::AccessibleExtManual]
541 #[doc(alias = "GtkPopover")]
542 pub struct Popover(Object<ffi::GtkPopover, ffi::GtkPopoverClass>) @extends Widget, @implements Accessible, Buildable, ConstraintTarget, Native, ShortcutManager;
543
544 match fn {
545 type_ => || ffi::gtk_popover_get_type(),
546 }
547}
548
549#[cfg(not(feature = "v4_10"))]
550glib::wrapper! {
551 #[doc(alias = "GtkPopover")]
552 pub struct Popover(Object<ffi::GtkPopover, ffi::GtkPopoverClass>) @extends Widget, @implements Buildable, ConstraintTarget, Native, ShortcutManager;
553
554 match fn {
555 type_ => || ffi::gtk_popover_get_type(),
556 }
557}
558
559impl Popover {
560 pub const NONE: Option<&'static Popover> = None;
561
562 /// Creates a new [`Popover`][crate::Popover].
563 ///
564 /// # Returns
565 ///
566 /// the new [`Popover`][crate::Popover]
567 #[doc(alias = "gtk_popover_new")]
568 pub fn new() -> Popover {
569 assert_initialized_main_thread!();
570 unsafe { Widget::from_glib_none(ffi::gtk_popover_new()).unsafe_cast() }
571 }
572
573 // rustdoc-stripper-ignore-next
574 /// Creates a new builder-pattern struct instance to construct [`Popover`] objects.
575 ///
576 /// This method returns an instance of [`PopoverBuilder`](crate::builders::PopoverBuilder) which can be used to create [`Popover`] objects.
577 pub fn builder() -> PopoverBuilder {
578 PopoverBuilder::new()
579 }
580}
581
582impl Default for Popover {
583 fn default() -> Self {
584 Self::new()
585 }
586}
587
588// rustdoc-stripper-ignore-next
589/// A [builder-pattern] type to construct [`Popover`] objects.
590///
591/// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html
592#[must_use = "The builder must be built to be used"]
593pub struct PopoverBuilder {
594 builder: glib::object::ObjectBuilder<'static, Popover>,
595}
596
597impl PopoverBuilder {
598 fn new() -> Self {
599 Self {
600 builder: glib::object::Object::builder(),
601 }
602 }
603
604 /// Whether to dismiss the popover on outside clicks.
605 pub fn autohide(self, autohide: bool) -> Self {
606 Self {
607 builder: self.builder.property("autohide", autohide),
608 }
609 }
610
611 /// Whether the popover pops down after a child popover.
612 ///
613 /// This is used to implement the expected behavior of submenus.
614 pub fn cascade_popdown(self, cascade_popdown: bool) -> Self {
615 Self {
616 builder: self.builder.property("cascade-popdown", cascade_popdown),
617 }
618 }
619
620 /// The child widget.
621 pub fn child(self, child: &impl IsA<Widget>) -> Self {
622 Self {
623 builder: self.builder.property("child", child.clone().upcast()),
624 }
625 }
626
627 /// The default widget inside the popover.
628 pub fn default_widget(self, default_widget: &impl IsA<Widget>) -> Self {
629 Self {
630 builder: self
631 .builder
632 .property("default-widget", default_widget.clone().upcast()),
633 }
634 }
635
636 /// Whether to draw an arrow.
637 pub fn has_arrow(self, has_arrow: bool) -> Self {
638 Self {
639 builder: self.builder.property("has-arrow", has_arrow),
640 }
641 }
642
643 /// Whether mnemonics are currently visible in this popover.
644 pub fn mnemonics_visible(self, mnemonics_visible: bool) -> Self {
645 Self {
646 builder: self
647 .builder
648 .property("mnemonics-visible", mnemonics_visible),
649 }
650 }
651
652 /// Rectangle in the parent widget that the popover points to.
653 pub fn pointing_to(self, pointing_to: &gdk::Rectangle) -> Self {
654 Self {
655 builder: self.builder.property("pointing-to", pointing_to),
656 }
657 }
658
659 /// How to place the popover, relative to its parent.
660 pub fn position(self, position: PositionType) -> Self {
661 Self {
662 builder: self.builder.property("position", position),
663 }
664 }
665
666 /// Whether the widget or any of its descendents can accept
667 /// the input focus.
668 ///
669 /// This property is meant to be set by widget implementations,
670 /// typically in their instance init function.
671 pub fn can_focus(self, can_focus: bool) -> Self {
672 Self {
673 builder: self.builder.property("can-focus", can_focus),
674 }
675 }
676
677 /// Whether the widget can receive pointer events.
678 pub fn can_target(self, can_target: bool) -> Self {
679 Self {
680 builder: self.builder.property("can-target", can_target),
681 }
682 }
683
684 /// A list of css classes applied to this widget.
685 pub fn css_classes(self, css_classes: impl Into<glib::StrV>) -> Self {
686 Self {
687 builder: self.builder.property("css-classes", css_classes.into()),
688 }
689 }
690
691 /// The name of this widget in the CSS tree.
692 ///
693 /// This property is meant to be set by widget implementations,
694 /// typically in their instance init function.
695 pub fn css_name(self, css_name: impl Into<glib::GString>) -> Self {
696 Self {
697 builder: self.builder.property("css-name", css_name.into()),
698 }
699 }
700
701 /// The cursor used by @widget.
702 pub fn cursor(self, cursor: &gdk::Cursor) -> Self {
703 Self {
704 builder: self.builder.property("cursor", cursor.clone()),
705 }
706 }
707
708 /// Whether the widget should grab focus when it is clicked with the mouse.
709 ///
710 /// This property is only relevant for widgets that can take focus.
711 pub fn focus_on_click(self, focus_on_click: bool) -> Self {
712 Self {
713 builder: self.builder.property("focus-on-click", focus_on_click),
714 }
715 }
716
717 /// Whether this widget itself will accept the input focus.
718 pub fn focusable(self, focusable: bool) -> Self {
719 Self {
720 builder: self.builder.property("focusable", focusable),
721 }
722 }
723
724 /// How to distribute horizontal space if widget gets extra space.
725 pub fn halign(self, halign: Align) -> Self {
726 Self {
727 builder: self.builder.property("halign", halign),
728 }
729 }
730
731 /// Enables or disables the emission of the [`query-tooltip`][struct@crate::Widget#query-tooltip]
732 /// signal on @widget.
733 ///
734 /// A true value indicates that @widget can have a tooltip, in this case
735 /// the widget will be queried using [`query-tooltip`][struct@crate::Widget#query-tooltip] to
736 /// determine whether it will provide a tooltip or not.
737 pub fn has_tooltip(self, has_tooltip: bool) -> Self {
738 Self {
739 builder: self.builder.property("has-tooltip", has_tooltip),
740 }
741 }
742
743 /// Overrides for height request of the widget.
744 ///
745 /// If this is -1, the natural request will be used.
746 pub fn height_request(self, height_request: i32) -> Self {
747 Self {
748 builder: self.builder.property("height-request", height_request),
749 }
750 }
751
752 /// Whether to expand horizontally.
753 pub fn hexpand(self, hexpand: bool) -> Self {
754 Self {
755 builder: self.builder.property("hexpand", hexpand),
756 }
757 }
758
759 /// Whether to use the `hexpand` property.
760 pub fn hexpand_set(self, hexpand_set: bool) -> Self {
761 Self {
762 builder: self.builder.property("hexpand-set", hexpand_set),
763 }
764 }
765
766 /// The [`LayoutManager`][crate::LayoutManager] instance to use to compute
767 /// the preferred size of the widget, and allocate its children.
768 ///
769 /// This property is meant to be set by widget implementations,
770 /// typically in their instance init function.
771 pub fn layout_manager(self, layout_manager: &impl IsA<LayoutManager>) -> Self {
772 Self {
773 builder: self
774 .builder
775 .property("layout-manager", layout_manager.clone().upcast()),
776 }
777 }
778
779 /// Makes this widget act like a modal dialog, with respect to
780 /// event delivery.
781 ///
782 /// Global event controllers will not handle events with targets
783 /// inside the widget, unless they are set up to ignore propagation
784 /// limits. See [`EventControllerExt::set_propagation_limit()`][crate::prelude::EventControllerExt::set_propagation_limit()].
785 #[cfg(feature = "v4_18")]
786 #[cfg_attr(docsrs, doc(cfg(feature = "v4_18")))]
787 pub fn limit_events(self, limit_events: bool) -> Self {
788 Self {
789 builder: self.builder.property("limit-events", limit_events),
790 }
791 }
792
793 /// Margin on bottom side of widget.
794 ///
795 /// This property adds margin outside of the widget's normal size
796 /// request, the margin will be added in addition to the size from
797 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
798 pub fn margin_bottom(self, margin_bottom: i32) -> Self {
799 Self {
800 builder: self.builder.property("margin-bottom", margin_bottom),
801 }
802 }
803
804 /// Margin on end of widget, horizontally.
805 ///
806 /// This property supports left-to-right and right-to-left text
807 /// directions.
808 ///
809 /// This property adds margin outside of the widget's normal size
810 /// request, the margin will be added in addition to the size from
811 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
812 pub fn margin_end(self, margin_end: i32) -> Self {
813 Self {
814 builder: self.builder.property("margin-end", margin_end),
815 }
816 }
817
818 /// Margin on start of widget, horizontally.
819 ///
820 /// This property supports left-to-right and right-to-left text
821 /// directions.
822 ///
823 /// This property adds margin outside of the widget's normal size
824 /// request, the margin will be added in addition to the size from
825 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
826 pub fn margin_start(self, margin_start: i32) -> Self {
827 Self {
828 builder: self.builder.property("margin-start", margin_start),
829 }
830 }
831
832 /// Margin on top side of widget.
833 ///
834 /// This property adds margin outside of the widget's normal size
835 /// request, the margin will be added in addition to the size from
836 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
837 pub fn margin_top(self, margin_top: i32) -> Self {
838 Self {
839 builder: self.builder.property("margin-top", margin_top),
840 }
841 }
842
843 /// The name of the widget.
844 pub fn name(self, name: impl Into<glib::GString>) -> Self {
845 Self {
846 builder: self.builder.property("name", name.into()),
847 }
848 }
849
850 /// The requested opacity of the widget.
851 pub fn opacity(self, opacity: f64) -> Self {
852 Self {
853 builder: self.builder.property("opacity", opacity),
854 }
855 }
856
857 /// How content outside the widget's content area is treated.
858 ///
859 /// This property is meant to be set by widget implementations,
860 /// typically in their instance init function.
861 pub fn overflow(self, overflow: Overflow) -> Self {
862 Self {
863 builder: self.builder.property("overflow", overflow),
864 }
865 }
866
867 /// Whether the widget will receive the default action when it is focused.
868 pub fn receives_default(self, receives_default: bool) -> Self {
869 Self {
870 builder: self.builder.property("receives-default", receives_default),
871 }
872 }
873
874 /// Whether the widget responds to input.
875 pub fn sensitive(self, sensitive: bool) -> Self {
876 Self {
877 builder: self.builder.property("sensitive", sensitive),
878 }
879 }
880
881 /// Sets the text of tooltip to be the given string, which is marked up
882 /// with Pango markup.
883 ///
884 /// Also see [`Tooltip::set_markup()`][crate::Tooltip::set_markup()].
885 ///
886 /// This is a convenience property which will take care of getting the
887 /// tooltip shown if the given string is not `NULL`:
888 /// [`has-tooltip`][struct@crate::Widget#has-tooltip] will automatically be set to true
889 /// and there will be taken care of [`query-tooltip`][struct@crate::Widget#query-tooltip] in
890 /// the default signal handler.
891 ///
892 /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and
893 /// [`tooltip-markup`][struct@crate::Widget#tooltip-markup] are set, the last one wins.
894 pub fn tooltip_markup(self, tooltip_markup: impl Into<glib::GString>) -> Self {
895 Self {
896 builder: self
897 .builder
898 .property("tooltip-markup", tooltip_markup.into()),
899 }
900 }
901
902 /// Sets the text of tooltip to be the given string.
903 ///
904 /// Also see [`Tooltip::set_text()`][crate::Tooltip::set_text()].
905 ///
906 /// This is a convenience property which will take care of getting the
907 /// tooltip shown if the given string is not `NULL`:
908 /// [`has-tooltip`][struct@crate::Widget#has-tooltip] will automatically be set to true
909 /// and there will be taken care of [`query-tooltip`][struct@crate::Widget#query-tooltip] in
910 /// the default signal handler.
911 ///
912 /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and
913 /// [`tooltip-markup`][struct@crate::Widget#tooltip-markup] are set, the last one wins.
914 pub fn tooltip_text(self, tooltip_text: impl Into<glib::GString>) -> Self {
915 Self {
916 builder: self.builder.property("tooltip-text", tooltip_text.into()),
917 }
918 }
919
920 /// How to distribute vertical space if widget gets extra space.
921 pub fn valign(self, valign: Align) -> Self {
922 Self {
923 builder: self.builder.property("valign", valign),
924 }
925 }
926
927 /// Whether to expand vertically.
928 pub fn vexpand(self, vexpand: bool) -> Self {
929 Self {
930 builder: self.builder.property("vexpand", vexpand),
931 }
932 }
933
934 /// Whether to use the `vexpand` property.
935 pub fn vexpand_set(self, vexpand_set: bool) -> Self {
936 Self {
937 builder: self.builder.property("vexpand-set", vexpand_set),
938 }
939 }
940
941 /// Whether the widget is visible.
942 pub fn visible(self, visible: bool) -> Self {
943 Self {
944 builder: self.builder.property("visible", visible),
945 }
946 }
947
948 /// Overrides for width request of the widget.
949 ///
950 /// If this is -1, the natural request will be used.
951 pub fn width_request(self, width_request: i32) -> Self {
952 Self {
953 builder: self.builder.property("width-request", width_request),
954 }
955 }
956
957 /// The accessible role of the given [`Accessible`][crate::Accessible] implementation.
958 ///
959 /// The accessible role cannot be changed once set.
960 pub fn accessible_role(self, accessible_role: AccessibleRole) -> Self {
961 Self {
962 builder: self.builder.property("accessible-role", accessible_role),
963 }
964 }
965
966 // rustdoc-stripper-ignore-next
967 /// Build the [`Popover`].
968 #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"]
969 pub fn build(self) -> Popover {
970 assert_initialized_main_thread!();
971 self.builder.build()
972 }
973}
974
975/// Trait containing all [`struct@Popover`] methods.
976///
977/// # Implementors
978///
979/// [`EmojiChooser`][struct@crate::EmojiChooser], [`PopoverMenu`][struct@crate::PopoverMenu], [`Popover`][struct@crate::Popover]
980pub trait PopoverExt: IsA<Popover> + 'static {
981 /// Returns whether the popover is modal.
982 ///
983 /// See [`set_autohide()`][Self::set_autohide()] for the
984 /// implications of this.
985 ///
986 /// # Returns
987 ///
988 /// [`true`] if @self is modal
989 #[doc(alias = "gtk_popover_get_autohide")]
990 #[doc(alias = "get_autohide")]
991 #[doc(alias = "autohide")]
992 fn is_autohide(&self) -> bool {
993 unsafe {
994 from_glib(ffi::gtk_popover_get_autohide(
995 self.as_ref().to_glib_none().0,
996 ))
997 }
998 }
999
1000 /// Returns whether the popover will close after a modal child is closed.
1001 ///
1002 /// # Returns
1003 ///
1004 /// [`true`] if @self will close after a modal child.
1005 #[doc(alias = "gtk_popover_get_cascade_popdown")]
1006 #[doc(alias = "get_cascade_popdown")]
1007 #[doc(alias = "cascade-popdown")]
1008 fn is_cascade_popdown(&self) -> bool {
1009 unsafe {
1010 from_glib(ffi::gtk_popover_get_cascade_popdown(
1011 self.as_ref().to_glib_none().0,
1012 ))
1013 }
1014 }
1015
1016 /// Gets the child widget of @self.
1017 ///
1018 /// # Returns
1019 ///
1020 /// the child widget of @self
1021 #[doc(alias = "gtk_popover_get_child")]
1022 #[doc(alias = "get_child")]
1023 fn child(&self) -> Option<Widget> {
1024 unsafe { from_glib_none(ffi::gtk_popover_get_child(self.as_ref().to_glib_none().0)) }
1025 }
1026
1027 /// Gets whether this popover is showing an arrow
1028 /// pointing at the widget that it is relative to.
1029 ///
1030 /// # Returns
1031 ///
1032 /// whether the popover has an arrow
1033 #[doc(alias = "gtk_popover_get_has_arrow")]
1034 #[doc(alias = "get_has_arrow")]
1035 #[doc(alias = "has-arrow")]
1036 fn has_arrow(&self) -> bool {
1037 unsafe {
1038 from_glib(ffi::gtk_popover_get_has_arrow(
1039 self.as_ref().to_glib_none().0,
1040 ))
1041 }
1042 }
1043
1044 /// Gets whether mnemonics are visible.
1045 ///
1046 /// # Returns
1047 ///
1048 /// [`true`] if mnemonics are supposed to be visible
1049 /// in this popover
1050 #[doc(alias = "gtk_popover_get_mnemonics_visible")]
1051 #[doc(alias = "get_mnemonics_visible")]
1052 #[doc(alias = "mnemonics-visible")]
1053 fn is_mnemonics_visible(&self) -> bool {
1054 unsafe {
1055 from_glib(ffi::gtk_popover_get_mnemonics_visible(
1056 self.as_ref().to_glib_none().0,
1057 ))
1058 }
1059 }
1060
1061 /// Gets the offset previous set with [`set_offset()`][Self::set_offset()].
1062 ///
1063 /// # Returns
1064 ///
1065 ///
1066 /// ## `x_offset`
1067 /// a location for the x_offset
1068 ///
1069 /// ## `y_offset`
1070 /// a location for the y_offset
1071 #[doc(alias = "gtk_popover_get_offset")]
1072 #[doc(alias = "get_offset")]
1073 fn offset(&self) -> (i32, i32) {
1074 unsafe {
1075 let mut x_offset = std::mem::MaybeUninit::uninit();
1076 let mut y_offset = std::mem::MaybeUninit::uninit();
1077 ffi::gtk_popover_get_offset(
1078 self.as_ref().to_glib_none().0,
1079 x_offset.as_mut_ptr(),
1080 y_offset.as_mut_ptr(),
1081 );
1082 (x_offset.assume_init(), y_offset.assume_init())
1083 }
1084 }
1085
1086 /// Gets the rectangle that the popover points to.
1087 ///
1088 /// If a rectangle to point to has been set, this function will
1089 /// return [`true`] and fill in @rect with such rectangle, otherwise
1090 /// it will return [`false`] and fill in @rect with the parent
1091 /// widget coordinates.
1092 ///
1093 /// # Returns
1094 ///
1095 /// [`true`] if a rectangle to point to was set.
1096 ///
1097 /// ## `rect`
1098 /// location to store the rectangle
1099 #[doc(alias = "gtk_popover_get_pointing_to")]
1100 #[doc(alias = "get_pointing_to")]
1101 #[doc(alias = "pointing-to")]
1102 fn pointing_to(&self) -> (bool, gdk::Rectangle) {
1103 unsafe {
1104 let mut rect = gdk::Rectangle::uninitialized();
1105 let ret = from_glib(ffi::gtk_popover_get_pointing_to(
1106 self.as_ref().to_glib_none().0,
1107 rect.to_glib_none_mut().0,
1108 ));
1109 (ret, rect)
1110 }
1111 }
1112
1113 /// Returns the preferred position of @self.
1114 ///
1115 /// # Returns
1116 ///
1117 /// The preferred position.
1118 #[doc(alias = "gtk_popover_get_position")]
1119 #[doc(alias = "get_position")]
1120 fn position(&self) -> PositionType {
1121 unsafe {
1122 from_glib(ffi::gtk_popover_get_position(
1123 self.as_ref().to_glib_none().0,
1124 ))
1125 }
1126 }
1127
1128 /// Pops @self down.
1129 ///
1130 /// This may have the side-effect of closing a parent popover
1131 /// as well. See [`cascade-popdown`][struct@crate::Popover#cascade-popdown].
1132 #[doc(alias = "gtk_popover_popdown")]
1133 fn popdown(&self) {
1134 unsafe {
1135 ffi::gtk_popover_popdown(self.as_ref().to_glib_none().0);
1136 }
1137 }
1138
1139 /// Pops @self up.
1140 #[doc(alias = "gtk_popover_popup")]
1141 fn popup(&self) {
1142 unsafe {
1143 ffi::gtk_popover_popup(self.as_ref().to_glib_none().0);
1144 }
1145 }
1146
1147 /// Allocate a size for the [`Popover`][crate::Popover].
1148 ///
1149 /// This function needs to be called in size-allocate by widgets
1150 /// who have a [`Popover`][crate::Popover] as child. When using a layout manager,
1151 /// this is happening automatically.
1152 ///
1153 /// To make a popover appear on screen, use [`popup()`][Self::popup()].
1154 #[doc(alias = "gtk_popover_present")]
1155 fn present(&self) {
1156 unsafe {
1157 ffi::gtk_popover_present(self.as_ref().to_glib_none().0);
1158 }
1159 }
1160
1161 /// Sets whether @self is modal.
1162 ///
1163 /// A modal popover will grab the keyboard focus on it when being
1164 /// displayed. Focus will wrap around within the popover. Clicking
1165 /// outside the popover area or pressing Esc will dismiss the popover.
1166 ///
1167 /// Called this function on an already showing popup with a new
1168 /// autohide value different from the current one, will cause the
1169 /// popup to be hidden.
1170 /// ## `autohide`
1171 /// [`true`] to dismiss the popover on outside clicks
1172 #[doc(alias = "gtk_popover_set_autohide")]
1173 #[doc(alias = "autohide")]
1174 fn set_autohide(&self, autohide: bool) {
1175 unsafe {
1176 ffi::gtk_popover_set_autohide(self.as_ref().to_glib_none().0, autohide.into_glib());
1177 }
1178 }
1179
1180 /// If @cascade_popdown is [`true`], the popover will be
1181 /// closed when a child modal popover is closed.
1182 ///
1183 /// If [`false`], @self will stay visible.
1184 /// ## `cascade_popdown`
1185 /// [`true`] if the popover should follow a child closing
1186 #[doc(alias = "gtk_popover_set_cascade_popdown")]
1187 #[doc(alias = "cascade-popdown")]
1188 fn set_cascade_popdown(&self, cascade_popdown: bool) {
1189 unsafe {
1190 ffi::gtk_popover_set_cascade_popdown(
1191 self.as_ref().to_glib_none().0,
1192 cascade_popdown.into_glib(),
1193 );
1194 }
1195 }
1196
1197 /// Sets the child widget of @self.
1198 /// ## `child`
1199 /// the child widget
1200 #[doc(alias = "gtk_popover_set_child")]
1201 #[doc(alias = "child")]
1202 fn set_child(&self, child: Option<&impl IsA<Widget>>) {
1203 unsafe {
1204 ffi::gtk_popover_set_child(
1205 self.as_ref().to_glib_none().0,
1206 child.map(|p| p.as_ref()).to_glib_none().0,
1207 );
1208 }
1209 }
1210
1211 /// s activated when the user
1212 /// presses Enter in a dialog (for example). This function sets or
1213 /// unsets the default widget for a [`Popover`][crate::Popover].
1214 /// ## `widget`
1215 /// a child widget of @self to set as
1216 /// the default, or [`None`] to unset the default widget for the popover
1217 #[doc(alias = "gtk_popover_set_default_widget")]
1218 #[doc(alias = "default-widget")]
1219 fn set_default_widget(&self, widget: Option<&impl IsA<Widget>>) {
1220 unsafe {
1221 ffi::gtk_popover_set_default_widget(
1222 self.as_ref().to_glib_none().0,
1223 widget.map(|p| p.as_ref()).to_glib_none().0,
1224 );
1225 }
1226 }
1227
1228 /// Sets whether this popover should draw an arrow
1229 /// pointing at the widget it is relative to.
1230 /// ## `has_arrow`
1231 /// [`true`] to draw an arrow
1232 #[doc(alias = "gtk_popover_set_has_arrow")]
1233 #[doc(alias = "has-arrow")]
1234 fn set_has_arrow(&self, has_arrow: bool) {
1235 unsafe {
1236 ffi::gtk_popover_set_has_arrow(self.as_ref().to_glib_none().0, has_arrow.into_glib());
1237 }
1238 }
1239
1240 /// Sets whether mnemonics should be visible.
1241 /// ## `mnemonics_visible`
1242 /// the new value
1243 #[doc(alias = "gtk_popover_set_mnemonics_visible")]
1244 #[doc(alias = "mnemonics-visible")]
1245 fn set_mnemonics_visible(&self, mnemonics_visible: bool) {
1246 unsafe {
1247 ffi::gtk_popover_set_mnemonics_visible(
1248 self.as_ref().to_glib_none().0,
1249 mnemonics_visible.into_glib(),
1250 );
1251 }
1252 }
1253
1254 /// Sets the offset to use when calculating the position
1255 /// of the popover.
1256 ///
1257 /// These values are used when preparing the `Gdk::PopupLayout`
1258 /// for positioning the popover.
1259 /// ## `x_offset`
1260 /// the x offset to adjust the position by
1261 /// ## `y_offset`
1262 /// the y offset to adjust the position by
1263 #[doc(alias = "gtk_popover_set_offset")]
1264 fn set_offset(&self, x_offset: i32, y_offset: i32) {
1265 unsafe {
1266 ffi::gtk_popover_set_offset(self.as_ref().to_glib_none().0, x_offset, y_offset);
1267 }
1268 }
1269
1270 /// Sets the rectangle that @self points to.
1271 ///
1272 /// This is in the coordinate space of the @self parent.
1273 /// ## `rect`
1274 /// rectangle to point to
1275 #[doc(alias = "gtk_popover_set_pointing_to")]
1276 #[doc(alias = "pointing-to")]
1277 fn set_pointing_to(&self, rect: Option<&gdk::Rectangle>) {
1278 unsafe {
1279 ffi::gtk_popover_set_pointing_to(self.as_ref().to_glib_none().0, rect.to_glib_none().0);
1280 }
1281 }
1282
1283 /// Sets the preferred position for @self to appear.
1284 ///
1285 /// If the @self is currently visible, it will be immediately
1286 /// updated.
1287 ///
1288 /// This preference will be respected where possible, although
1289 /// on lack of space (eg. if close to the window edges), the
1290 /// [`Popover`][crate::Popover] may choose to appear on the opposite side.
1291 /// ## `position`
1292 /// preferred popover position
1293 #[doc(alias = "gtk_popover_set_position")]
1294 #[doc(alias = "position")]
1295 fn set_position(&self, position: PositionType) {
1296 unsafe {
1297 ffi::gtk_popover_set_position(self.as_ref().to_glib_none().0, position.into_glib());
1298 }
1299 }
1300
1301 /// The default widget inside the popover.
1302 #[doc(alias = "default-widget")]
1303 fn default_widget(&self) -> Option<Widget> {
1304 ObjectExt::property(self.as_ref(), "default-widget")
1305 }
1306
1307 /// .
1308 #[doc(alias = "activate-default")]
1309 fn connect_activate_default<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1310 unsafe extern "C" fn activate_default_trampoline<P: IsA<Popover>, F: Fn(&P) + 'static>(
1311 this: *mut ffi::GtkPopover,
1312 f: glib::ffi::gpointer,
1313 ) {
1314 unsafe {
1315 let f: &F = &*(f as *const F);
1316 f(Popover::from_glib_borrow(this).unsafe_cast_ref())
1317 }
1318 }
1319 unsafe {
1320 let f: Box_<F> = Box_::new(f);
1321 connect_raw(
1322 self.as_ptr() as *mut _,
1323 c"activate-default".as_ptr(),
1324 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1325 activate_default_trampoline::<Self, F> as *const (),
1326 )),
1327 Box_::into_raw(f),
1328 )
1329 }
1330 }
1331
1332 fn emit_activate_default(&self) {
1333 self.emit_by_name::<()>("activate-default", &[]);
1334 }
1335
1336 /// Emitted when the popover is closed.
1337 #[doc(alias = "closed")]
1338 fn connect_closed<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1339 unsafe extern "C" fn closed_trampoline<P: IsA<Popover>, F: Fn(&P) + 'static>(
1340 this: *mut ffi::GtkPopover,
1341 f: glib::ffi::gpointer,
1342 ) {
1343 unsafe {
1344 let f: &F = &*(f as *const F);
1345 f(Popover::from_glib_borrow(this).unsafe_cast_ref())
1346 }
1347 }
1348 unsafe {
1349 let f: Box_<F> = Box_::new(f);
1350 connect_raw(
1351 self.as_ptr() as *mut _,
1352 c"closed".as_ptr(),
1353 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1354 closed_trampoline::<Self, F> as *const (),
1355 )),
1356 Box_::into_raw(f),
1357 )
1358 }
1359 }
1360
1361 #[doc(alias = "autohide")]
1362 fn connect_autohide_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1363 unsafe extern "C" fn notify_autohide_trampoline<P: IsA<Popover>, F: Fn(&P) + 'static>(
1364 this: *mut ffi::GtkPopover,
1365 _param_spec: glib::ffi::gpointer,
1366 f: glib::ffi::gpointer,
1367 ) {
1368 unsafe {
1369 let f: &F = &*(f as *const F);
1370 f(Popover::from_glib_borrow(this).unsafe_cast_ref())
1371 }
1372 }
1373 unsafe {
1374 let f: Box_<F> = Box_::new(f);
1375 connect_raw(
1376 self.as_ptr() as *mut _,
1377 c"notify::autohide".as_ptr(),
1378 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1379 notify_autohide_trampoline::<Self, F> as *const (),
1380 )),
1381 Box_::into_raw(f),
1382 )
1383 }
1384 }
1385
1386 #[doc(alias = "cascade-popdown")]
1387 fn connect_cascade_popdown_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1388 unsafe extern "C" fn notify_cascade_popdown_trampoline<
1389 P: IsA<Popover>,
1390 F: Fn(&P) + 'static,
1391 >(
1392 this: *mut ffi::GtkPopover,
1393 _param_spec: glib::ffi::gpointer,
1394 f: glib::ffi::gpointer,
1395 ) {
1396 unsafe {
1397 let f: &F = &*(f as *const F);
1398 f(Popover::from_glib_borrow(this).unsafe_cast_ref())
1399 }
1400 }
1401 unsafe {
1402 let f: Box_<F> = Box_::new(f);
1403 connect_raw(
1404 self.as_ptr() as *mut _,
1405 c"notify::cascade-popdown".as_ptr(),
1406 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1407 notify_cascade_popdown_trampoline::<Self, F> as *const (),
1408 )),
1409 Box_::into_raw(f),
1410 )
1411 }
1412 }
1413
1414 #[doc(alias = "child")]
1415 fn connect_child_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1416 unsafe extern "C" fn notify_child_trampoline<P: IsA<Popover>, F: Fn(&P) + 'static>(
1417 this: *mut ffi::GtkPopover,
1418 _param_spec: glib::ffi::gpointer,
1419 f: glib::ffi::gpointer,
1420 ) {
1421 unsafe {
1422 let f: &F = &*(f as *const F);
1423 f(Popover::from_glib_borrow(this).unsafe_cast_ref())
1424 }
1425 }
1426 unsafe {
1427 let f: Box_<F> = Box_::new(f);
1428 connect_raw(
1429 self.as_ptr() as *mut _,
1430 c"notify::child".as_ptr(),
1431 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1432 notify_child_trampoline::<Self, F> as *const (),
1433 )),
1434 Box_::into_raw(f),
1435 )
1436 }
1437 }
1438
1439 #[doc(alias = "default-widget")]
1440 fn connect_default_widget_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1441 unsafe extern "C" fn notify_default_widget_trampoline<
1442 P: IsA<Popover>,
1443 F: Fn(&P) + 'static,
1444 >(
1445 this: *mut ffi::GtkPopover,
1446 _param_spec: glib::ffi::gpointer,
1447 f: glib::ffi::gpointer,
1448 ) {
1449 unsafe {
1450 let f: &F = &*(f as *const F);
1451 f(Popover::from_glib_borrow(this).unsafe_cast_ref())
1452 }
1453 }
1454 unsafe {
1455 let f: Box_<F> = Box_::new(f);
1456 connect_raw(
1457 self.as_ptr() as *mut _,
1458 c"notify::default-widget".as_ptr(),
1459 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1460 notify_default_widget_trampoline::<Self, F> as *const (),
1461 )),
1462 Box_::into_raw(f),
1463 )
1464 }
1465 }
1466
1467 #[doc(alias = "has-arrow")]
1468 fn connect_has_arrow_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1469 unsafe extern "C" fn notify_has_arrow_trampoline<P: IsA<Popover>, F: Fn(&P) + 'static>(
1470 this: *mut ffi::GtkPopover,
1471 _param_spec: glib::ffi::gpointer,
1472 f: glib::ffi::gpointer,
1473 ) {
1474 unsafe {
1475 let f: &F = &*(f as *const F);
1476 f(Popover::from_glib_borrow(this).unsafe_cast_ref())
1477 }
1478 }
1479 unsafe {
1480 let f: Box_<F> = Box_::new(f);
1481 connect_raw(
1482 self.as_ptr() as *mut _,
1483 c"notify::has-arrow".as_ptr(),
1484 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1485 notify_has_arrow_trampoline::<Self, F> as *const (),
1486 )),
1487 Box_::into_raw(f),
1488 )
1489 }
1490 }
1491
1492 #[doc(alias = "mnemonics-visible")]
1493 fn connect_mnemonics_visible_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1494 unsafe extern "C" fn notify_mnemonics_visible_trampoline<
1495 P: IsA<Popover>,
1496 F: Fn(&P) + 'static,
1497 >(
1498 this: *mut ffi::GtkPopover,
1499 _param_spec: glib::ffi::gpointer,
1500 f: glib::ffi::gpointer,
1501 ) {
1502 unsafe {
1503 let f: &F = &*(f as *const F);
1504 f(Popover::from_glib_borrow(this).unsafe_cast_ref())
1505 }
1506 }
1507 unsafe {
1508 let f: Box_<F> = Box_::new(f);
1509 connect_raw(
1510 self.as_ptr() as *mut _,
1511 c"notify::mnemonics-visible".as_ptr(),
1512 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1513 notify_mnemonics_visible_trampoline::<Self, F> as *const (),
1514 )),
1515 Box_::into_raw(f),
1516 )
1517 }
1518 }
1519
1520 #[doc(alias = "pointing-to")]
1521 fn connect_pointing_to_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1522 unsafe extern "C" fn notify_pointing_to_trampoline<P: IsA<Popover>, F: Fn(&P) + 'static>(
1523 this: *mut ffi::GtkPopover,
1524 _param_spec: glib::ffi::gpointer,
1525 f: glib::ffi::gpointer,
1526 ) {
1527 unsafe {
1528 let f: &F = &*(f as *const F);
1529 f(Popover::from_glib_borrow(this).unsafe_cast_ref())
1530 }
1531 }
1532 unsafe {
1533 let f: Box_<F> = Box_::new(f);
1534 connect_raw(
1535 self.as_ptr() as *mut _,
1536 c"notify::pointing-to".as_ptr(),
1537 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1538 notify_pointing_to_trampoline::<Self, F> as *const (),
1539 )),
1540 Box_::into_raw(f),
1541 )
1542 }
1543 }
1544
1545 #[doc(alias = "position")]
1546 fn connect_position_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1547 unsafe extern "C" fn notify_position_trampoline<P: IsA<Popover>, F: Fn(&P) + 'static>(
1548 this: *mut ffi::GtkPopover,
1549 _param_spec: glib::ffi::gpointer,
1550 f: glib::ffi::gpointer,
1551 ) {
1552 unsafe {
1553 let f: &F = &*(f as *const F);
1554 f(Popover::from_glib_borrow(this).unsafe_cast_ref())
1555 }
1556 }
1557 unsafe {
1558 let f: Box_<F> = Box_::new(f);
1559 connect_raw(
1560 self.as_ptr() as *mut _,
1561 c"notify::position".as_ptr(),
1562 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1563 notify_position_trampoline::<Self, F> as *const (),
1564 )),
1565 Box_::into_raw(f),
1566 )
1567 }
1568 }
1569}
1570
1571impl<O: IsA<Popover>> PopoverExt for O {}