Skip to main content

Screen

Trait Screen 

Source
pub trait Screen {
Show 13 methods // Required methods fn render(&mut self, frame: &mut Frame<'_>); fn handle_key(&mut self, key: KeyEvent); fn interrupt(&mut self); fn done(&self) -> bool; // Provided methods fn quit(&mut self) { ... } fn pending_work(&self) -> Option<String> { ... } fn do_work(&mut self) { ... } fn tick(&mut self) -> bool { ... } fn takes_mouse(&self) -> bool { ... } fn mouse(&mut self, _event: MouseEvent) -> bool { ... } fn reports_chords(&self) -> bool { ... } fn take_notice(&mut self) -> Option<String> { ... } fn status(&self) -> Option<String> { ... }
}
Expand description

A full-screen view, driven by Tui::run or run_screen.

Required Methods§

Source

fn render(&mut self, frame: &mut Frame<'_>)

Draw the view.

Source

fn handle_key(&mut self, key: KeyEvent)

A key press (Ctrl-C goes to Screen::interrupt instead).

Source

fn interrupt(&mut self)

Ctrl-C.

Source

fn done(&self) -> bool

Whether the view has ended.

Provided Methods§

Source

fn quit(&mut self)

A kill asked the view to stop: leave as its quit key does, without asking; work that must finish may run on, and is waited for (Tui::settle). By default as Ctrl-C.

Source

fn pending_work(&self) -> Option<String>

Blocking work the last key asked for, as a line to print while it runs; Screen::do_work then does it.

Source

fn do_work(&mut self)

Do the work Screen::pending_work named.

Source

fn tick(&mut self) -> bool

Called about every TICK, keys or not: true redraws, for a view waiting on work in the background.

Source

fn takes_mouse(&self) -> bool

Whether the view takes the mouse: only then is the terminal asked for it, since a view holding it keeps text from being selected.

Source

fn mouse(&mut self, _event: MouseEvent) -> bool

A mouse event (a button pressed or let go, or a turn of the wheel) at a cell of the screen; whether the screen changed and is drawn again.

Source

fn reports_chords(&self) -> bool

Whether the terminal is asked to report keys held with Shift, Alt or Ctrl apart (the kitty keyboard protocol, asked only of a terminal that says it has it: Keyboard::DISAMBIGUATE), so that Shift+Enter, say, is not taken for Enter.

Source

fn take_notice(&mut self) -> Option<String>

Something to tell whoever is away, once: the loop rings the terminal’s bell and asks it for a desktop notification saying it (notify).

Source

fn status(&self) -> Option<String>

What the view is doing, in one short line, for the tool’s session list and the session picker to show (Session::status).

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl Screen for ListView

Source§

impl Screen for PlanView<'_>

Source§

impl Screen for QcView

Source§

impl Screen for StatExplorer<'_>

Source§

impl<S> Screen for Framed<'_, S>
where S: Screen,