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