Fixup Surface

pull/1/head
Blaž Hrastnik 5 years ago
parent 2ea5feaeb1
commit c17045ed07

@ -1,15 +1,17 @@
// IDEA: render to a cache buffer, then if not changed, copy the buf into the parent // IDEA: render to a cache buffer, then if not changed, copy the buf into the parent
type Surface = ();
pub trait Component { pub trait Component {
/// Process input events, return true if handled. /// Process input events, return true if handled.
fn process_event(&mut self, event: crossterm::event::Event, args) -> bool; fn process_event(&mut self, event: crossterm::event::Event, args: ()) -> bool;
/// Should redraw? Useful for saving redraw cycles if we know component didn't change. /// Should redraw? Useful for saving redraw cycles if we know component didn't change.
fn should_update(&self) -> bool { true } fn should_update(&self) -> bool {
true
}
fn render(&mut self, surface: &mut Surface, args: ()); fn render(&mut self, surface: &mut Surface, args: ());
} }
// HStack / VStack // HStack / VStack
// focus by component id: each View/Editor gets it's own incremental id at create // focus by component id: each View/Editor gets it's own incremental id at create
// Component: View(Arc<State>) -> multiple views can point to same state // Component: View(Arc<State>) -> multiple views can point to same state
// id 0 = prompt? // id 0 = prompt?

Loading…
Cancel
Save