mirror of
https://codeberg.org/unspeaker/tengri.git
synced 2025-12-06 11:46:42 +01:00
This commit is contained in:
parent
5d546affed
commit
bad20f5037
2 changed files with 41 additions and 0 deletions
|
|
@ -22,6 +22,7 @@ impl<T: Content<TuiOut>> Content<TuiOut> for std::sync::Arc<T> {
|
||||||
}
|
}
|
||||||
|
|
||||||
mod tui_border; pub use self::tui_border::*;
|
mod tui_border; pub use self::tui_border::*;
|
||||||
|
mod tui_button; pub use self::tui_button::*;
|
||||||
mod tui_color; pub use self::tui_color::*;
|
mod tui_color; pub use self::tui_color::*;
|
||||||
mod tui_field; pub use self::tui_field::*;
|
mod tui_field; pub use self::tui_field::*;
|
||||||
mod tui_phat; pub use self::tui_phat::*;
|
mod tui_phat; pub use self::tui_phat::*;
|
||||||
|
|
|
||||||
40
tui/src/tui_content/tui_button.rs
Normal file
40
tui/src/tui_content/tui_button.rs
Normal file
|
|
@ -0,0 +1,40 @@
|
||||||
|
use crate::{*, Color::*};
|
||||||
|
|
||||||
|
pub fn button_2 <'a> (
|
||||||
|
key: impl Content<TuiOut> + 'a, label: impl Content<TuiOut> + 'a, editing: bool,
|
||||||
|
) -> impl Content<TuiOut> + 'a {
|
||||||
|
let key = Tui::fg_bg(Tui::g(0), Tui::orange(), Bsp::e(
|
||||||
|
Tui::fg_bg(Tui::orange(), Reset, "▐"),
|
||||||
|
Bsp::e(key, Tui::fg(Tui::g(96), "▐"))
|
||||||
|
));
|
||||||
|
let label = When::new(!editing, Tui::fg_bg(Tui::g(255), Tui::g(96), label));
|
||||||
|
Tui::bold(true, Bsp::e(key, label))
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn button_3 <'a, K, L, V> (
|
||||||
|
key: K,
|
||||||
|
label: L,
|
||||||
|
value: V,
|
||||||
|
editing: bool,
|
||||||
|
) -> impl Content<TuiOut> + 'a where
|
||||||
|
K: Content<TuiOut> + 'a,
|
||||||
|
L: Content<TuiOut> + 'a,
|
||||||
|
V: Content<TuiOut> + 'a,
|
||||||
|
{
|
||||||
|
let key = Tui::fg_bg(Tui::g(0), Tui::orange(),
|
||||||
|
Bsp::e(Tui::fg_bg(Tui::orange(), Reset, "▐"), Bsp::e(key, Tui::fg(if editing {
|
||||||
|
Tui::g(128)
|
||||||
|
} else {
|
||||||
|
Tui::g(96)
|
||||||
|
}, "▐"))));
|
||||||
|
let label = Bsp::e(
|
||||||
|
When::new(!editing, Bsp::e(
|
||||||
|
Tui::fg_bg(Tui::g(255), Tui::g(96), label),
|
||||||
|
Tui::fg_bg(Tui::g(128), Tui::g(96), "▐"),
|
||||||
|
)),
|
||||||
|
Bsp::e(
|
||||||
|
Tui::fg_bg(Tui::g(224), Tui::g(128), value),
|
||||||
|
Tui::fg_bg(Tui::g(128), Reset, "▌"),
|
||||||
|
));
|
||||||
|
Tui::bold(true, Bsp::e(key, label))
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue