//! 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/nstextcheckingcontroller?language=objc)
    #[unsafe(super(NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    pub struct NSTextCheckingController;
);

extern_conformance!(
    unsafe impl NSObjectProtocol for NSTextCheckingController {}
);

impl NSTextCheckingController {
    extern_methods!(
        #[cfg(all(feature = "NSTextCheckingClient", feature = "NSTextInputClient"))]
        #[unsafe(method(initWithClient:))]
        #[unsafe(method_family = init)]
        pub fn initWithClient(
            this: Allocated<Self>,
            client: &ProtocolObject<dyn NSTextCheckingClient>,
        ) -> Retained<Self>;

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

        #[cfg(all(feature = "NSTextCheckingClient", feature = "NSTextInputClient"))]
        #[unsafe(method(client))]
        #[unsafe(method_family = none)]
        pub fn client(&self) -> Retained<ProtocolObject<dyn NSTextCheckingClient>>;

        #[unsafe(method(invalidate))]
        #[unsafe(method_family = none)]
        pub fn invalidate(&self);

        #[unsafe(method(didChangeTextInRange:))]
        #[unsafe(method_family = none)]
        pub fn didChangeTextInRange(&self, range: NSRange);

        #[unsafe(method(insertedTextInRange:))]
        #[unsafe(method_family = none)]
        pub fn insertedTextInRange(&self, range: NSRange);

        #[unsafe(method(didChangeSelectedRange))]
        #[unsafe(method_family = none)]
        pub fn didChangeSelectedRange(&self);

        #[unsafe(method(considerTextCheckingForRange:))]
        #[unsafe(method_family = none)]
        pub fn considerTextCheckingForRange(&self, range: NSRange);

        #[cfg(feature = "NSSpellChecker")]
        /// # Safety
        ///
        /// `options` generic should be of the correct type.
        #[unsafe(method(checkTextInRange:types:options:))]
        #[unsafe(method_family = none)]
        pub unsafe fn checkTextInRange_types_options(
            &self,
            range: NSRange,
            checking_types: NSTextCheckingTypes,
            options: &NSDictionary<NSTextCheckingOptionKey, AnyObject>,
        );

        /// # Safety
        ///
        /// `sender` should be of the correct type.
        #[unsafe(method(checkTextInSelection:))]
        #[unsafe(method_family = none)]
        pub unsafe fn checkTextInSelection(&self, sender: Option<&AnyObject>);

        /// # Safety
        ///
        /// `sender` should be of the correct type.
        #[unsafe(method(checkTextInDocument:))]
        #[unsafe(method_family = none)]
        pub unsafe fn checkTextInDocument(&self, sender: Option<&AnyObject>);

        /// # Safety
        ///
        /// `sender` should be of the correct type.
        #[unsafe(method(orderFrontSubstitutionsPanel:))]
        #[unsafe(method_family = none)]
        pub unsafe fn orderFrontSubstitutionsPanel(&self, sender: Option<&AnyObject>);

        /// # Safety
        ///
        /// `sender` should be of the correct type.
        #[unsafe(method(checkSpelling:))]
        #[unsafe(method_family = none)]
        pub unsafe fn checkSpelling(&self, sender: Option<&AnyObject>);

        /// # Safety
        ///
        /// `sender` should be of the correct type.
        #[unsafe(method(showGuessPanel:))]
        #[unsafe(method_family = none)]
        pub unsafe fn showGuessPanel(&self, sender: Option<&AnyObject>);

        /// # Safety
        ///
        /// `sender` should be of the correct type.
        #[unsafe(method(changeSpelling:))]
        #[unsafe(method_family = none)]
        pub unsafe fn changeSpelling(&self, sender: Option<&AnyObject>);

        /// # Safety
        ///
        /// `sender` should be of the correct type.
        #[unsafe(method(ignoreSpelling:))]
        #[unsafe(method_family = none)]
        pub unsafe fn ignoreSpelling(&self, sender: Option<&AnyObject>);

        #[unsafe(method(updateCandidates))]
        #[unsafe(method_family = none)]
        pub fn updateCandidates(&self);

        #[unsafe(method(validAnnotations))]
        #[unsafe(method_family = none)]
        pub fn validAnnotations(&self) -> Retained<NSArray<NSAttributedStringKey>>;

        #[cfg(feature = "NSMenu")]
        /// # Safety
        ///
        /// `effective_range` must be a valid pointer.
        #[unsafe(method(menuAtIndex:clickedOnSelection:effectiveRange:))]
        #[unsafe(method_family = none)]
        pub unsafe fn menuAtIndex_clickedOnSelection_effectiveRange(
            &self,
            location: NSUInteger,
            clicked_on_selection: bool,
            effective_range: NSRangePointer,
            mtm: MainThreadMarker,
        ) -> Option<Retained<NSMenu>>;

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

        /// Setter for [`spellCheckerDocumentTag`][Self::spellCheckerDocumentTag].
        #[unsafe(method(setSpellCheckerDocumentTag:))]
        #[unsafe(method_family = none)]
        pub fn setSpellCheckerDocumentTag(&self, spell_checker_document_tag: NSInteger);
    );
}

/// Methods declared on superclass `NSObject`.
impl NSTextCheckingController {
    extern_methods!(
        #[unsafe(method(new))]
        #[unsafe(method_family = new)]
        pub unsafe fn new() -> Retained<Self>;
    );
}
