use crate::foundation::Id;
use super::{InteractState, KeyCode, ModState, MouseButton};
#[derive(Debug, Clone)]
pub struct TextEditChangeEvent {
pub text: String,
pub display_text: String,
pub from_typing: bool,
}
#[derive(Debug, Clone)]
pub struct TextEditCommitEvent {
pub text: String,
pub display_text: String,
}
#[derive(Debug, Clone)]
pub struct SliderChangeEvent {
pub value: f32,
pub percent: f32,
}
#[derive(Debug, Clone)]
pub struct ScrollHandleVisibleEvent {
pub vertical: bool,
pub horizontal: bool,
}
#[derive(Debug, Clone)]
pub struct ProgressChangeEvent {
pub value: f32,
pub prev: f32,
}
#[derive(Debug, Clone)]
pub struct ListItemSelectEvent {
pub index: Option<usize>,
pub component: Option<Id>,
pub mouse_event: Option<MouseEvent>,
}
#[derive(Debug, Clone)]
pub struct ListItemEnterEvent {
pub index: Option<usize>,
pub component: Option<Id>,
pub mouse_event: Option<MouseEvent>,
}
#[derive(Debug, Clone)]
pub struct ListItemLeaveEvent {
pub index: Option<usize>,
pub component: Option<Id>,
pub mouse_event: Option<MouseEvent>,
}
#[derive(Debug, Clone)]
pub struct DropdownSelectEvent {
pub index: Option<usize>,
pub component: Id,
pub mouse_event: MouseEvent,
}
#[derive(Debug, Clone)]
pub struct ScaleChangeEvent {
pub value: f32,
pub prev: f32,
}
#[derive(Debug, Clone)]
pub struct WidgetRenameEvent {
pub name: String,
pub prev: String,
}
#[derive(Debug, Clone)]
pub struct WidgetClipEvent {
pub clipped: bool,
pub x: f32,
pub y: f32,
pub w: f32,
pub h: f32,
}
#[derive(Debug, Clone)]
pub struct MouseEvent {
pub timestamp: f32,
pub state: InteractState,
pub button: MouseButton,
pub x: i32,
pub y: i32,
pub xrel: i32,
pub yrel: i32,
pub bubble: bool,
}
#[derive(Debug, Clone)]
pub struct KeyEvent {
pub timestamp: f32,
pub state: InteractState,
pub keycode: i32,
pub key: KeyCode,
pub mod_: ModState,
pub bubble: bool,
}
#[derive(Debug, Clone)]
pub struct TextEvent {
pub text: String,
pub event_type: TextEventType,
pub timestamp: f32,
pub start: i32,
pub length: i32,
pub bubble: bool,
}
#[derive(Debug, Clone, Copy, PartialEq, Hash)]
#[repr(i32)]
pub enum TextEventType {
Unknown,
Edit,
Input,
}