Init
This commit is contained in:
38
src/page.rs
Normal file
38
src/page.rs
Normal file
@@ -0,0 +1,38 @@
|
||||
#[derive(Debug, Default, Clone, Copy, PartialEq, Eq)]
|
||||
pub enum Page {
|
||||
#[default]
|
||||
Main,
|
||||
Patterns,
|
||||
Audio,
|
||||
Doc,
|
||||
}
|
||||
|
||||
impl Page {
|
||||
pub fn left(&mut self) {
|
||||
*self = match self {
|
||||
Page::Main | Page::Patterns => Page::Doc,
|
||||
Page::Audio => Page::Main,
|
||||
Page::Doc => Page::Audio,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn right(&mut self) {
|
||||
*self = match self {
|
||||
Page::Main | Page::Patterns => Page::Audio,
|
||||
Page::Audio => Page::Doc,
|
||||
Page::Doc => Page::Main,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn up(&mut self) {
|
||||
if *self == Page::Main {
|
||||
*self = Page::Patterns;
|
||||
}
|
||||
}
|
||||
|
||||
pub fn down(&mut self) {
|
||||
if *self == Page::Patterns {
|
||||
*self = Page::Main;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user