use crate::foundation::NSUInteger;
#[derive(Copy, Clone, Debug)]
pub enum TerminateResponse {
Now,
Cancel,
Later
}
impl From<TerminateResponse> for NSUInteger {
fn from(response: TerminateResponse) -> NSUInteger {
match response {
TerminateResponse::Now => 1,
TerminateResponse::Cancel => 0,
TerminateResponse::Later => 2
}
}
}
#[derive(Copy, Clone, Debug)]
pub enum AppDelegateResponse {
Cancelled,
Success,
Failure
}
impl From<AppDelegateResponse> for NSUInteger {
fn from(response: AppDelegateResponse) -> Self {
match response {
AppDelegateResponse::Cancelled => 1,
AppDelegateResponse::Success => 0,
AppDelegateResponse::Failure => 2
}
}
}
#[derive(Copy, Clone, Debug)]
pub enum PresentationOption {
Default,
AutoHideDock,
HideDock,
AutoHideMenuBar,
HideMenuBar,
DisableAppleMenu,
DisableProcessSwitching,
DisableForceQuit,
DisableSessionTermination,
DisableHideApplication,
DisableMenuBarTransparency,
FullScreen,
AutoHideToolbar,
DisableCursorLocationAssistance
}
impl From<PresentationOption> for NSUInteger {
fn from(option: PresentationOption) -> Self {
match option {
PresentationOption::Default => 0,
PresentationOption::AutoHideDock => (1 << 0),
PresentationOption::HideDock => (1 << 1),
PresentationOption::AutoHideMenuBar => (1 << 2),
PresentationOption::HideMenuBar => (1 << 3),
PresentationOption::DisableAppleMenu => (1 << 4),
PresentationOption::DisableProcessSwitching => (1 << 5),
PresentationOption::DisableForceQuit => (1 << 6),
PresentationOption::DisableSessionTermination => (1 << 7),
PresentationOption::DisableHideApplication => (1 << 8),
PresentationOption::DisableMenuBarTransparency => (1 << 9),
PresentationOption::FullScreen => (1 << 10),
PresentationOption::AutoHideToolbar => (1 << 11),
PresentationOption::DisableCursorLocationAssistance => (1 << 12)
}
}
}
impl From<&PresentationOption> for NSUInteger {
fn from(option: &PresentationOption) -> Self {
match option {
PresentationOption::Default => 0,
PresentationOption::AutoHideDock => (1 << 0),
PresentationOption::HideDock => (1 << 1),
PresentationOption::AutoHideMenuBar => (1 << 2),
PresentationOption::HideMenuBar => (1 << 3),
PresentationOption::DisableAppleMenu => (1 << 4),
PresentationOption::DisableProcessSwitching => (1 << 5),
PresentationOption::DisableForceQuit => (1 << 6),
PresentationOption::DisableSessionTermination => (1 << 7),
PresentationOption::DisableHideApplication => (1 << 8),
PresentationOption::DisableMenuBarTransparency => (1 << 9),
PresentationOption::FullScreen => (1 << 10),
PresentationOption::AutoHideToolbar => (1 << 11),
PresentationOption::DisableCursorLocationAssistance => (1 << 12)
}
}
}