@@ -8,6 +8,8 @@ use EventSequenceState;
8
8
use ffi;
9
9
#[ cfg( any( feature = "v3_14" , feature = "dox" ) ) ]
10
10
use gdk;
11
+ #[ cfg( any( feature = "v3_14" , feature = "dox" ) ) ]
12
+ use gdk_ffi;
11
13
use glib;
12
14
#[ cfg( any( feature = "v3_14" , feature = "dox" ) ) ]
13
15
use glib:: StaticType ;
@@ -51,29 +53,29 @@ pub trait GestureExt {
51
53
#[ cfg( any( feature = "v3_14" , feature = "dox" ) ) ]
52
54
fn get_group ( & self ) -> Vec < Gesture > ;
53
55
54
- // #[cfg(any(feature = "v3_14", feature = "dox"))]
55
- // fn get_last_event(&self, sequence: /*Ignored*/ &gdk::EventSequence) -> Option<gdk::Event>;
56
+ #[ cfg( any( feature = "v3_14" , feature = "dox" ) ) ]
57
+ fn get_last_event ( & self , sequence : & gdk:: EventSequence ) -> Option < gdk:: Event > ;
56
58
57
- // #[cfg(any(feature = "v3_14", feature = "dox"))]
58
- // fn get_last_updated_sequence(&self) -> /*Ignored*/ Option<gdk::EventSequence>;
59
+ #[ cfg( any( feature = "v3_14" , feature = "dox" ) ) ]
60
+ fn get_last_updated_sequence ( & self ) -> Option < gdk:: EventSequence > ;
59
61
60
- // #[cfg(any(feature = "v3_14", feature = "dox"))]
61
- // fn get_point<'a, P: Into<Option<&'a /*Ignored*/ gdk::EventSequence>>>(&self, sequence: P) -> Option<(f64, f64)>;
62
+ #[ cfg( any( feature = "v3_14" , feature = "dox" ) ) ]
63
+ fn get_point < ' a , P : Into < Option < & ' a gdk:: EventSequence > > > ( & self , sequence : P ) -> Option < ( f64 , f64 ) > ;
62
64
63
- // #[cfg(any(feature = "v3_14", feature = "dox"))]
64
- // fn get_sequence_state(&self, sequence: /*Ignored*/ &gdk::EventSequence) -> EventSequenceState;
65
+ #[ cfg( any( feature = "v3_14" , feature = "dox" ) ) ]
66
+ fn get_sequence_state ( & self , sequence : & gdk:: EventSequence ) -> EventSequenceState ;
65
67
66
- // #[cfg(any(feature = "v3_14", feature = "dox"))]
67
- // fn get_sequences(&self) -> /*Ignored*/ Vec<gdk::EventSequence>;
68
+ #[ cfg( any( feature = "v3_14" , feature = "dox" ) ) ]
69
+ fn get_sequences ( & self ) -> Vec < gdk:: EventSequence > ;
68
70
69
71
#[ cfg( any( feature = "v3_14" , feature = "dox" ) ) ]
70
72
fn get_window ( & self ) -> Option < gdk:: Window > ;
71
73
72
74
#[ cfg( any( feature = "v3_14" , feature = "dox" ) ) ]
73
75
fn group < P : IsA < Gesture > > ( & self , gesture : & P ) ;
74
76
75
- // #[cfg(any(feature = "v3_14", feature = "dox"))]
76
- // fn handles_sequence<'a, P: Into<Option<&'a /*Ignored*/ gdk::EventSequence>>>(&self, sequence: P) -> bool;
77
+ #[ cfg( any( feature = "v3_14" , feature = "dox" ) ) ]
78
+ fn handles_sequence < ' a , P : Into < Option < & ' a gdk:: EventSequence > > > ( & self , sequence : P ) -> bool ;
77
79
78
80
#[ cfg( any( feature = "v3_14" , feature = "dox" ) ) ]
79
81
fn is_active ( & self ) -> bool ;
@@ -84,8 +86,8 @@ pub trait GestureExt {
84
86
#[ cfg( any( feature = "v3_14" , feature = "dox" ) ) ]
85
87
fn is_recognized ( & self ) -> bool ;
86
88
87
- // #[cfg(any(feature = "v3_14", feature = "dox"))]
88
- // fn set_sequence_state(&self, sequence: /*Ignored*/ &gdk::EventSequence, state: EventSequenceState) -> bool;
89
+ #[ cfg( any( feature = "v3_14" , feature = "dox" ) ) ]
90
+ fn set_sequence_state ( & self , sequence : & gdk:: EventSequence , state : EventSequenceState ) -> bool ;
89
91
90
92
#[ cfg( any( feature = "v3_14" , feature = "dox" ) ) ]
91
93
fn set_state ( & self , state : EventSequenceState ) -> bool ;
@@ -99,20 +101,20 @@ pub trait GestureExt {
99
101
#[ cfg( any( feature = "v3_14" , feature = "dox" ) ) ]
100
102
fn get_property_n_points ( & self ) -> u32 ;
101
103
102
- // #[cfg(any(feature = "v3_14", feature = "dox"))]
103
- // fn connect_begin<Unsupported or ignored types >(&self, f: F) -> SignalHandlerId;
104
+ #[ cfg( any( feature = "v3_14" , feature = "dox" ) ) ]
105
+ fn connect_begin < F : Fn ( & Self , & gdk :: EventSequence ) + ' static > ( & self , f : F ) -> SignalHandlerId ;
104
106
105
- // #[cfg(any(feature = "v3_14", feature = "dox"))]
106
- // fn connect_cancel<Unsupported or ignored types >(&self, f: F) -> SignalHandlerId;
107
+ #[ cfg( any( feature = "v3_14" , feature = "dox" ) ) ]
108
+ fn connect_cancel < F : Fn ( & Self , & gdk :: EventSequence ) + ' static > ( & self , f : F ) -> SignalHandlerId ;
107
109
108
- // #[cfg(any(feature = "v3_14", feature = "dox"))]
109
- // fn connect_end<Unsupported or ignored types >(&self, f: F) -> SignalHandlerId;
110
+ #[ cfg( any( feature = "v3_14" , feature = "dox" ) ) ]
111
+ fn connect_end < F : Fn ( & Self , & gdk :: EventSequence ) + ' static > ( & self , f : F ) -> SignalHandlerId ;
110
112
111
- // #[cfg(any(feature = "v3_14", feature = "dox"))]
112
- // fn connect_sequence_state_changed<Unsupported or ignored types >(&self, f: F) -> SignalHandlerId;
113
+ #[ cfg( any( feature = "v3_14" , feature = "dox" ) ) ]
114
+ fn connect_sequence_state_changed < F : Fn ( & Self , & gdk :: EventSequence , EventSequenceState ) + ' static > ( & self , f : F ) -> SignalHandlerId ;
113
115
114
- // #[cfg(any(feature = "v3_14", feature = "dox"))]
115
- // fn connect_update<Unsupported or ignored types >(&self, f: F) -> SignalHandlerId;
116
+ #[ cfg( any( feature = "v3_14" , feature = "dox" ) ) ]
117
+ fn connect_update < F : Fn ( & Self , & gdk :: EventSequence ) + ' static > ( & self , f : F ) -> SignalHandlerId ;
116
118
117
119
#[ cfg( any( feature = "v3_14" , feature = "dox" ) ) ]
118
120
fn connect_property_n_points_notify < F : Fn ( & Self ) + ' static > ( & self , f : F ) -> SignalHandlerId ;
@@ -155,30 +157,44 @@ impl<O: IsA<Gesture> + IsA<glib::object::Object>> GestureExt for O {
155
157
}
156
158
}
157
159
158
- //#[cfg(any(feature = "v3_14", feature = "dox"))]
159
- //fn get_last_event(&self, sequence: /*Ignored*/&gdk::EventSequence) -> Option<gdk::Event> {
160
- // unsafe { TODO: call ffi::gtk_gesture_get_last_event() }
161
- //}
160
+ #[ cfg( any( feature = "v3_14" , feature = "dox" ) ) ]
161
+ fn get_last_event ( & self , sequence : & gdk:: EventSequence ) -> Option < gdk:: Event > {
162
+ unsafe {
163
+ from_glib_none ( ffi:: gtk_gesture_get_last_event ( self . to_glib_none ( ) . 0 , mut_override ( sequence. to_glib_none ( ) . 0 ) ) )
164
+ }
165
+ }
162
166
163
- //#[cfg(any(feature = "v3_14", feature = "dox"))]
164
- //fn get_last_updated_sequence(&self) -> /*Ignored*/Option<gdk::EventSequence> {
165
- // unsafe { TODO: call ffi::gtk_gesture_get_last_updated_sequence() }
166
- //}
167
+ #[ cfg( any( feature = "v3_14" , feature = "dox" ) ) ]
168
+ fn get_last_updated_sequence ( & self ) -> Option < gdk:: EventSequence > {
169
+ unsafe {
170
+ from_glib_none ( ffi:: gtk_gesture_get_last_updated_sequence ( self . to_glib_none ( ) . 0 ) )
171
+ }
172
+ }
167
173
168
- //#[cfg(any(feature = "v3_14", feature = "dox"))]
169
- //fn get_point<'a, P: Into<Option<&'a /*Ignored*/gdk::EventSequence>>>(&self, sequence: P) -> Option<(f64, f64)> {
170
- // unsafe { TODO: call ffi::gtk_gesture_get_point() }
171
- //}
174
+ #[ cfg( any( feature = "v3_14" , feature = "dox" ) ) ]
175
+ fn get_point < ' a , P : Into < Option < & ' a gdk:: EventSequence > > > ( & self , sequence : P ) -> Option < ( f64 , f64 ) > {
176
+ let sequence = sequence. into ( ) ;
177
+ unsafe {
178
+ let mut x = mem:: uninitialized ( ) ;
179
+ let mut y = mem:: uninitialized ( ) ;
180
+ let ret = from_glib ( ffi:: gtk_gesture_get_point ( self . to_glib_none ( ) . 0 , mut_override ( sequence. to_glib_none ( ) . 0 ) , & mut x, & mut y) ) ;
181
+ if ret { Some ( ( x, y) ) } else { None }
182
+ }
183
+ }
172
184
173
- //#[cfg(any(feature = "v3_14", feature = "dox"))]
174
- //fn get_sequence_state(&self, sequence: /*Ignored*/&gdk::EventSequence) -> EventSequenceState {
175
- // unsafe { TODO: call ffi::gtk_gesture_get_sequence_state() }
176
- //}
185
+ #[ cfg( any( feature = "v3_14" , feature = "dox" ) ) ]
186
+ fn get_sequence_state ( & self , sequence : & gdk:: EventSequence ) -> EventSequenceState {
187
+ unsafe {
188
+ from_glib ( ffi:: gtk_gesture_get_sequence_state ( self . to_glib_none ( ) . 0 , mut_override ( sequence. to_glib_none ( ) . 0 ) ) )
189
+ }
190
+ }
177
191
178
- //#[cfg(any(feature = "v3_14", feature = "dox"))]
179
- //fn get_sequences(&self) -> /*Ignored*/Vec<gdk::EventSequence> {
180
- // unsafe { TODO: call ffi::gtk_gesture_get_sequences() }
181
- //}
192
+ #[ cfg( any( feature = "v3_14" , feature = "dox" ) ) ]
193
+ fn get_sequences ( & self ) -> Vec < gdk:: EventSequence > {
194
+ unsafe {
195
+ FromGlibPtrContainer :: from_glib_container ( ffi:: gtk_gesture_get_sequences ( self . to_glib_none ( ) . 0 ) )
196
+ }
197
+ }
182
198
183
199
#[ cfg( any( feature = "v3_14" , feature = "dox" ) ) ]
184
200
fn get_window ( & self ) -> Option < gdk:: Window > {
@@ -194,10 +210,13 @@ impl<O: IsA<Gesture> + IsA<glib::object::Object>> GestureExt for O {
194
210
}
195
211
}
196
212
197
- //#[cfg(any(feature = "v3_14", feature = "dox"))]
198
- //fn handles_sequence<'a, P: Into<Option<&'a /*Ignored*/gdk::EventSequence>>>(&self, sequence: P) -> bool {
199
- // unsafe { TODO: call ffi::gtk_gesture_handles_sequence() }
200
- //}
213
+ #[ cfg( any( feature = "v3_14" , feature = "dox" ) ) ]
214
+ fn handles_sequence < ' a , P : Into < Option < & ' a gdk:: EventSequence > > > ( & self , sequence : P ) -> bool {
215
+ let sequence = sequence. into ( ) ;
216
+ unsafe {
217
+ from_glib ( ffi:: gtk_gesture_handles_sequence ( self . to_glib_none ( ) . 0 , mut_override ( sequence. to_glib_none ( ) . 0 ) ) )
218
+ }
219
+ }
201
220
202
221
#[ cfg( any( feature = "v3_14" , feature = "dox" ) ) ]
203
222
fn is_active ( & self ) -> bool {
@@ -220,10 +239,12 @@ impl<O: IsA<Gesture> + IsA<glib::object::Object>> GestureExt for O {
220
239
}
221
240
}
222
241
223
- //#[cfg(any(feature = "v3_14", feature = "dox"))]
224
- //fn set_sequence_state(&self, sequence: /*Ignored*/&gdk::EventSequence, state: EventSequenceState) -> bool {
225
- // unsafe { TODO: call ffi::gtk_gesture_set_sequence_state() }
226
- //}
242
+ #[ cfg( any( feature = "v3_14" , feature = "dox" ) ) ]
243
+ fn set_sequence_state ( & self , sequence : & gdk:: EventSequence , state : EventSequenceState ) -> bool {
244
+ unsafe {
245
+ from_glib ( ffi:: gtk_gesture_set_sequence_state ( self . to_glib_none ( ) . 0 , mut_override ( sequence. to_glib_none ( ) . 0 ) , state. to_glib ( ) ) )
246
+ }
247
+ }
227
248
228
249
#[ cfg( any( feature = "v3_14" , feature = "dox" ) ) ]
229
250
fn set_state ( & self , state : EventSequenceState ) -> bool {
@@ -257,30 +278,50 @@ impl<O: IsA<Gesture> + IsA<glib::object::Object>> GestureExt for O {
257
278
}
258
279
}
259
280
260
- //#[cfg(any(feature = "v3_14", feature = "dox"))]
261
- //fn connect_begin<Unsupported or ignored types>(&self, f: F) -> SignalHandlerId {
262
- // Ignored sequence: Gdk.EventSequence
263
- //}
281
+ #[ cfg( any( feature = "v3_14" , feature = "dox" ) ) ]
282
+ fn connect_begin < F : Fn ( & Self , & gdk:: EventSequence ) + ' static > ( & self , f : F ) -> SignalHandlerId {
283
+ unsafe {
284
+ let f: Box_ < Box_ < Fn ( & Self , & gdk:: EventSequence ) + ' static > > = Box_ :: new ( Box_ :: new ( f) ) ;
285
+ connect ( self . to_glib_none ( ) . 0 , "begin" ,
286
+ transmute ( begin_trampoline :: < Self > as usize ) , Box_ :: into_raw ( f) as * mut _ )
287
+ }
288
+ }
264
289
265
- //#[cfg(any(feature = "v3_14", feature = "dox"))]
266
- //fn connect_cancel<Unsupported or ignored types>(&self, f: F) -> SignalHandlerId {
267
- // Ignored sequence: Gdk.EventSequence
268
- //}
290
+ #[ cfg( any( feature = "v3_14" , feature = "dox" ) ) ]
291
+ fn connect_cancel < F : Fn ( & Self , & gdk:: EventSequence ) + ' static > ( & self , f : F ) -> SignalHandlerId {
292
+ unsafe {
293
+ let f: Box_ < Box_ < Fn ( & Self , & gdk:: EventSequence ) + ' static > > = Box_ :: new ( Box_ :: new ( f) ) ;
294
+ connect ( self . to_glib_none ( ) . 0 , "cancel" ,
295
+ transmute ( cancel_trampoline :: < Self > as usize ) , Box_ :: into_raw ( f) as * mut _ )
296
+ }
297
+ }
269
298
270
- //#[cfg(any(feature = "v3_14", feature = "dox"))]
271
- //fn connect_end<Unsupported or ignored types>(&self, f: F) -> SignalHandlerId {
272
- // Ignored sequence: Gdk.EventSequence
273
- //}
299
+ #[ cfg( any( feature = "v3_14" , feature = "dox" ) ) ]
300
+ fn connect_end < F : Fn ( & Self , & gdk:: EventSequence ) + ' static > ( & self , f : F ) -> SignalHandlerId {
301
+ unsafe {
302
+ let f: Box_ < Box_ < Fn ( & Self , & gdk:: EventSequence ) + ' static > > = Box_ :: new ( Box_ :: new ( f) ) ;
303
+ connect ( self . to_glib_none ( ) . 0 , "end" ,
304
+ transmute ( end_trampoline :: < Self > as usize ) , Box_ :: into_raw ( f) as * mut _ )
305
+ }
306
+ }
274
307
275
- //#[cfg(any(feature = "v3_14", feature = "dox"))]
276
- //fn connect_sequence_state_changed<Unsupported or ignored types>(&self, f: F) -> SignalHandlerId {
277
- // Ignored sequence: Gdk.EventSequence
278
- //}
308
+ #[ cfg( any( feature = "v3_14" , feature = "dox" ) ) ]
309
+ fn connect_sequence_state_changed < F : Fn ( & Self , & gdk:: EventSequence , EventSequenceState ) + ' static > ( & self , f : F ) -> SignalHandlerId {
310
+ unsafe {
311
+ let f: Box_ < Box_ < Fn ( & Self , & gdk:: EventSequence , EventSequenceState ) + ' static > > = Box_ :: new ( Box_ :: new ( f) ) ;
312
+ connect ( self . to_glib_none ( ) . 0 , "sequence-state-changed" ,
313
+ transmute ( sequence_state_changed_trampoline :: < Self > as usize ) , Box_ :: into_raw ( f) as * mut _ )
314
+ }
315
+ }
279
316
280
- //#[cfg(any(feature = "v3_14", feature = "dox"))]
281
- //fn connect_update<Unsupported or ignored types>(&self, f: F) -> SignalHandlerId {
282
- // Ignored sequence: Gdk.EventSequence
283
- //}
317
+ #[ cfg( any( feature = "v3_14" , feature = "dox" ) ) ]
318
+ fn connect_update < F : Fn ( & Self , & gdk:: EventSequence ) + ' static > ( & self , f : F ) -> SignalHandlerId {
319
+ unsafe {
320
+ let f: Box_ < Box_ < Fn ( & Self , & gdk:: EventSequence ) + ' static > > = Box_ :: new ( Box_ :: new ( f) ) ;
321
+ connect ( self . to_glib_none ( ) . 0 , "update" ,
322
+ transmute ( update_trampoline :: < Self > as usize ) , Box_ :: into_raw ( f) as * mut _ )
323
+ }
324
+ }
284
325
285
326
#[ cfg( any( feature = "v3_14" , feature = "dox" ) ) ]
286
327
fn connect_property_n_points_notify < F : Fn ( & Self ) + ' static > ( & self , f : F ) -> SignalHandlerId {
@@ -301,6 +342,41 @@ impl<O: IsA<Gesture> + IsA<glib::object::Object>> GestureExt for O {
301
342
}
302
343
}
303
344
345
+ #[ cfg( any( feature = "v3_14" , feature = "dox" ) ) ]
346
+ unsafe extern "C" fn begin_trampoline < P > ( this : * mut ffi:: GtkGesture , sequence : * mut gdk_ffi:: GdkEventSequence , f : glib_ffi:: gpointer )
347
+ where P : IsA < Gesture > {
348
+ let f: & & ( Fn ( & P , & gdk:: EventSequence ) + ' static ) = transmute ( f) ;
349
+ f ( & Gesture :: from_glib_borrow ( this) . downcast_unchecked ( ) , & from_glib_borrow ( sequence) )
350
+ }
351
+
352
+ #[ cfg( any( feature = "v3_14" , feature = "dox" ) ) ]
353
+ unsafe extern "C" fn cancel_trampoline < P > ( this : * mut ffi:: GtkGesture , sequence : * mut gdk_ffi:: GdkEventSequence , f : glib_ffi:: gpointer )
354
+ where P : IsA < Gesture > {
355
+ let f: & & ( Fn ( & P , & gdk:: EventSequence ) + ' static ) = transmute ( f) ;
356
+ f ( & Gesture :: from_glib_borrow ( this) . downcast_unchecked ( ) , & from_glib_borrow ( sequence) )
357
+ }
358
+
359
+ #[ cfg( any( feature = "v3_14" , feature = "dox" ) ) ]
360
+ unsafe extern "C" fn end_trampoline < P > ( this : * mut ffi:: GtkGesture , sequence : * mut gdk_ffi:: GdkEventSequence , f : glib_ffi:: gpointer )
361
+ where P : IsA < Gesture > {
362
+ let f: & & ( Fn ( & P , & gdk:: EventSequence ) + ' static ) = transmute ( f) ;
363
+ f ( & Gesture :: from_glib_borrow ( this) . downcast_unchecked ( ) , & from_glib_borrow ( sequence) )
364
+ }
365
+
366
+ #[ cfg( any( feature = "v3_14" , feature = "dox" ) ) ]
367
+ unsafe extern "C" fn sequence_state_changed_trampoline < P > ( this : * mut ffi:: GtkGesture , sequence : * mut gdk_ffi:: GdkEventSequence , state : ffi:: GtkEventSequenceState , f : glib_ffi:: gpointer )
368
+ where P : IsA < Gesture > {
369
+ let f: & & ( Fn ( & P , & gdk:: EventSequence , EventSequenceState ) + ' static ) = transmute ( f) ;
370
+ f ( & Gesture :: from_glib_borrow ( this) . downcast_unchecked ( ) , & from_glib_borrow ( sequence) , from_glib ( state) )
371
+ }
372
+
373
+ #[ cfg( any( feature = "v3_14" , feature = "dox" ) ) ]
374
+ unsafe extern "C" fn update_trampoline < P > ( this : * mut ffi:: GtkGesture , sequence : * mut gdk_ffi:: GdkEventSequence , f : glib_ffi:: gpointer )
375
+ where P : IsA < Gesture > {
376
+ let f: & & ( Fn ( & P , & gdk:: EventSequence ) + ' static ) = transmute ( f) ;
377
+ f ( & Gesture :: from_glib_borrow ( this) . downcast_unchecked ( ) , & from_glib_borrow ( sequence) )
378
+ }
379
+
304
380
#[ cfg( any( feature = "v3_14" , feature = "dox" ) ) ]
305
381
unsafe extern "C" fn notify_n_points_trampoline < P > ( this : * mut ffi:: GtkGesture , _param_spec : glib_ffi:: gpointer , f : glib_ffi:: gpointer )
306
382
where P : IsA < Gesture > {
0 commit comments