Trait winit::platform::macos::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§
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.