1use crate::{
6 ffi, Accessible, AccessibleRole, Align, Buildable, ConstraintTarget, LayoutManager, Native,
7 Overflow, PositionType, ShortcutManager, Widget,
8};
9use glib::{
10 object::ObjectType as _,
11 prelude::*,
12 signal::{connect_raw, SignalHandlerId},
13 translate::*,
14};
15use std::boxed::Box as Box_;
16
17glib::wrapper! {
18 #[doc(alias = "GtkPopover")]
19 pub struct Popover(Object<ffi::GtkPopover, ffi::GtkPopoverClass>) @extends Widget, @implements Accessible, Buildable, ConstraintTarget, Native, ShortcutManager;
20
21 match fn {
22 type_ => || ffi::gtk_popover_get_type(),
23 }
24}
25
26impl Popover {
27 pub const NONE: Option<&'static Popover> = None;
28
29 #[doc(alias = "gtk_popover_new")]
30 pub fn new() -> Popover {
31 assert_initialized_main_thread!();
32 unsafe { Widget::from_glib_none(ffi::gtk_popover_new()).unsafe_cast() }
33 }
34
35 pub fn builder() -> PopoverBuilder {
40 PopoverBuilder::new()
41 }
42}
43
44impl Default for Popover {
45 fn default() -> Self {
46 Self::new()
47 }
48}
49
50#[must_use = "The builder must be built to be used"]
55pub struct PopoverBuilder {
56 builder: glib::object::ObjectBuilder<'static, Popover>,
57}
58
59impl PopoverBuilder {
60 fn new() -> Self {
61 Self {
62 builder: glib::object::Object::builder(),
63 }
64 }
65
66 pub fn autohide(self, autohide: bool) -> Self {
67 Self {
68 builder: self.builder.property("autohide", autohide),
69 }
70 }
71
72 pub fn cascade_popdown(self, cascade_popdown: bool) -> Self {
73 Self {
74 builder: self.builder.property("cascade-popdown", cascade_popdown),
75 }
76 }
77
78 pub fn child(self, child: &impl IsA<Widget>) -> Self {
79 Self {
80 builder: self.builder.property("child", child.clone().upcast()),
81 }
82 }
83
84 pub fn default_widget(self, default_widget: &impl IsA<Widget>) -> Self {
85 Self {
86 builder: self
87 .builder
88 .property("default-widget", default_widget.clone().upcast()),
89 }
90 }
91
92 pub fn has_arrow(self, has_arrow: bool) -> Self {
93 Self {
94 builder: self.builder.property("has-arrow", has_arrow),
95 }
96 }
97
98 pub fn mnemonics_visible(self, mnemonics_visible: bool) -> Self {
99 Self {
100 builder: self
101 .builder
102 .property("mnemonics-visible", mnemonics_visible),
103 }
104 }
105
106 pub fn pointing_to(self, pointing_to: &gdk::Rectangle) -> Self {
107 Self {
108 builder: self.builder.property("pointing-to", pointing_to),
109 }
110 }
111
112 pub fn position(self, position: PositionType) -> Self {
113 Self {
114 builder: self.builder.property("position", position),
115 }
116 }
117
118 pub fn can_focus(self, can_focus: bool) -> Self {
119 Self {
120 builder: self.builder.property("can-focus", can_focus),
121 }
122 }
123
124 pub fn can_target(self, can_target: bool) -> Self {
125 Self {
126 builder: self.builder.property("can-target", can_target),
127 }
128 }
129
130 pub fn css_classes(self, css_classes: impl Into<glib::StrV>) -> Self {
131 Self {
132 builder: self.builder.property("css-classes", css_classes.into()),
133 }
134 }
135
136 pub fn css_name(self, css_name: impl Into<glib::GString>) -> Self {
137 Self {
138 builder: self.builder.property("css-name", css_name.into()),
139 }
140 }
141
142 pub fn cursor(self, cursor: &gdk::Cursor) -> Self {
143 Self {
144 builder: self.builder.property("cursor", cursor.clone()),
145 }
146 }
147
148 pub fn focus_on_click(self, focus_on_click: bool) -> Self {
149 Self {
150 builder: self.builder.property("focus-on-click", focus_on_click),
151 }
152 }
153
154 pub fn focusable(self, focusable: bool) -> Self {
155 Self {
156 builder: self.builder.property("focusable", focusable),
157 }
158 }
159
160 pub fn halign(self, halign: Align) -> Self {
161 Self {
162 builder: self.builder.property("halign", halign),
163 }
164 }
165
166 pub fn has_tooltip(self, has_tooltip: bool) -> Self {
167 Self {
168 builder: self.builder.property("has-tooltip", has_tooltip),
169 }
170 }
171
172 pub fn height_request(self, height_request: i32) -> Self {
173 Self {
174 builder: self.builder.property("height-request", height_request),
175 }
176 }
177
178 pub fn hexpand(self, hexpand: bool) -> Self {
179 Self {
180 builder: self.builder.property("hexpand", hexpand),
181 }
182 }
183
184 pub fn hexpand_set(self, hexpand_set: bool) -> Self {
185 Self {
186 builder: self.builder.property("hexpand-set", hexpand_set),
187 }
188 }
189
190 pub fn layout_manager(self, layout_manager: &impl IsA<LayoutManager>) -> Self {
191 Self {
192 builder: self
193 .builder
194 .property("layout-manager", layout_manager.clone().upcast()),
195 }
196 }
197
198 #[cfg(feature = "v4_18")]
199 #[cfg_attr(docsrs, doc(cfg(feature = "v4_18")))]
200 pub fn limit_events(self, limit_events: bool) -> Self {
201 Self {
202 builder: self.builder.property("limit-events", limit_events),
203 }
204 }
205
206 pub fn margin_bottom(self, margin_bottom: i32) -> Self {
207 Self {
208 builder: self.builder.property("margin-bottom", margin_bottom),
209 }
210 }
211
212 pub fn margin_end(self, margin_end: i32) -> Self {
213 Self {
214 builder: self.builder.property("margin-end", margin_end),
215 }
216 }
217
218 pub fn margin_start(self, margin_start: i32) -> Self {
219 Self {
220 builder: self.builder.property("margin-start", margin_start),
221 }
222 }
223
224 pub fn margin_top(self, margin_top: i32) -> Self {
225 Self {
226 builder: self.builder.property("margin-top", margin_top),
227 }
228 }
229
230 pub fn name(self, name: impl Into<glib::GString>) -> Self {
231 Self {
232 builder: self.builder.property("name", name.into()),
233 }
234 }
235
236 pub fn opacity(self, opacity: f64) -> Self {
237 Self {
238 builder: self.builder.property("opacity", opacity),
239 }
240 }
241
242 pub fn overflow(self, overflow: Overflow) -> Self {
243 Self {
244 builder: self.builder.property("overflow", overflow),
245 }
246 }
247
248 pub fn receives_default(self, receives_default: bool) -> Self {
249 Self {
250 builder: self.builder.property("receives-default", receives_default),
251 }
252 }
253
254 pub fn sensitive(self, sensitive: bool) -> Self {
255 Self {
256 builder: self.builder.property("sensitive", sensitive),
257 }
258 }
259
260 pub fn tooltip_markup(self, tooltip_markup: impl Into<glib::GString>) -> Self {
261 Self {
262 builder: self
263 .builder
264 .property("tooltip-markup", tooltip_markup.into()),
265 }
266 }
267
268 pub fn tooltip_text(self, tooltip_text: impl Into<glib::GString>) -> Self {
269 Self {
270 builder: self.builder.property("tooltip-text", tooltip_text.into()),
271 }
272 }
273
274 pub fn valign(self, valign: Align) -> Self {
275 Self {
276 builder: self.builder.property("valign", valign),
277 }
278 }
279
280 pub fn vexpand(self, vexpand: bool) -> Self {
281 Self {
282 builder: self.builder.property("vexpand", vexpand),
283 }
284 }
285
286 pub fn vexpand_set(self, vexpand_set: bool) -> Self {
287 Self {
288 builder: self.builder.property("vexpand-set", vexpand_set),
289 }
290 }
291
292 pub fn visible(self, visible: bool) -> Self {
293 Self {
294 builder: self.builder.property("visible", visible),
295 }
296 }
297
298 pub fn width_request(self, width_request: i32) -> Self {
299 Self {
300 builder: self.builder.property("width-request", width_request),
301 }
302 }
303
304 pub fn accessible_role(self, accessible_role: AccessibleRole) -> Self {
305 Self {
306 builder: self.builder.property("accessible-role", accessible_role),
307 }
308 }
309
310 #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"]
313 pub fn build(self) -> Popover {
314 assert_initialized_main_thread!();
315 self.builder.build()
316 }
317}
318
319pub trait PopoverExt: IsA<Popover> + 'static {
320 #[doc(alias = "gtk_popover_get_autohide")]
321 #[doc(alias = "get_autohide")]
322 #[doc(alias = "autohide")]
323 fn is_autohide(&self) -> bool {
324 unsafe {
325 from_glib(ffi::gtk_popover_get_autohide(
326 self.as_ref().to_glib_none().0,
327 ))
328 }
329 }
330
331 #[doc(alias = "gtk_popover_get_cascade_popdown")]
332 #[doc(alias = "get_cascade_popdown")]
333 #[doc(alias = "cascade-popdown")]
334 fn is_cascade_popdown(&self) -> bool {
335 unsafe {
336 from_glib(ffi::gtk_popover_get_cascade_popdown(
337 self.as_ref().to_glib_none().0,
338 ))
339 }
340 }
341
342 #[doc(alias = "gtk_popover_get_child")]
343 #[doc(alias = "get_child")]
344 fn child(&self) -> Option<Widget> {
345 unsafe { from_glib_none(ffi::gtk_popover_get_child(self.as_ref().to_glib_none().0)) }
346 }
347
348 #[doc(alias = "gtk_popover_get_has_arrow")]
349 #[doc(alias = "get_has_arrow")]
350 #[doc(alias = "has-arrow")]
351 fn has_arrow(&self) -> bool {
352 unsafe {
353 from_glib(ffi::gtk_popover_get_has_arrow(
354 self.as_ref().to_glib_none().0,
355 ))
356 }
357 }
358
359 #[doc(alias = "gtk_popover_get_mnemonics_visible")]
360 #[doc(alias = "get_mnemonics_visible")]
361 #[doc(alias = "mnemonics-visible")]
362 fn is_mnemonics_visible(&self) -> bool {
363 unsafe {
364 from_glib(ffi::gtk_popover_get_mnemonics_visible(
365 self.as_ref().to_glib_none().0,
366 ))
367 }
368 }
369
370 #[doc(alias = "gtk_popover_get_offset")]
371 #[doc(alias = "get_offset")]
372 fn offset(&self) -> (i32, i32) {
373 unsafe {
374 let mut x_offset = std::mem::MaybeUninit::uninit();
375 let mut y_offset = std::mem::MaybeUninit::uninit();
376 ffi::gtk_popover_get_offset(
377 self.as_ref().to_glib_none().0,
378 x_offset.as_mut_ptr(),
379 y_offset.as_mut_ptr(),
380 );
381 (x_offset.assume_init(), y_offset.assume_init())
382 }
383 }
384
385 #[doc(alias = "gtk_popover_get_pointing_to")]
386 #[doc(alias = "get_pointing_to")]
387 #[doc(alias = "pointing-to")]
388 fn pointing_to(&self) -> (bool, gdk::Rectangle) {
389 unsafe {
390 let mut rect = gdk::Rectangle::uninitialized();
391 let ret = from_glib(ffi::gtk_popover_get_pointing_to(
392 self.as_ref().to_glib_none().0,
393 rect.to_glib_none_mut().0,
394 ));
395 (ret, rect)
396 }
397 }
398
399 #[doc(alias = "gtk_popover_get_position")]
400 #[doc(alias = "get_position")]
401 fn position(&self) -> PositionType {
402 unsafe {
403 from_glib(ffi::gtk_popover_get_position(
404 self.as_ref().to_glib_none().0,
405 ))
406 }
407 }
408
409 #[doc(alias = "gtk_popover_popdown")]
410 fn popdown(&self) {
411 unsafe {
412 ffi::gtk_popover_popdown(self.as_ref().to_glib_none().0);
413 }
414 }
415
416 #[doc(alias = "gtk_popover_popup")]
417 fn popup(&self) {
418 unsafe {
419 ffi::gtk_popover_popup(self.as_ref().to_glib_none().0);
420 }
421 }
422
423 #[doc(alias = "gtk_popover_present")]
424 fn present(&self) {
425 unsafe {
426 ffi::gtk_popover_present(self.as_ref().to_glib_none().0);
427 }
428 }
429
430 #[doc(alias = "gtk_popover_set_autohide")]
431 #[doc(alias = "autohide")]
432 fn set_autohide(&self, autohide: bool) {
433 unsafe {
434 ffi::gtk_popover_set_autohide(self.as_ref().to_glib_none().0, autohide.into_glib());
435 }
436 }
437
438 #[doc(alias = "gtk_popover_set_cascade_popdown")]
439 #[doc(alias = "cascade-popdown")]
440 fn set_cascade_popdown(&self, cascade_popdown: bool) {
441 unsafe {
442 ffi::gtk_popover_set_cascade_popdown(
443 self.as_ref().to_glib_none().0,
444 cascade_popdown.into_glib(),
445 );
446 }
447 }
448
449 #[doc(alias = "gtk_popover_set_child")]
450 #[doc(alias = "child")]
451 fn set_child(&self, child: Option<&impl IsA<Widget>>) {
452 unsafe {
453 ffi::gtk_popover_set_child(
454 self.as_ref().to_glib_none().0,
455 child.map(|p| p.as_ref()).to_glib_none().0,
456 );
457 }
458 }
459
460 #[doc(alias = "gtk_popover_set_default_widget")]
461 #[doc(alias = "default-widget")]
462 fn set_default_widget(&self, widget: Option<&impl IsA<Widget>>) {
463 unsafe {
464 ffi::gtk_popover_set_default_widget(
465 self.as_ref().to_glib_none().0,
466 widget.map(|p| p.as_ref()).to_glib_none().0,
467 );
468 }
469 }
470
471 #[doc(alias = "gtk_popover_set_has_arrow")]
472 #[doc(alias = "has-arrow")]
473 fn set_has_arrow(&self, has_arrow: bool) {
474 unsafe {
475 ffi::gtk_popover_set_has_arrow(self.as_ref().to_glib_none().0, has_arrow.into_glib());
476 }
477 }
478
479 #[doc(alias = "gtk_popover_set_mnemonics_visible")]
480 #[doc(alias = "mnemonics-visible")]
481 fn set_mnemonics_visible(&self, mnemonics_visible: bool) {
482 unsafe {
483 ffi::gtk_popover_set_mnemonics_visible(
484 self.as_ref().to_glib_none().0,
485 mnemonics_visible.into_glib(),
486 );
487 }
488 }
489
490 #[doc(alias = "gtk_popover_set_offset")]
491 fn set_offset(&self, x_offset: i32, y_offset: i32) {
492 unsafe {
493 ffi::gtk_popover_set_offset(self.as_ref().to_glib_none().0, x_offset, y_offset);
494 }
495 }
496
497 #[doc(alias = "gtk_popover_set_pointing_to")]
498 #[doc(alias = "pointing-to")]
499 fn set_pointing_to(&self, rect: Option<&gdk::Rectangle>) {
500 unsafe {
501 ffi::gtk_popover_set_pointing_to(self.as_ref().to_glib_none().0, rect.to_glib_none().0);
502 }
503 }
504
505 #[doc(alias = "gtk_popover_set_position")]
506 #[doc(alias = "position")]
507 fn set_position(&self, position: PositionType) {
508 unsafe {
509 ffi::gtk_popover_set_position(self.as_ref().to_glib_none().0, position.into_glib());
510 }
511 }
512
513 #[doc(alias = "default-widget")]
514 fn default_widget(&self) -> Option<Widget> {
515 ObjectExt::property(self.as_ref(), "default-widget")
516 }
517
518 #[doc(alias = "activate-default")]
519 fn connect_activate_default<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
520 unsafe extern "C" fn activate_default_trampoline<P: IsA<Popover>, F: Fn(&P) + 'static>(
521 this: *mut ffi::GtkPopover,
522 f: glib::ffi::gpointer,
523 ) {
524 let f: &F = &*(f as *const F);
525 f(Popover::from_glib_borrow(this).unsafe_cast_ref())
526 }
527 unsafe {
528 let f: Box_<F> = Box_::new(f);
529 connect_raw(
530 self.as_ptr() as *mut _,
531 c"activate-default".as_ptr() as *const _,
532 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
533 activate_default_trampoline::<Self, F> as *const (),
534 )),
535 Box_::into_raw(f),
536 )
537 }
538 }
539
540 fn emit_activate_default(&self) {
541 self.emit_by_name::<()>("activate-default", &[]);
542 }
543
544 #[doc(alias = "closed")]
545 fn connect_closed<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
546 unsafe extern "C" fn closed_trampoline<P: IsA<Popover>, F: Fn(&P) + 'static>(
547 this: *mut ffi::GtkPopover,
548 f: glib::ffi::gpointer,
549 ) {
550 let f: &F = &*(f as *const F);
551 f(Popover::from_glib_borrow(this).unsafe_cast_ref())
552 }
553 unsafe {
554 let f: Box_<F> = Box_::new(f);
555 connect_raw(
556 self.as_ptr() as *mut _,
557 c"closed".as_ptr() as *const _,
558 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
559 closed_trampoline::<Self, F> as *const (),
560 )),
561 Box_::into_raw(f),
562 )
563 }
564 }
565
566 #[doc(alias = "autohide")]
567 fn connect_autohide_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
568 unsafe extern "C" fn notify_autohide_trampoline<P: IsA<Popover>, F: Fn(&P) + 'static>(
569 this: *mut ffi::GtkPopover,
570 _param_spec: glib::ffi::gpointer,
571 f: glib::ffi::gpointer,
572 ) {
573 let f: &F = &*(f as *const F);
574 f(Popover::from_glib_borrow(this).unsafe_cast_ref())
575 }
576 unsafe {
577 let f: Box_<F> = Box_::new(f);
578 connect_raw(
579 self.as_ptr() as *mut _,
580 c"notify::autohide".as_ptr() as *const _,
581 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
582 notify_autohide_trampoline::<Self, F> as *const (),
583 )),
584 Box_::into_raw(f),
585 )
586 }
587 }
588
589 #[doc(alias = "cascade-popdown")]
590 fn connect_cascade_popdown_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
591 unsafe extern "C" fn notify_cascade_popdown_trampoline<
592 P: IsA<Popover>,
593 F: Fn(&P) + 'static,
594 >(
595 this: *mut ffi::GtkPopover,
596 _param_spec: glib::ffi::gpointer,
597 f: glib::ffi::gpointer,
598 ) {
599 let f: &F = &*(f as *const F);
600 f(Popover::from_glib_borrow(this).unsafe_cast_ref())
601 }
602 unsafe {
603 let f: Box_<F> = Box_::new(f);
604 connect_raw(
605 self.as_ptr() as *mut _,
606 c"notify::cascade-popdown".as_ptr() as *const _,
607 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
608 notify_cascade_popdown_trampoline::<Self, F> as *const (),
609 )),
610 Box_::into_raw(f),
611 )
612 }
613 }
614
615 #[doc(alias = "child")]
616 fn connect_child_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
617 unsafe extern "C" fn notify_child_trampoline<P: IsA<Popover>, F: Fn(&P) + 'static>(
618 this: *mut ffi::GtkPopover,
619 _param_spec: glib::ffi::gpointer,
620 f: glib::ffi::gpointer,
621 ) {
622 let f: &F = &*(f as *const F);
623 f(Popover::from_glib_borrow(this).unsafe_cast_ref())
624 }
625 unsafe {
626 let f: Box_<F> = Box_::new(f);
627 connect_raw(
628 self.as_ptr() as *mut _,
629 c"notify::child".as_ptr() as *const _,
630 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
631 notify_child_trampoline::<Self, F> as *const (),
632 )),
633 Box_::into_raw(f),
634 )
635 }
636 }
637
638 #[doc(alias = "default-widget")]
639 fn connect_default_widget_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
640 unsafe extern "C" fn notify_default_widget_trampoline<
641 P: IsA<Popover>,
642 F: Fn(&P) + 'static,
643 >(
644 this: *mut ffi::GtkPopover,
645 _param_spec: glib::ffi::gpointer,
646 f: glib::ffi::gpointer,
647 ) {
648 let f: &F = &*(f as *const F);
649 f(Popover::from_glib_borrow(this).unsafe_cast_ref())
650 }
651 unsafe {
652 let f: Box_<F> = Box_::new(f);
653 connect_raw(
654 self.as_ptr() as *mut _,
655 c"notify::default-widget".as_ptr() as *const _,
656 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
657 notify_default_widget_trampoline::<Self, F> as *const (),
658 )),
659 Box_::into_raw(f),
660 )
661 }
662 }
663
664 #[doc(alias = "has-arrow")]
665 fn connect_has_arrow_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
666 unsafe extern "C" fn notify_has_arrow_trampoline<P: IsA<Popover>, F: Fn(&P) + 'static>(
667 this: *mut ffi::GtkPopover,
668 _param_spec: glib::ffi::gpointer,
669 f: glib::ffi::gpointer,
670 ) {
671 let f: &F = &*(f as *const F);
672 f(Popover::from_glib_borrow(this).unsafe_cast_ref())
673 }
674 unsafe {
675 let f: Box_<F> = Box_::new(f);
676 connect_raw(
677 self.as_ptr() as *mut _,
678 c"notify::has-arrow".as_ptr() as *const _,
679 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
680 notify_has_arrow_trampoline::<Self, F> as *const (),
681 )),
682 Box_::into_raw(f),
683 )
684 }
685 }
686
687 #[doc(alias = "mnemonics-visible")]
688 fn connect_mnemonics_visible_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
689 unsafe extern "C" fn notify_mnemonics_visible_trampoline<
690 P: IsA<Popover>,
691 F: Fn(&P) + 'static,
692 >(
693 this: *mut ffi::GtkPopover,
694 _param_spec: glib::ffi::gpointer,
695 f: glib::ffi::gpointer,
696 ) {
697 let f: &F = &*(f as *const F);
698 f(Popover::from_glib_borrow(this).unsafe_cast_ref())
699 }
700 unsafe {
701 let f: Box_<F> = Box_::new(f);
702 connect_raw(
703 self.as_ptr() as *mut _,
704 c"notify::mnemonics-visible".as_ptr() as *const _,
705 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
706 notify_mnemonics_visible_trampoline::<Self, F> as *const (),
707 )),
708 Box_::into_raw(f),
709 )
710 }
711 }
712
713 #[doc(alias = "pointing-to")]
714 fn connect_pointing_to_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
715 unsafe extern "C" fn notify_pointing_to_trampoline<P: IsA<Popover>, F: Fn(&P) + 'static>(
716 this: *mut ffi::GtkPopover,
717 _param_spec: glib::ffi::gpointer,
718 f: glib::ffi::gpointer,
719 ) {
720 let f: &F = &*(f as *const F);
721 f(Popover::from_glib_borrow(this).unsafe_cast_ref())
722 }
723 unsafe {
724 let f: Box_<F> = Box_::new(f);
725 connect_raw(
726 self.as_ptr() as *mut _,
727 c"notify::pointing-to".as_ptr() as *const _,
728 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
729 notify_pointing_to_trampoline::<Self, F> as *const (),
730 )),
731 Box_::into_raw(f),
732 )
733 }
734 }
735
736 #[doc(alias = "position")]
737 fn connect_position_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
738 unsafe extern "C" fn notify_position_trampoline<P: IsA<Popover>, F: Fn(&P) + 'static>(
739 this: *mut ffi::GtkPopover,
740 _param_spec: glib::ffi::gpointer,
741 f: glib::ffi::gpointer,
742 ) {
743 let f: &F = &*(f as *const F);
744 f(Popover::from_glib_borrow(this).unsafe_cast_ref())
745 }
746 unsafe {
747 let f: Box_<F> = Box_::new(f);
748 connect_raw(
749 self.as_ptr() as *mut _,
750 c"notify::position".as_ptr() as *const _,
751 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
752 notify_position_trampoline::<Self, F> as *const (),
753 )),
754 Box_::into_raw(f),
755 )
756 }
757 }
758}
759
760impl<O: IsA<Popover>> PopoverExt for O {}