parent
0f64a84362
commit
e3bbb9366c
|
@ -134,3 +134,47 @@ impl From<WindowToolbarStyle> for NSUInteger {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Describe the level of the window. Stacking of window levels take precedence over stacking
|
||||||
|
/// of windows withing each level.
|
||||||
|
#[derive(Clone, Copy, Debug)]
|
||||||
|
pub enum WindowLevel {
|
||||||
|
/// The default level for NSWindow objects.
|
||||||
|
Normal,
|
||||||
|
|
||||||
|
/// Useful for floating palettes.
|
||||||
|
Floating,
|
||||||
|
|
||||||
|
/// The level for a modal panel.
|
||||||
|
ModalPanel,
|
||||||
|
|
||||||
|
/// Reserved for the application’s main menu.
|
||||||
|
MainMenu,
|
||||||
|
|
||||||
|
/// The level for a status window.
|
||||||
|
Status,
|
||||||
|
|
||||||
|
/// The level for the dock.
|
||||||
|
DockWindow,
|
||||||
|
|
||||||
|
/// The level for a pop-up menu.
|
||||||
|
PopUpMenu,
|
||||||
|
|
||||||
|
/// The level for a screen saver.
|
||||||
|
ScreenSaver
|
||||||
|
}
|
||||||
|
|
||||||
|
impl From<WindowLevel> for NSInteger {
|
||||||
|
fn from(mode: WindowLevel) -> Self {
|
||||||
|
match mode {
|
||||||
|
WindowLevel::Normal => 0,
|
||||||
|
WindowLevel::Floating => 3,
|
||||||
|
WindowLevel::ModalPanel => 8,
|
||||||
|
WindowLevel::MainMenu => 24,
|
||||||
|
WindowLevel::Status => 25,
|
||||||
|
WindowLevel::DockWindow => 100,
|
||||||
|
WindowLevel::PopUpMenu => 101,
|
||||||
|
WindowLevel::ScreenSaver => 1000
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -312,6 +312,21 @@ impl<T> Window<T> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Sets the window level, which determines the stacking order of windows on the screen.
|
||||||
|
pub fn set_level(&self, value: WindowLevel) {
|
||||||
|
let value: NSInteger = value.into();
|
||||||
|
unsafe {
|
||||||
|
let _: () = msg_send![&*self.objc, setLevel: value];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Removes window from the screen making it effectively hidden.
|
||||||
|
pub fn order_out(&self) {
|
||||||
|
unsafe {
|
||||||
|
let _: () = msg_send![&*self.objc, orderOut: nil];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// Set whether the toolbar toggle button is shown. Has no effect if no toolbar exists on this
|
/// Set whether the toolbar toggle button is shown. Has no effect if no toolbar exists on this
|
||||||
/// window.
|
/// window.
|
||||||
pub fn set_shows_toolbar_button(&self, shows: bool) {
|
pub fn set_shows_toolbar_button(&self, shows: bool) {
|
||||||
|
|
Loading…
Reference in a new issue