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::*;

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

#[cfg(feature = "NSTouchBarItem")]
extern_conformance!(
    unsafe impl NSCoding for NSCustomTouchBarItem {}
);

#[cfg(feature = "NSTouchBarItem")]
extern_conformance!(
    unsafe impl NSObjectProtocol for NSCustomTouchBarItem {}
);

#[cfg(feature = "NSTouchBarItem")]
impl NSCustomTouchBarItem {
    extern_methods!(
        #[cfg(all(feature = "NSResponder", feature = "NSView"))]
        #[unsafe(method(view))]
        #[unsafe(method_family = none)]
        pub fn view(&self) -> Retained<NSView>;

        #[cfg(all(feature = "NSResponder", feature = "NSView"))]
        /// Setter for [`view`][Self::view].
        #[unsafe(method(setView:))]
        #[unsafe(method_family = none)]
        pub fn setView(&self, view: &NSView);

        #[cfg(all(feature = "NSResponder", feature = "NSViewController"))]
        #[unsafe(method(viewController))]
        #[unsafe(method_family = none)]
        pub fn viewController(&self) -> Option<Retained<NSViewController>>;

        #[cfg(all(feature = "NSResponder", feature = "NSViewController"))]
        /// Setter for [`viewController`][Self::viewController].
        #[unsafe(method(setViewController:))]
        #[unsafe(method_family = none)]
        pub fn setViewController(&self, view_controller: Option<&NSViewController>);

        #[unsafe(method(customizationLabel))]
        #[unsafe(method_family = none)]
        pub fn customizationLabel(&self) -> Retained<NSString>;

        /// Setter for [`customizationLabel`][Self::customizationLabel].
        ///
        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
        #[unsafe(method(setCustomizationLabel:))]
        #[unsafe(method_family = none)]
        pub fn setCustomizationLabel(&self, customization_label: Option<&NSString>);
    );
}

/// Methods declared on superclass `NSTouchBarItem`.
#[cfg(feature = "NSTouchBarItem")]
impl NSCustomTouchBarItem {
    extern_methods!(
        #[unsafe(method(initWithIdentifier:))]
        #[unsafe(method_family = init)]
        pub fn initWithIdentifier(
            this: Allocated<Self>,
            identifier: &NSTouchBarItemIdentifier,
        ) -> Retained<Self>;

        /// # Safety
        ///
        /// `coder` possibly has further requirements.
        #[unsafe(method(initWithCoder:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithCoder(
            this: Allocated<Self>,
            coder: &NSCoder,
        ) -> Option<Retained<Self>>;

        #[unsafe(method(init))]
        #[unsafe(method_family = init)]
        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
    );
}

/// Methods declared on superclass `NSObject`.
#[cfg(feature = "NSTouchBarItem")]
impl NSCustomTouchBarItem {
    extern_methods!(
        #[unsafe(method(new))]
        #[unsafe(method_family = new)]
        pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
    );
}