clide/src/tui/component.rs

31 lines
681 B
Rust
Raw Normal View History

2026-01-19 09:23:12 -05:00
#![allow(dead_code, unused_variables)]
use ratatui::crossterm::event::{Event, KeyEvent, MouseEvent};
2026-01-17 17:09:42 -05:00
pub enum Action {
Noop,
Quit,
Pass, // Pass input to another component.
2026-01-17 17:09:42 -05:00
}
2026-01-19 09:23:12 -05:00
pub trait Component {
fn handle_event(&mut self, event: Event) -> Action {
match event {
Event::Key(key_event) => self.handle_key_events(key_event),
_ => Action::Noop,
}
}
2026-01-19 09:23:12 -05:00
fn handle_key_events(&mut self, key: KeyEvent) -> Action {
Action::Noop
2026-01-17 17:09:42 -05:00
}
2026-01-19 09:23:12 -05:00
fn handle_mouse_events(&mut self, mouse: MouseEvent) -> Action {
2026-01-17 17:09:42 -05:00
Action::Noop
}
2026-01-19 09:23:12 -05:00
fn update(&mut self, action: Action) -> Action {
2026-01-17 17:09:42 -05:00
Action::Noop
}
}