Struct NSApplication

Source
pub struct NSApplication<'app, M = ()> {
    pub ptr: Id<Object>,
    /* private fields */
}
Expand description

An object that manages an app’s main event loop and resources used by all of that app’s objects.

Fields§

§ptr: Id<Object>

The underlying Objective-C object.

Implementations§

Source§

impl<'app> NSApplication<'app>

Source

pub fn shared_application() -> NSApplication<'app>

Returns the application instance, creating it if it doesn’t exist yet.

Source

pub fn delegate(&self) -> id

The app delegate object.

Source§

impl NSApplication<'_>

Source

pub fn running(&self) -> bool

A Boolean value indicating whether the main event loop is running.

Source

pub fn run(&mut self)

Starts the main event loop.

Source

pub fn finish_launching(&mut self)

Activates the app, opens any files specified by the NSOpen user default, and unhighlights the app’s icon.

Source

pub fn stop(&mut self, sender: id)

Stops the main event loop.

Source

pub fn terminate(&mut self, sender: id)

Terminates the receiver.

Source

pub fn reply_to_application_should_terminate(&self, should_terminate: bool)

Responds to NSTerminateLater once the app knows whether it can terminate.

Source

pub fn disable_relaunch_on_login(&mut self)

Disables relaunching the app on login.

Source

pub fn enable_relaunch_on_login(&mut self)

Enables relaunching the app on login.

Source

pub fn register_for_remote_notifications(&mut self)

Register for notifications sent by Apple Push Notification service (APNs).

Source

pub fn unregister_for_remote_notifications(&mut self)

Unregister for notifications received from Apple Push Notification service.

Source

pub fn reply_to_open_or_print(&self, response: NSApplicationDelegateReply)

Handles errors that might occur when the user attempts to open or print files.

Source

pub fn activation_policy(&self) -> NSApplicationActivationPolicy

Returns the app’s activation policy.

Source

pub fn set_activation_policy(&mut self, policy: NSApplicationActivationPolicy)

Sets the app’s activation policy.

§Arguments
  • policy - The activation policy to set.
Source

pub fn main_menu(&self) -> NSMenu

The app’s main menu bar.

Source

pub fn set_main_menu(&mut self, menu: NSMenu)

Sets the app’s main menu bar.

Source§

impl NSApplication<'_>

Source

pub fn new() -> Self

Creates a new NSApplication,

Trait Implementations§

Source§

impl Debug for NSApplication<'_>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for NSApplication<'_>

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl FromId for NSApplication<'_>

Source§

unsafe fn from_id(ptr: id) -> Self

Returns Self representation of the object. Read more
Source§

impl INSApplication for NSApplication<'_>

Source§

fn p_shared_application() -> Self
where Self: Sized + FromId,

Returns the application instance, creating it if it doesn’t exist yet.
Source§

fn p_delegate(&self) -> id

The app delegate object.
Source§

fn p_set_delegate<'app, T>(&'app mut self, app_delegate: T)
where T: PNSApplicationDelegate + 'app,

Sets the app delegate object.
Source§

fn p_running(&self) -> bool

A Boolean value indicating whether the main event loop is running.
Source§

fn m_run(&self)

Starts the main event loop.
Source§

fn m_finish_launching(&self)

Activates the app, opens any files specified by the NSOpen user default, and unhighlights the app’s icon.
Source§

fn m_stop(&self, sender: id)

Stops the main event loop.
Source§

fn m_terminate(&self, sender: id)

Terminates the receiver.
Source§

fn m_reply_to_application_should_terminate(&self, should_terminate: bool)

Responds to NSTerminateLater once the app knows whether it can terminate.
Source§

fn p_active(&self) -> bool

A Boolean value indicating whether this is the active app.
Source§

fn m_activate_ignoring_other_apps(&mut self, flag: bool)

Makes the receiver the active app.
Source§

fn m_deactivate(&mut self)

Deactivates the receiver.
Source§

fn m_disable_relaunch_on_login(&mut self)

Disables relaunching the app on login.
Source§

fn m_enable_relaunch_on_login(&mut self)

Enables relaunching the app on login.
Source§

fn m_register_for_remote_notifications(&mut self)

Register for notifications sent by Apple Push Notification service (APNs).
Source§

fn m_unregister_for_remote_notifications(&mut self)

Unregister for notifications received from Apple Push Notification service.
Source§

fn m_reply_to_open_or_print(&self, response: NSApplicationDelegateReply)

Handles errors that might occur when the user attempts to open or print files.
Source§

fn m_activation_policy(&self) -> NSApplicationActivationPolicy

Returns the app’s activation policy.
Source§

fn m_set_activation_policy(&mut self, policy: NSApplicationActivationPolicy)

Sets the app’s activation policy. Read more
Source§

fn p_main_menu(&self) -> NSMenu

The app’s main menu bar.
Source§

fn p_set_main_menu(&mut self, menu: NSMenu)

Sets the app’s main menu bar.
Source§

impl PNSObject for NSApplication<'_>

Source§

fn m_class<'a>() -> &'a Class

Returns the class object for the receiver’s class.
Source§

fn m_self(&self) -> id

Returns the receiver.
Source§

fn m_new() -> Self
where Self: Sized + FromId,

Allocates a new instance of the receiving class, sends it an init message, and returns the initialized object.
Source§

fn m_alloc() -> Self
where Self: Sized + FromId,

Returns a new instance of the receiving class.
Source§

fn m_initialize()

Initializes the class before it receives its first message.
Source§

fn ip_superclass<'a>() -> Option<&'a Class>

Returns the class object for the receiver’s superclass.
Source§

fn m_is_equal(&self, object: &Self) -> bool

Returns a Boolean value that indicates whether the receiver and a given object are equal.
Source§

fn p_hash(&self) -> UInt

Returns an integer that can be used as a table address in a hash table structure.
Source§

fn m_is_kind_of_class(&self, class: Class) -> bool

Returns a Boolean value that indicates whether the receiver is an instance of given class or an instance of any class that inherits from that class.
Source§

fn m_is_member_of_class(&self, class: Class) -> bool

Returns a Boolean value that indicates whether the receiver is an instance of a given class.
Source§

fn m_responds_to_selector(&self, selector: Sel) -> bool

Returns a Boolean value that indicates whether the receiver implements or inherits a method that can respond to a specified message.
Source§

fn m_conforms_to_protocol(&self, protocol: Protocol) -> bool

Returns a Boolean value that indicates whether the receiver conforms to a given protocol.
Source§

fn p_description(&self) -> NSString

A textual representation of the receiver.
Source§

fn p_debug_description(&self) -> NSString

A textual representation of the receiver to use with a debugger.
Source§

fn m_perform_selector(&self, selector: Sel) -> id

Sends a specified message to the receiver and returns the result of the message.
Source§

fn m_perform_selector_with_object(&self, selector: Sel, with_object: id) -> id

Sends a message to the receiver with an object as the argument.
Source§

fn m_is_proxy(&self) -> bool

Returns a Boolean value that indicates whether the receiver does not descend from NSObject.
Source§

impl ToId for NSApplication<'_>

Source§

fn to_id(self) -> id

Returns id representation of the object.
Source§

impl INSResponder for NSApplication<'_>

Auto Trait Implementations§

§

impl<'app, M> Freeze for NSApplication<'app, M>

§

impl<'app, M> RefUnwindSafe for NSApplication<'app, M>
where M: RefUnwindSafe,

§

impl<'app, M> Send for NSApplication<'app, M>
where M: Sync,

§

impl<'app, M> Sync for NSApplication<'app, M>
where M: Sync,

§

impl<'app, M> Unpin for NSApplication<'app, M>

§

impl<'app, M> UnwindSafe for NSApplication<'app, M>
where M: RefUnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.