rio_window::platform::macos

Trait WindowExtMacOS

Source
pub trait WindowExtMacOS {
Show 17 methods // Required methods fn simple_fullscreen(&self) -> bool; fn set_simple_fullscreen(&self, fullscreen: bool) -> bool; fn has_shadow(&self) -> bool; fn set_has_shadow(&self, has_shadow: bool); fn set_background_color(&self, _r: f64, _g: f64, _b: f64, _a: f64); fn set_tabbing_identifier(&self, identifier: &str); fn tabbing_identifier(&self) -> String; fn select_next_tab(&self); fn select_previous_tab(&self); fn select_tab_at_index(&self, index: usize); fn num_tabs(&self) -> usize; fn is_document_edited(&self) -> bool; fn set_document_edited(&self, edited: bool); fn set_option_as_alt(&self, option_as_alt: OptionAsAlt); fn option_as_alt(&self) -> OptionAsAlt; fn set_unified_titlebar(&self, unified_titlebar: bool); fn unified_titlebar(&self) -> bool;
}
Expand description

Additional methods on Window that are specific to MacOS.

Required Methods§

Source

fn simple_fullscreen(&self) -> bool

Returns whether or not the window is in simple fullscreen mode.

Source

fn set_simple_fullscreen(&self, fullscreen: bool) -> bool

Toggles a fullscreen mode that doesn’t require a new macOS space. Returns a boolean indicating whether the transition was successful (this won’t work if the window was already in the native fullscreen).

This is how fullscreen used to work on macOS in versions before Lion. And allows the user to have a fullscreen window without using another space or taking control over the entire monitor.

Source

fn has_shadow(&self) -> bool

Returns whether or not the window has shadow.

Source

fn set_has_shadow(&self, has_shadow: bool)

Sets whether or not the window has shadow.

Source

fn set_background_color(&self, _r: f64, _g: f64, _b: f64, _a: f64)

Sets background color.

Source

fn set_tabbing_identifier(&self, identifier: &str)

Group windows together by using the same tabbing identifier.

https://developer.apple.com/documentation/appkit/nswindow/1644704-tabbingidentifier

Source

fn tabbing_identifier(&self) -> String

Returns the window’s tabbing identifier.

Source

fn select_next_tab(&self)

Select next tab.

Source

fn select_previous_tab(&self)

Select previous tab.

Source

fn select_tab_at_index(&self, index: usize)

Select the tab with the given index.

Will no-op when the index is out of bounds.

Source

fn num_tabs(&self) -> usize

Get the number of tabs in the window tab group.

Source

fn is_document_edited(&self) -> bool

Get the window’s edit state.

§Examples
WindowEvent::CloseRequested => {
    if window.is_document_edited() {
        // Show the user a save pop-up or similar
    } else {
        // Close the window
        drop(window);
    }
}
Source

fn set_document_edited(&self, edited: bool)

Put the window in a state which indicates a file save is required.

Source

fn set_option_as_alt(&self, option_as_alt: OptionAsAlt)

Set option as alt behavior as described in OptionAsAlt.

This will ignore diacritical marks and accent characters from being processed as received characters. Instead, the input device’s raw character will be placed in event queues with the Alt modifier set.

Source

fn option_as_alt(&self) -> OptionAsAlt

Source

fn set_unified_titlebar(&self, unified_titlebar: bool)

Makes the titlebar bigger, effectively adding more space around the window controls if the titlebar is invisible.

Source

fn unified_titlebar(&self) -> bool

Implementors§