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::*;
#[cfg(feature = "objc2-core-foundation")]
use objc2_core_foundation::*;
use objc2_foundation::*;

use crate::*;

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

#[cfg(all(
    feature = "NSAccessibilityProtocols",
    feature = "NSActionCell",
    feature = "NSCell"
))]
extern_conformance!(
    unsafe impl NSAccessibility for NSFormCell {}
);

#[cfg(all(
    feature = "NSAccessibilityProtocols",
    feature = "NSActionCell",
    feature = "NSCell"
))]
extern_conformance!(
    unsafe impl NSAccessibilityElementProtocol for NSFormCell {}
);

#[cfg(all(feature = "NSActionCell", feature = "NSCell"))]
extern_conformance!(
    unsafe impl NSCoding for NSFormCell {}
);

#[cfg(all(feature = "NSActionCell", feature = "NSCell"))]
extern_conformance!(
    unsafe impl NSCopying for NSFormCell {}
);

#[cfg(all(feature = "NSActionCell", feature = "NSCell"))]
unsafe impl CopyingHelper for NSFormCell {
    type Result = Self;
}

#[cfg(all(feature = "NSActionCell", feature = "NSCell"))]
extern_conformance!(
    unsafe impl NSObjectProtocol for NSFormCell {}
);

#[cfg(all(
    feature = "NSActionCell",
    feature = "NSCell",
    feature = "NSUserInterfaceItemIdentification"
))]
extern_conformance!(
    unsafe impl NSUserInterfaceItemIdentification for NSFormCell {}
);

#[cfg(all(feature = "NSActionCell", feature = "NSCell"))]
impl NSFormCell {
    extern_methods!(
        #[unsafe(method(initTextCell:))]
        #[unsafe(method_family = init)]
        pub fn initTextCell(this: Allocated<Self>, string: Option<&NSString>) -> Retained<Self>;

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

        #[cfg(feature = "NSImage")]
        #[unsafe(method(initImageCell:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initImageCell(
            this: Allocated<Self>,
            image: Option<&NSImage>,
        ) -> Retained<Self>;

        #[cfg(feature = "objc2-core-foundation")]
        #[unsafe(method(titleWidth:))]
        #[unsafe(method_family = none)]
        pub fn titleWidth_(&self, size: NSSize) -> CGFloat;

        #[cfg(feature = "objc2-core-foundation")]
        #[unsafe(method(titleWidth))]
        #[unsafe(method_family = none)]
        pub fn titleWidth(&self) -> CGFloat;

        #[cfg(feature = "objc2-core-foundation")]
        /// Setter for [`titleWidth`][Self::titleWidth].
        #[unsafe(method(setTitleWidth:))]
        #[unsafe(method_family = none)]
        pub fn setTitleWidth(&self, title_width: CGFloat);

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

        /// Setter for [`title`][Self::title].
        ///
        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
        #[unsafe(method(setTitle:))]
        #[unsafe(method_family = none)]
        pub fn setTitle(&self, title: &NSString);

        #[cfg(feature = "NSFont")]
        #[unsafe(method(titleFont))]
        #[unsafe(method_family = none)]
        pub fn titleFont(&self) -> Retained<NSFont>;

        #[cfg(feature = "NSFont")]
        /// Setter for [`titleFont`][Self::titleFont].
        #[unsafe(method(setTitleFont:))]
        #[unsafe(method_family = none)]
        pub fn setTitleFont(&self, title_font: &NSFont);

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

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

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

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

        /// Setter for [`placeholderAttributedString`][Self::placeholderAttributedString].
        ///
        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
        #[unsafe(method(setPlaceholderAttributedString:))]
        #[unsafe(method_family = none)]
        pub fn setPlaceholderAttributedString(
            &self,
            placeholder_attributed_string: Option<&NSAttributedString>,
        );

        #[cfg(feature = "NSText")]
        #[unsafe(method(titleAlignment))]
        #[unsafe(method_family = none)]
        pub fn titleAlignment(&self) -> NSTextAlignment;

        #[cfg(feature = "NSText")]
        /// Setter for [`titleAlignment`][Self::titleAlignment].
        #[unsafe(method(setTitleAlignment:))]
        #[unsafe(method_family = none)]
        pub fn setTitleAlignment(&self, title_alignment: NSTextAlignment);

        #[cfg(feature = "NSText")]
        #[unsafe(method(titleBaseWritingDirection))]
        #[unsafe(method_family = none)]
        pub fn titleBaseWritingDirection(&self) -> NSWritingDirection;

        #[cfg(feature = "NSText")]
        /// Setter for [`titleBaseWritingDirection`][Self::titleBaseWritingDirection].
        #[unsafe(method(setTitleBaseWritingDirection:))]
        #[unsafe(method_family = none)]
        pub fn setTitleBaseWritingDirection(
            &self,
            title_base_writing_direction: NSWritingDirection,
        );

        #[cfg(feature = "objc2-core-foundation")]
        #[unsafe(method(preferredTextFieldWidth))]
        #[unsafe(method_family = none)]
        pub fn preferredTextFieldWidth(&self) -> CGFloat;

        #[cfg(feature = "objc2-core-foundation")]
        /// Setter for [`preferredTextFieldWidth`][Self::preferredTextFieldWidth].
        #[unsafe(method(setPreferredTextFieldWidth:))]
        #[unsafe(method_family = none)]
        pub fn setPreferredTextFieldWidth(&self, preferred_text_field_width: CGFloat);
    );
}

/// Methods declared on superclass `NSCell`.
#[cfg(all(feature = "NSActionCell", feature = "NSCell"))]
impl NSFormCell {
    extern_methods!(
        #[unsafe(method(init))]
        #[unsafe(method_family = init)]
        pub fn init(this: Allocated<Self>) -> Retained<Self>;
    );
}

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

/// NSKeyboardUI.
#[cfg(all(feature = "NSActionCell", feature = "NSCell"))]
impl NSFormCell {
    extern_methods!(
        /// # Safety
        ///
        /// `string_with_ampersand` might not allow `None`.
        #[deprecated]
        #[unsafe(method(setTitleWithMnemonic:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setTitleWithMnemonic(&self, string_with_ampersand: Option<&NSString>);
    );
}

/// NSFormCellAttributedStringMethods.
#[cfg(all(feature = "NSActionCell", feature = "NSCell"))]
impl NSFormCell {
    extern_methods!(
        #[unsafe(method(attributedTitle))]
        #[unsafe(method_family = none)]
        pub fn attributedTitle(&self) -> Retained<NSAttributedString>;

        /// Setter for [`attributedTitle`][Self::attributedTitle].
        ///
        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
        #[unsafe(method(setAttributedTitle:))]
        #[unsafe(method_family = none)]
        pub fn setAttributedTitle(&self, attributed_title: &NSAttributedString);
    );
}