Skip to main content

flux_tui/
lib.rs

1//! # Flux TUI
2//!
3//! Flux TUI is a library which tries to unify both rendering Terminal UIs and event handling
4//!
5//!
6//! # Main features:
7//! - Hierachical reference counted structure
8//! - Events get automatically delegated to the focused child and if unhandled bubble up
9//! - Premade existing implementations of well-known components (still getting improved tho)
10//! - Lightweight and relies only on few dependencies
11//!
12//! # Getting started:
13//!
14//! ```no_run
15//! use flux_tui::tui::Tui;
16//! use flux_tui::window::*;
17//! use flux_tui::canvas::Canvas;
18//!
19//! use std::rc::Rc;
20//! use std::cell::RefCell;
21//!
22//! struct Start(WindowUID);
23//!
24//! impl Start{
25//!     fn new() -> Self{
26//!         Self(WindowUID::new())
27//!     }
28//! }
29//!
30//! impl Window for Start{
31//!     fn render(&self, canvas: &mut Canvas){}
32//! }
33//!
34//! impl WindowLayout for Start{}
35//!
36//! impl HasWindowUID for Start{
37//!     fn uid(&self) -> WindowUID{
38//!         self.0
39//!     }
40//! }
41//!
42//! // Construct your Window implementation here
43//! let control: WindowRef = Rc::new(RefCell::new(Start::new()));
44//! let mut tui = Tui::new(control.clone()).unwrap();
45//! while let Ok(()) = tui.handle_next_event() {
46//!     tui.render().unwrap();
47//! }
48//!
49//! ```
50
51pub mod canvas;
52pub mod common;
53pub mod components;
54mod framebuffer;
55pub mod misc;
56pub mod tui;
57pub mod window;