1 use gtk_sys;
2 
3 use glib::translate::*;
4 
5 use glib::subclass::prelude::*;
6 use glib::ObjectClass;
7 
8 use crate::DragResult;
9 use crate::Inhibit;
10 use crate::Orientation;
11 use crate::SelectionData;
12 use crate::TextDirection;
13 use cairo;
14 use cairo_sys;
15 use Widget;
16 use WidgetClass;
17 use WidgetExt;
18 
19 pub trait WidgetImpl: WidgetImplExt + ObjectImpl + 'static {
adjust_baseline_allocation(&self, widget: &Widget, baseline: &mut i32)20     fn adjust_baseline_allocation(&self, widget: &Widget, baseline: &mut i32) {
21         self.parent_adjust_baseline_allocation(widget, baseline)
22     }
23 
adjust_baseline_request( &self, widget: &Widget, minimum_baseline: &mut i32, natural_baseline: &mut i32, )24     fn adjust_baseline_request(
25         &self,
26         widget: &Widget,
27         minimum_baseline: &mut i32,
28         natural_baseline: &mut i32,
29     ) {
30         self.parent_adjust_baseline_request(widget, minimum_baseline, natural_baseline)
31     }
32 
adjust_size_allocation( &self, widget: &Widget, orientation: Orientation, minimum_size: &mut i32, natural_size: &mut i32, allocated_pos: &mut i32, allocated_size: &mut i32, )33     fn adjust_size_allocation(
34         &self,
35         widget: &Widget,
36         orientation: Orientation,
37         minimum_size: &mut i32,
38         natural_size: &mut i32,
39         allocated_pos: &mut i32,
40         allocated_size: &mut i32,
41     ) {
42         self.parent_adjust_size_allocation(
43             widget,
44             orientation,
45             minimum_size,
46             natural_size,
47             allocated_pos,
48             allocated_size,
49         )
50     }
51 
adjust_size_request( &self, widget: &Widget, orientation: Orientation, minimum_size: &mut i32, natural_size: &mut i32, )52     fn adjust_size_request(
53         &self,
54         widget: &Widget,
55         orientation: Orientation,
56         minimum_size: &mut i32,
57         natural_size: &mut i32,
58     ) {
59         self.parent_adjust_size_request(widget, orientation, minimum_size, natural_size)
60     }
61 
button_press_event(&self, widget: &Widget, event: &gdk::EventButton) -> Inhibit62     fn button_press_event(&self, widget: &Widget, event: &gdk::EventButton) -> Inhibit {
63         self.parent_button_press_event(widget, event)
64     }
65 
button_release_event(&self, widget: &Widget, event: &gdk::EventButton) -> Inhibit66     fn button_release_event(&self, widget: &Widget, event: &gdk::EventButton) -> Inhibit {
67         self.parent_button_release_event(widget, event)
68     }
69 
child_notify(&self, widget: &Widget, child_property: &glib::ParamSpec)70     fn child_notify(&self, widget: &Widget, child_property: &glib::ParamSpec) {
71         self.parent_child_notify(widget, child_property)
72     }
73 
composited_changed(&self, widget: &Widget)74     fn composited_changed(&self, widget: &Widget) {
75         self.parent_composited_changed(widget)
76     }
77 
compute_expand(&self, widget: &Widget, hexpand_p: &mut bool, vexpand_p: &mut bool)78     fn compute_expand(&self, widget: &Widget, hexpand_p: &mut bool, vexpand_p: &mut bool) {
79         self.parent_compute_expand(widget, hexpand_p, vexpand_p)
80     }
81 
configure_event(&self, widget: &Widget, event: &gdk::EventConfigure) -> Inhibit82     fn configure_event(&self, widget: &Widget, event: &gdk::EventConfigure) -> Inhibit {
83         self.parent_configure_event(widget, event)
84     }
85 
damage_event(&self, widget: &Widget, event: &gdk::EventExpose) -> Inhibit86     fn damage_event(&self, widget: &Widget, event: &gdk::EventExpose) -> Inhibit {
87         self.parent_damage_event(widget, event)
88     }
89 
delete_event(&self, widget: &Widget, event: &gdk::Event) -> Inhibit90     fn delete_event(&self, widget: &Widget, event: &gdk::Event) -> Inhibit {
91         self.parent_delete_event(widget, event)
92     }
93 
destroy(&self, widget: &Widget)94     fn destroy(&self, widget: &Widget) {
95         self.parent_destroy(widget)
96     }
97 
destroy_event(&self, widget: &Widget, event: &gdk::Event) -> Inhibit98     fn destroy_event(&self, widget: &Widget, event: &gdk::Event) -> Inhibit {
99         self.parent_destroy_event(widget, event)
100     }
101 
direction_changed(&self, widget: &Widget, previous_direction: TextDirection)102     fn direction_changed(&self, widget: &Widget, previous_direction: TextDirection) {
103         self.parent_direction_changed(widget, previous_direction)
104     }
105 
dispatch_child_properties_changed(&self, widget: &Widget, pspecs: &[glib::ParamSpec])106     fn dispatch_child_properties_changed(&self, widget: &Widget, pspecs: &[glib::ParamSpec]) {
107         self.parent_dispatch_child_properties_changed(widget, pspecs)
108     }
109 
drag_begin(&self, widget: &Widget, context: &gdk::DragContext)110     fn drag_begin(&self, widget: &Widget, context: &gdk::DragContext) {
111         self.parent_drag_begin(widget, context)
112     }
113 
drag_data_delete(&self, widget: &Widget, context: &gdk::DragContext)114     fn drag_data_delete(&self, widget: &Widget, context: &gdk::DragContext) {
115         self.parent_drag_data_delete(widget, context)
116     }
117 
drag_data_get( &self, widget: &Widget, context: &gdk::DragContext, selection_data: &SelectionData, info: u32, time: u32, )118     fn drag_data_get(
119         &self,
120         widget: &Widget,
121         context: &gdk::DragContext,
122         selection_data: &SelectionData,
123         info: u32,
124         time: u32,
125     ) {
126         self.parent_drag_data_get(widget, context, selection_data, info, time)
127     }
128 
drag_data_received( &self, widget: &Widget, context: &gdk::DragContext, x: i32, y: i32, selection_data: &SelectionData, info: u32, time: u32, )129     fn drag_data_received(
130         &self,
131         widget: &Widget,
132         context: &gdk::DragContext,
133         x: i32,
134         y: i32,
135         selection_data: &SelectionData,
136         info: u32,
137         time: u32,
138     ) {
139         self.parent_drag_data_received(widget, context, x, y, selection_data, info, time)
140     }
141 
drag_drop( &self, widget: &Widget, context: &gdk::DragContext, x: i32, y: i32, time: u32, ) -> Inhibit142     fn drag_drop(
143         &self,
144         widget: &Widget,
145         context: &gdk::DragContext,
146         x: i32,
147         y: i32,
148         time: u32,
149     ) -> Inhibit {
150         self.parent_drag_drop(widget, context, x, y, time)
151     }
152 
drag_end(&self, widget: &Widget, context: &gdk::DragContext)153     fn drag_end(&self, widget: &Widget, context: &gdk::DragContext) {
154         self.parent_drag_end(widget, context)
155     }
156 
drag_failed( &self, widget: &Widget, context: &gdk::DragContext, result: DragResult, ) -> Inhibit157     fn drag_failed(
158         &self,
159         widget: &Widget,
160         context: &gdk::DragContext,
161         result: DragResult,
162     ) -> Inhibit {
163         self.parent_drag_failed(widget, context, result)
164     }
165 
drag_leave(&self, widget: &Widget, context: &gdk::DragContext, time: u32)166     fn drag_leave(&self, widget: &Widget, context: &gdk::DragContext, time: u32) {
167         self.parent_drag_leave(widget, context, time)
168     }
169 
drag_motion( &self, widget: &Widget, context: &gdk::DragContext, x: i32, y: i32, time: u32, ) -> Inhibit170     fn drag_motion(
171         &self,
172         widget: &Widget,
173         context: &gdk::DragContext,
174         x: i32,
175         y: i32,
176         time: u32,
177     ) -> Inhibit {
178         self.parent_drag_motion(widget, context, x, y, time)
179     }
180 
draw(&self, widget: &Widget, cr: &cairo::Context) -> Inhibit181     fn draw(&self, widget: &Widget, cr: &cairo::Context) -> Inhibit {
182         self.parent_draw(widget, cr)
183     }
184 
185     // fn can_activate_accel(&self, widget: &Widget, signal_id: u32) -> bool {
186     //     self.parent_can_activate_accel(widget, signal_id)
187     // }
188 }
189 
190 pub trait WidgetImplExt {
parent_adjust_baseline_allocation(&self, widget: &Widget, baseline: &mut i32)191     fn parent_adjust_baseline_allocation(&self, widget: &Widget, baseline: &mut i32);
parent_adjust_baseline_request( &self, widget: &Widget, minimum_baseline: &mut i32, natural_baseline: &mut i32, )192     fn parent_adjust_baseline_request(
193         &self,
194         widget: &Widget,
195         minimum_baseline: &mut i32,
196         natural_baseline: &mut i32,
197     );
parent_adjust_size_allocation( &self, widget: &Widget, orientation: Orientation, minimum_size: &mut i32, natural_size: &mut i32, allocated_pos: &mut i32, allocated_size: &mut i32, )198     fn parent_adjust_size_allocation(
199         &self,
200         widget: &Widget,
201         orientation: Orientation,
202         minimum_size: &mut i32,
203         natural_size: &mut i32,
204         allocated_pos: &mut i32,
205         allocated_size: &mut i32,
206     );
parent_adjust_size_request( &self, widget: &Widget, orientation: Orientation, minimum_size: &mut i32, natural_size: &mut i32, )207     fn parent_adjust_size_request(
208         &self,
209         widget: &Widget,
210         orientation: Orientation,
211         minimum_size: &mut i32,
212         natural_size: &mut i32,
213     );
parent_button_press_event(&self, widget: &Widget, event: &gdk::EventButton) -> Inhibit214     fn parent_button_press_event(&self, widget: &Widget, event: &gdk::EventButton) -> Inhibit;
parent_button_release_event(&self, widget: &Widget, event: &gdk::EventButton) -> Inhibit215     fn parent_button_release_event(&self, widget: &Widget, event: &gdk::EventButton) -> Inhibit;
216     // fn parent_can_activate_accel(&self, widget: &Widget, signal_id: u32) -> bool;
parent_child_notify(&self, widget: &Widget, child_property: &glib::ParamSpec)217     fn parent_child_notify(&self, widget: &Widget, child_property: &glib::ParamSpec);
parent_composited_changed(&self, widget: &Widget)218     fn parent_composited_changed(&self, widget: &Widget);
parent_compute_expand(&self, widget: &Widget, hexpand_p: &mut bool, vexpand_p: &mut bool)219     fn parent_compute_expand(&self, widget: &Widget, hexpand_p: &mut bool, vexpand_p: &mut bool);
parent_configure_event(&self, widget: &Widget, event: &gdk::EventConfigure) -> Inhibit220     fn parent_configure_event(&self, widget: &Widget, event: &gdk::EventConfigure) -> Inhibit;
parent_damage_event(&self, widget: &Widget, event: &gdk::EventExpose) -> Inhibit221     fn parent_damage_event(&self, widget: &Widget, event: &gdk::EventExpose) -> Inhibit;
parent_delete_event(&self, widget: &Widget, event: &gdk::Event) -> Inhibit222     fn parent_delete_event(&self, widget: &Widget, event: &gdk::Event) -> Inhibit;
parent_destroy(&self, widget: &Widget)223     fn parent_destroy(&self, widget: &Widget);
parent_destroy_event(&self, widget: &Widget, event: &gdk::Event) -> Inhibit224     fn parent_destroy_event(&self, widget: &Widget, event: &gdk::Event) -> Inhibit;
parent_direction_changed(&self, widget: &Widget, previous_direction: TextDirection)225     fn parent_direction_changed(&self, widget: &Widget, previous_direction: TextDirection);
parent_dispatch_child_properties_changed(&self, widget: &Widget, pspecs: &[glib::ParamSpec])226     fn parent_dispatch_child_properties_changed(&self, widget: &Widget, pspecs: &[glib::ParamSpec]);
parent_drag_begin(&self, widget: &Widget, context: &gdk::DragContext)227     fn parent_drag_begin(&self, widget: &Widget, context: &gdk::DragContext);
parent_drag_data_delete(&self, widget: &Widget, context: &gdk::DragContext)228     fn parent_drag_data_delete(&self, widget: &Widget, context: &gdk::DragContext);
parent_drag_data_get( &self, widget: &Widget, context: &gdk::DragContext, selection_data: &SelectionData, info: u32, time: u32, )229     fn parent_drag_data_get(
230         &self,
231         widget: &Widget,
232         context: &gdk::DragContext,
233         selection_data: &SelectionData,
234         info: u32,
235         time: u32,
236     );
parent_drag_data_received( &self, widget: &Widget, context: &gdk::DragContext, x: i32, y: i32, selection_data: &SelectionData, info: u32, time: u32, )237     fn parent_drag_data_received(
238         &self,
239         widget: &Widget,
240         context: &gdk::DragContext,
241         x: i32,
242         y: i32,
243         selection_data: &SelectionData,
244         info: u32,
245         time: u32,
246     );
parent_drag_drop( &self, widget: &Widget, context: &gdk::DragContext, x: i32, y: i32, time: u32, ) -> Inhibit247     fn parent_drag_drop(
248         &self,
249         widget: &Widget,
250         context: &gdk::DragContext,
251         x: i32,
252         y: i32,
253         time: u32,
254     ) -> Inhibit;
parent_drag_end(&self, widget: &Widget, context: &gdk::DragContext)255     fn parent_drag_end(&self, widget: &Widget, context: &gdk::DragContext);
parent_drag_failed( &self, widget: &Widget, context: &gdk::DragContext, result: DragResult, ) -> Inhibit256     fn parent_drag_failed(
257         &self,
258         widget: &Widget,
259         context: &gdk::DragContext,
260         result: DragResult,
261     ) -> Inhibit;
parent_drag_leave(&self, widget: &Widget, context: &gdk::DragContext, time: u32)262     fn parent_drag_leave(&self, widget: &Widget, context: &gdk::DragContext, time: u32);
parent_drag_motion( &self, widget: &Widget, context: &gdk::DragContext, x: i32, y: i32, time: u32, ) -> Inhibit263     fn parent_drag_motion(
264         &self,
265         widget: &Widget,
266         context: &gdk::DragContext,
267         x: i32,
268         y: i32,
269         time: u32,
270     ) -> Inhibit;
parent_draw(&self, widget: &Widget, cr: &cairo::Context) -> Inhibit271     fn parent_draw(&self, widget: &Widget, cr: &cairo::Context) -> Inhibit;
272 }
273 
274 impl<T: WidgetImpl + ObjectImpl> WidgetImplExt for T {
parent_adjust_baseline_allocation(&self, widget: &Widget, baseline: &mut i32)275     fn parent_adjust_baseline_allocation(&self, widget: &Widget, baseline: &mut i32) {
276         unsafe {
277             let data = self.get_type_data();
278             let parent_class = data.as_ref().get_parent_class() as *mut gtk_sys::GtkWidgetClass;
279             let f = (*parent_class)
280                 .adjust_baseline_allocation
281                 .expect("No parent class impl for \"adjust_baseline_allocation\"");
282             f(widget.to_glib_none().0, baseline)
283         }
284     }
285 
parent_adjust_baseline_request( &self, widget: &Widget, minimum_baseline: &mut i32, natural_baseline: &mut i32, )286     fn parent_adjust_baseline_request(
287         &self,
288         widget: &Widget,
289         minimum_baseline: &mut i32,
290         natural_baseline: &mut i32,
291     ) {
292         unsafe {
293             let data = self.get_type_data();
294             let parent_class = data.as_ref().get_parent_class() as *mut gtk_sys::GtkWidgetClass;
295             let f = (*parent_class)
296                 .adjust_baseline_request
297                 .expect("No parent class impl for \"adjust_baseline_request\"");
298             f(widget.to_glib_none().0, minimum_baseline, natural_baseline)
299         }
300     }
301 
parent_adjust_size_allocation( &self, widget: &Widget, orientation: Orientation, minimum_size: &mut i32, natural_size: &mut i32, allocated_pos: &mut i32, allocated_size: &mut i32, )302     fn parent_adjust_size_allocation(
303         &self,
304         widget: &Widget,
305         orientation: Orientation,
306         minimum_size: &mut i32,
307         natural_size: &mut i32,
308         allocated_pos: &mut i32,
309         allocated_size: &mut i32,
310     ) {
311         unsafe {
312             let data = self.get_type_data();
313             let parent_class = data.as_ref().get_parent_class() as *mut gtk_sys::GtkWidgetClass;
314             let f = (*parent_class)
315                 .adjust_size_allocation
316                 .expect("No parent class impl for \"adjust_size_allocation\"");
317             f(
318                 widget.to_glib_none().0,
319                 orientation.to_glib(),
320                 minimum_size,
321                 natural_size,
322                 allocated_pos,
323                 allocated_size,
324             )
325         }
326     }
327 
parent_adjust_size_request( &self, widget: &Widget, orientation: Orientation, minimum_size: &mut i32, natural_size: &mut i32, )328     fn parent_adjust_size_request(
329         &self,
330         widget: &Widget,
331         orientation: Orientation,
332         minimum_size: &mut i32,
333         natural_size: &mut i32,
334     ) {
335         unsafe {
336             let data = self.get_type_data();
337             let parent_class = data.as_ref().get_parent_class() as *mut gtk_sys::GtkWidgetClass;
338             let f = (*parent_class)
339                 .adjust_size_request
340                 .expect("No parent class impl for \"adjust_size_request\"");
341             f(
342                 widget.to_glib_none().0,
343                 orientation.to_glib(),
344                 minimum_size as *mut i32,
345                 natural_size as *mut i32,
346             )
347         }
348     }
349 
parent_button_press_event(&self, widget: &Widget, event: &gdk::EventButton) -> Inhibit350     fn parent_button_press_event(&self, widget: &Widget, event: &gdk::EventButton) -> Inhibit {
351         unsafe {
352             let data = self.get_type_data();
353             let parent_class = data.as_ref().get_parent_class() as *mut gtk_sys::GtkWidgetClass;
354             if let Some(f) = (*parent_class).button_press_event {
355                 let ev_glib = glib::translate::mut_override(event.to_glib_none().0);
356                 Inhibit(from_glib(f(widget.to_glib_none().0, ev_glib)))
357             } else {
358                 Inhibit(false)
359             }
360         }
361     }
362 
parent_button_release_event(&self, widget: &Widget, event: &gdk::EventButton) -> Inhibit363     fn parent_button_release_event(&self, widget: &Widget, event: &gdk::EventButton) -> Inhibit {
364         unsafe {
365             let data = self.get_type_data();
366             let parent_class = data.as_ref().get_parent_class() as *mut gtk_sys::GtkWidgetClass;
367             if let Some(f) = (*parent_class).button_release_event {
368                 let ev_glib = glib::translate::mut_override(event.to_glib_none().0);
369                 Inhibit(from_glib(f(widget.to_glib_none().0, ev_glib)))
370             } else {
371                 Inhibit(false)
372             }
373         }
374     }
375 
376     // fn parent_can_activate_accel(&self, widget: &Widget, signal_id: u32) -> bool {
377     //     unsafe {
378     //         let data = self.get_type_data();
379     //         let parent_class =
380     //             data.as_ref().get_parent_class() as *mut gtk_sys::GtkWidgetClass;
381     //         let f = (*parent_class)
382     //             .can_activate_accel
383     //             .expect("No parent class impl for \"can_activate_accel\"");
384     //         f(widget.to_glib_none().0, signal_id) != 0
385     //     }
386     // }
387 
parent_child_notify(&self, widget: &Widget, child_property: &glib::ParamSpec)388     fn parent_child_notify(&self, widget: &Widget, child_property: &glib::ParamSpec) {
389         unsafe {
390             let data = self.get_type_data();
391             let parent_class = data.as_ref().get_parent_class() as *mut gtk_sys::GtkWidgetClass;
392             if let Some(f) = (*parent_class).child_notify {
393                 let pspec_glib = glib::translate::mut_override(child_property.to_glib_none().0);
394                 f(widget.to_glib_none().0, pspec_glib)
395             }
396         }
397     }
398 
parent_composited_changed(&self, widget: &Widget)399     fn parent_composited_changed(&self, widget: &Widget) {
400         unsafe {
401             let data = self.get_type_data();
402             let parent_class = data.as_ref().get_parent_class() as *mut gtk_sys::GtkWidgetClass;
403             if let Some(f) = (*parent_class).composited_changed {
404                 f(widget.to_glib_none().0)
405             }
406         }
407     }
408 
parent_compute_expand(&self, widget: &Widget, hexpand_p: &mut bool, vexpand_p: &mut bool)409     fn parent_compute_expand(&self, widget: &Widget, hexpand_p: &mut bool, vexpand_p: &mut bool) {
410         unsafe {
411             let data = self.get_type_data();
412             let parent_class = data.as_ref().get_parent_class() as *mut gtk_sys::GtkWidgetClass;
413             if let Some(f) = (*parent_class).compute_expand {
414                 let mut h: i32 = hexpand_p.to_glib();
415                 let mut v: i32 = vexpand_p.to_glib();
416                 f(widget.to_glib_none().0, &mut h, &mut v);
417                 *hexpand_p = from_glib(h);
418                 *vexpand_p = from_glib(v);
419             } else {
420                 // Fill the booleans so the compiler will be happy
421                 // and do nothing else since the vmenthod is NULL
422                 *hexpand_p = widget.get_hexpand();
423                 *vexpand_p = widget.get_vexpand();
424             }
425         }
426     }
427 
parent_configure_event(&self, widget: &Widget, event: &gdk::EventConfigure) -> Inhibit428     fn parent_configure_event(&self, widget: &Widget, event: &gdk::EventConfigure) -> Inhibit {
429         unsafe {
430             let data = self.get_type_data();
431             let parent_class = data.as_ref().get_parent_class() as *mut gtk_sys::GtkWidgetClass;
432             if let Some(f) = (*parent_class).configure_event {
433                 let ev_glib = glib::translate::mut_override(event.to_glib_none().0);
434                 Inhibit(from_glib(f(widget.to_glib_none().0, ev_glib)))
435             } else {
436                 Inhibit(false)
437             }
438         }
439     }
440 
parent_damage_event(&self, widget: &Widget, event: &gdk::EventExpose) -> Inhibit441     fn parent_damage_event(&self, widget: &Widget, event: &gdk::EventExpose) -> Inhibit {
442         unsafe {
443             let data = self.get_type_data();
444             let parent_class = data.as_ref().get_parent_class() as *mut gtk_sys::GtkWidgetClass;
445             if let Some(f) = (*parent_class).damage_event {
446                 let ev_glib = glib::translate::mut_override(event.to_glib_none().0);
447                 Inhibit(from_glib(f(widget.to_glib_none().0, ev_glib)))
448             } else {
449                 Inhibit(false)
450             }
451         }
452     }
453 
parent_delete_event(&self, widget: &Widget, event: &gdk::Event) -> Inhibit454     fn parent_delete_event(&self, widget: &Widget, event: &gdk::Event) -> Inhibit {
455         unsafe {
456             let data = self.get_type_data();
457             let parent_class = data.as_ref().get_parent_class() as *mut gtk_sys::GtkWidgetClass;
458             if let Some(f) = (*parent_class).delete_event {
459                 let ev_glib = glib::translate::mut_override(event.to_glib_none().0);
460                 Inhibit(from_glib(f(widget.to_glib_none().0, ev_glib)))
461             } else {
462                 Inhibit(false)
463             }
464         }
465     }
466 
parent_destroy(&self, widget: &Widget)467     fn parent_destroy(&self, widget: &Widget) {
468         unsafe {
469             let data = self.get_type_data();
470             let parent_class = data.as_ref().get_parent_class() as *mut gtk_sys::GtkWidgetClass;
471             if let Some(f) = (*parent_class).destroy {
472                 f(widget.to_glib_none().0)
473             }
474         }
475     }
476 
parent_destroy_event(&self, widget: &Widget, event: &gdk::Event) -> Inhibit477     fn parent_destroy_event(&self, widget: &Widget, event: &gdk::Event) -> Inhibit {
478         unsafe {
479             let data = self.get_type_data();
480             let parent_class = data.as_ref().get_parent_class() as *mut gtk_sys::GtkWidgetClass;
481             if let Some(f) = (*parent_class).destroy_event {
482                 let ev_glib = glib::translate::mut_override(event.to_glib_none().0);
483                 Inhibit(from_glib(f(widget.to_glib_none().0, ev_glib)))
484             } else {
485                 Inhibit(false)
486             }
487         }
488     }
489 
parent_direction_changed(&self, widget: &Widget, previous_direction: TextDirection)490     fn parent_direction_changed(&self, widget: &Widget, previous_direction: TextDirection) {
491         unsafe {
492             let data = self.get_type_data();
493             let parent_class = data.as_ref().get_parent_class() as *mut gtk_sys::GtkWidgetClass;
494             if let Some(f) = (*parent_class).direction_changed {
495                 f(widget.to_glib_none().0, previous_direction.to_glib())
496             }
497         }
498     }
499 
parent_dispatch_child_properties_changed( &self, widget: &Widget, pspecs: &[glib::ParamSpec], )500     fn parent_dispatch_child_properties_changed(
501         &self,
502         widget: &Widget,
503         pspecs: &[glib::ParamSpec],
504     ) {
505         unsafe {
506             let data = self.get_type_data();
507             let parent_class = data.as_ref().get_parent_class() as *mut gtk_sys::GtkWidgetClass;
508             if let Some(f) = (*parent_class).dispatch_child_properties_changed {
509                 let pspecs_ptr = pspecs
510                     .iter()
511                     .map(|p| p.to_glib_none().0)
512                     .collect::<Vec<_>>()
513                     .as_mut_ptr();
514                 f(widget.to_glib_none().0, pspecs.len() as u32, pspecs_ptr)
515             }
516         }
517     }
518 
parent_drag_begin(&self, widget: &Widget, context: &gdk::DragContext)519     fn parent_drag_begin(&self, widget: &Widget, context: &gdk::DragContext) {
520         unsafe {
521             let data = self.get_type_data();
522             let parent_class = data.as_ref().get_parent_class() as *mut gtk_sys::GtkWidgetClass;
523             if let Some(f) = (*parent_class).drag_begin {
524                 f(widget.to_glib_none().0, context.to_glib_none().0)
525             }
526         }
527     }
528 
parent_drag_data_delete(&self, widget: &Widget, context: &gdk::DragContext)529     fn parent_drag_data_delete(&self, widget: &Widget, context: &gdk::DragContext) {
530         unsafe {
531             let data = self.get_type_data();
532             let parent_class = data.as_ref().get_parent_class() as *mut gtk_sys::GtkWidgetClass;
533             if let Some(f) = (*parent_class).drag_data_delete {
534                 f(widget.to_glib_none().0, context.to_glib_none().0)
535             }
536         }
537     }
538 
parent_drag_data_get( &self, widget: &Widget, context: &gdk::DragContext, selection_data: &SelectionData, info: u32, time: u32, )539     fn parent_drag_data_get(
540         &self,
541         widget: &Widget,
542         context: &gdk::DragContext,
543         selection_data: &SelectionData,
544         info: u32,
545         time: u32,
546     ) {
547         unsafe {
548             let data = self.get_type_data();
549             let parent_class = data.as_ref().get_parent_class() as *mut gtk_sys::GtkWidgetClass;
550             if let Some(f) = (*parent_class).drag_data_get {
551                 let selection_mut = glib::translate::mut_override(selection_data.to_glib_none().0);
552                 f(
553                     widget.to_glib_none().0,
554                     context.to_glib_none().0,
555                     selection_mut,
556                     info,
557                     time,
558                 )
559             }
560         }
561     }
562 
parent_drag_data_received( &self, widget: &Widget, context: &gdk::DragContext, x: i32, y: i32, selection_data: &SelectionData, info: u32, time: u32, )563     fn parent_drag_data_received(
564         &self,
565         widget: &Widget,
566         context: &gdk::DragContext,
567         x: i32,
568         y: i32,
569         selection_data: &SelectionData,
570         info: u32,
571         time: u32,
572     ) {
573         unsafe {
574             let data = self.get_type_data();
575             let parent_class = data.as_ref().get_parent_class() as *mut gtk_sys::GtkWidgetClass;
576             if let Some(f) = (*parent_class).drag_data_received {
577                 let selection_mut = glib::translate::mut_override(selection_data.to_glib_none().0);
578                 f(
579                     widget.to_glib_none().0,
580                     context.to_glib_none().0,
581                     x,
582                     y,
583                     selection_mut,
584                     info,
585                     time,
586                 )
587             }
588         }
589     }
590 
parent_drag_drop( &self, widget: &Widget, context: &gdk::DragContext, x: i32, y: i32, time: u32, ) -> Inhibit591     fn parent_drag_drop(
592         &self,
593         widget: &Widget,
594         context: &gdk::DragContext,
595         x: i32,
596         y: i32,
597         time: u32,
598     ) -> Inhibit {
599         unsafe {
600             let data = self.get_type_data();
601             let parent_class = data.as_ref().get_parent_class() as *mut gtk_sys::GtkWidgetClass;
602             if let Some(f) = (*parent_class).drag_drop {
603                 Inhibit(from_glib(f(
604                     widget.to_glib_none().0,
605                     context.to_glib_none().0,
606                     x,
607                     y,
608                     time,
609                 )))
610             } else {
611                 Inhibit(false)
612             }
613         }
614     }
615 
parent_drag_end(&self, widget: &Widget, context: &gdk::DragContext)616     fn parent_drag_end(&self, widget: &Widget, context: &gdk::DragContext) {
617         unsafe {
618             let data = self.get_type_data();
619             let parent_class = data.as_ref().get_parent_class() as *mut gtk_sys::GtkWidgetClass;
620             if let Some(f) = (*parent_class).drag_end {
621                 f(widget.to_glib_none().0, context.to_glib_none().0)
622             }
623         }
624     }
625 
parent_drag_failed( &self, widget: &Widget, context: &gdk::DragContext, result: DragResult, ) -> Inhibit626     fn parent_drag_failed(
627         &self,
628         widget: &Widget,
629         context: &gdk::DragContext,
630         result: DragResult,
631     ) -> Inhibit {
632         unsafe {
633             let data = self.get_type_data();
634             let parent_class = data.as_ref().get_parent_class() as *mut gtk_sys::GtkWidgetClass;
635             if let Some(f) = (*parent_class).drag_failed {
636                 Inhibit(from_glib(f(
637                     widget.to_glib_none().0,
638                     context.to_glib_none().0,
639                     result.to_glib(),
640                 )))
641             } else {
642                 Inhibit(false)
643             }
644         }
645     }
646 
parent_drag_leave(&self, widget: &Widget, context: &gdk::DragContext, time: u32)647     fn parent_drag_leave(&self, widget: &Widget, context: &gdk::DragContext, time: u32) {
648         unsafe {
649             let data = self.get_type_data();
650             let parent_class = data.as_ref().get_parent_class() as *mut gtk_sys::GtkWidgetClass;
651             if let Some(f) = (*parent_class).drag_leave {
652                 f(widget.to_glib_none().0, context.to_glib_none().0, time)
653             }
654         }
655     }
656 
parent_drag_motion( &self, widget: &Widget, context: &gdk::DragContext, x: i32, y: i32, time: u32, ) -> Inhibit657     fn parent_drag_motion(
658         &self,
659         widget: &Widget,
660         context: &gdk::DragContext,
661         x: i32,
662         y: i32,
663         time: u32,
664     ) -> Inhibit {
665         unsafe {
666             let data = self.get_type_data();
667             let parent_class = data.as_ref().get_parent_class() as *mut gtk_sys::GtkWidgetClass;
668             if let Some(f) = (*parent_class).drag_motion {
669                 Inhibit(from_glib(f(
670                     widget.to_glib_none().0,
671                     context.to_glib_none().0,
672                     x,
673                     y,
674                     time,
675                 )))
676             } else {
677                 Inhibit(false)
678             }
679         }
680     }
681 
parent_draw(&self, widget: &Widget, cr: &cairo::Context) -> Inhibit682     fn parent_draw(&self, widget: &Widget, cr: &cairo::Context) -> Inhibit {
683         unsafe {
684             let data = self.get_type_data();
685             let parent_class = data.as_ref().get_parent_class() as *mut gtk_sys::GtkWidgetClass;
686             if let Some(f) = (*parent_class).draw {
687                 Inhibit(from_glib(f(widget.to_glib_none().0, cr.to_glib_none().0)))
688             } else {
689                 Inhibit(false)
690             }
691         }
692     }
693 }
694 
695 unsafe impl<T: ObjectSubclass + WidgetImpl> IsSubclassable<T> for WidgetClass {
override_vfuncs(&mut self)696     fn override_vfuncs(&mut self) {
697         <ObjectClass as IsSubclassable<T>>::override_vfuncs(self);
698         unsafe {
699             let klass = &mut *(self as *mut Self as *mut gtk_sys::GtkWidgetClass);
700             klass.adjust_baseline_allocation = Some(widget_adjust_baseline_allocation::<T>);
701             klass.adjust_baseline_request = Some(widget_adjust_baseline_request::<T>);
702             klass.adjust_size_allocation = Some(widget_adjust_size_allocation::<T>);
703             klass.adjust_size_request = Some(widget_adjust_size_request::<T>);
704             klass.button_press_event = Some(widget_button_press_event::<T>);
705             klass.button_release_event = Some(widget_button_release_event::<T>);
706             // klass.can_activate_accel = Some(widget_can_activate_accel::<T>);
707             klass.child_notify = Some(widget_child_notify::<T>);
708             klass.composited_changed = Some(widget_composited_changed::<T>);
709             klass.compute_expand = Some(widget_compute_expand::<T>);
710             klass.configure_event = Some(widget_configure_event::<T>);
711             klass.damage_event = Some(widget_damage_event::<T>);
712             klass.delete_event = Some(widget_delete_event::<T>);
713             klass.destroy = Some(widget_destroy::<T>);
714             klass.destroy_event = Some(widget_destroy_event::<T>);
715             klass.direction_changed = Some(widget_direction_changed::<T>);
716             klass.dispatch_child_properties_changed =
717                 Some(widget_dispatch_child_properties_changed::<T>);
718             klass.drag_begin = Some(widget_drag_begin::<T>);
719             klass.drag_data_delete = Some(widget_drag_data_delete::<T>);
720             klass.drag_data_get = Some(widget_drag_data_get::<T>);
721             klass.drag_data_received = Some(widget_drag_data_received::<T>);
722             klass.drag_drop = Some(widget_drag_drop::<T>);
723             klass.drag_end = Some(widget_drag_end::<T>);
724             klass.drag_failed = Some(widget_drag_failed::<T>);
725             klass.drag_leave = Some(widget_drag_leave::<T>);
726             klass.drag_motion = Some(widget_drag_motion::<T>);
727             klass.draw = Some(widget_draw::<T>);
728         }
729     }
730 }
731 
widget_adjust_baseline_allocation<T: ObjectSubclass>( ptr: *mut gtk_sys::GtkWidget, baseptr: *mut i32, ) where T: WidgetImpl,732 unsafe extern "C" fn widget_adjust_baseline_allocation<T: ObjectSubclass>(
733     ptr: *mut gtk_sys::GtkWidget,
734     baseptr: *mut i32,
735 ) where
736     T: WidgetImpl,
737 {
738     let instance = &*(ptr as *mut T::Instance);
739     let imp = instance.get_impl();
740     let wrap: Widget = from_glib_borrow(ptr);
741 
742     imp.adjust_baseline_allocation(&wrap, &mut *baseptr)
743 }
744 
widget_adjust_baseline_request<T: ObjectSubclass>( ptr: *mut gtk_sys::GtkWidget, minptr: *mut i32, natptr: *mut i32, ) where T: WidgetImpl,745 unsafe extern "C" fn widget_adjust_baseline_request<T: ObjectSubclass>(
746     ptr: *mut gtk_sys::GtkWidget,
747     minptr: *mut i32,
748     natptr: *mut i32,
749 ) where
750     T: WidgetImpl,
751 {
752     let instance = &*(ptr as *mut T::Instance);
753     let imp = instance.get_impl();
754     let wrap: Widget = from_glib_borrow(ptr);
755 
756     imp.adjust_baseline_request(&wrap, &mut *minptr, &mut *natptr)
757 }
758 
widget_adjust_size_allocation<T: ObjectSubclass>( ptr: *mut gtk_sys::GtkWidget, orientation: gtk_sys::GtkOrientation, minptr: *mut i32, natptr: *mut i32, posptr: *mut i32, sizeptr: *mut i32, ) where T: WidgetImpl,759 unsafe extern "C" fn widget_adjust_size_allocation<T: ObjectSubclass>(
760     ptr: *mut gtk_sys::GtkWidget,
761     orientation: gtk_sys::GtkOrientation,
762     minptr: *mut i32,
763     natptr: *mut i32,
764     posptr: *mut i32,
765     sizeptr: *mut i32,
766 ) where
767     T: WidgetImpl,
768 {
769     let instance = &*(ptr as *mut T::Instance);
770     let imp = instance.get_impl();
771     let wrap: Widget = from_glib_borrow(ptr);
772     let wrap_orientation: Orientation = from_glib(orientation);
773 
774     imp.adjust_size_allocation(
775         &wrap,
776         wrap_orientation,
777         &mut *minptr,
778         &mut *natptr,
779         &mut *posptr,
780         &mut *sizeptr,
781     )
782 }
783 
widget_adjust_size_request<T: ObjectSubclass>( ptr: *mut gtk_sys::GtkWidget, orientation: gtk_sys::GtkOrientation, minptr: *mut i32, natptr: *mut i32, ) where T: WidgetImpl,784 unsafe extern "C" fn widget_adjust_size_request<T: ObjectSubclass>(
785     ptr: *mut gtk_sys::GtkWidget,
786     orientation: gtk_sys::GtkOrientation,
787     minptr: *mut i32,
788     natptr: *mut i32,
789 ) where
790     T: WidgetImpl,
791 {
792     let instance = &*(ptr as *mut T::Instance);
793     let imp = instance.get_impl();
794     let wrap: Widget = from_glib_borrow(ptr);
795     let wrap_orientation: Orientation = from_glib(orientation);
796 
797     imp.adjust_size_request(&wrap, wrap_orientation, &mut *minptr, &mut *natptr)
798 }
799 
widget_button_press_event<T: ObjectSubclass>( ptr: *mut gtk_sys::GtkWidget, btnptr: *mut gdk_sys::GdkEventButton, ) -> glib_sys::gboolean where T: WidgetImpl,800 unsafe extern "C" fn widget_button_press_event<T: ObjectSubclass>(
801     ptr: *mut gtk_sys::GtkWidget,
802     btnptr: *mut gdk_sys::GdkEventButton,
803 ) -> glib_sys::gboolean
804 where
805     T: WidgetImpl,
806 {
807     let instance = &*(ptr as *mut T::Instance);
808     let imp = instance.get_impl();
809     let wrap: Widget = from_glib_borrow(ptr);
810     let evwrap: gdk::EventButton = from_glib_borrow(btnptr);
811 
812     imp.button_press_event(&wrap, &evwrap).to_glib()
813 }
814 
widget_button_release_event<T: ObjectSubclass>( ptr: *mut gtk_sys::GtkWidget, btnptr: *mut gdk_sys::GdkEventButton, ) -> glib_sys::gboolean where T: WidgetImpl,815 unsafe extern "C" fn widget_button_release_event<T: ObjectSubclass>(
816     ptr: *mut gtk_sys::GtkWidget,
817     btnptr: *mut gdk_sys::GdkEventButton,
818 ) -> glib_sys::gboolean
819 where
820     T: WidgetImpl,
821 {
822     let instance = &*(ptr as *mut T::Instance);
823     let imp = instance.get_impl();
824     let wrap: Widget = from_glib_borrow(ptr);
825     let evwrap: gdk::EventButton = from_glib_borrow(btnptr);
826 
827     imp.button_release_event(&wrap, &evwrap).to_glib()
828 }
829 
830 // unsafe extern "C" fn widget_can_activate_accel<T: ObjectSubclass>(
831 //     ptr: *mut gtk_sys::GtkWidget,
832 //     signal_id: u32,
833 // ) -> glib_sys::gboolean
834 //     where T: WidgetImpl
835 // {
836 //     let instance = &*(ptr as *mut T::Instance);
837 //     let imp = instance.get_impl();
838 //     let wrap: Widget = from_glib_borrow(ptr);
839 
840 //     imp.can_activate_accel(&wrap, signal_id) as glib_sys::gboolean
841 // }
842 
widget_child_notify<T: ObjectSubclass>( ptr: *mut gtk_sys::GtkWidget, paramptr: *mut gobject_sys::GParamSpec, ) where T: WidgetImpl,843 unsafe extern "C" fn widget_child_notify<T: ObjectSubclass>(
844     ptr: *mut gtk_sys::GtkWidget,
845     paramptr: *mut gobject_sys::GParamSpec,
846 ) where
847     T: WidgetImpl,
848 {
849     let instance = &*(ptr as *mut T::Instance);
850     let imp = instance.get_impl();
851     let wrap: Widget = from_glib_borrow(ptr);
852     let paramwrap: glib::ParamSpec = from_glib_borrow(paramptr);
853 
854     imp.child_notify(&wrap, &paramwrap)
855 }
856 
widget_composited_changed<T: ObjectSubclass>(ptr: *mut gtk_sys::GtkWidget) where T: WidgetImpl,857 unsafe extern "C" fn widget_composited_changed<T: ObjectSubclass>(ptr: *mut gtk_sys::GtkWidget)
858 where
859     T: WidgetImpl,
860 {
861     let instance = &*(ptr as *mut T::Instance);
862     let imp = instance.get_impl();
863     let wrap: Widget = from_glib_borrow(ptr);
864 
865     imp.composited_changed(&wrap)
866 }
867 
widget_compute_expand<T: ObjectSubclass>( ptr: *mut gtk_sys::GtkWidget, hexpand_ptr: *mut glib_sys::gboolean, vexpand_ptr: *mut glib_sys::gboolean, ) where T: WidgetImpl,868 unsafe extern "C" fn widget_compute_expand<T: ObjectSubclass>(
869     ptr: *mut gtk_sys::GtkWidget,
870     hexpand_ptr: *mut glib_sys::gboolean,
871     vexpand_ptr: *mut glib_sys::gboolean,
872 ) where
873     T: WidgetImpl,
874 {
875     let instance = &*(ptr as *mut T::Instance);
876     let imp = instance.get_impl();
877     let wrap: Widget = from_glib_borrow(ptr);
878     let mut hexpand_p: bool = from_glib(*hexpand_ptr);
879     let mut vexpand_p: bool = from_glib(*vexpand_ptr);
880 
881     imp.compute_expand(&wrap, &mut hexpand_p, &mut vexpand_p);
882     *hexpand_ptr = hexpand_p.to_glib();
883     *vexpand_ptr = vexpand_p.to_glib();
884 }
885 
widget_configure_event<T: ObjectSubclass>( ptr: *mut gtk_sys::GtkWidget, confptr: *mut gdk_sys::GdkEventConfigure, ) -> glib_sys::gboolean where T: WidgetImpl,886 unsafe extern "C" fn widget_configure_event<T: ObjectSubclass>(
887     ptr: *mut gtk_sys::GtkWidget,
888     confptr: *mut gdk_sys::GdkEventConfigure,
889 ) -> glib_sys::gboolean
890 where
891     T: WidgetImpl,
892 {
893     let instance = &*(ptr as *mut T::Instance);
894     let imp = instance.get_impl();
895     let wrap: Widget = from_glib_borrow(ptr);
896     let evwrap: gdk::EventConfigure = from_glib_borrow(confptr);
897 
898     imp.configure_event(&wrap, &evwrap).to_glib()
899 }
900 
widget_damage_event<T: ObjectSubclass>( ptr: *mut gtk_sys::GtkWidget, exposeptr: *mut gdk_sys::GdkEventExpose, ) -> glib_sys::gboolean where T: WidgetImpl,901 unsafe extern "C" fn widget_damage_event<T: ObjectSubclass>(
902     ptr: *mut gtk_sys::GtkWidget,
903     exposeptr: *mut gdk_sys::GdkEventExpose,
904 ) -> glib_sys::gboolean
905 where
906     T: WidgetImpl,
907 {
908     let instance = &*(ptr as *mut T::Instance);
909     let imp = instance.get_impl();
910     let wrap: Widget = from_glib_borrow(ptr);
911     let evwrap: gdk::EventExpose = from_glib_borrow(exposeptr);
912 
913     imp.damage_event(&wrap, &evwrap).to_glib()
914 }
915 
widget_delete_event<T: ObjectSubclass>( ptr: *mut gtk_sys::GtkWidget, anyptr: *mut gdk_sys::GdkEventAny, ) -> glib_sys::gboolean where T: WidgetImpl,916 unsafe extern "C" fn widget_delete_event<T: ObjectSubclass>(
917     ptr: *mut gtk_sys::GtkWidget,
918     anyptr: *mut gdk_sys::GdkEventAny,
919 ) -> glib_sys::gboolean
920 where
921     T: WidgetImpl,
922 {
923     let instance = &*(ptr as *mut T::Instance);
924     let imp = instance.get_impl();
925     let wrap: Widget = from_glib_borrow(ptr);
926     let evwrap: gdk::Event = from_glib_borrow(anyptr);
927 
928     imp.delete_event(&wrap, &evwrap).to_glib()
929 }
930 
widget_destroy<T: ObjectSubclass>(ptr: *mut gtk_sys::GtkWidget) where T: WidgetImpl,931 unsafe extern "C" fn widget_destroy<T: ObjectSubclass>(ptr: *mut gtk_sys::GtkWidget)
932 where
933     T: WidgetImpl,
934 {
935     let instance = &*(ptr as *mut T::Instance);
936     let imp = instance.get_impl();
937     let wrap: Widget = from_glib_borrow(ptr);
938 
939     imp.destroy(&wrap)
940 }
941 
widget_destroy_event<T: ObjectSubclass>( ptr: *mut gtk_sys::GtkWidget, anyptr: *mut gdk_sys::GdkEventAny, ) -> glib_sys::gboolean where T: WidgetImpl,942 unsafe extern "C" fn widget_destroy_event<T: ObjectSubclass>(
943     ptr: *mut gtk_sys::GtkWidget,
944     anyptr: *mut gdk_sys::GdkEventAny,
945 ) -> glib_sys::gboolean
946 where
947     T: WidgetImpl,
948 {
949     let instance = &*(ptr as *mut T::Instance);
950     let imp = instance.get_impl();
951     let wrap: Widget = from_glib_borrow(ptr);
952     let evwrap: gdk::Event = from_glib_borrow(anyptr);
953 
954     imp.destroy_event(&wrap, &evwrap).to_glib()
955 }
956 
widget_direction_changed<T: ObjectSubclass>( ptr: *mut gtk_sys::GtkWidget, directnptr: gtk_sys::GtkTextDirection, ) where T: WidgetImpl,957 unsafe extern "C" fn widget_direction_changed<T: ObjectSubclass>(
958     ptr: *mut gtk_sys::GtkWidget,
959     directnptr: gtk_sys::GtkTextDirection,
960 ) where
961     T: WidgetImpl,
962 {
963     let instance = &*(ptr as *mut T::Instance);
964     let imp = instance.get_impl();
965     let wrap: Widget = from_glib_borrow(ptr);
966     let dirwrap: TextDirection = from_glib(directnptr);
967 
968     imp.direction_changed(&wrap, dirwrap)
969 }
970 
widget_dispatch_child_properties_changed<T: ObjectSubclass>( ptr: *mut gtk_sys::GtkWidget, n_pspec_ptr: u32, pspecsptr: *mut *mut gobject_sys::GParamSpec, ) where T: WidgetImpl,971 unsafe extern "C" fn widget_dispatch_child_properties_changed<T: ObjectSubclass>(
972     ptr: *mut gtk_sys::GtkWidget,
973     n_pspec_ptr: u32,
974     pspecsptr: *mut *mut gobject_sys::GParamSpec,
975 ) where
976     T: WidgetImpl,
977 {
978     let instance = &*(ptr as *mut T::Instance);
979     let imp = instance.get_impl();
980     let wrap: Widget = from_glib_borrow(ptr);
981     let pspecs: Vec<glib::ParamSpec> =
982         FromGlibContainer::from_glib_none_num(pspecsptr, n_pspec_ptr as usize);
983 
984     imp.dispatch_child_properties_changed(&wrap, &pspecs)
985 }
986 
widget_drag_begin<T: ObjectSubclass>( ptr: *mut gtk_sys::GtkWidget, ctxptr: *mut gdk_sys::GdkDragContext, ) where T: WidgetImpl,987 unsafe extern "C" fn widget_drag_begin<T: ObjectSubclass>(
988     ptr: *mut gtk_sys::GtkWidget,
989     ctxptr: *mut gdk_sys::GdkDragContext,
990 ) where
991     T: WidgetImpl,
992 {
993     let instance = &*(ptr as *mut T::Instance);
994     let imp = instance.get_impl();
995     let wrap: Widget = from_glib_borrow(ptr);
996     let context: gdk::DragContext = from_glib_borrow(ctxptr);
997 
998     imp.drag_begin(&wrap, &context)
999 }
1000 
widget_drag_data_delete<T: ObjectSubclass>( ptr: *mut gtk_sys::GtkWidget, ctxptr: *mut gdk_sys::GdkDragContext, ) where T: WidgetImpl,1001 unsafe extern "C" fn widget_drag_data_delete<T: ObjectSubclass>(
1002     ptr: *mut gtk_sys::GtkWidget,
1003     ctxptr: *mut gdk_sys::GdkDragContext,
1004 ) where
1005     T: WidgetImpl,
1006 {
1007     let instance = &*(ptr as *mut T::Instance);
1008     let imp = instance.get_impl();
1009     let wrap: Widget = from_glib_borrow(ptr);
1010     let context: gdk::DragContext = from_glib_borrow(ctxptr);
1011 
1012     imp.drag_data_delete(&wrap, &context)
1013 }
1014 
widget_drag_data_get<T: ObjectSubclass>( ptr: *mut gtk_sys::GtkWidget, ctxptr: *mut gdk_sys::GdkDragContext, selectptr: *mut gtk_sys::GtkSelectionData, info: u32, time: u32, ) where T: WidgetImpl,1015 unsafe extern "C" fn widget_drag_data_get<T: ObjectSubclass>(
1016     ptr: *mut gtk_sys::GtkWidget,
1017     ctxptr: *mut gdk_sys::GdkDragContext,
1018     selectptr: *mut gtk_sys::GtkSelectionData,
1019     info: u32,
1020     time: u32,
1021 ) where
1022     T: WidgetImpl,
1023 {
1024     let instance = &*(ptr as *mut T::Instance);
1025     let imp = instance.get_impl();
1026     let wrap: Widget = from_glib_borrow(ptr);
1027     let context: gdk::DragContext = from_glib_borrow(ctxptr);
1028     let selection_data: SelectionData = from_glib_borrow(selectptr);
1029 
1030     imp.drag_data_get(&wrap, &context, &selection_data, info, time)
1031 }
1032 
widget_drag_data_received<T: ObjectSubclass>( ptr: *mut gtk_sys::GtkWidget, ctxptr: *mut gdk_sys::GdkDragContext, x: i32, y: i32, selectptr: *mut gtk_sys::GtkSelectionData, info: u32, time: u32, ) where T: WidgetImpl,1033 unsafe extern "C" fn widget_drag_data_received<T: ObjectSubclass>(
1034     ptr: *mut gtk_sys::GtkWidget,
1035     ctxptr: *mut gdk_sys::GdkDragContext,
1036     x: i32,
1037     y: i32,
1038     selectptr: *mut gtk_sys::GtkSelectionData,
1039     info: u32,
1040     time: u32,
1041 ) where
1042     T: WidgetImpl,
1043 {
1044     let instance = &*(ptr as *mut T::Instance);
1045     let imp = instance.get_impl();
1046     let wrap: Widget = from_glib_borrow(ptr);
1047     let context: gdk::DragContext = from_glib_borrow(ctxptr);
1048     let selection_data: SelectionData = from_glib_borrow(selectptr);
1049 
1050     imp.drag_data_received(&wrap, &context, x, y, &selection_data, info, time)
1051 }
1052 
widget_drag_drop<T: ObjectSubclass>( ptr: *mut gtk_sys::GtkWidget, ctxptr: *mut gdk_sys::GdkDragContext, x: i32, y: i32, time: u32, ) -> glib_sys::gboolean where T: WidgetImpl,1053 unsafe extern "C" fn widget_drag_drop<T: ObjectSubclass>(
1054     ptr: *mut gtk_sys::GtkWidget,
1055     ctxptr: *mut gdk_sys::GdkDragContext,
1056     x: i32,
1057     y: i32,
1058     time: u32,
1059 ) -> glib_sys::gboolean
1060 where
1061     T: WidgetImpl,
1062 {
1063     let instance = &*(ptr as *mut T::Instance);
1064     let imp = instance.get_impl();
1065     let wrap: Widget = from_glib_borrow(ptr);
1066     let context: gdk::DragContext = from_glib_borrow(ctxptr);
1067 
1068     imp.drag_drop(&wrap, &context, x, y, time).to_glib()
1069 }
1070 
widget_drag_end<T: ObjectSubclass>( ptr: *mut gtk_sys::GtkWidget, ctxptr: *mut gdk_sys::GdkDragContext, ) where T: WidgetImpl,1071 unsafe extern "C" fn widget_drag_end<T: ObjectSubclass>(
1072     ptr: *mut gtk_sys::GtkWidget,
1073     ctxptr: *mut gdk_sys::GdkDragContext,
1074 ) where
1075     T: WidgetImpl,
1076 {
1077     let instance = &*(ptr as *mut T::Instance);
1078     let imp = instance.get_impl();
1079     let wrap: Widget = from_glib_borrow(ptr);
1080     let context: gdk::DragContext = from_glib_borrow(ctxptr);
1081 
1082     imp.drag_end(&wrap, &context)
1083 }
1084 
widget_drag_failed<T: ObjectSubclass>( ptr: *mut gtk_sys::GtkWidget, ctxptr: *mut gdk_sys::GdkDragContext, resultptr: gtk_sys::GtkDragResult, ) -> glib_sys::gboolean where T: WidgetImpl,1085 unsafe extern "C" fn widget_drag_failed<T: ObjectSubclass>(
1086     ptr: *mut gtk_sys::GtkWidget,
1087     ctxptr: *mut gdk_sys::GdkDragContext,
1088     resultptr: gtk_sys::GtkDragResult,
1089 ) -> glib_sys::gboolean
1090 where
1091     T: WidgetImpl,
1092 {
1093     let instance = &*(ptr as *mut T::Instance);
1094     let imp = instance.get_impl();
1095     let wrap: Widget = from_glib_borrow(ptr);
1096     let context: gdk::DragContext = from_glib_borrow(ctxptr);
1097     let result: DragResult = from_glib(resultptr);
1098 
1099     imp.drag_failed(&wrap, &context, result).to_glib()
1100 }
1101 
widget_drag_leave<T: ObjectSubclass>( ptr: *mut gtk_sys::GtkWidget, ctxptr: *mut gdk_sys::GdkDragContext, time: u32, ) where T: WidgetImpl,1102 unsafe extern "C" fn widget_drag_leave<T: ObjectSubclass>(
1103     ptr: *mut gtk_sys::GtkWidget,
1104     ctxptr: *mut gdk_sys::GdkDragContext,
1105     time: u32,
1106 ) where
1107     T: WidgetImpl,
1108 {
1109     let instance = &*(ptr as *mut T::Instance);
1110     let imp = instance.get_impl();
1111     let wrap: Widget = from_glib_borrow(ptr);
1112     let context: gdk::DragContext = from_glib_borrow(ctxptr);
1113 
1114     imp.drag_leave(&wrap, &context, time)
1115 }
1116 
widget_drag_motion<T: ObjectSubclass>( ptr: *mut gtk_sys::GtkWidget, ctxptr: *mut gdk_sys::GdkDragContext, x: i32, y: i32, time: u32, ) -> glib_sys::gboolean where T: WidgetImpl,1117 unsafe extern "C" fn widget_drag_motion<T: ObjectSubclass>(
1118     ptr: *mut gtk_sys::GtkWidget,
1119     ctxptr: *mut gdk_sys::GdkDragContext,
1120     x: i32,
1121     y: i32,
1122     time: u32,
1123 ) -> glib_sys::gboolean
1124 where
1125     T: WidgetImpl,
1126 {
1127     let instance = &*(ptr as *mut T::Instance);
1128     let imp = instance.get_impl();
1129     let wrap: Widget = from_glib_borrow(ptr);
1130     let context: gdk::DragContext = from_glib_borrow(ctxptr);
1131 
1132     imp.drag_motion(&wrap, &context, x, y, time).to_glib()
1133 }
1134 
widget_draw<T: ObjectSubclass>( ptr: *mut gtk_sys::GtkWidget, cr_ptr: *mut cairo_sys::cairo_t, ) -> glib_sys::gboolean where T: WidgetImpl,1135 unsafe extern "C" fn widget_draw<T: ObjectSubclass>(
1136     ptr: *mut gtk_sys::GtkWidget,
1137     cr_ptr: *mut cairo_sys::cairo_t,
1138 ) -> glib_sys::gboolean
1139 where
1140     T: WidgetImpl,
1141 {
1142     let instance = &*(ptr as *mut T::Instance);
1143     let imp = instance.get_impl();
1144     let wrap: Widget = from_glib_borrow(ptr);
1145     let cr: cairo::Context = from_glib_borrow(cr_ptr);
1146 
1147     imp.draw(&wrap, &cr).to_glib()
1148 }
1149