gdk4_macos/auto/macos_surface.rs
1// This file was generated by gir (https://github.com/gtk-rs/gir)
2// from gir-files (https://github.com/gtk-rs/gir-files)
3// DO NOT EDIT
4
5use crate::ffi;
6use glib::{
7 prelude::*,
8 signal::{connect_raw, SignalHandlerId},
9 translate::*,
10};
11use std::boxed::Box as Box_;
12
13glib::wrapper! {
14 ///
15 ///
16 /// This is an Abstract Base Class, you cannot instantiate it.
17 ///
18 /// ## Properties
19 ///
20 ///
21 /// #### `native`
22 /// The "native" property contains the underlying NSWindow.
23 ///
24 /// Readable
25 /// <details><summary><h4>Surface</h4></summary>
26 ///
27 ///
28 /// #### `cursor`
29 /// The mouse pointer for the [`gdk::Surface`][crate::gdk::Surface].
30 ///
31 /// Readable | Writeable
32 ///
33 ///
34 /// #### `display`
35 /// The [`gdk::Display`][crate::gdk::Display] connection of the surface.
36 ///
37 /// Readable | Writeable | Construct Only
38 ///
39 ///
40 /// #### `frame-clock`
41 /// The `GdkFrameClock` of the surface.
42 ///
43 /// Readable | Writeable | Construct Only
44 ///
45 ///
46 /// #### `height`
47 /// The height of the surface, in pixels.
48 ///
49 /// Readable
50 ///
51 ///
52 /// #### `mapped`
53 /// Whether the surface is mapped.
54 ///
55 /// Readable
56 ///
57 ///
58 /// #### `scale`
59 /// The scale of the surface.
60 ///
61 /// Readable
62 ///
63 ///
64 /// #### `scale-factor`
65 /// The scale factor of the surface.
66 ///
67 /// The scale factor is the next larger integer,
68 /// compared to [`scale`][struct@crate::gdk::Surface#scale].
69 ///
70 /// Readable
71 ///
72 ///
73 /// #### `width`
74 /// The width of the surface in pixels.
75 ///
76 /// Readable
77 /// </details>
78 ///
79 /// # Implements
80 ///
81 /// [`trait@gdk::prelude::SurfaceExt`]
82 #[doc(alias = "GdkMacosSurface")]
83 pub struct MacosSurface(Object<ffi::GdkMacosSurface, ffi::GdkMacosSurfaceClass>) @extends gdk::Surface;
84
85 match fn {
86 type_ => || ffi::gdk_macos_surface_get_type(),
87 }
88}
89
90impl MacosSurface {
91 #[doc(alias = "native")]
92 pub fn connect_native_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
93 unsafe extern "C" fn notify_native_trampoline<F: Fn(&MacosSurface) + 'static>(
94 this: *mut ffi::GdkMacosSurface,
95 _param_spec: glib::ffi::gpointer,
96 f: glib::ffi::gpointer,
97 ) {
98 let f: &F = &*(f as *const F);
99 f(&from_glib_borrow(this))
100 }
101 unsafe {
102 let f: Box_<F> = Box_::new(f);
103 connect_raw(
104 self.as_ptr() as *mut _,
105 b"notify::native\0".as_ptr() as *const _,
106 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
107 notify_native_trampoline::<F> as *const (),
108 )),
109 Box_::into_raw(f),
110 )
111 }
112 }
113}