tui_additions/framework/
frameworkhistory.rs

1use typemap::{CloneMap, TypeMap};
2
3use super::{CursorState, Framework, FrameworkData, State};
4
5/// Save state for Framework
6#[derive(Clone)]
7pub struct FrameworkHistory {
8    /// Selectable items, auto generated when `state` is set with `new()` or `set_state()`
9    pub selectables: Vec<Vec<(usize, usize)>>,
10    /// Global data store for the framework
11    pub data: CloneMap,
12    /// Defines the layout of items on screen
13    pub state: State,
14    /// The state and position of cursor
15    pub cursor: CursorState,
16}
17
18impl From<FrameworkHistory> for Framework {
19    fn from(original: FrameworkHistory) -> Framework {
20        Framework {
21            selectables: original.selectables,
22            data: FrameworkData::from((TypeMap::custom(), original.data)),
23            state: original.state,
24            cursor: original.cursor,
25            history: Vec::new(),
26            frame_area: None,
27        }
28    }
29}