Skip to main content

ferroui_base/input/
i_input_device.rs

1use super::raw::IRawInputEventArgs;
2use super::IPointerDevice;
3use std::any::Any;
4
5/// Represents an input device: the object that turns the raw input events
6/// of the platform into routed events.
7pub trait IInputDevice {
8    /// Processes raw event. Is called after preprocessing by the input
9    /// manager.
10    fn process_raw_event(&self, ev: &dyn IRawInputEventArgs);
11
12    /// The device as [`Any`], for downcasting to the concrete device.
13    fn as_any(&self) -> &dyn Any;
14
15    /// The device as a pointer device, if it is one.
16    fn as_pointer_device(&self) -> Option<&dyn IPointerDevice> {
17        None
18    }
19}