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