ferroui_base/input/raw/
raw_drag_event.rs1use super::raw_input_event_args::raw_input_event_args;
2use super::{IDragDropDevice, RawDragEventType, RawInputEventArgs};
3use crate::input::{DragDropEffects, IDataTransfer, IInputRoot, KeyModifiers, RawInputModifiers};
4use crate::Point;
5use std::cell::Cell;
6use std::rc::Rc;
7
8pub struct RawDragEvent {
13 base: RawInputEventArgs,
14 location: Cell<Point>,
15 data_transfer: Rc<dyn IDataTransfer>,
16 effects: Cell<DragDropEffects>,
17 type_: RawDragEventType,
18 key_modifiers: KeyModifiers,
19}
20
21raw_input_event_args!(RawDragEvent: RawInputEventArgs);
22
23impl RawDragEvent {
24 pub fn new(
26 input_device: Rc<dyn IDragDropDevice>,
27 type_: RawDragEventType,
28 root: Rc<dyn IInputRoot>,
29 location: Point,
30 data_transfer: Rc<dyn IDataTransfer>,
31 effects: DragDropEffects,
32 modifiers: RawInputModifiers,
33 ) -> Self {
34 Self {
35 base: RawInputEventArgs::new(input_device, 0, root),
36 location: Cell::new(location),
37 data_transfer,
38 effects: Cell::new(effects),
39 type_,
40 key_modifiers: modifiers.to_key_modifiers(),
41 }
42 }
43
44 #[inline]
46 pub fn location(&self) -> Point {
47 self.location.get()
48 }
49
50 #[inline]
52 pub fn set_location(&self, value: Point) {
53 self.location.set(value)
54 }
55
56 #[inline]
58 pub fn data_transfer(&self) -> &Rc<dyn IDataTransfer> {
59 &self.data_transfer
60 }
61
62 #[inline]
65 pub fn effects(&self) -> DragDropEffects {
66 self.effects.get()
67 }
68
69 #[inline]
71 pub fn set_effects(&self, value: DragDropEffects) {
72 self.effects.set(value)
73 }
74
75 #[inline]
77 pub fn type_(&self) -> RawDragEventType {
78 self.type_
79 }
80
81 #[inline]
83 pub fn key_modifiers(&self) -> KeyModifiers {
84 self.key_modifiers
85 }
86}