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
use crossterm::event::KeyEvent;
use crate::{
dependency::{Action, DependencyId, Evaluation},
step::CompoundStep,
text::{DrawerContents, Segment},
};
mod selectinput;
pub use selectinput::*;
mod statictext;
pub use statictext::*;
mod textinput;
pub use textinput::*;
pub trait Control {
fn focusable(&self) -> bool;
fn update(&mut self, input: KeyEvent);
fn help(&self) -> Option<Segment>;
fn text(&self) -> (Segment, Option<u16>);
fn drawer(&self) -> Option<DrawerContents>;
fn evaluation(&self) -> Option<(DependencyId, Evaluation)>;
fn dependency(&self) -> Option<(DependencyId, Action)>;
fn evaluate(&self, evaluation: &Evaluation) -> bool;
fn add_to(self, step: &mut CompoundStep);
}