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/nsform?language=objc)
    #[unsafe(super(NSMatrix, NSControl, NSView, NSResponder, NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    #[cfg(all(
        feature = "NSControl",
        feature = "NSMatrix",
        feature = "NSResponder",
        feature = "NSView"
    ))]
    #[deprecated = "Use NSTextField directly instead, and consider NSStackView for layout assistance"]
    pub struct NSForm;
);

#[cfg(all(
    feature = "NSAccessibilityProtocols",
    feature = "NSControl",
    feature = "NSMatrix",
    feature = "NSResponder",
    feature = "NSView"
))]
extern_conformance!(
    unsafe impl NSAccessibility for NSForm {}
);

#[cfg(all(
    feature = "NSAccessibilityProtocols",
    feature = "NSControl",
    feature = "NSMatrix",
    feature = "NSResponder",
    feature = "NSView"
))]
extern_conformance!(
    unsafe impl NSAccessibilityElementProtocol for NSForm {}
);

#[cfg(all(
    feature = "NSAnimation",
    feature = "NSControl",
    feature = "NSMatrix",
    feature = "NSResponder",
    feature = "NSView"
))]
extern_conformance!(
    unsafe impl NSAnimatablePropertyContainer for NSForm {}
);

#[cfg(all(
    feature = "NSAppearance",
    feature = "NSControl",
    feature = "NSMatrix",
    feature = "NSResponder",
    feature = "NSView"
))]
extern_conformance!(
    unsafe impl NSAppearanceCustomization for NSForm {}
);

#[cfg(all(
    feature = "NSControl",
    feature = "NSMatrix",
    feature = "NSResponder",
    feature = "NSView"
))]
extern_conformance!(
    unsafe impl NSCoding for NSForm {}
);

#[cfg(all(
    feature = "NSControl",
    feature = "NSDragging",
    feature = "NSMatrix",
    feature = "NSResponder",
    feature = "NSView"
))]
extern_conformance!(
    unsafe impl NSDraggingDestination for NSForm {}
);

#[cfg(all(
    feature = "NSControl",
    feature = "NSMatrix",
    feature = "NSResponder",
    feature = "NSView"
))]
extern_conformance!(
    unsafe impl NSObjectProtocol for NSForm {}
);

#[cfg(all(
    feature = "NSControl",
    feature = "NSMatrix",
    feature = "NSResponder",
    feature = "NSUserInterfaceItemIdentification",
    feature = "NSView"
))]
extern_conformance!(
    unsafe impl NSUserInterfaceItemIdentification for NSForm {}
);

#[cfg(all(
    feature = "NSControl",
    feature = "NSMatrix",
    feature = "NSResponder",
    feature = "NSUserInterfaceValidation",
    feature = "NSView"
))]
extern_conformance!(
    unsafe impl NSUserInterfaceValidations for NSForm {}
);

#[cfg(all(
    feature = "NSControl",
    feature = "NSMatrix",
    feature = "NSResponder",
    feature = "NSView"
))]
extern_conformance!(
    unsafe impl NSViewToolTipOwner for NSForm {}
);

#[cfg(all(
    feature = "NSControl",
    feature = "NSMatrix",
    feature = "NSResponder",
    feature = "NSView"
))]
impl NSForm {
    extern_methods!(
        #[unsafe(method(indexOfSelectedItem))]
        #[unsafe(method_family = none)]
        pub fn indexOfSelectedItem(&self) -> NSInteger;

        #[cfg(feature = "objc2-core-foundation")]
        #[unsafe(method(setEntryWidth:))]
        #[unsafe(method_family = none)]
        pub fn setEntryWidth(&self, width: CGFloat);

        #[cfg(feature = "objc2-core-foundation")]
        #[unsafe(method(setInterlineSpacing:))]
        #[unsafe(method_family = none)]
        pub fn setInterlineSpacing(&self, spacing: CGFloat);

        #[unsafe(method(setBordered:))]
        #[unsafe(method_family = none)]
        pub fn setBordered(&self, flag: bool);

        #[unsafe(method(setBezeled:))]
        #[unsafe(method_family = none)]
        pub fn setBezeled(&self, flag: bool);

        #[cfg(feature = "NSText")]
        #[unsafe(method(setTitleAlignment:))]
        #[unsafe(method_family = none)]
        pub fn setTitleAlignment(&self, mode: NSTextAlignment);

        #[cfg(feature = "NSText")]
        #[unsafe(method(setTextAlignment:))]
        #[unsafe(method_family = none)]
        pub fn setTextAlignment(&self, mode: NSTextAlignment);

        #[cfg(feature = "NSFont")]
        #[unsafe(method(setTitleFont:))]
        #[unsafe(method_family = none)]
        pub fn setTitleFont(&self, font_obj: &NSFont);

        #[cfg(feature = "NSFont")]
        #[unsafe(method(setTextFont:))]
        #[unsafe(method_family = none)]
        pub fn setTextFont(&self, font_obj: &NSFont);

        #[unsafe(method(cellAtIndex:))]
        #[unsafe(method_family = none)]
        pub fn cellAtIndex(&self, index: NSInteger) -> Option<Retained<AnyObject>>;

        #[unsafe(method(drawCellAtIndex:))]
        #[unsafe(method_family = none)]
        pub fn drawCellAtIndex(&self, index: NSInteger);

        #[cfg(all(feature = "NSActionCell", feature = "NSCell", feature = "NSFormCell"))]
        #[unsafe(method(addEntry:))]
        #[unsafe(method_family = none)]
        pub fn addEntry(&self, title: &NSString) -> Retained<NSFormCell>;

        #[cfg(all(feature = "NSActionCell", feature = "NSCell", feature = "NSFormCell"))]
        #[unsafe(method(insertEntry:atIndex:))]
        #[unsafe(method_family = none)]
        pub fn insertEntry_atIndex(
            &self,
            title: &NSString,
            index: NSInteger,
        ) -> Option<Retained<NSFormCell>>;

        #[unsafe(method(removeEntryAtIndex:))]
        #[unsafe(method_family = none)]
        pub fn removeEntryAtIndex(&self, index: NSInteger);

        #[unsafe(method(indexOfCellWithTag:))]
        #[unsafe(method_family = none)]
        pub fn indexOfCellWithTag(&self, tag: NSInteger) -> NSInteger;

        #[unsafe(method(selectTextAtIndex:))]
        #[unsafe(method_family = none)]
        pub fn selectTextAtIndex(&self, index: NSInteger);

        #[unsafe(method(setFrameSize:))]
        #[unsafe(method_family = none)]
        pub fn setFrameSize(&self, new_size: NSSize);

        #[cfg(feature = "NSText")]
        #[unsafe(method(setTitleBaseWritingDirection:))]
        #[unsafe(method_family = none)]
        pub fn setTitleBaseWritingDirection(&self, writing_direction: NSWritingDirection);

        #[cfg(feature = "NSText")]
        #[unsafe(method(setTextBaseWritingDirection:))]
        #[unsafe(method_family = none)]
        pub fn setTextBaseWritingDirection(&self, writing_direction: NSWritingDirection);

        #[cfg(feature = "objc2-core-foundation")]
        #[unsafe(method(setPreferredTextFieldWidth:))]
        #[unsafe(method_family = none)]
        pub fn setPreferredTextFieldWidth(&self, preferred_width: CGFloat);

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

/// Methods declared on superclass `NSMatrix`.
#[cfg(all(
    feature = "NSControl",
    feature = "NSMatrix",
    feature = "NSResponder",
    feature = "NSView"
))]
impl NSForm {
    extern_methods!(
        #[unsafe(method(initWithFrame:))]
        #[unsafe(method_family = init)]
        pub fn initWithFrame(this: Allocated<Self>, frame_rect: NSRect) -> Retained<Self>;

        #[cfg(feature = "NSCell")]
        #[unsafe(method(initWithFrame:mode:prototype:numberOfRows:numberOfColumns:))]
        #[unsafe(method_family = init)]
        pub fn initWithFrame_mode_prototype_numberOfRows_numberOfColumns(
            this: Allocated<Self>,
            frame_rect: NSRect,
            mode: NSMatrixMode,
            cell: &NSCell,
            rows_high: NSInteger,
            cols_wide: NSInteger,
        ) -> Retained<Self>;

        /// # Safety
        ///
        /// `factory_id` probably has further requirements.
        #[unsafe(method(initWithFrame:mode:cellClass:numberOfRows:numberOfColumns:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithFrame_mode_cellClass_numberOfRows_numberOfColumns(
            this: Allocated<Self>,
            frame_rect: NSRect,
            mode: NSMatrixMode,
            factory_id: Option<&AnyClass>,
            rows_high: NSInteger,
            cols_wide: NSInteger,
        ) -> Retained<Self>;
    );
}

/// Methods declared on superclass `NSControl`.
#[cfg(all(
    feature = "NSControl",
    feature = "NSMatrix",
    feature = "NSResponder",
    feature = "NSView"
))]
impl NSForm {
    extern_methods!(
        /// # 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>>;
    );
}

/// Methods declared on superclass `NSResponder`.
#[cfg(all(
    feature = "NSControl",
    feature = "NSMatrix",
    feature = "NSResponder",
    feature = "NSView"
))]
impl NSForm {
    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 = "NSControl",
    feature = "NSMatrix",
    feature = "NSResponder",
    feature = "NSView"
))]
impl NSForm {
    extern_methods!(
        #[unsafe(method(new))]
        #[unsafe(method_family = new)]
        pub fn new(mtm: MainThreadMarker) -> Retained<Self>;
    );
}