mirror of
https://codeberg.org/unspeaker/tengri.git
synced 2025-12-06 03:36:42 +01:00
This commit is contained in:
parent
91dc77cfea
commit
11f686650f
19 changed files with 964 additions and 918 deletions
|
|
@ -33,23 +33,23 @@ const EXAMPLES: &'static [&'static str] = &[
|
|||
];
|
||||
|
||||
handle!(TuiIn: |self: Example, input|{
|
||||
Ok(if let Some(command) = SourceIter::new(KEYMAP).command::<_, ExampleCommand, _>(self, input) {
|
||||
Ok(None)/*if let Some(command) = CstIter::new(KEYMAP).command::<_, ExampleCommand, _>(self, input) {
|
||||
command.execute(self)?;
|
||||
Some(true)
|
||||
} else {
|
||||
None
|
||||
})
|
||||
})*/
|
||||
});
|
||||
|
||||
#[tengri_proc::expose]
|
||||
impl Example {
|
||||
fn _todo_u16_stub (&self) -> u16 { todo!() }
|
||||
fn _todo_bool_stub (&self) -> bool { todo!() }
|
||||
fn _todo_usize_stub (&self) -> usize { todo!() }
|
||||
//[bool] => {}
|
||||
//[u16] => {}
|
||||
//[usize] => {}
|
||||
}
|
||||
//#[tengri_proc::expose]
|
||||
//impl Example {
|
||||
//fn _todo_u16_stub (&self) -> u16 { todo!() }
|
||||
//fn _todo_bool_stub (&self) -> bool { todo!() }
|
||||
//fn _todo_usize_stub (&self) -> usize { todo!() }
|
||||
////[bool] => {}
|
||||
////[u16] => {}
|
||||
////[usize] => {}
|
||||
//}
|
||||
|
||||
#[tengri_proc::command(Example)]
|
||||
impl ExampleCommand {
|
||||
|
|
@ -70,31 +70,31 @@ content!(TuiOut: |self: Example|{
|
|||
let heading = format!("Example {}/{} in {:?}", index, EXAMPLES.len(), &wh);
|
||||
let title = Tui::bg(Color::Rgb(60, 10, 10), Push::y(1, Align::n(heading)));
|
||||
let code = Tui::bg(Color::Rgb(10, 60, 10), Push::y(2, Align::n(format!("{}", src))));
|
||||
let content = Tui::bg(Color::Rgb(10, 10, 60), View(self, TokenIter::new(src)));
|
||||
let content = ();//Tui::bg(Color::Rgb(10, 10, 60), View(self, CstIter::new(src)));
|
||||
self.1.of(Bsp::s(title, Bsp::n(""/*code*/, content)))
|
||||
});
|
||||
|
||||
#[tengri_proc::view(TuiOut)]
|
||||
impl Example {
|
||||
pub fn title (&self) -> impl Content<TuiOut> + use<'_> {
|
||||
Tui::bg(Color::Rgb(60, 10, 10), Push::y(1, Align::n(format!("Example {}/{}:", self.0 + 1, EXAMPLES.len())))).boxed()
|
||||
}
|
||||
pub fn code (&self) -> impl Content<TuiOut> + use<'_> {
|
||||
Tui::bg(Color::Rgb(10, 60, 10), Push::y(2, Align::n(format!("{}", EXAMPLES[self.0])))).boxed()
|
||||
}
|
||||
pub fn hello (&self) -> impl Content<TuiOut> + use<'_> {
|
||||
Tui::bg(Color::Rgb(10, 100, 10), "Hello").boxed()
|
||||
}
|
||||
pub fn world (&self) -> impl Content<TuiOut> + use<'_> {
|
||||
Tui::bg(Color::Rgb(100, 10, 10), "world").boxed()
|
||||
}
|
||||
pub fn hello_world (&self) -> impl Content<TuiOut> + use<'_> {
|
||||
"Hello world!".boxed()
|
||||
}
|
||||
pub fn map_e (&self) -> impl Content<TuiOut> + use<'_> {
|
||||
Map::east(5u16, ||0..5u16, |n, _i|format!("{n}")).boxed()
|
||||
}
|
||||
pub fn map_s (&self) -> impl Content<TuiOut> + use<'_> {
|
||||
Map::south(5u16, ||0..5u16, |n, _i|format!("{n}")).boxed()
|
||||
}
|
||||
}
|
||||
//#[tengri_proc::view(TuiOut)]
|
||||
//impl Example {
|
||||
//pub fn title (&self) -> impl Content<TuiOut> + use<'_> {
|
||||
//Tui::bg(Color::Rgb(60, 10, 10), Push::y(1, Align::n(format!("Example {}/{}:", self.0 + 1, EXAMPLES.len())))).boxed()
|
||||
//}
|
||||
//pub fn code (&self) -> impl Content<TuiOut> + use<'_> {
|
||||
//Tui::bg(Color::Rgb(10, 60, 10), Push::y(2, Align::n(format!("{}", EXAMPLES[self.0])))).boxed()
|
||||
//}
|
||||
//pub fn hello (&self) -> impl Content<TuiOut> + use<'_> {
|
||||
//Tui::bg(Color::Rgb(10, 100, 10), "Hello").boxed()
|
||||
//}
|
||||
//pub fn world (&self) -> impl Content<TuiOut> + use<'_> {
|
||||
//Tui::bg(Color::Rgb(100, 10, 10), "world").boxed()
|
||||
//}
|
||||
//pub fn hello_world (&self) -> impl Content<TuiOut> + use<'_> {
|
||||
//"Hello world!".boxed()
|
||||
//}
|
||||
//pub fn map_e (&self) -> impl Content<TuiOut> + use<'_> {
|
||||
//Map::east(5u16, ||0..5u16, |n, _i|format!("{n}")).boxed()
|
||||
//}
|
||||
//pub fn map_s (&self) -> impl Content<TuiOut> + use<'_> {
|
||||
//Map::south(5u16, ||0..5u16, |n, _i|format!("{n}")).boxed()
|
||||
//}
|
||||
//}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue