spice_client_glib/auto/
cursor_channel.rs1use crate::{ffi, Channel, CursorShape};
7use glib::{
8 object::ObjectType as _,
9 prelude::*,
10 signal::{connect_raw, SignalHandlerId},
11 translate::*,
12};
13use std::boxed::Box as Box_;
14
15glib::wrapper! {
16 #[doc(alias = "SpiceCursorChannel")]
17 pub struct CursorChannel(Object<ffi::SpiceCursorChannel, ffi::SpiceCursorChannelClass>) @extends Channel;
18
19 match fn {
20 type_ => || ffi::spice_cursor_channel_get_type(),
21 }
22}
23
24impl CursorChannel {
25 pub fn cursor(&self) -> Option<CursorShape> {
26 ObjectExt::property(self, "cursor")
27 }
28
29 #[doc(alias = "cursor-hide")]
30 pub fn connect_cursor_hide<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
31 unsafe extern "C" fn cursor_hide_trampoline<F: Fn(&CursorChannel) + 'static>(
32 this: *mut ffi::SpiceCursorChannel,
33 f: glib::ffi::gpointer,
34 ) {
35 unsafe {
36 let f: &F = &*(f as *const F);
37 f(&from_glib_borrow(this))
38 }
39 }
40 unsafe {
41 let f: Box_<F> = Box_::new(f);
42 connect_raw(
43 self.as_ptr() as *mut _,
44 c"cursor-hide".as_ptr(),
45 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
46 cursor_hide_trampoline::<F> as *const (),
47 )),
48 Box_::into_raw(f),
49 )
50 }
51 }
52
53 #[doc(alias = "cursor-move")]
54 pub fn connect_cursor_move<F: Fn(&Self, i32, i32) + 'static>(&self, f: F) -> SignalHandlerId {
55 unsafe extern "C" fn cursor_move_trampoline<F: Fn(&CursorChannel, i32, i32) + 'static>(
56 this: *mut ffi::SpiceCursorChannel,
57 x: std::ffi::c_int,
58 y: std::ffi::c_int,
59 f: glib::ffi::gpointer,
60 ) {
61 unsafe {
62 let f: &F = &*(f as *const F);
63 f(&from_glib_borrow(this), x, y)
64 }
65 }
66 unsafe {
67 let f: Box_<F> = Box_::new(f);
68 connect_raw(
69 self.as_ptr() as *mut _,
70 c"cursor-move".as_ptr(),
71 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
72 cursor_move_trampoline::<F> as *const (),
73 )),
74 Box_::into_raw(f),
75 )
76 }
77 }
78
79 #[doc(alias = "cursor-reset")]
80 pub fn connect_cursor_reset<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
81 unsafe extern "C" fn cursor_reset_trampoline<F: Fn(&CursorChannel) + 'static>(
82 this: *mut ffi::SpiceCursorChannel,
83 f: glib::ffi::gpointer,
84 ) {
85 unsafe {
86 let f: &F = &*(f as *const F);
87 f(&from_glib_borrow(this))
88 }
89 }
90 unsafe {
91 let f: Box_<F> = Box_::new(f);
92 connect_raw(
93 self.as_ptr() as *mut _,
94 c"cursor-reset".as_ptr(),
95 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
96 cursor_reset_trampoline::<F> as *const (),
97 )),
98 Box_::into_raw(f),
99 )
100 }
101 }
102
103 #[doc(alias = "cursor")]
104 pub fn connect_cursor_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
105 unsafe extern "C" fn notify_cursor_trampoline<F: Fn(&CursorChannel) + 'static>(
106 this: *mut ffi::SpiceCursorChannel,
107 _param_spec: glib::ffi::gpointer,
108 f: glib::ffi::gpointer,
109 ) {
110 unsafe {
111 let f: &F = &*(f as *const F);
112 f(&from_glib_borrow(this))
113 }
114 }
115 unsafe {
116 let f: Box_<F> = Box_::new(f);
117 connect_raw(
118 self.as_ptr() as *mut _,
119 c"notify::cursor".as_ptr(),
120 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
121 notify_cursor_trampoline::<F> as *const (),
122 )),
123 Box_::into_raw(f),
124 )
125 }
126 }
127}