1#[cfg(feature = "v1_2")]
7#[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))]
8use crate::Position;
9use crate::{ffi, Area, Frame, Widget};
10use glib::{
11 object::ObjectType as _,
12 prelude::*,
13 signal::{connect_raw, SignalHandlerId},
14 translate::*,
15};
16use std::boxed::Box as Box_;
17
18glib::wrapper! {
19 #[doc(alias = "PanelDock")]
20 pub struct Dock(Object<ffi::PanelDock, ffi::PanelDockClass>) @extends gtk::Widget, @implements gtk::Accessible, gtk::Buildable, gtk::ConstraintTarget;
21
22 match fn {
23 type_ => || ffi::panel_dock_get_type(),
24 }
25}
26
27impl Dock {
28 pub const NONE: Option<&'static Dock> = None;
29
30 #[doc(alias = "panel_dock_new")]
31 pub fn new() -> Dock {
32 assert_initialized_main_thread!();
33 unsafe { gtk::Widget::from_glib_none(ffi::panel_dock_new()).unsafe_cast() }
34 }
35
36 pub fn builder() -> DockBuilder {
41 DockBuilder::new()
42 }
43}
44
45impl Default for Dock {
46 fn default() -> Self {
47 Self::new()
48 }
49}
50
51#[must_use = "The builder must be built to be used"]
56pub struct DockBuilder {
57 builder: glib::object::ObjectBuilder<'static, Dock>,
58}
59
60impl DockBuilder {
61 fn new() -> Self {
62 Self {
63 builder: glib::object::Object::builder(),
64 }
65 }
66
67 pub fn bottom_height(self, bottom_height: i32) -> Self {
68 Self {
69 builder: self.builder.property("bottom-height", bottom_height),
70 }
71 }
72
73 pub fn end_width(self, end_width: i32) -> Self {
74 Self {
75 builder: self.builder.property("end-width", end_width),
76 }
77 }
78
79 pub fn reveal_bottom(self, reveal_bottom: bool) -> Self {
80 Self {
81 builder: self.builder.property("reveal-bottom", reveal_bottom),
82 }
83 }
84
85 pub fn reveal_end(self, reveal_end: bool) -> Self {
86 Self {
87 builder: self.builder.property("reveal-end", reveal_end),
88 }
89 }
90
91 pub fn reveal_start(self, reveal_start: bool) -> Self {
92 Self {
93 builder: self.builder.property("reveal-start", reveal_start),
94 }
95 }
96
97 pub fn reveal_top(self, reveal_top: bool) -> Self {
98 Self {
99 builder: self.builder.property("reveal-top", reveal_top),
100 }
101 }
102
103 pub fn start_width(self, start_width: i32) -> Self {
104 Self {
105 builder: self.builder.property("start-width", start_width),
106 }
107 }
108
109 pub fn top_height(self, top_height: i32) -> Self {
110 Self {
111 builder: self.builder.property("top-height", top_height),
112 }
113 }
114
115 pub fn can_focus(self, can_focus: bool) -> Self {
116 Self {
117 builder: self.builder.property("can-focus", can_focus),
118 }
119 }
120
121 pub fn can_target(self, can_target: bool) -> Self {
122 Self {
123 builder: self.builder.property("can-target", can_target),
124 }
125 }
126
127 pub fn css_classes(self, css_classes: impl Into<glib::StrV>) -> Self {
128 Self {
129 builder: self.builder.property("css-classes", css_classes.into()),
130 }
131 }
132
133 pub fn css_name(self, css_name: impl Into<glib::GString>) -> Self {
134 Self {
135 builder: self.builder.property("css-name", css_name.into()),
136 }
137 }
138
139 pub fn cursor(self, cursor: &gdk::Cursor) -> Self {
140 Self {
141 builder: self.builder.property("cursor", cursor.clone()),
142 }
143 }
144
145 pub fn focus_on_click(self, focus_on_click: bool) -> Self {
146 Self {
147 builder: self.builder.property("focus-on-click", focus_on_click),
148 }
149 }
150
151 pub fn focusable(self, focusable: bool) -> Self {
152 Self {
153 builder: self.builder.property("focusable", focusable),
154 }
155 }
156
157 pub fn halign(self, halign: gtk::Align) -> Self {
158 Self {
159 builder: self.builder.property("halign", halign),
160 }
161 }
162
163 pub fn has_tooltip(self, has_tooltip: bool) -> Self {
164 Self {
165 builder: self.builder.property("has-tooltip", has_tooltip),
166 }
167 }
168
169 pub fn height_request(self, height_request: i32) -> Self {
170 Self {
171 builder: self.builder.property("height-request", height_request),
172 }
173 }
174
175 pub fn hexpand(self, hexpand: bool) -> Self {
176 Self {
177 builder: self.builder.property("hexpand", hexpand),
178 }
179 }
180
181 pub fn hexpand_set(self, hexpand_set: bool) -> Self {
182 Self {
183 builder: self.builder.property("hexpand-set", hexpand_set),
184 }
185 }
186
187 pub fn layout_manager(self, layout_manager: &impl IsA<gtk::LayoutManager>) -> Self {
188 Self {
189 builder: self
190 .builder
191 .property("layout-manager", layout_manager.clone().upcast()),
192 }
193 }
194
195 #[cfg(feature = "gtk_v4_18")]
196 #[cfg_attr(docsrs, doc(cfg(feature = "gtk_v4_18")))]
197 pub fn limit_events(self, limit_events: bool) -> Self {
198 Self {
199 builder: self.builder.property("limit-events", limit_events),
200 }
201 }
202
203 pub fn margin_bottom(self, margin_bottom: i32) -> Self {
204 Self {
205 builder: self.builder.property("margin-bottom", margin_bottom),
206 }
207 }
208
209 pub fn margin_end(self, margin_end: i32) -> Self {
210 Self {
211 builder: self.builder.property("margin-end", margin_end),
212 }
213 }
214
215 pub fn margin_start(self, margin_start: i32) -> Self {
216 Self {
217 builder: self.builder.property("margin-start", margin_start),
218 }
219 }
220
221 pub fn margin_top(self, margin_top: i32) -> Self {
222 Self {
223 builder: self.builder.property("margin-top", margin_top),
224 }
225 }
226
227 pub fn name(self, name: impl Into<glib::GString>) -> Self {
228 Self {
229 builder: self.builder.property("name", name.into()),
230 }
231 }
232
233 pub fn opacity(self, opacity: f64) -> Self {
234 Self {
235 builder: self.builder.property("opacity", opacity),
236 }
237 }
238
239 pub fn overflow(self, overflow: gtk::Overflow) -> Self {
240 Self {
241 builder: self.builder.property("overflow", overflow),
242 }
243 }
244
245 pub fn receives_default(self, receives_default: bool) -> Self {
246 Self {
247 builder: self.builder.property("receives-default", receives_default),
248 }
249 }
250
251 pub fn sensitive(self, sensitive: bool) -> Self {
252 Self {
253 builder: self.builder.property("sensitive", sensitive),
254 }
255 }
256
257 pub fn tooltip_markup(self, tooltip_markup: impl Into<glib::GString>) -> Self {
258 Self {
259 builder: self
260 .builder
261 .property("tooltip-markup", tooltip_markup.into()),
262 }
263 }
264
265 pub fn tooltip_text(self, tooltip_text: impl Into<glib::GString>) -> Self {
266 Self {
267 builder: self.builder.property("tooltip-text", tooltip_text.into()),
268 }
269 }
270
271 pub fn valign(self, valign: gtk::Align) -> Self {
272 Self {
273 builder: self.builder.property("valign", valign),
274 }
275 }
276
277 pub fn vexpand(self, vexpand: bool) -> Self {
278 Self {
279 builder: self.builder.property("vexpand", vexpand),
280 }
281 }
282
283 pub fn vexpand_set(self, vexpand_set: bool) -> Self {
284 Self {
285 builder: self.builder.property("vexpand-set", vexpand_set),
286 }
287 }
288
289 pub fn visible(self, visible: bool) -> Self {
290 Self {
291 builder: self.builder.property("visible", visible),
292 }
293 }
294
295 pub fn width_request(self, width_request: i32) -> Self {
296 Self {
297 builder: self.builder.property("width-request", width_request),
298 }
299 }
300
301 pub fn accessible_role(self, accessible_role: gtk::AccessibleRole) -> Self {
302 Self {
303 builder: self.builder.property("accessible-role", accessible_role),
304 }
305 }
306
307 #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"]
310 pub fn build(self) -> Dock {
311 assert_initialized_main_thread!();
312 self.builder.build()
313 }
314}
315
316pub trait DockExt: IsA<Dock> + 'static {
317 #[doc(alias = "panel_dock_foreach_frame")]
318 fn foreach_frame<P: FnMut(&Frame)>(&self, callback: P) {
319 let mut callback_data: P = callback;
320 unsafe extern "C" fn callback_func<P: FnMut(&Frame)>(
321 frame: *mut ffi::PanelFrame,
322 user_data: glib::ffi::gpointer,
323 ) {
324 let frame = from_glib_borrow(frame);
325 let callback = user_data as *mut P;
326 (*callback)(&frame)
327 }
328 let callback = Some(callback_func::<P> as _);
329 let super_callback0: &mut P = &mut callback_data;
330 unsafe {
331 ffi::panel_dock_foreach_frame(
332 self.as_ref().to_glib_none().0,
333 callback,
334 super_callback0 as *mut _ as *mut _,
335 );
336 }
337 }
338
339 #[doc(alias = "panel_dock_get_can_reveal_area")]
340 #[doc(alias = "get_can_reveal_area")]
341 fn can_reveal_area(&self, area: Area) -> bool {
342 unsafe {
343 from_glib(ffi::panel_dock_get_can_reveal_area(
344 self.as_ref().to_glib_none().0,
345 area.into_glib(),
346 ))
347 }
348 }
349
350 #[doc(alias = "panel_dock_get_can_reveal_bottom")]
351 #[doc(alias = "get_can_reveal_bottom")]
352 #[doc(alias = "can-reveal-bottom")]
353 fn can_reveal_bottom(&self) -> bool {
354 unsafe {
355 from_glib(ffi::panel_dock_get_can_reveal_bottom(
356 self.as_ref().to_glib_none().0,
357 ))
358 }
359 }
360
361 #[doc(alias = "panel_dock_get_can_reveal_end")]
362 #[doc(alias = "get_can_reveal_end")]
363 #[doc(alias = "can-reveal-end")]
364 fn can_reveal_end(&self) -> bool {
365 unsafe {
366 from_glib(ffi::panel_dock_get_can_reveal_end(
367 self.as_ref().to_glib_none().0,
368 ))
369 }
370 }
371
372 #[doc(alias = "panel_dock_get_can_reveal_start")]
373 #[doc(alias = "get_can_reveal_start")]
374 #[doc(alias = "can-reveal-start")]
375 fn can_reveal_start(&self) -> bool {
376 unsafe {
377 from_glib(ffi::panel_dock_get_can_reveal_start(
378 self.as_ref().to_glib_none().0,
379 ))
380 }
381 }
382
383 #[doc(alias = "panel_dock_get_can_reveal_top")]
384 #[doc(alias = "get_can_reveal_top")]
385 #[doc(alias = "can-reveal-top")]
386 fn can_reveal_top(&self) -> bool {
387 unsafe {
388 from_glib(ffi::panel_dock_get_can_reveal_top(
389 self.as_ref().to_glib_none().0,
390 ))
391 }
392 }
393
394 #[doc(alias = "panel_dock_get_reveal_area")]
395 #[doc(alias = "get_reveal_area")]
396 fn reveals_area(&self, area: Area) -> bool {
397 unsafe {
398 from_glib(ffi::panel_dock_get_reveal_area(
399 self.as_ref().to_glib_none().0,
400 area.into_glib(),
401 ))
402 }
403 }
404
405 #[doc(alias = "panel_dock_get_reveal_bottom")]
406 #[doc(alias = "get_reveal_bottom")]
407 #[doc(alias = "reveal-bottom")]
408 fn reveals_bottom(&self) -> bool {
409 unsafe {
410 from_glib(ffi::panel_dock_get_reveal_bottom(
411 self.as_ref().to_glib_none().0,
412 ))
413 }
414 }
415
416 #[doc(alias = "panel_dock_get_reveal_end")]
417 #[doc(alias = "get_reveal_end")]
418 #[doc(alias = "reveal-end")]
419 fn reveals_end(&self) -> bool {
420 unsafe {
421 from_glib(ffi::panel_dock_get_reveal_end(
422 self.as_ref().to_glib_none().0,
423 ))
424 }
425 }
426
427 #[doc(alias = "panel_dock_get_reveal_start")]
428 #[doc(alias = "get_reveal_start")]
429 #[doc(alias = "reveal-start")]
430 fn reveals_start(&self) -> bool {
431 unsafe {
432 from_glib(ffi::panel_dock_get_reveal_start(
433 self.as_ref().to_glib_none().0,
434 ))
435 }
436 }
437
438 #[doc(alias = "panel_dock_get_reveal_top")]
439 #[doc(alias = "get_reveal_top")]
440 #[doc(alias = "reveal-top")]
441 fn reveals_top(&self) -> bool {
442 unsafe {
443 from_glib(ffi::panel_dock_get_reveal_top(
444 self.as_ref().to_glib_none().0,
445 ))
446 }
447 }
448
449 #[doc(alias = "panel_dock_remove")]
450 fn remove(&self, widget: &impl IsA<gtk::Widget>) {
451 unsafe {
452 ffi::panel_dock_remove(
453 self.as_ref().to_glib_none().0,
454 widget.as_ref().to_glib_none().0,
455 );
456 }
457 }
458
459 #[doc(alias = "panel_dock_set_bottom_height")]
460 #[doc(alias = "bottom-height")]
461 fn set_bottom_height(&self, height: i32) {
462 unsafe {
463 ffi::panel_dock_set_bottom_height(self.as_ref().to_glib_none().0, height);
464 }
465 }
466
467 #[doc(alias = "panel_dock_set_end_width")]
468 #[doc(alias = "end-width")]
469 fn set_end_width(&self, width: i32) {
470 unsafe {
471 ffi::panel_dock_set_end_width(self.as_ref().to_glib_none().0, width);
472 }
473 }
474
475 #[doc(alias = "panel_dock_set_reveal_area")]
476 fn set_reveal_area(&self, area: Area, reveal: bool) {
477 unsafe {
478 ffi::panel_dock_set_reveal_area(
479 self.as_ref().to_glib_none().0,
480 area.into_glib(),
481 reveal.into_glib(),
482 );
483 }
484 }
485
486 #[doc(alias = "panel_dock_set_reveal_bottom")]
487 #[doc(alias = "reveal-bottom")]
488 fn set_reveal_bottom(&self, reveal_bottom: bool) {
489 unsafe {
490 ffi::panel_dock_set_reveal_bottom(
491 self.as_ref().to_glib_none().0,
492 reveal_bottom.into_glib(),
493 );
494 }
495 }
496
497 #[doc(alias = "panel_dock_set_reveal_end")]
498 #[doc(alias = "reveal-end")]
499 fn set_reveal_end(&self, reveal_end: bool) {
500 unsafe {
501 ffi::panel_dock_set_reveal_end(self.as_ref().to_glib_none().0, reveal_end.into_glib());
502 }
503 }
504
505 #[doc(alias = "panel_dock_set_reveal_start")]
506 #[doc(alias = "reveal-start")]
507 fn set_reveal_start(&self, reveal_start: bool) {
508 unsafe {
509 ffi::panel_dock_set_reveal_start(
510 self.as_ref().to_glib_none().0,
511 reveal_start.into_glib(),
512 );
513 }
514 }
515
516 #[doc(alias = "panel_dock_set_reveal_top")]
517 #[doc(alias = "reveal-top")]
518 fn set_reveal_top(&self, reveal_top: bool) {
519 unsafe {
520 ffi::panel_dock_set_reveal_top(self.as_ref().to_glib_none().0, reveal_top.into_glib());
521 }
522 }
523
524 #[doc(alias = "panel_dock_set_start_width")]
525 #[doc(alias = "start-width")]
526 fn set_start_width(&self, width: i32) {
527 unsafe {
528 ffi::panel_dock_set_start_width(self.as_ref().to_glib_none().0, width);
529 }
530 }
531
532 #[doc(alias = "panel_dock_set_top_height")]
533 #[doc(alias = "top-height")]
534 fn set_top_height(&self, height: i32) {
535 unsafe {
536 ffi::panel_dock_set_top_height(self.as_ref().to_glib_none().0, height);
537 }
538 }
539
540 #[doc(alias = "bottom-height")]
541 fn bottom_height(&self) -> i32 {
542 ObjectExt::property(self.as_ref(), "bottom-height")
543 }
544
545 #[doc(alias = "end-width")]
546 fn end_width(&self) -> i32 {
547 ObjectExt::property(self.as_ref(), "end-width")
548 }
549
550 #[doc(alias = "start-width")]
551 fn start_width(&self) -> i32 {
552 ObjectExt::property(self.as_ref(), "start-width")
553 }
554
555 #[doc(alias = "top-height")]
556 fn top_height(&self) -> i32 {
557 ObjectExt::property(self.as_ref(), "top-height")
558 }
559
560 #[cfg(feature = "v1_2")]
561 #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))]
562 #[doc(alias = "adopt-widget")]
563 fn connect_adopt_widget<F: Fn(&Self, &Widget) -> bool + 'static>(
564 &self,
565 f: F,
566 ) -> SignalHandlerId {
567 unsafe extern "C" fn adopt_widget_trampoline<
568 P: IsA<Dock>,
569 F: Fn(&P, &Widget) -> bool + 'static,
570 >(
571 this: *mut ffi::PanelDock,
572 widget: *mut ffi::PanelWidget,
573 f: glib::ffi::gpointer,
574 ) -> glib::ffi::gboolean {
575 let f: &F = &*(f as *const F);
576 f(
577 Dock::from_glib_borrow(this).unsafe_cast_ref(),
578 &from_glib_borrow(widget),
579 )
580 .into_glib()
581 }
582 unsafe {
583 let f: Box_<F> = Box_::new(f);
584 connect_raw(
585 self.as_ptr() as *mut _,
586 c"adopt-widget".as_ptr() as *const _,
587 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
588 adopt_widget_trampoline::<Self, F> as *const (),
589 )),
590 Box_::into_raw(f),
591 )
592 }
593 }
594
595 #[cfg(feature = "v1_2")]
596 #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))]
597 #[doc(alias = "create-frame")]
598 fn connect_create_frame<F: Fn(&Self, &Position) -> Frame + 'static>(
599 &self,
600 f: F,
601 ) -> SignalHandlerId {
602 unsafe extern "C" fn create_frame_trampoline<
603 P: IsA<Dock>,
604 F: Fn(&P, &Position) -> Frame + 'static,
605 >(
606 this: *mut ffi::PanelDock,
607 position: *mut ffi::PanelPosition,
608 f: glib::ffi::gpointer,
609 ) -> *mut ffi::PanelFrame {
610 let f: &F = &*(f as *const F);
611 f(
612 Dock::from_glib_borrow(this).unsafe_cast_ref(),
613 &from_glib_borrow(position),
614 )
615 .to_glib_full()
616 }
617 unsafe {
618 let f: Box_<F> = Box_::new(f);
619 connect_raw(
620 self.as_ptr() as *mut _,
621 c"create-frame".as_ptr() as *const _,
622 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
623 create_frame_trampoline::<Self, F> as *const (),
624 )),
625 Box_::into_raw(f),
626 )
627 }
628 }
629
630 #[doc(alias = "panel-drag-begin")]
631 fn connect_panel_drag_begin<F: Fn(&Self, &Widget) + 'static>(&self, f: F) -> SignalHandlerId {
632 unsafe extern "C" fn panel_drag_begin_trampoline<
633 P: IsA<Dock>,
634 F: Fn(&P, &Widget) + 'static,
635 >(
636 this: *mut ffi::PanelDock,
637 panel: *mut ffi::PanelWidget,
638 f: glib::ffi::gpointer,
639 ) {
640 let f: &F = &*(f as *const F);
641 f(
642 Dock::from_glib_borrow(this).unsafe_cast_ref(),
643 &from_glib_borrow(panel),
644 )
645 }
646 unsafe {
647 let f: Box_<F> = Box_::new(f);
648 connect_raw(
649 self.as_ptr() as *mut _,
650 c"panel-drag-begin".as_ptr() as *const _,
651 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
652 panel_drag_begin_trampoline::<Self, F> as *const (),
653 )),
654 Box_::into_raw(f),
655 )
656 }
657 }
658
659 #[doc(alias = "panel-drag-end")]
660 fn connect_panel_drag_end<F: Fn(&Self, &Widget) + 'static>(&self, f: F) -> SignalHandlerId {
661 unsafe extern "C" fn panel_drag_end_trampoline<
662 P: IsA<Dock>,
663 F: Fn(&P, &Widget) + 'static,
664 >(
665 this: *mut ffi::PanelDock,
666 panel: *mut ffi::PanelWidget,
667 f: glib::ffi::gpointer,
668 ) {
669 let f: &F = &*(f as *const F);
670 f(
671 Dock::from_glib_borrow(this).unsafe_cast_ref(),
672 &from_glib_borrow(panel),
673 )
674 }
675 unsafe {
676 let f: Box_<F> = Box_::new(f);
677 connect_raw(
678 self.as_ptr() as *mut _,
679 c"panel-drag-end".as_ptr() as *const _,
680 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
681 panel_drag_end_trampoline::<Self, F> as *const (),
682 )),
683 Box_::into_raw(f),
684 )
685 }
686 }
687
688 #[doc(alias = "bottom-height")]
689 fn connect_bottom_height_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
690 unsafe extern "C" fn notify_bottom_height_trampoline<P: IsA<Dock>, F: Fn(&P) + 'static>(
691 this: *mut ffi::PanelDock,
692 _param_spec: glib::ffi::gpointer,
693 f: glib::ffi::gpointer,
694 ) {
695 let f: &F = &*(f as *const F);
696 f(Dock::from_glib_borrow(this).unsafe_cast_ref())
697 }
698 unsafe {
699 let f: Box_<F> = Box_::new(f);
700 connect_raw(
701 self.as_ptr() as *mut _,
702 c"notify::bottom-height".as_ptr() as *const _,
703 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
704 notify_bottom_height_trampoline::<Self, F> as *const (),
705 )),
706 Box_::into_raw(f),
707 )
708 }
709 }
710
711 #[doc(alias = "can-reveal-bottom")]
712 fn connect_can_reveal_bottom_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
713 unsafe extern "C" fn notify_can_reveal_bottom_trampoline<
714 P: IsA<Dock>,
715 F: Fn(&P) + 'static,
716 >(
717 this: *mut ffi::PanelDock,
718 _param_spec: glib::ffi::gpointer,
719 f: glib::ffi::gpointer,
720 ) {
721 let f: &F = &*(f as *const F);
722 f(Dock::from_glib_borrow(this).unsafe_cast_ref())
723 }
724 unsafe {
725 let f: Box_<F> = Box_::new(f);
726 connect_raw(
727 self.as_ptr() as *mut _,
728 c"notify::can-reveal-bottom".as_ptr() as *const _,
729 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
730 notify_can_reveal_bottom_trampoline::<Self, F> as *const (),
731 )),
732 Box_::into_raw(f),
733 )
734 }
735 }
736
737 #[doc(alias = "can-reveal-end")]
738 fn connect_can_reveal_end_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
739 unsafe extern "C" fn notify_can_reveal_end_trampoline<P: IsA<Dock>, F: Fn(&P) + 'static>(
740 this: *mut ffi::PanelDock,
741 _param_spec: glib::ffi::gpointer,
742 f: glib::ffi::gpointer,
743 ) {
744 let f: &F = &*(f as *const F);
745 f(Dock::from_glib_borrow(this).unsafe_cast_ref())
746 }
747 unsafe {
748 let f: Box_<F> = Box_::new(f);
749 connect_raw(
750 self.as_ptr() as *mut _,
751 c"notify::can-reveal-end".as_ptr() as *const _,
752 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
753 notify_can_reveal_end_trampoline::<Self, F> as *const (),
754 )),
755 Box_::into_raw(f),
756 )
757 }
758 }
759
760 #[doc(alias = "can-reveal-start")]
761 fn connect_can_reveal_start_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
762 unsafe extern "C" fn notify_can_reveal_start_trampoline<
763 P: IsA<Dock>,
764 F: Fn(&P) + 'static,
765 >(
766 this: *mut ffi::PanelDock,
767 _param_spec: glib::ffi::gpointer,
768 f: glib::ffi::gpointer,
769 ) {
770 let f: &F = &*(f as *const F);
771 f(Dock::from_glib_borrow(this).unsafe_cast_ref())
772 }
773 unsafe {
774 let f: Box_<F> = Box_::new(f);
775 connect_raw(
776 self.as_ptr() as *mut _,
777 c"notify::can-reveal-start".as_ptr() as *const _,
778 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
779 notify_can_reveal_start_trampoline::<Self, F> as *const (),
780 )),
781 Box_::into_raw(f),
782 )
783 }
784 }
785
786 #[doc(alias = "can-reveal-top")]
787 fn connect_can_reveal_top_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
788 unsafe extern "C" fn notify_can_reveal_top_trampoline<P: IsA<Dock>, F: Fn(&P) + 'static>(
789 this: *mut ffi::PanelDock,
790 _param_spec: glib::ffi::gpointer,
791 f: glib::ffi::gpointer,
792 ) {
793 let f: &F = &*(f as *const F);
794 f(Dock::from_glib_borrow(this).unsafe_cast_ref())
795 }
796 unsafe {
797 let f: Box_<F> = Box_::new(f);
798 connect_raw(
799 self.as_ptr() as *mut _,
800 c"notify::can-reveal-top".as_ptr() as *const _,
801 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
802 notify_can_reveal_top_trampoline::<Self, F> as *const (),
803 )),
804 Box_::into_raw(f),
805 )
806 }
807 }
808
809 #[doc(alias = "end-width")]
810 fn connect_end_width_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
811 unsafe extern "C" fn notify_end_width_trampoline<P: IsA<Dock>, F: Fn(&P) + 'static>(
812 this: *mut ffi::PanelDock,
813 _param_spec: glib::ffi::gpointer,
814 f: glib::ffi::gpointer,
815 ) {
816 let f: &F = &*(f as *const F);
817 f(Dock::from_glib_borrow(this).unsafe_cast_ref())
818 }
819 unsafe {
820 let f: Box_<F> = Box_::new(f);
821 connect_raw(
822 self.as_ptr() as *mut _,
823 c"notify::end-width".as_ptr() as *const _,
824 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
825 notify_end_width_trampoline::<Self, F> as *const (),
826 )),
827 Box_::into_raw(f),
828 )
829 }
830 }
831
832 #[doc(alias = "reveal-bottom")]
833 fn connect_reveal_bottom_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
834 unsafe extern "C" fn notify_reveal_bottom_trampoline<P: IsA<Dock>, F: Fn(&P) + 'static>(
835 this: *mut ffi::PanelDock,
836 _param_spec: glib::ffi::gpointer,
837 f: glib::ffi::gpointer,
838 ) {
839 let f: &F = &*(f as *const F);
840 f(Dock::from_glib_borrow(this).unsafe_cast_ref())
841 }
842 unsafe {
843 let f: Box_<F> = Box_::new(f);
844 connect_raw(
845 self.as_ptr() as *mut _,
846 c"notify::reveal-bottom".as_ptr() as *const _,
847 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
848 notify_reveal_bottom_trampoline::<Self, F> as *const (),
849 )),
850 Box_::into_raw(f),
851 )
852 }
853 }
854
855 #[doc(alias = "reveal-end")]
856 fn connect_reveal_end_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
857 unsafe extern "C" fn notify_reveal_end_trampoline<P: IsA<Dock>, F: Fn(&P) + 'static>(
858 this: *mut ffi::PanelDock,
859 _param_spec: glib::ffi::gpointer,
860 f: glib::ffi::gpointer,
861 ) {
862 let f: &F = &*(f as *const F);
863 f(Dock::from_glib_borrow(this).unsafe_cast_ref())
864 }
865 unsafe {
866 let f: Box_<F> = Box_::new(f);
867 connect_raw(
868 self.as_ptr() as *mut _,
869 c"notify::reveal-end".as_ptr() as *const _,
870 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
871 notify_reveal_end_trampoline::<Self, F> as *const (),
872 )),
873 Box_::into_raw(f),
874 )
875 }
876 }
877
878 #[doc(alias = "reveal-start")]
879 fn connect_reveal_start_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
880 unsafe extern "C" fn notify_reveal_start_trampoline<P: IsA<Dock>, F: Fn(&P) + 'static>(
881 this: *mut ffi::PanelDock,
882 _param_spec: glib::ffi::gpointer,
883 f: glib::ffi::gpointer,
884 ) {
885 let f: &F = &*(f as *const F);
886 f(Dock::from_glib_borrow(this).unsafe_cast_ref())
887 }
888 unsafe {
889 let f: Box_<F> = Box_::new(f);
890 connect_raw(
891 self.as_ptr() as *mut _,
892 c"notify::reveal-start".as_ptr() as *const _,
893 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
894 notify_reveal_start_trampoline::<Self, F> as *const (),
895 )),
896 Box_::into_raw(f),
897 )
898 }
899 }
900
901 #[doc(alias = "reveal-top")]
902 fn connect_reveal_top_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
903 unsafe extern "C" fn notify_reveal_top_trampoline<P: IsA<Dock>, F: Fn(&P) + 'static>(
904 this: *mut ffi::PanelDock,
905 _param_spec: glib::ffi::gpointer,
906 f: glib::ffi::gpointer,
907 ) {
908 let f: &F = &*(f as *const F);
909 f(Dock::from_glib_borrow(this).unsafe_cast_ref())
910 }
911 unsafe {
912 let f: Box_<F> = Box_::new(f);
913 connect_raw(
914 self.as_ptr() as *mut _,
915 c"notify::reveal-top".as_ptr() as *const _,
916 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
917 notify_reveal_top_trampoline::<Self, F> as *const (),
918 )),
919 Box_::into_raw(f),
920 )
921 }
922 }
923
924 #[doc(alias = "start-width")]
925 fn connect_start_width_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
926 unsafe extern "C" fn notify_start_width_trampoline<P: IsA<Dock>, F: Fn(&P) + 'static>(
927 this: *mut ffi::PanelDock,
928 _param_spec: glib::ffi::gpointer,
929 f: glib::ffi::gpointer,
930 ) {
931 let f: &F = &*(f as *const F);
932 f(Dock::from_glib_borrow(this).unsafe_cast_ref())
933 }
934 unsafe {
935 let f: Box_<F> = Box_::new(f);
936 connect_raw(
937 self.as_ptr() as *mut _,
938 c"notify::start-width".as_ptr() as *const _,
939 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
940 notify_start_width_trampoline::<Self, F> as *const (),
941 )),
942 Box_::into_raw(f),
943 )
944 }
945 }
946
947 #[doc(alias = "top-height")]
948 fn connect_top_height_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
949 unsafe extern "C" fn notify_top_height_trampoline<P: IsA<Dock>, F: Fn(&P) + 'static>(
950 this: *mut ffi::PanelDock,
951 _param_spec: glib::ffi::gpointer,
952 f: glib::ffi::gpointer,
953 ) {
954 let f: &F = &*(f as *const F);
955 f(Dock::from_glib_borrow(this).unsafe_cast_ref())
956 }
957 unsafe {
958 let f: Box_<F> = Box_::new(f);
959 connect_raw(
960 self.as_ptr() as *mut _,
961 c"notify::top-height".as_ptr() as *const _,
962 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
963 notify_top_height_trampoline::<Self, F> as *const (),
964 )),
965 Box_::into_raw(f),
966 )
967 }
968 }
969}
970
971impl<O: IsA<Dock>> DockExt for O {}