glyph_ui 0.1.0

TUI library utilizing the Elm architecture
Documentation
//! Event handling

pub(crate) mod keyboard_types;

use ::keyboard_types::KeyboardEvent;
use euclid::Size2D;

use crate::unit::Cell;

/// Reason for new events
#[derive(Debug)]
pub enum Cause {
    /// Application was just initialized
    Init,

    /// [`ControlFlow::Wait`] was requested and now the wait is over
    ///
    /// [`ControlFlow::Wait`]: crate::ControlFlow::Wait
    WaitOver,
}

/// An event
#[derive(Debug)]
pub enum Event<T> {
    /// A custom event
    Custom(T),

    /// New events are coming in, [`Cause`] contains the reason
    ///
    /// [`Cause`]: Cause
    New(Cause),

    /// The terminal was resized
    Resize(Size2D<u16, Cell>),

    /// A key was pressed
    Key(KeyboardEvent),
}