pub trait EventLoopBuilderExtMacOS: EventLoopBuilderPrivate {
// 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;
}Expand description
Additional methods on EventLoopBuilder that are specific to MacOS.
Required Methods§
Sourcefn with_activation_policy(
&mut self,
activation_policy: ActivationPolicy,
) -> &mut Self
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 winit::event_loop::EventLoopBuilder;
#[cfg(target_os = "macos")]
use winit::platform::macos::{EventLoopBuilderExtMacOS, ActivationPolicy};
let mut builder = EventLoopBuilder::new();
#[cfg(target_os = "macos")]
builder.with_activation_policy(ActivationPolicy::Accessory);
let event_loop = builder.build();Used to control whether a default menubar menu is created.
Menu creation is enabled by default.
§Example
Disable creating a default menubar.
use winit::event_loop::EventLoopBuilder;
#[cfg(target_os = "macos")]
use winit::platform::macos::EventLoopBuilderExtMacOS;
let mut builder = EventLoopBuilder::new();
#[cfg(target_os = "macos")]
builder.with_default_menu(false);
let event_loop = builder.build();Sourcefn with_activate_ignoring_other_apps(&mut self, ignore: bool) -> &mut Self
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.