icrate 0.1.2

Bindings to Apple's frameworks
Documentation
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use crate::common::*;
use crate::AppKit::*;
use crate::CoreData::*;
use crate::Foundation::*;

ns_options!(
    #[underlying(NSUInteger)]
    pub enum NSApplicationActivationOptions {
        NSApplicationActivateAllWindows = 1 << 0,
        #[deprecated = "ignoringOtherApps is deprecated in macOS 14 and will have no effect."]
        NSApplicationActivateIgnoringOtherApps = 1 << 1,
    }
);

ns_enum!(
    #[underlying(NSInteger)]
    pub enum NSApplicationActivationPolicy {
        NSApplicationActivationPolicyRegular = 0,
        NSApplicationActivationPolicyAccessory = 1,
        NSApplicationActivationPolicyProhibited = 2,
    }
);

extern_class!(
    #[derive(Debug, PartialEq, Eq, Hash)]
    #[cfg(feature = "AppKit_NSRunningApplication")]
    pub struct NSRunningApplication;

    #[cfg(feature = "AppKit_NSRunningApplication")]
    unsafe impl ClassType for NSRunningApplication {
        type Super = NSObject;
        type Mutability = InteriorMutable;
    }
);

#[cfg(feature = "AppKit_NSRunningApplication")]
unsafe impl NSObjectProtocol for NSRunningApplication {}

extern_methods!(
    #[cfg(feature = "AppKit_NSRunningApplication")]
    unsafe impl NSRunningApplication {
        #[method(isTerminated)]
        pub unsafe fn isTerminated(&self) -> bool;

        #[method(isFinishedLaunching)]
        pub unsafe fn isFinishedLaunching(&self) -> bool;

        #[method(isHidden)]
        pub unsafe fn isHidden(&self) -> bool;

        #[method(isActive)]
        pub unsafe fn isActive(&self) -> bool;

        #[method(ownsMenuBar)]
        pub unsafe fn ownsMenuBar(&self) -> bool;

        #[method(activationPolicy)]
        pub unsafe fn activationPolicy(&self) -> NSApplicationActivationPolicy;

        #[cfg(feature = "Foundation_NSString")]
        #[method_id(@__retain_semantics Other localizedName)]
        pub unsafe fn localizedName(&self) -> Option<Id<NSString>>;

        #[cfg(feature = "Foundation_NSString")]
        #[method_id(@__retain_semantics Other bundleIdentifier)]
        pub unsafe fn bundleIdentifier(&self) -> Option<Id<NSString>>;

        #[cfg(feature = "Foundation_NSURL")]
        #[method_id(@__retain_semantics Other bundleURL)]
        pub unsafe fn bundleURL(&self) -> Option<Id<NSURL>>;

        #[cfg(feature = "Foundation_NSURL")]
        #[method_id(@__retain_semantics Other executableURL)]
        pub unsafe fn executableURL(&self) -> Option<Id<NSURL>>;

        #[cfg(feature = "Foundation_NSDate")]
        #[method_id(@__retain_semantics Other launchDate)]
        pub unsafe fn launchDate(&self) -> Option<Id<NSDate>>;

        #[cfg(feature = "AppKit_NSImage")]
        #[method_id(@__retain_semantics Other icon)]
        pub unsafe fn icon(&self) -> Option<Id<NSImage>>;

        #[method(executableArchitecture)]
        pub unsafe fn executableArchitecture(&self) -> NSInteger;

        #[method(hide)]
        pub unsafe fn hide(&self) -> bool;

        #[method(unhide)]
        pub unsafe fn unhide(&self) -> bool;

        #[method(activateFromApplication:options:)]
        pub unsafe fn activateFromApplication_options(
            &self,
            application: &NSRunningApplication,
            options: NSApplicationActivationOptions,
        ) -> bool;

        #[method(activateWithOptions:)]
        pub unsafe fn activateWithOptions(&self, options: NSApplicationActivationOptions) -> bool;

        #[method(terminate)]
        pub unsafe fn terminate(&self) -> bool;

        #[method(forceTerminate)]
        pub unsafe fn forceTerminate(&self) -> bool;

        #[cfg(all(feature = "Foundation_NSArray", feature = "Foundation_NSString"))]
        #[method_id(@__retain_semantics Other runningApplicationsWithBundleIdentifier:)]
        pub unsafe fn runningApplicationsWithBundleIdentifier(
            bundle_identifier: &NSString,
        ) -> Id<NSArray<NSRunningApplication>>;

        #[method_id(@__retain_semantics Other currentApplication)]
        pub unsafe fn currentApplication() -> Id<NSRunningApplication>;

        #[method(terminateAutomaticallyTerminableApplications)]
        pub unsafe fn terminateAutomaticallyTerminableApplications();
    }
);

extern_methods!(
    /// Methods declared on superclass `NSObject`
    #[cfg(feature = "AppKit_NSRunningApplication")]
    unsafe impl NSRunningApplication {
        #[method_id(@__retain_semantics Init init)]
        pub unsafe fn init(this: Allocated<Self>) -> Id<Self>;

        #[method_id(@__retain_semantics New new)]
        pub unsafe fn new() -> Id<Self>;
    }
);

extern_methods!(
    /// NSWorkspaceRunningApplications
    #[cfg(feature = "AppKit_NSWorkspace")]
    unsafe impl NSWorkspace {
        #[cfg(all(
            feature = "AppKit_NSRunningApplication",
            feature = "Foundation_NSArray"
        ))]
        #[method_id(@__retain_semantics Other runningApplications)]
        pub unsafe fn runningApplications(&self) -> Id<NSArray<NSRunningApplication>>;
    }
);