xref: /Held/src/utils/ui/mode/state.rs (revision c2100e27aa48126d72fb7b1fd875b0c0f48cf395)
1 use std::{io, sync::MutexGuard};
2 
3 use crate::utils::ui::{event::WarpUiCallBackType, uicore::UiCore};
4 
5 use super::mode::ModeType;
6 
7 pub enum StateCallback {
8     None,
9     Reset,
10     Exit(ModeType),
11 }
12 
13 pub trait StateMachine {
handle(&mut self, ui: &mut MutexGuard<UiCore>) -> io::Result<WarpUiCallBackType>14     fn handle(&mut self, ui: &mut MutexGuard<UiCore>) -> io::Result<WarpUiCallBackType>;
exit(&mut self, callback: WarpUiCallBackType) -> io::Result<WarpUiCallBackType>15     fn exit(&mut self, callback: WarpUiCallBackType) -> io::Result<WarpUiCallBackType>;
reset(&mut self)16     fn reset(&mut self);
17 }
18