//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use objc2::__framework_prelude::*;
use objc2_foundation::*;

use crate::*;

// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSTextInsertionIndicatorDisplayMode(pub NSInteger);
impl NSTextInsertionIndicatorDisplayMode {
    #[doc(alias = "NSTextInsertionIndicatorDisplayModeAutomatic")]
    pub const Automatic: Self = Self(0);
    #[doc(alias = "NSTextInsertionIndicatorDisplayModeHidden")]
    pub const Hidden: Self = Self(1);
    #[doc(alias = "NSTextInsertionIndicatorDisplayModeVisible")]
    pub const Visible: Self = Self(2);
}

unsafe impl Encode for NSTextInsertionIndicatorDisplayMode {
    const ENCODING: Encoding = NSInteger::ENCODING;
}

unsafe impl RefEncode for NSTextInsertionIndicatorDisplayMode {
    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}

// NS_OPTIONS
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSTextInsertionIndicatorAutomaticModeOptions(pub NSInteger);
bitflags::bitflags! {
    impl NSTextInsertionIndicatorAutomaticModeOptions: NSInteger {
        #[doc(alias = "NSTextInsertionIndicatorAutomaticModeOptionsShowEffectsView")]
        const ShowEffectsView = 1<<0;
        #[doc(alias = "NSTextInsertionIndicatorAutomaticModeOptionsShowWhileTracking")]
        const ShowWhileTracking = 1<<1;
    }
}

unsafe impl Encode for NSTextInsertionIndicatorAutomaticModeOptions {
    const ENCODING: Encoding = NSInteger::ENCODING;
}

unsafe impl RefEncode for NSTextInsertionIndicatorAutomaticModeOptions {
    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}

extern_class!(
    #[derive(Debug, PartialEq, Eq, Hash)]
    #[cfg(all(feature = "NSResponder", feature = "NSView"))]
    pub struct NSTextInsertionIndicator;

    #[cfg(all(feature = "NSResponder", feature = "NSView"))]
    unsafe impl ClassType for NSTextInsertionIndicator {
        #[inherits(NSResponder, NSObject)]
        type Super = NSView;
        type Mutability = MainThreadOnly;
    }
);

#[cfg(all(
    feature = "NSAccessibilityProtocols",
    feature = "NSResponder",
    feature = "NSView"
))]
unsafe impl NSAccessibility for NSTextInsertionIndicator {}

#[cfg(all(
    feature = "NSAccessibilityProtocols",
    feature = "NSResponder",
    feature = "NSView"
))]
unsafe impl NSAccessibilityElementProtocol for NSTextInsertionIndicator {}

#[cfg(all(feature = "NSAnimation", feature = "NSResponder", feature = "NSView"))]
unsafe impl NSAnimatablePropertyContainer for NSTextInsertionIndicator {}

#[cfg(all(feature = "NSAppearance", feature = "NSResponder", feature = "NSView"))]
unsafe impl NSAppearanceCustomization for NSTextInsertionIndicator {}

#[cfg(all(feature = "NSResponder", feature = "NSView"))]
unsafe impl NSCoding for NSTextInsertionIndicator {}

#[cfg(all(feature = "NSDragging", feature = "NSResponder", feature = "NSView"))]
unsafe impl NSDraggingDestination for NSTextInsertionIndicator {}

#[cfg(all(feature = "NSResponder", feature = "NSView"))]
unsafe impl NSObjectProtocol for NSTextInsertionIndicator {}

#[cfg(all(
    feature = "NSResponder",
    feature = "NSUserInterfaceItemIdentification",
    feature = "NSView"
))]
unsafe impl NSUserInterfaceItemIdentification for NSTextInsertionIndicator {}

extern_methods!(
    #[cfg(all(feature = "NSResponder", feature = "NSView"))]
    unsafe impl NSTextInsertionIndicator {
        #[method(displayMode)]
        pub unsafe fn displayMode(&self) -> NSTextInsertionIndicatorDisplayMode;

        #[method(setDisplayMode:)]
        pub unsafe fn setDisplayMode(&self, display_mode: NSTextInsertionIndicatorDisplayMode);

        #[cfg(feature = "NSColor")]
        #[method_id(@__retain_semantics Other color)]
        pub unsafe fn color(&self) -> Retained<NSColor>;

        #[cfg(feature = "NSColor")]
        #[method(setColor:)]
        pub unsafe fn setColor(&self, color: Option<&NSColor>);

        #[method(automaticModeOptions)]
        pub unsafe fn automaticModeOptions(&self) -> NSTextInsertionIndicatorAutomaticModeOptions;

        #[method(setAutomaticModeOptions:)]
        pub unsafe fn setAutomaticModeOptions(
            &self,
            automatic_mode_options: NSTextInsertionIndicatorAutomaticModeOptions,
        );

        #[cfg(feature = "block2")]
        #[method(effectsViewInserter)]
        pub unsafe fn effectsViewInserter(&self) -> *mut block2::Block<dyn Fn(NonNull<NSView>)>;

        #[cfg(feature = "block2")]
        #[method(setEffectsViewInserter:)]
        pub unsafe fn setEffectsViewInserter(
            &self,
            effects_view_inserter: Option<&block2::Block<dyn Fn(NonNull<NSView>)>>,
        );
    }
);

extern_methods!(
    /// Methods declared on superclass `NSView`
    #[cfg(all(feature = "NSResponder", feature = "NSView"))]
    unsafe impl NSTextInsertionIndicator {
        #[method_id(@__retain_semantics Init initWithFrame:)]
        pub unsafe fn initWithFrame(this: Allocated<Self>, frame_rect: NSRect) -> Retained<Self>;

        #[method_id(@__retain_semantics Init initWithCoder:)]
        pub unsafe fn initWithCoder(
            this: Allocated<Self>,
            coder: &NSCoder,
        ) -> Option<Retained<Self>>;
    }
);

extern_methods!(
    /// Methods declared on superclass `NSResponder`
    #[cfg(all(feature = "NSResponder", feature = "NSView"))]
    unsafe impl NSTextInsertionIndicator {
        #[method_id(@__retain_semantics Init init)]
        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
    }
);

extern_methods!(
    /// Methods declared on superclass `NSObject`
    #[cfg(all(feature = "NSResponder", feature = "NSView"))]
    unsafe impl NSTextInsertionIndicator {
        #[method_id(@__retain_semantics New new)]
        pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
    }
);
