//! 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_protocol!(
    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nstextattachmentcellprotocol?language=objc)
    #[name = "NSTextAttachmentCell"]
    pub unsafe trait NSTextAttachmentCellProtocol: NSObjectProtocol {
        #[cfg(all(feature = "NSResponder", feature = "NSView"))]
        #[unsafe(method(drawWithFrame:inView:))]
        #[unsafe(method_family = none)]
        unsafe fn drawWithFrame_inView(
            &self,
            cell_frame: NSRect,
            control_view: Option<&NSView>,
            mtm: MainThreadMarker,
        );

        #[unsafe(method(wantsToTrackMouse))]
        #[unsafe(method_family = none)]
        unsafe fn wantsToTrackMouse(&self, mtm: MainThreadMarker) -> bool;

        #[cfg(all(feature = "NSResponder", feature = "NSView"))]
        #[unsafe(method(highlight:withFrame:inView:))]
        #[unsafe(method_family = none)]
        unsafe fn highlight_withFrame_inView(
            &self,
            flag: bool,
            cell_frame: NSRect,
            control_view: Option<&NSView>,
            mtm: MainThreadMarker,
        );

        #[cfg(all(feature = "NSEvent", feature = "NSResponder", feature = "NSView"))]
        #[unsafe(method(trackMouse:inRect:ofView:untilMouseUp:))]
        #[unsafe(method_family = none)]
        unsafe fn trackMouse_inRect_ofView_untilMouseUp(
            &self,
            the_event: &NSEvent,
            cell_frame: NSRect,
            control_view: Option<&NSView>,
            flag: bool,
            mtm: MainThreadMarker,
        ) -> bool;

        #[unsafe(method(cellSize))]
        #[unsafe(method_family = none)]
        unsafe fn cellSize(&self) -> NSSize;

        #[unsafe(method(cellBaselineOffset))]
        #[unsafe(method_family = none)]
        unsafe fn cellBaselineOffset(&self) -> NSPoint;

        #[cfg(feature = "NSTextAttachment")]
        #[unsafe(method(attachment))]
        #[unsafe(method_family = none)]
        unsafe fn attachment(&self) -> Option<Retained<NSTextAttachment>>;

        #[cfg(feature = "NSTextAttachment")]
        /// Setter for [`attachment`][Self::attachment].
        #[unsafe(method(setAttachment:))]
        #[unsafe(method_family = none)]
        unsafe fn setAttachment(&self, attachment: Option<&NSTextAttachment>);

        #[cfg(all(feature = "NSResponder", feature = "NSView"))]
        #[unsafe(method(drawWithFrame:inView:characterIndex:))]
        #[unsafe(method_family = none)]
        unsafe fn drawWithFrame_inView_characterIndex(
            &self,
            cell_frame: NSRect,
            control_view: Option<&NSView>,
            char_index: NSUInteger,
            mtm: MainThreadMarker,
        );

        #[cfg(all(
            feature = "NSLayoutManager",
            feature = "NSResponder",
            feature = "NSView"
        ))]
        #[unsafe(method(drawWithFrame:inView:characterIndex:layoutManager:))]
        #[unsafe(method_family = none)]
        unsafe fn drawWithFrame_inView_characterIndex_layoutManager(
            &self,
            cell_frame: NSRect,
            control_view: Option<&NSView>,
            char_index: NSUInteger,
            layout_manager: &NSLayoutManager,
            mtm: MainThreadMarker,
        );

        #[cfg(all(feature = "NSEvent", feature = "NSResponder", feature = "NSView"))]
        #[unsafe(method(wantsToTrackMouseForEvent:inRect:ofView:atCharacterIndex:))]
        #[unsafe(method_family = none)]
        unsafe fn wantsToTrackMouseForEvent_inRect_ofView_atCharacterIndex(
            &self,
            the_event: &NSEvent,
            cell_frame: NSRect,
            control_view: Option<&NSView>,
            char_index: NSUInteger,
            mtm: MainThreadMarker,
        ) -> bool;

        #[cfg(all(feature = "NSEvent", feature = "NSResponder", feature = "NSView"))]
        #[unsafe(method(trackMouse:inRect:ofView:atCharacterIndex:untilMouseUp:))]
        #[unsafe(method_family = none)]
        unsafe fn trackMouse_inRect_ofView_atCharacterIndex_untilMouseUp(
            &self,
            the_event: &NSEvent,
            cell_frame: NSRect,
            control_view: Option<&NSView>,
            char_index: NSUInteger,
            flag: bool,
            mtm: MainThreadMarker,
        ) -> bool;

        #[cfg(feature = "NSTextContainer")]
        #[unsafe(method(cellFrameForTextContainer:proposedLineFragment:glyphPosition:characterIndex:))]
        #[unsafe(method_family = none)]
        unsafe fn cellFrameForTextContainer_proposedLineFragment_glyphPosition_characterIndex(
            &self,
            text_container: &NSTextContainer,
            line_frag: NSRect,
            position: NSPoint,
            char_index: NSUInteger,
        ) -> NSRect;
    }
);

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

#[cfg(all(feature = "NSAccessibilityProtocols", feature = "NSCell"))]
unsafe impl NSAccessibility for NSTextAttachmentCell {}

#[cfg(all(feature = "NSAccessibilityProtocols", feature = "NSCell"))]
unsafe impl NSAccessibilityElementProtocol for NSTextAttachmentCell {}

#[cfg(feature = "NSCell")]
unsafe impl NSCoding for NSTextAttachmentCell {}

#[cfg(feature = "NSCell")]
unsafe impl NSCopying for NSTextAttachmentCell {}

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

#[cfg(feature = "NSCell")]
unsafe impl NSObjectProtocol for NSTextAttachmentCell {}

#[cfg(feature = "NSCell")]
unsafe impl NSTextAttachmentCellProtocol for NSTextAttachmentCell {}

#[cfg(all(feature = "NSCell", feature = "NSUserInterfaceItemIdentification"))]
unsafe impl NSUserInterfaceItemIdentification for NSTextAttachmentCell {}

#[cfg(feature = "NSCell")]
impl NSTextAttachmentCell {
    extern_methods!();
}

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

        #[unsafe(method(initTextCell:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initTextCell(this: Allocated<Self>, string: &NSString) -> Retained<Self>;

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

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

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