euv-core 0.46.1

Core cross-platform runtime for euv featuring arena-based fine-grained reactivity, deterministic layout, flat scene graph, multi-mode rendering, and direct OS platform adapters.
Documentation
use super::*;

/// Dispatched UI event envelope carrying target node and event payload.
#[derive(Clone, Data, Debug, New, PartialEq)]
pub struct UiEvent {
    /// Scene node receiving this event.
    #[get(type(copy))]
    pub(crate) target: NodeId,
    /// Specific event variant and payload.
    pub(crate) kind: UiEventKind,
}

/// Attached event listener slots on a `SceneNode`.
#[derive(Clone, CustomDebug, Data, Default)]
pub struct EventHandlers {
    /// Click / tap callback.
    #[debug(skip)]
    #[get(skip)]
    pub(crate) on_click: Option<UiEventHandler>,
    /// Pointer down callback.
    #[debug(skip)]
    #[get(skip)]
    pub(crate) on_pointer_down: Option<UiEventHandler>,
    /// Pointer move callback.
    #[debug(skip)]
    #[get(skip)]
    pub(crate) on_pointer_move: Option<UiEventHandler>,
    /// Pointer up callback.
    #[debug(skip)]
    #[get(skip)]
    pub(crate) on_pointer_up: Option<UiEventHandler>,
    /// Pointer cancel callback invoked when OS or gesture arbitration aborts an active press.
    #[debug(skip)]
    #[get(skip)]
    pub(crate) on_pointer_cancel: Option<UiEventHandler>,
    /// Pointer enter callback.
    #[debug(skip)]
    #[get(skip)]
    pub(crate) on_pointer_enter: Option<UiEventHandler>,
    /// Pointer leave callback.
    #[debug(skip)]
    #[get(skip)]
    pub(crate) on_pointer_leave: Option<UiEventHandler>,
    /// Scroll callback.
    #[debug(skip)]
    #[get(skip)]
    pub(crate) on_scroll: Option<UiEventHandler>,
    /// Key down callback.
    #[debug(skip)]
    #[get(skip)]
    pub(crate) on_key_down: Option<UiEventHandler>,
    /// Text change callback for input widgets.
    #[debug(skip)]
    #[get(skip)]
    pub(crate) on_change: Option<UiEventHandler>,
    /// Focus gained callback.
    #[debug(skip)]
    #[get(skip)]
    pub(crate) on_focus: Option<UiEventHandler>,
    /// Focus lost callback.
    #[debug(skip)]
    #[get(skip)]
    pub(crate) on_blur: Option<UiEventHandler>,
}

/// Normalized scroll bounds and current offsets for a single scene node across standard and virtualized scroll views.
#[derive(Clone, Copy, Debug, Default, Getter, New, PartialEq)]
pub(crate) struct ScrollAxisMetrics {
    /// Whether the node is an `Overflow::Scroll` container.
    #[get(type(copy))]
    pub(crate) is_scroll_box: bool,
    /// Whether the node carries virtualized vertical scroll metrics.
    #[get(type(copy))]
    pub(crate) is_virtual: bool,
    /// Current clamped horizontal scroll offset in logical pixels.
    #[get(type(copy))]
    pub(crate) cur_x: f32,
    /// Maximum horizontal scroll extent in logical pixels.
    #[get(type(copy))]
    pub(crate) max_x: f32,
    /// Current clamped vertical scroll offset in logical pixels.
    #[get(type(copy))]
    pub(crate) cur_y: f32,
    /// Maximum vertical scroll extent in logical pixels.
    #[get(type(copy))]
    pub(crate) max_y: f32,
    /// Full virtualized content height in logical pixels when `is_virtual` is `true`.
    #[get(type(copy))]
    pub(crate) total_virtual_h: f32,
}

/// Result of dispatching a scroll delta across an ancestor scroll chain.
#[derive(Clone, Copy, Debug, Default, Getter, New, PartialEq)]
pub(crate) struct ScrollDispatchOutcome {
    /// Whether any container in the chain consumed non-zero scroll delta.
    #[get(type(copy))]
    pub(crate) moved: bool,
    /// Outermost container that most recently consumed delta during chaining for gesture/smooth-scroll handoff.
    #[get(skip)]
    pub(crate) active_target: Option<NodeId>,
}