Skip to main content

itools_tui/components/
mod.rs

1//! 组件系统模块
2//!
3//! 提供各种 TUI 组件,包括按钮、文本框、列表、表格等。
4
5/// 组件 trait
6pub trait Component {
7    /// 渲染组件
8    fn render(&self, frame: &mut Frame, area: Rect);
9
10    /// 处理事件
11    fn handle_event(&mut self, event: &Event) -> bool;
12}
13
14/// 按钮组件
15pub mod button;
16
17/// 文本框组件
18pub mod input;
19
20/// 列表组件
21pub mod list;
22
23/// 表格组件
24pub mod table;
25
26/// 面板组件
27pub mod panel;
28
29/// 进度条组件
30pub mod progress_bar;
31
32/// 加载动画组件
33pub mod loading_animation;
34
35/// 选择菜单组件
36pub mod select_menu;
37
38/// 导出组件
39pub use button::Button;
40pub use input::Input;
41pub use list::List;
42pub use loading_animation::LoadingAnimation;
43pub use panel::Panel;
44pub use progress_bar::ProgressBar;
45pub use select_menu::SelectMenu;
46pub use table::Table;
47
48/// 从其他模块导入必要的类型
49use crate::event::Event;
50use crate::{layout::Rect, render::Frame};