rio_window::platform::macos

Trait EventLoopBuilderExtMacOS

Source
pub trait EventLoopBuilderExtMacOS {
    // Required methods
    fn with_activation_policy(
        &mut self,
        activation_policy: ActivationPolicy,
    ) -> &mut Self;
    fn with_default_menu(&mut self, enable: bool) -> &mut Self;
    fn with_activate_ignoring_other_apps(&mut self, ignore: bool) -> &mut Self;
}

Required Methods§

Source

fn with_activation_policy( &mut self, activation_policy: ActivationPolicy, ) -> &mut Self

Sets the activation policy for the application.

It is set to ActivationPolicy::Regular by default.

§Example

Set the activation policy to “accessory”.

use rio_window::event_loop::EventLoopBuilder;
#[cfg(target_os = "macos")]
use rio_window::platform::macos::{ActivationPolicy, EventLoopBuilderExtMacOS};

let mut builder = EventLoopBuilder::new();
#[cfg(target_os = "macos")]
builder.with_activation_policy(ActivationPolicy::Accessory);
let event_loop = builder.build();
Source

fn with_default_menu(&mut self, enable: bool) -> &mut Self

Used to control whether a default menubar menu is created.

Menu creation is enabled by default.

§Example

Disable creating a default menubar.

use rio_window::event_loop::EventLoopBuilder;
#[cfg(target_os = "macos")]
use rio_window::platform::macos::EventLoopBuilderExtMacOS;

let mut builder = EventLoopBuilder::new();
#[cfg(target_os = "macos")]
builder.with_default_menu(false);
let event_loop = builder.build();
Source

fn with_activate_ignoring_other_apps(&mut self, ignore: bool) -> &mut Self

Used to prevent the application from automatically activating when launched if another application is already active.

The default behavior is to ignore other applications and activate when launched.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§