objc2-app-kit 0.3.2

Bindings to the AppKit framework
Documentation
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use core::ffi::*;
use core::ptr::NonNull;
use objc2::__framework_prelude::*;
use objc2_foundation::*;

use crate::*;

/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nscolorlistname?language=objc)
pub type NSColorListName = NSString;

/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nscolorname?language=objc)
pub type NSColorName = NSString;

extern_class!(
    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nscolorlist?language=objc)
    #[unsafe(super(NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    pub struct NSColorList;
);

extern_conformance!(
    unsafe impl NSCoding for NSColorList {}
);

extern_conformance!(
    unsafe impl NSObjectProtocol for NSColorList {}
);

extern_conformance!(
    unsafe impl NSSecureCoding for NSColorList {}
);

impl NSColorList {
    extern_methods!(
        #[unsafe(method(availableColorLists))]
        #[unsafe(method_family = none)]
        pub fn availableColorLists() -> Retained<NSArray<NSColorList>>;

        #[unsafe(method(colorListNamed:))]
        #[unsafe(method_family = none)]
        pub fn colorListNamed(name: &NSColorListName) -> Option<Retained<NSColorList>>;

        #[unsafe(method(initWithName:))]
        #[unsafe(method_family = init)]
        pub fn initWithName(this: Allocated<Self>, name: &NSColorListName) -> Retained<Self>;

        #[unsafe(method(initWithName:fromFile:))]
        #[unsafe(method_family = init)]
        pub fn initWithName_fromFile(
            this: Allocated<Self>,
            name: &NSColorListName,
            path: Option<&NSString>,
        ) -> Option<Retained<Self>>;

        #[unsafe(method(name))]
        #[unsafe(method_family = none)]
        pub fn name(&self) -> Option<Retained<NSColorListName>>;

        #[cfg(feature = "NSColor")]
        #[unsafe(method(setColor:forKey:))]
        #[unsafe(method_family = none)]
        pub fn setColor_forKey(&self, color: &NSColor, key: &NSColorName);

        #[cfg(feature = "NSColor")]
        #[unsafe(method(insertColor:key:atIndex:))]
        #[unsafe(method_family = none)]
        pub fn insertColor_key_atIndex(&self, color: &NSColor, key: &NSColorName, loc: NSUInteger);

        #[unsafe(method(removeColorWithKey:))]
        #[unsafe(method_family = none)]
        pub fn removeColorWithKey(&self, key: &NSColorName);

        #[cfg(feature = "NSColor")]
        #[unsafe(method(colorWithKey:))]
        #[unsafe(method_family = none)]
        pub fn colorWithKey(&self, key: &NSColorName) -> Option<Retained<NSColor>>;

        #[unsafe(method(allKeys))]
        #[unsafe(method_family = none)]
        pub fn allKeys(&self) -> Retained<NSArray<NSColorName>>;

        #[unsafe(method(isEditable))]
        #[unsafe(method_family = none)]
        pub fn isEditable(&self) -> bool;

        #[unsafe(method(writeToURL:error:_))]
        #[unsafe(method_family = none)]
        pub fn writeToURL_error(&self, url: Option<&NSURL>) -> Result<(), Retained<NSError>>;

        #[deprecated = "Use -writeToURL:error: instead"]
        #[unsafe(method(writeToFile:))]
        #[unsafe(method_family = none)]
        pub fn writeToFile(&self, path: Option<&NSString>) -> bool;

        #[unsafe(method(removeFile))]
        #[unsafe(method_family = none)]
        pub fn removeFile(&self);
    );
}

/// Methods declared on superclass `NSObject`.
impl NSColorList {
    extern_methods!(
        #[unsafe(method(init))]
        #[unsafe(method_family = init)]
        pub fn init(this: Allocated<Self>) -> Retained<Self>;

        #[unsafe(method(new))]
        #[unsafe(method_family = new)]
        pub fn new() -> Retained<Self>;
    );
}

impl DefaultRetained for NSColorList {
    #[inline]
    fn default_retained() -> Retained<Self> {
        Self::new()
    }
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nscolorlistdidchangenotification?language=objc)
    pub static NSColorListDidChangeNotification: &'static NSNotificationName;
}