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 use gdk; 6 use glib::object::Cast; 7 use glib::object::IsA; 8 use glib::signal::connect_raw; 9 use glib::signal::SignalHandlerId; 10 use glib::translate::*; 11 use glib_sys; 12 use gtk_sys; 13 use std::boxed::Box as Box_; 14 use std::fmt; 15 use std::mem::transmute; 16 use EventController; 17 use Gesture; 18 19 glib_wrapper! { 20 pub struct GestureSingle(Object<gtk_sys::GtkGestureSingle, gtk_sys::GtkGestureSingleClass, GestureSingleClass>) @extends Gesture, EventController; 21 22 match fn { 23 get_type => || gtk_sys::gtk_gesture_single_get_type(), 24 } 25 } 26 27 pub const NONE_GESTURE_SINGLE: Option<&GestureSingle> = None; 28 29 pub trait GestureSingleExt: 'static { get_button(&self) -> u3230 fn get_button(&self) -> u32; 31 get_current_button(&self) -> u3232 fn get_current_button(&self) -> u32; 33 get_current_sequence(&self) -> Option<gdk::EventSequence>34 fn get_current_sequence(&self) -> Option<gdk::EventSequence>; 35 get_exclusive(&self) -> bool36 fn get_exclusive(&self) -> bool; 37 get_touch_only(&self) -> bool38 fn get_touch_only(&self) -> bool; 39 set_button(&self, button: u32)40 fn set_button(&self, button: u32); 41 set_exclusive(&self, exclusive: bool)42 fn set_exclusive(&self, exclusive: bool); 43 set_touch_only(&self, touch_only: bool)44 fn set_touch_only(&self, touch_only: bool); 45 connect_property_button_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId46 fn connect_property_button_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId; 47 connect_property_exclusive_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId48 fn connect_property_exclusive_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId; 49 connect_property_touch_only_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId50 fn connect_property_touch_only_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId; 51 } 52 53 impl<O: IsA<GestureSingle>> GestureSingleExt for O { get_button(&self) -> u3254 fn get_button(&self) -> u32 { 55 unsafe { gtk_sys::gtk_gesture_single_get_button(self.as_ref().to_glib_none().0) } 56 } 57 get_current_button(&self) -> u3258 fn get_current_button(&self) -> u32 { 59 unsafe { gtk_sys::gtk_gesture_single_get_current_button(self.as_ref().to_glib_none().0) } 60 } 61 get_current_sequence(&self) -> Option<gdk::EventSequence>62 fn get_current_sequence(&self) -> Option<gdk::EventSequence> { 63 unsafe { 64 from_glib_full(gtk_sys::gtk_gesture_single_get_current_sequence( 65 self.as_ref().to_glib_none().0, 66 )) 67 } 68 } 69 get_exclusive(&self) -> bool70 fn get_exclusive(&self) -> bool { 71 unsafe { 72 from_glib(gtk_sys::gtk_gesture_single_get_exclusive( 73 self.as_ref().to_glib_none().0, 74 )) 75 } 76 } 77 get_touch_only(&self) -> bool78 fn get_touch_only(&self) -> bool { 79 unsafe { 80 from_glib(gtk_sys::gtk_gesture_single_get_touch_only( 81 self.as_ref().to_glib_none().0, 82 )) 83 } 84 } 85 set_button(&self, button: u32)86 fn set_button(&self, button: u32) { 87 unsafe { 88 gtk_sys::gtk_gesture_single_set_button(self.as_ref().to_glib_none().0, button); 89 } 90 } 91 set_exclusive(&self, exclusive: bool)92 fn set_exclusive(&self, exclusive: bool) { 93 unsafe { 94 gtk_sys::gtk_gesture_single_set_exclusive( 95 self.as_ref().to_glib_none().0, 96 exclusive.to_glib(), 97 ); 98 } 99 } 100 set_touch_only(&self, touch_only: bool)101 fn set_touch_only(&self, touch_only: bool) { 102 unsafe { 103 gtk_sys::gtk_gesture_single_set_touch_only( 104 self.as_ref().to_glib_none().0, 105 touch_only.to_glib(), 106 ); 107 } 108 } 109 connect_property_button_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId110 fn connect_property_button_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { 111 unsafe extern "C" fn notify_button_trampoline<P, F: Fn(&P) + 'static>( 112 this: *mut gtk_sys::GtkGestureSingle, 113 _param_spec: glib_sys::gpointer, 114 f: glib_sys::gpointer, 115 ) where 116 P: IsA<GestureSingle>, 117 { 118 let f: &F = &*(f as *const F); 119 f(&GestureSingle::from_glib_borrow(this).unsafe_cast()) 120 } 121 unsafe { 122 let f: Box_<F> = Box_::new(f); 123 connect_raw( 124 self.as_ptr() as *mut _, 125 b"notify::button\0".as_ptr() as *const _, 126 Some(transmute(notify_button_trampoline::<Self, F> as usize)), 127 Box_::into_raw(f), 128 ) 129 } 130 } 131 connect_property_exclusive_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId132 fn connect_property_exclusive_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { 133 unsafe extern "C" fn notify_exclusive_trampoline<P, F: Fn(&P) + 'static>( 134 this: *mut gtk_sys::GtkGestureSingle, 135 _param_spec: glib_sys::gpointer, 136 f: glib_sys::gpointer, 137 ) where 138 P: IsA<GestureSingle>, 139 { 140 let f: &F = &*(f as *const F); 141 f(&GestureSingle::from_glib_borrow(this).unsafe_cast()) 142 } 143 unsafe { 144 let f: Box_<F> = Box_::new(f); 145 connect_raw( 146 self.as_ptr() as *mut _, 147 b"notify::exclusive\0".as_ptr() as *const _, 148 Some(transmute(notify_exclusive_trampoline::<Self, F> as usize)), 149 Box_::into_raw(f), 150 ) 151 } 152 } 153 connect_property_touch_only_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId154 fn connect_property_touch_only_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { 155 unsafe extern "C" fn notify_touch_only_trampoline<P, F: Fn(&P) + 'static>( 156 this: *mut gtk_sys::GtkGestureSingle, 157 _param_spec: glib_sys::gpointer, 158 f: glib_sys::gpointer, 159 ) where 160 P: IsA<GestureSingle>, 161 { 162 let f: &F = &*(f as *const F); 163 f(&GestureSingle::from_glib_borrow(this).unsafe_cast()) 164 } 165 unsafe { 166 let f: Box_<F> = Box_::new(f); 167 connect_raw( 168 self.as_ptr() as *mut _, 169 b"notify::touch-only\0".as_ptr() as *const _, 170 Some(transmute(notify_touch_only_trampoline::<Self, F> as usize)), 171 Box_::into_raw(f), 172 ) 173 } 174 } 175 } 176 177 impl fmt::Display for GestureSingle { fmt(&self, f: &mut fmt::Formatter) -> fmt::Result178 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { 179 write!(f, "GestureSingle") 180 } 181 } 182