use dioxus_core::Template;
use torin::prelude::CursorPoint;
use uuid::Uuid;
use winit::window::{
CursorIcon,
Window,
};
use crate::prelude::PlatformEvent;
pub struct TextGroupMeasurement {
pub text_id: Uuid,
pub cursor_id: usize,
pub cursor_position: Option<CursorPoint>,
pub cursor_selection: Option<(CursorPoint, CursorPoint)>,
}
pub enum EventMessage {
UpdateTemplate(Template),
PollVDOM,
RequestRerender,
RemeasureTextGroup(TextGroupMeasurement),
SetCursorIcon(CursorIcon),
Accessibility(accesskit_winit::WindowEvent),
FocusAccessibilityNode(accesskit::NodeId),
QueueFocusAccessibilityNode(accesskit::NodeId),
FocusNextAccessibilityNode,
FocusPrevAccessibilityNode,
ExitApp,
WithWindow(Box<dyn FnOnce(&Window) + Send + Sync>),
PlatformEvent(PlatformEvent),
}
impl From<accesskit_winit::Event> for EventMessage {
fn from(value: accesskit_winit::Event) -> Self {
Self::Accessibility(value.window_event)
}
}