appcui 0.4.13

A feature-rich and cross-platform TUI/CUI framework for Rust, enabling modern terminal-based applications on Windows, Linux, and macOS. Includes built-in UI components like buttons, menus, list views, tree views, checkboxes, and more. Perfect for building fast and interactive CLI tools and text-based interfaces.
Documentation
use std::any::TypeId;
use crate::{system::Handle, ui::common::traits::EventProcessStatus};

/// Event handlers for [`super::BufferView`] notifications.
///
/// Implement this trait on a window or other event receiver to react when the user moves
/// the cursor or changes the selection inside a buffer view control.
pub trait GenericBufferViewEvents {
    /// Called when the current byte position changes inside a [`super::BufferView`].
    fn on_current_pos_changed(&mut self, _handle: Handle<()>, _type_id: TypeId) -> EventProcessStatus {
        EventProcessStatus::Ignored
    }
    /// Called when the selected byte range changes inside a [`super::BufferView`].
    fn on_selection_changed(&mut self, _handle: Handle<()>, _type_id: TypeId) -> EventProcessStatus {
        EventProcessStatus::Ignored
    }
}


#[derive(Copy, Clone)]
pub(crate) enum BufferViewEventTypes {
    CurrentPosChanged,
    SelectionChanged,
}

#[derive(Copy, Clone)]
pub(crate) struct EventData {
    pub(crate) event_type: BufferViewEventTypes,
    pub(crate) type_id: std::any::TypeId,
}