1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
use crate::atom::Atom;
use crate::Device;
use crate::DragAction;
use crate::DragContext;
use crate::DragProtocol;
use crate::Screen;
use crate::Window;
use glib::object::IsA;
use glib::translate::*;
use std::ptr;
impl DragContext {
#[doc(alias = "gdk_drag_get_selection")]
pub fn drag_get_selection(&self) -> Atom {
unsafe { from_glib_none(ffi::gdk_drag_get_selection(self.to_glib_none().0) as *mut _) }
}
#[doc(alias = "gdk_drag_abort")]
pub fn drag_abort(&self, time_: u32) {
unsafe { ffi::gdk_drag_abort(self.to_glib_none().0, time_) }
}
#[doc(alias = "gdk_drop_reply")]
pub fn drop_reply(&self, accepted: bool, time_: u32) {
unsafe { ffi::gdk_drop_reply(self.to_glib_none().0, accepted.into_glib(), time_) }
}
#[doc(alias = "gdk_drag_drop")]
pub fn drop(&self, time_: u32) {
unsafe { ffi::gdk_drag_drop(self.to_glib_none().0, time_) }
}
#[doc(alias = "gdk_drag_find_window_for_screen")]
pub fn drag_find_window_for_screen(
&self,
drag_window: &Window,
screen: &Screen,
x_root: i32,
y_root: i32,
) -> (Option<Window>, DragProtocol) {
unsafe {
let mut dest_window = ptr::null_mut();
let mut protocol = ffi::GDK_DRAG_PROTO_NONE;
ffi::gdk_drag_find_window_for_screen(
self.to_glib_none().0,
drag_window.to_glib_none().0,
screen.to_glib_none().0,
x_root,
y_root,
&mut dest_window,
&mut protocol,
);
(from_glib_full(dest_window), from_glib(protocol))
}
}
#[allow(clippy::too_many_arguments)]
#[doc(alias = "gdk_drag_motion")]
pub fn drag_motion(
&self,
dest_window: &Window,
protocol: DragProtocol,
x_root: i32,
y_root: i32,
suggested_action: DragAction,
possible_actions: DragAction,
time_: u32,
) -> bool {
unsafe {
from_glib(ffi::gdk_drag_motion(
self.to_glib_none().0,
dest_window.to_glib_none().0,
protocol.into_glib(),
x_root,
y_root,
suggested_action.into_glib(),
possible_actions.into_glib(),
time_,
))
}
}
#[doc(alias = "gdk_drop_finish")]
pub fn drop_finish(&self, success: bool, time_: u32) {
unsafe { ffi::gdk_drop_finish(self.to_glib_none().0, success.into_glib(), time_) }
}
#[doc(alias = "gdk_drag_status")]
pub fn drag_status(&self, action: DragAction, time_: u32) {
unsafe { ffi::gdk_drag_status(self.to_glib_none().0, action.into_glib(), time_) }
}
#[doc(alias = "gdk_drag_drop_succeeded")]
pub fn drag_drop_succeeded(&self) -> bool {
unsafe { from_glib(ffi::gdk_drag_drop_succeeded(self.to_glib_none().0)) }
}
#[doc(alias = "gdk_drag_begin")]
pub fn drag_begin(window: &Window, targets: &[Atom]) -> Option<DragContext> {
skip_assert_initialized!();
unsafe {
from_glib_full(ffi::gdk_drag_begin(
window.to_glib_none().0,
targets.to_glib_none().0,
))
}
}
#[doc(alias = "gdk_drag_begin_for_device")]
pub fn drag_begin_for_device<P: IsA<Device>>(
window: &Window,
device: &P,
targets: &[Atom],
) -> Option<DragContext> {
skip_assert_initialized!();
unsafe {
from_glib_full(ffi::gdk_drag_begin_for_device(
window.to_glib_none().0,
device.as_ref().to_glib_none().0,
targets.to_glib_none().0,
))
}
}
#[doc(alias = "gdk_drag_begin_from_point")]
pub fn drag_begin_from_point<P: IsA<Device>>(
window: &Window,
device: &P,
targets: &[Atom],
x_root: i32,
y_root: i32,
) -> Option<DragContext> {
skip_assert_initialized!();
unsafe {
from_glib_full(ffi::gdk_drag_begin_from_point(
window.to_glib_none().0,
device.as_ref().to_glib_none().0,
targets.to_glib_none().0,
x_root,
y_root,
))
}
}
#[doc(alias = "gdk_drag_drop_done")]
pub fn drag_drop_done(&self, success: bool) {
skip_assert_initialized!();
unsafe {
ffi::gdk_drag_drop_done(self.to_glib_none().0, success.into_glib());
}
}
}