use crate::common::*;
use crate::AppKit::*;
use crate::CoreData::*;
use crate::Foundation::*;
ns_options!(
#[underlying(NSUInteger)]
pub enum NSApplicationActivationOptions {
NSApplicationActivateAllWindows = 1 << 0,
NSApplicationActivateIgnoringOtherApps = 1 << 1,
}
);
ns_enum!(
#[underlying(NSInteger)]
pub enum NSApplicationActivationPolicy {
NSApplicationActivationPolicyRegular = 0,
NSApplicationActivationPolicyAccessory = 1,
NSApplicationActivationPolicyProhibited = 2,
}
);
extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct NSRunningApplication;
unsafe impl ClassType for NSRunningApplication {
type Super = NSObject;
}
);
extern_methods!(
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;
#[method_id(@__retain_semantics Other localizedName)]
pub unsafe fn localizedName(&self) -> Option<Id<NSString, Shared>>;
#[method_id(@__retain_semantics Other bundleIdentifier)]
pub unsafe fn bundleIdentifier(&self) -> Option<Id<NSString, Shared>>;
#[method_id(@__retain_semantics Other bundleURL)]
pub unsafe fn bundleURL(&self) -> Option<Id<NSURL, Shared>>;
#[method_id(@__retain_semantics Other executableURL)]
pub unsafe fn executableURL(&self) -> Option<Id<NSURL, Shared>>;
#[method_id(@__retain_semantics Other launchDate)]
pub unsafe fn launchDate(&self) -> Option<Id<NSDate, Shared>>;
#[method_id(@__retain_semantics Other icon)]
pub unsafe fn icon(&self) -> Option<Id<NSImage, Shared>>;
#[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(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;
#[method_id(@__retain_semantics Other runningApplicationsWithBundleIdentifier:)]
pub unsafe fn runningApplicationsWithBundleIdentifier(
bundleIdentifier: &NSString,
) -> Id<NSArray<NSRunningApplication>, Shared>;
#[method_id(@__retain_semantics Other currentApplication)]
pub unsafe fn currentApplication() -> Id<NSRunningApplication, Shared>;
#[method(terminateAutomaticallyTerminableApplications)]
pub unsafe fn terminateAutomaticallyTerminableApplications();
}
);
extern_methods!(
unsafe impl NSWorkspace {
#[method_id(@__retain_semantics Other runningApplications)]
pub unsafe fn runningApplications(&self) -> Id<NSArray<NSRunningApplication>, Shared>;
}
);