...
This commit is contained in:
parent
3cdf7c62d5
commit
71ac8d97fa
12 changed files with 445 additions and 445 deletions
|
|
@ -1,25 +0,0 @@
|
|||
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
||||
pub enum Focus {
|
||||
Eula,
|
||||
Tos,
|
||||
Pp,
|
||||
Cancel,
|
||||
Continue,
|
||||
ContinueAll,
|
||||
}
|
||||
|
||||
impl Focus {
|
||||
pub fn next(&mut self, order: &[Focus]) {
|
||||
if let Some(pos) = order.iter().position(|&f| f == *self) {
|
||||
let next_pos = (pos + 1) % order.len();
|
||||
*self = order[next_pos];
|
||||
}
|
||||
}
|
||||
|
||||
pub fn prev(&mut self, order: &[Focus]) {
|
||||
if let Some(pos) = order.iter().position(|&f| f == *self) {
|
||||
let prev_pos = if pos == 0 { order.len() - 1 } else { pos - 1 };
|
||||
*self = order[prev_pos];
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Reference in a new issue