1use crossterm::event::KeyEvent;
2
3use crate::{
4 dependency::{Action, DependencyId, Evaluation},
5 step::CompoundStep,
6 text::{DrawerContents, Segment},
7};
8
9mod selectinput;
10pub use selectinput::*;
11
12mod statictext;
13pub use statictext::*;
14
15mod textinput;
16pub use textinput::*;
17
18pub trait Control {
20 fn focusable(&self) -> bool;
22
23 fn update(&mut self, input: KeyEvent);
25
26 fn help(&self) -> Option<Segment>;
28
29 fn text(&self) -> (Segment, Option<u16>);
31
32 fn drawer(&self) -> Option<DrawerContents>;
34
35 fn evaluation(&self) -> Option<(DependencyId, Evaluation)>;
37
38 fn dependency(&self) -> Option<(DependencyId, Action)>;
40
41 fn evaluate(&self, evaluation: &Evaluation) -> bool;
43
44 fn add_to(self, step: &mut CompoundStep);
46}