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