animate/legacy/
drag_action.rs

1use crate::{Action, Actor, ActorMeta, DragAxis, InternalRect, ModifierType};
2use glib::{
3    object as gobject,
4    object::{Cast, IsA},
5    signal::{connect_raw, SignalHandlerId},
6    translate::*,
7    StaticType, Value,
8};
9use std::boxed::Box as Box_;
10use std::{fmt, mem, mem::transmute};
11
12glib_wrapper! {
13    pub struct DragAction(Object<ffi::ClutterDragAction, ffi::ClutterDragActionClass, DragActionClass>) @extends Action, ActorMeta, gobject::InitiallyUnowned;
14
15    match fn {
16        get_type => || ffi::clutter_drag_action_get_type(),
17    }
18}
19
20impl DragAction {
21    /// Creates a new `DragAction` instance
22    ///
23    /// # Returns
24    ///
25    /// the newly created `DragAction`
26    pub fn new() -> DragAction {
27        unsafe { Action::from_glib_none(ffi::clutter_drag_action_new()).unsafe_cast() }
28    }
29}
30
31impl Default for DragAction {
32    fn default() -> Self {
33        Self::new()
34    }
35}
36
37/// Trait containing all `DragAction` methods.
38///
39/// # Implementors
40///
41/// [`DragAction`](struct.DragAction.html)
42pub trait DragActionExt: 'static {
43    /// Retrieves the "drag area" associated with `self`, that
44    /// is a `Rect` that constrains the actor movements,
45    /// in parents coordinates.
46    /// ## `drag_area`
47    /// a `Rect` to be filled
48    ///
49    /// # Returns
50    ///
51    /// `true` if the actor is actually constrained (and thus
52    ///  `drag_area` is valid), `false` otherwise
53    fn get_drag_area(&self) -> Option<InternalRect>;
54
55    /// Retrieves the axis constraint set by `DragActionExt::set_drag_axis`
56    ///
57    /// # Returns
58    ///
59    /// the axis constraint
60    fn get_drag_axis(&self) -> DragAxis;
61
62    /// Retrieves the drag handle set by `DragActionExt::set_drag_handle`
63    ///
64    /// # Returns
65    ///
66    /// a `Actor`, used as the drag
67    ///  handle, or `None` if none was set
68    fn get_drag_handle(&self) -> Option<Actor>;
69
70    /// Retrieves the values set by `DragActionExt::set_drag_threshold`.
71    ///
72    /// If the `DragAction:x-drag-threshold` property or the
73    /// `DragAction:y-drag-threshold` property have been set to -1 then
74    /// this function will return the default drag threshold value as stored
75    /// by the `Settings:dnd-drag-threshold` property of `Settings`.
76    /// ## `x_threshold`
77    /// return location for the horizontal drag
78    ///  threshold value, in pixels
79    /// ## `y_threshold`
80    /// return location for the vertical drag
81    ///  threshold value, in pixels
82    fn get_drag_threshold(&self) -> (u32, u32);
83
84    /// Retrieves the coordinates, in stage space, of the latest motion
85    /// event during the dragging
86    /// ## `motion_x`
87    /// return location for the latest motion
88    ///  event's X coordinate
89    /// ## `motion_y`
90    /// return location for the latest motion
91    ///  event's Y coordinate
92    fn get_motion_coords(&self) -> (f32, f32);
93
94    /// Retrieves the coordinates, in stage space, of the press event
95    /// that started the dragging
96    /// ## `press_x`
97    /// return location for the press event's X coordinate
98    /// ## `press_y`
99    /// return location for the press event's Y coordinate
100    fn get_press_coords(&self) -> (f32, f32);
101
102    /// Sets `drag_area` to constrain the dragging of the actor associated
103    /// with `self`, so that it position is always within `drag_area`, expressed
104    /// in parent's coordinates.
105    /// If `drag_area` is `None`, the actor is not constrained.
106    /// ## `drag_area`
107    /// a `Rect`
108    fn set_drag_area(&self, drag_area: Option<&InternalRect>);
109
110    /// Restricts the dragging action to a specific axis
111    /// ## `axis`
112    /// the axis to constraint the dragging to
113    fn set_drag_axis(&self, axis: DragAxis);
114
115    /// Sets the actor to be used as the drag handle.
116    /// ## `handle`
117    /// a `Actor`, or `None` to unset
118    fn set_drag_handle<P: IsA<Actor>>(&self, handle: Option<&P>);
119
120    /// Sets the horizontal and vertical drag thresholds that must be
121    /// cleared by the pointer before `self` can begin the dragging.
122    ///
123    /// If `x_threshold` or `y_threshold` are set to -1 then the default
124    /// drag threshold stored in the `Settings:dnd-drag-threshold`
125    /// property of `Settings` will be used.
126    /// ## `x_threshold`
127    /// a distance on the horizontal axis, in pixels, or
128    ///  -1 to use the default drag threshold from `Settings`
129    /// ## `y_threshold`
130    /// a distance on the vertical axis, in pixels, or
131    ///  -1 to use the default drag threshold from `Settings`
132    fn set_drag_threshold(&self, x_threshold: i32, y_threshold: i32);
133
134    /// Whether the `DragAction:drag-area` property has been set.
135    fn get_property_drag_area_set(&self) -> bool;
136
137    /// The horizontal threshold, in pixels, that the cursor must travel
138    /// in order to begin a drag action.
139    ///
140    /// When set to a positive value, `DragAction` will only emit
141    /// `DragAction::drag-begin` if the pointer has moved
142    /// horizontally at least of the given amount of pixels since
143    /// the button press event.
144    ///
145    /// When set to -1, `DragAction` will use the default threshold
146    /// stored in the `Settings:dnd-drag-threshold` property of
147    /// `Settings`.
148    ///
149    /// When read, this property will always return a valid drag
150    /// threshold, either as set or the default one.
151    fn get_property_x_drag_threshold(&self) -> i32;
152
153    /// The horizontal threshold, in pixels, that the cursor must travel
154    /// in order to begin a drag action.
155    ///
156    /// When set to a positive value, `DragAction` will only emit
157    /// `DragAction::drag-begin` if the pointer has moved
158    /// horizontally at least of the given amount of pixels since
159    /// the button press event.
160    ///
161    /// When set to -1, `DragAction` will use the default threshold
162    /// stored in the `Settings:dnd-drag-threshold` property of
163    /// `Settings`.
164    ///
165    /// When read, this property will always return a valid drag
166    /// threshold, either as set or the default one.
167    fn set_property_x_drag_threshold(&self, x_drag_threshold: i32);
168
169    /// The vertical threshold, in pixels, that the cursor must travel
170    /// in order to begin a drag action.
171    ///
172    /// When set to a positive value, `DragAction` will only emit
173    /// `DragAction::drag-begin` if the pointer has moved
174    /// vertically at least of the given amount of pixels since
175    /// the button press event.
176    ///
177    /// When set to -1, `DragAction` will use the value stored
178    /// in the `Settings:dnd-drag-threshold` property of
179    /// `Settings`.
180    ///
181    /// When read, this property will always return a valid drag
182    /// threshold, either as set or the default one.
183    fn get_property_y_drag_threshold(&self) -> i32;
184
185    /// The vertical threshold, in pixels, that the cursor must travel
186    /// in order to begin a drag action.
187    ///
188    /// When set to a positive value, `DragAction` will only emit
189    /// `DragAction::drag-begin` if the pointer has moved
190    /// vertically at least of the given amount of pixels since
191    /// the button press event.
192    ///
193    /// When set to -1, `DragAction` will use the value stored
194    /// in the `Settings:dnd-drag-threshold` property of
195    /// `Settings`.
196    ///
197    /// When read, this property will always return a valid drag
198    /// threshold, either as set or the default one.
199    fn set_property_y_drag_threshold(&self, y_drag_threshold: i32);
200
201    /// The ::drag-begin signal is emitted when the `DragAction`
202    /// starts the dragging
203    ///
204    /// The emission of this signal can be delayed by using the
205    /// `DragAction:x-drag-threshold` and
206    /// `DragAction:y-drag-threshold` properties
207    /// ## `actor`
208    /// the `Actor` attached to the action
209    /// ## `event_x`
210    /// the X coordinate (in stage space) of the press event
211    /// ## `event_y`
212    /// the Y coordinate (in stage space) of the press event
213    /// ## `modifiers`
214    /// the modifiers of the press event
215    fn connect_drag_begin<F: Fn(&Self, &Actor, f32, f32, ModifierType) + 'static>(
216        &self,
217        f: F,
218    ) -> SignalHandlerId;
219
220    /// The ::drag-end signal is emitted at the end of the dragging,
221    /// when the pointer button's is released
222    ///
223    /// This signal is emitted if and only if the `DragAction::drag-begin`
224    /// signal has been emitted first
225    /// ## `actor`
226    /// the `Actor` attached to the action
227    /// ## `event_x`
228    /// the X coordinate (in stage space) of the release event
229    /// ## `event_y`
230    /// the Y coordinate (in stage space) of the release event
231    /// ## `modifiers`
232    /// the modifiers of the release event
233    fn connect_drag_end<F: Fn(&Self, &Actor, f32, f32, ModifierType) + 'static>(
234        &self,
235        f: F,
236    ) -> SignalHandlerId;
237
238    /// The ::drag-motion signal is emitted for each motion event after
239    /// the `DragAction::drag-begin` signal has been emitted.
240    ///
241    /// The components of the distance between the press event and the
242    /// latest motion event are computed in the actor's coordinate space,
243    /// to take into account eventual transformations. If you want the
244    /// stage coordinates of the latest motion event you can use
245    /// `DragActionExt::get_motion_coords`.
246    ///
247    /// The default handler of the signal will call `ActorExt::move_by`
248    /// either on `actor` or, if set, of `DragAction:drag-handle` using
249    /// the `delta_x` and `delta_y` components of the dragging motion. If you
250    /// want to override the default behaviour, you can connect to the
251    /// `DragAction::drag-progress` signal and return `false` from the
252    /// handler.
253    /// ## `actor`
254    /// the `Actor` attached to the action
255    /// ## `delta_x`
256    /// the X component of the distance between the press event
257    ///  that began the dragging and the current position of the pointer,
258    ///  as of the latest motion event
259    /// ## `delta_y`
260    /// the Y component of the distance between the press event
261    ///  that began the dragging and the current position of the pointer,
262    ///  as of the latest motion event
263    fn connect_drag_motion<F: Fn(&Self, &Actor, f32, f32) + 'static>(
264        &self,
265        f: F,
266    ) -> SignalHandlerId;
267
268    /// The ::drag-progress signal is emitted for each motion event after
269    /// the `DragAction::drag-begin` signal has been emitted.
270    ///
271    /// The components of the distance between the press event and the
272    /// latest motion event are computed in the actor's coordinate space,
273    /// to take into account eventual transformations. If you want the
274    /// stage coordinates of the latest motion event you can use
275    /// `DragActionExt::get_motion_coords`.
276    ///
277    /// The default handler will emit `DragAction::drag-motion`,
278    /// if `DragAction::drag-progress` emission returns `true`.
279    /// ## `actor`
280    /// the `Actor` attached to the action
281    /// ## `delta_x`
282    /// the X component of the distance between the press event
283    ///  that began the dragging and the current position of the pointer,
284    ///  as of the latest motion event
285    /// ## `delta_y`
286    /// the Y component of the distance between the press event
287    ///  that began the dragging and the current position of the pointer,
288    ///  as of the latest motion event
289    ///
290    /// # Returns
291    ///
292    /// `true` if the drag should continue, and `false`
293    ///  if it should be stopped.
294    fn connect_drag_progress<F: Fn(&Self, &Actor, f32, f32) -> bool + 'static>(
295        &self,
296        f: F,
297    ) -> SignalHandlerId;
298
299    fn connect_property_drag_area_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
300
301    fn connect_property_drag_area_set_notify<F: Fn(&Self) + 'static>(
302        &self,
303        f: F,
304    ) -> SignalHandlerId;
305
306    fn connect_property_drag_axis_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
307
308    fn connect_property_drag_handle_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
309
310    fn connect_property_x_drag_threshold_notify<F: Fn(&Self) + 'static>(
311        &self,
312        f: F,
313    ) -> SignalHandlerId;
314
315    fn connect_property_y_drag_threshold_notify<F: Fn(&Self) + 'static>(
316        &self,
317        f: F,
318    ) -> SignalHandlerId;
319}
320
321impl<O: IsA<DragAction>> DragActionExt for O {
322    fn get_drag_area(&self) -> Option<InternalRect> {
323        unsafe {
324            let mut drag_area = InternalRect::uninitialized();
325            let ret = from_glib(ffi::clutter_drag_action_get_drag_area(
326                self.as_ref().to_glib_none().0,
327                drag_area.to_glib_none_mut().0,
328            ));
329            if ret {
330                Some(drag_area)
331            } else {
332                None
333            }
334        }
335    }
336
337    fn get_drag_axis(&self) -> DragAxis {
338        unsafe {
339            from_glib(ffi::clutter_drag_action_get_drag_axis(
340                self.as_ref().to_glib_none().0,
341            ))
342        }
343    }
344
345    fn get_drag_handle(&self) -> Option<Actor> {
346        unsafe {
347            from_glib_none(ffi::clutter_drag_action_get_drag_handle(
348                self.as_ref().to_glib_none().0,
349            ))
350        }
351    }
352
353    fn get_drag_threshold(&self) -> (u32, u32) {
354        unsafe {
355            let mut x_threshold = mem::MaybeUninit::uninit();
356            let mut y_threshold = mem::MaybeUninit::uninit();
357            ffi::clutter_drag_action_get_drag_threshold(
358                self.as_ref().to_glib_none().0,
359                x_threshold.as_mut_ptr(),
360                y_threshold.as_mut_ptr(),
361            );
362            let x_threshold = x_threshold.assume_init();
363            let y_threshold = y_threshold.assume_init();
364            (x_threshold, y_threshold)
365        }
366    }
367
368    fn get_motion_coords(&self) -> (f32, f32) {
369        unsafe {
370            let mut motion_x = mem::MaybeUninit::uninit();
371            let mut motion_y = mem::MaybeUninit::uninit();
372            ffi::clutter_drag_action_get_motion_coords(
373                self.as_ref().to_glib_none().0,
374                motion_x.as_mut_ptr(),
375                motion_y.as_mut_ptr(),
376            );
377            let motion_x = motion_x.assume_init();
378            let motion_y = motion_y.assume_init();
379            (motion_x, motion_y)
380        }
381    }
382
383    fn get_press_coords(&self) -> (f32, f32) {
384        unsafe {
385            let mut press_x = mem::MaybeUninit::uninit();
386            let mut press_y = mem::MaybeUninit::uninit();
387            ffi::clutter_drag_action_get_press_coords(
388                self.as_ref().to_glib_none().0,
389                press_x.as_mut_ptr(),
390                press_y.as_mut_ptr(),
391            );
392            let press_x = press_x.assume_init();
393            let press_y = press_y.assume_init();
394            (press_x, press_y)
395        }
396    }
397
398    fn set_drag_area(&self, drag_area: Option<&InternalRect>) {
399        unsafe {
400            ffi::clutter_drag_action_set_drag_area(
401                self.as_ref().to_glib_none().0,
402                drag_area.to_glib_none().0,
403            );
404        }
405    }
406
407    fn set_drag_axis(&self, axis: DragAxis) {
408        unsafe {
409            ffi::clutter_drag_action_set_drag_axis(self.as_ref().to_glib_none().0, axis.to_glib());
410        }
411    }
412
413    fn set_drag_handle<P: IsA<Actor>>(&self, handle: Option<&P>) {
414        unsafe {
415            ffi::clutter_drag_action_set_drag_handle(
416                self.as_ref().to_glib_none().0,
417                handle.map(|p| p.as_ref()).to_glib_none().0,
418            );
419        }
420    }
421
422    fn set_drag_threshold(&self, x_threshold: i32, y_threshold: i32) {
423        unsafe {
424            ffi::clutter_drag_action_set_drag_threshold(
425                self.as_ref().to_glib_none().0,
426                x_threshold,
427                y_threshold,
428            );
429        }
430    }
431
432    fn get_property_drag_area_set(&self) -> bool {
433        unsafe {
434            let mut value = Value::from_type(<bool as StaticType>::static_type());
435            gobject_sys::g_object_get_property(
436                self.to_glib_none().0 as *mut gobject_sys::GObject,
437                b"drag-area-set\0".as_ptr() as *const _,
438                value.to_glib_none_mut().0,
439            );
440            value
441                .get()
442                .expect("Return Value for property `drag-area-set` getter")
443                .unwrap()
444        }
445    }
446
447    fn get_property_x_drag_threshold(&self) -> i32 {
448        unsafe {
449            let mut value = Value::from_type(<i32 as StaticType>::static_type());
450            gobject_sys::g_object_get_property(
451                self.to_glib_none().0 as *mut gobject_sys::GObject,
452                b"x-drag-threshold\0".as_ptr() as *const _,
453                value.to_glib_none_mut().0,
454            );
455            value
456                .get()
457                .expect("Return Value for property `x-drag-threshold` getter")
458                .unwrap()
459        }
460    }
461
462    fn set_property_x_drag_threshold(&self, x_drag_threshold: i32) {
463        unsafe {
464            gobject_sys::g_object_set_property(
465                self.to_glib_none().0 as *mut gobject_sys::GObject,
466                b"x-drag-threshold\0".as_ptr() as *const _,
467                Value::from(&x_drag_threshold).to_glib_none().0,
468            );
469        }
470    }
471
472    fn get_property_y_drag_threshold(&self) -> i32 {
473        unsafe {
474            let mut value = Value::from_type(<i32 as StaticType>::static_type());
475            gobject_sys::g_object_get_property(
476                self.to_glib_none().0 as *mut gobject_sys::GObject,
477                b"y-drag-threshold\0".as_ptr() as *const _,
478                value.to_glib_none_mut().0,
479            );
480            value
481                .get()
482                .expect("Return Value for property `y-drag-threshold` getter")
483                .unwrap()
484        }
485    }
486
487    fn set_property_y_drag_threshold(&self, y_drag_threshold: i32) {
488        unsafe {
489            gobject_sys::g_object_set_property(
490                self.to_glib_none().0 as *mut gobject_sys::GObject,
491                b"y-drag-threshold\0".as_ptr() as *const _,
492                Value::from(&y_drag_threshold).to_glib_none().0,
493            );
494        }
495    }
496
497    fn connect_drag_begin<F: Fn(&Self, &Actor, f32, f32, ModifierType) + 'static>(
498        &self,
499        f: F,
500    ) -> SignalHandlerId {
501        unsafe extern "C" fn drag_begin_trampoline<
502            P,
503            F: Fn(&P, &Actor, f32, f32, ModifierType) + 'static,
504        >(
505            this: *mut ffi::ClutterDragAction,
506            actor: *mut ffi::ClutterActor,
507            event_x: libc::c_float,
508            event_y: libc::c_float,
509            modifiers: ffi::ClutterModifierType,
510            f: glib_sys::gpointer,
511        ) where
512            P: IsA<DragAction>,
513        {
514            let f: &F = &*(f as *const F);
515            f(
516                &DragAction::from_glib_borrow(this).unsafe_cast_ref(),
517                &from_glib_borrow(actor),
518                event_x,
519                event_y,
520                from_glib(modifiers),
521            )
522        }
523        unsafe {
524            let f: Box_<F> = Box_::new(f);
525            connect_raw(
526                self.as_ptr() as *mut _,
527                b"drag-begin\0".as_ptr() as *const _,
528                Some(transmute::<_, unsafe extern "C" fn()>(
529                    drag_begin_trampoline::<Self, F> as *const (),
530                )),
531                Box_::into_raw(f),
532            )
533        }
534    }
535
536    fn connect_drag_end<F: Fn(&Self, &Actor, f32, f32, ModifierType) + 'static>(
537        &self,
538        f: F,
539    ) -> SignalHandlerId {
540        unsafe extern "C" fn drag_end_trampoline<
541            P,
542            F: Fn(&P, &Actor, f32, f32, ModifierType) + 'static,
543        >(
544            this: *mut ffi::ClutterDragAction,
545            actor: *mut ffi::ClutterActor,
546            event_x: libc::c_float,
547            event_y: libc::c_float,
548            modifiers: ffi::ClutterModifierType,
549            f: glib_sys::gpointer,
550        ) where
551            P: IsA<DragAction>,
552        {
553            let f: &F = &*(f as *const F);
554            f(
555                &DragAction::from_glib_borrow(this).unsafe_cast_ref(),
556                &from_glib_borrow(actor),
557                event_x,
558                event_y,
559                from_glib(modifiers),
560            )
561        }
562        unsafe {
563            let f: Box_<F> = Box_::new(f);
564            connect_raw(
565                self.as_ptr() as *mut _,
566                b"drag-end\0".as_ptr() as *const _,
567                Some(transmute::<_, unsafe extern "C" fn()>(
568                    drag_end_trampoline::<Self, F> as *const (),
569                )),
570                Box_::into_raw(f),
571            )
572        }
573    }
574
575    fn connect_drag_motion<F: Fn(&Self, &Actor, f32, f32) + 'static>(
576        &self,
577        f: F,
578    ) -> SignalHandlerId {
579        unsafe extern "C" fn drag_motion_trampoline<P, F: Fn(&P, &Actor, f32, f32) + 'static>(
580            this: *mut ffi::ClutterDragAction,
581            actor: *mut ffi::ClutterActor,
582            delta_x: libc::c_float,
583            delta_y: libc::c_float,
584            f: glib_sys::gpointer,
585        ) where
586            P: IsA<DragAction>,
587        {
588            let f: &F = &*(f as *const F);
589            f(
590                &DragAction::from_glib_borrow(this).unsafe_cast_ref(),
591                &from_glib_borrow(actor),
592                delta_x,
593                delta_y,
594            )
595        }
596        unsafe {
597            let f: Box_<F> = Box_::new(f);
598            connect_raw(
599                self.as_ptr() as *mut _,
600                b"drag-motion\0".as_ptr() as *const _,
601                Some(transmute::<_, unsafe extern "C" fn()>(
602                    drag_motion_trampoline::<Self, F> as *const (),
603                )),
604                Box_::into_raw(f),
605            )
606        }
607    }
608
609    fn connect_drag_progress<F: Fn(&Self, &Actor, f32, f32) -> bool + 'static>(
610        &self,
611        f: F,
612    ) -> SignalHandlerId {
613        unsafe extern "C" fn drag_progress_trampoline<
614            P,
615            F: Fn(&P, &Actor, f32, f32) -> bool + 'static,
616        >(
617            this: *mut ffi::ClutterDragAction,
618            actor: *mut ffi::ClutterActor,
619            delta_x: libc::c_float,
620            delta_y: libc::c_float,
621            f: glib_sys::gpointer,
622        ) -> glib_sys::gboolean
623        where
624            P: IsA<DragAction>,
625        {
626            let f: &F = &*(f as *const F);
627            f(
628                &DragAction::from_glib_borrow(this).unsafe_cast_ref(),
629                &from_glib_borrow(actor),
630                delta_x,
631                delta_y,
632            )
633            .to_glib()
634        }
635        unsafe {
636            let f: Box_<F> = Box_::new(f);
637            connect_raw(
638                self.as_ptr() as *mut _,
639                b"drag-progress\0".as_ptr() as *const _,
640                Some(transmute::<_, unsafe extern "C" fn()>(
641                    drag_progress_trampoline::<Self, F> as *const (),
642                )),
643                Box_::into_raw(f),
644            )
645        }
646    }
647
648    fn connect_property_drag_area_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
649        unsafe extern "C" fn notify_drag_area_trampoline<P, F: Fn(&P) + 'static>(
650            this: *mut ffi::ClutterDragAction,
651            _param_spec: glib_sys::gpointer,
652            f: glib_sys::gpointer,
653        ) where
654            P: IsA<DragAction>,
655        {
656            let f: &F = &*(f as *const F);
657            f(&DragAction::from_glib_borrow(this).unsafe_cast_ref())
658        }
659        unsafe {
660            let f: Box_<F> = Box_::new(f);
661            connect_raw(
662                self.as_ptr() as *mut _,
663                b"notify::drag-area\0".as_ptr() as *const _,
664                Some(transmute::<_, unsafe extern "C" fn()>(
665                    notify_drag_area_trampoline::<Self, F> as *const (),
666                )),
667                Box_::into_raw(f),
668            )
669        }
670    }
671
672    fn connect_property_drag_area_set_notify<F: Fn(&Self) + 'static>(
673        &self,
674        f: F,
675    ) -> SignalHandlerId {
676        unsafe extern "C" fn notify_drag_area_set_trampoline<P, F: Fn(&P) + 'static>(
677            this: *mut ffi::ClutterDragAction,
678            _param_spec: glib_sys::gpointer,
679            f: glib_sys::gpointer,
680        ) where
681            P: IsA<DragAction>,
682        {
683            let f: &F = &*(f as *const F);
684            f(&DragAction::from_glib_borrow(this).unsafe_cast_ref())
685        }
686        unsafe {
687            let f: Box_<F> = Box_::new(f);
688            connect_raw(
689                self.as_ptr() as *mut _,
690                b"notify::drag-area-set\0".as_ptr() as *const _,
691                Some(transmute::<_, unsafe extern "C" fn()>(
692                    notify_drag_area_set_trampoline::<Self, F> as *const (),
693                )),
694                Box_::into_raw(f),
695            )
696        }
697    }
698
699    fn connect_property_drag_axis_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
700        unsafe extern "C" fn notify_drag_axis_trampoline<P, F: Fn(&P) + 'static>(
701            this: *mut ffi::ClutterDragAction,
702            _param_spec: glib_sys::gpointer,
703            f: glib_sys::gpointer,
704        ) where
705            P: IsA<DragAction>,
706        {
707            let f: &F = &*(f as *const F);
708            f(&DragAction::from_glib_borrow(this).unsafe_cast_ref())
709        }
710        unsafe {
711            let f: Box_<F> = Box_::new(f);
712            connect_raw(
713                self.as_ptr() as *mut _,
714                b"notify::drag-axis\0".as_ptr() as *const _,
715                Some(transmute::<_, unsafe extern "C" fn()>(
716                    notify_drag_axis_trampoline::<Self, F> as *const (),
717                )),
718                Box_::into_raw(f),
719            )
720        }
721    }
722
723    fn connect_property_drag_handle_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
724        unsafe extern "C" fn notify_drag_handle_trampoline<P, F: Fn(&P) + 'static>(
725            this: *mut ffi::ClutterDragAction,
726            _param_spec: glib_sys::gpointer,
727            f: glib_sys::gpointer,
728        ) where
729            P: IsA<DragAction>,
730        {
731            let f: &F = &*(f as *const F);
732            f(&DragAction::from_glib_borrow(this).unsafe_cast_ref())
733        }
734        unsafe {
735            let f: Box_<F> = Box_::new(f);
736            connect_raw(
737                self.as_ptr() as *mut _,
738                b"notify::drag-handle\0".as_ptr() as *const _,
739                Some(transmute::<_, unsafe extern "C" fn()>(
740                    notify_drag_handle_trampoline::<Self, F> as *const (),
741                )),
742                Box_::into_raw(f),
743            )
744        }
745    }
746
747    fn connect_property_x_drag_threshold_notify<F: Fn(&Self) + 'static>(
748        &self,
749        f: F,
750    ) -> SignalHandlerId {
751        unsafe extern "C" fn notify_x_drag_threshold_trampoline<P, F: Fn(&P) + 'static>(
752            this: *mut ffi::ClutterDragAction,
753            _param_spec: glib_sys::gpointer,
754            f: glib_sys::gpointer,
755        ) where
756            P: IsA<DragAction>,
757        {
758            let f: &F = &*(f as *const F);
759            f(&DragAction::from_glib_borrow(this).unsafe_cast_ref())
760        }
761        unsafe {
762            let f: Box_<F> = Box_::new(f);
763            connect_raw(
764                self.as_ptr() as *mut _,
765                b"notify::x-drag-threshold\0".as_ptr() as *const _,
766                Some(transmute::<_, unsafe extern "C" fn()>(
767                    notify_x_drag_threshold_trampoline::<Self, F> as *const (),
768                )),
769                Box_::into_raw(f),
770            )
771        }
772    }
773
774    fn connect_property_y_drag_threshold_notify<F: Fn(&Self) + 'static>(
775        &self,
776        f: F,
777    ) -> SignalHandlerId {
778        unsafe extern "C" fn notify_y_drag_threshold_trampoline<P, F: Fn(&P) + 'static>(
779            this: *mut ffi::ClutterDragAction,
780            _param_spec: glib_sys::gpointer,
781            f: glib_sys::gpointer,
782        ) where
783            P: IsA<DragAction>,
784        {
785            let f: &F = &*(f as *const F);
786            f(&DragAction::from_glib_borrow(this).unsafe_cast_ref())
787        }
788        unsafe {
789            let f: Box_<F> = Box_::new(f);
790            connect_raw(
791                self.as_ptr() as *mut _,
792                b"notify::y-drag-threshold\0".as_ptr() as *const _,
793                Some(transmute::<_, unsafe extern "C" fn()>(
794                    notify_y_drag_threshold_trampoline::<Self, F> as *const (),
795                )),
796                Box_::into_raw(f),
797            )
798        }
799    }
800}
801
802impl fmt::Display for DragAction {
803    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
804        write!(f, "DragAction")
805    }
806}