diff options
| author | sam-anthony <samanthony6@protonmail.com> | 2022-02-04 17:04:49 -0330 |
|---|---|---|
| committer | sam-anthony <samanthony6@protonmail.com> | 2022-02-04 17:04:49 -0330 |
| commit | fd512094eb013e512c1faa98eb168bbc0b23859b (patch) | |
| tree | bfa688f482a67fc76e1cf6bba1867d0226dbb368 /src/app.rs | |
| parent | 36928f2351d0eb5fd27ccfe862f2cca21758f663 (diff) | |
| download | volute-fd512094eb013e512c1faa98eb168bbc0b23859b.zip | |
clean up
Diffstat (limited to 'src/app.rs')
| -rw-r--r-- | src/app.rs | 13 |
1 files changed, 10 insertions, 3 deletions
@@ -1,8 +1,11 @@ use crate::input::{InputMode, InputParam, Row}; +pub const INPUT_TAB_INDEX: usize = 0; +pub const CONFIG_TAB_INDEX: usize = 1; + pub struct App { pub tab_index: usize, - pub tab_titles: Vec<&'static str>, + tab_titles: [&'static str; 2], pub rows: Vec<Row>, pub selected_row: usize, @@ -12,6 +15,10 @@ pub struct App { } impl App { + pub fn tab_titles(&self) -> &[&str] { + &self.tab_titles + } + pub fn next_tab(&mut self) { self.tab_index = (self.tab_index + 1) % self.tab_titles.len(); } @@ -66,8 +73,8 @@ impl App { impl Default for App { fn default() -> App { App { - tab_index: 0, - tab_titles: vec!["Input", "Config"], + tab_index: INPUT_TAB_INDEX, + tab_titles: ["Input", "Config"], rows: vec![Row::default()], selected_row: 0, selected_column: InputParam::Rpm(String::new()), |