//! 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::*;

/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nshelpbookname?language=objc)
pub type NSHelpBookName = NSString;

/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nshelpanchorname?language=objc)
pub type NSHelpAnchorName = NSString;

/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nshelpmanagercontexthelpkey?language=objc)
pub type NSHelpManagerContextHelpKey = NSString;

extern_class!(
    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nshelpmanager?language=objc)
    #[unsafe(super(NSObject))]
    #[thread_kind = MainThreadOnly]
    #[derive(Debug, PartialEq, Eq, Hash)]
    pub struct NSHelpManager;
);

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

impl NSHelpManager {
    extern_methods!(
        #[unsafe(method(sharedHelpManager))]
        #[unsafe(method_family = none)]
        pub fn sharedHelpManager(mtm: MainThreadMarker) -> Retained<NSHelpManager>;

        #[unsafe(method(isContextHelpModeActive))]
        #[unsafe(method_family = none)]
        pub fn isContextHelpModeActive(mtm: MainThreadMarker) -> bool;

        /// Setter for [`isContextHelpModeActive`][Self::isContextHelpModeActive].
        #[unsafe(method(setContextHelpModeActive:))]
        #[unsafe(method_family = none)]
        pub fn setContextHelpModeActive(context_help_mode_active: bool, mtm: MainThreadMarker);

        /// # Safety
        ///
        /// `object` should be of the correct type.
        #[unsafe(method(setContextHelp:forObject:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setContextHelp_forObject(
            &self,
            attr_string: &NSAttributedString,
            object: &AnyObject,
        );

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

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

        /// # Safety
        ///
        /// `object` should be of the correct type.
        #[unsafe(method(showContextHelpForObject:locationHint:))]
        #[unsafe(method_family = none)]
        pub unsafe fn showContextHelpForObject_locationHint(
            &self,
            object: &AnyObject,
            pt: NSPoint,
        ) -> bool;

        #[unsafe(method(openHelpAnchor:inBook:))]
        #[unsafe(method_family = none)]
        pub fn openHelpAnchor_inBook(
            &self,
            anchor: &NSHelpAnchorName,
            book: Option<&NSHelpBookName>,
        );

        #[unsafe(method(findString:inBook:))]
        #[unsafe(method_family = none)]
        pub fn findString_inBook(&self, query: &NSString, book: Option<&NSHelpBookName>);

        #[unsafe(method(registerBooksInBundle:))]
        #[unsafe(method_family = none)]
        pub fn registerBooksInBundle(&self, bundle: &NSBundle) -> bool;
    );
}

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

        #[unsafe(method(new))]
        #[unsafe(method_family = new)]
        pub fn new(mtm: MainThreadMarker) -> Retained<Self>;
    );
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nscontexthelpmodedidactivatenotification?language=objc)
    pub static NSContextHelpModeDidActivateNotification: &'static NSNotificationName;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nscontexthelpmodediddeactivatenotification?language=objc)
    pub static NSContextHelpModeDidDeactivateNotification: &'static NSNotificationName;
}

mod private_NSBundleHelpExtension {
    pub trait Sealed {}
}

/// Category on [`NSBundle`].
pub unsafe trait NSBundleHelpExtension:
    ClassType + Sized + private_NSBundleHelpExtension::Sealed
{
    extern_methods!(
        #[unsafe(method(contextHelpForKey:))]
        #[unsafe(method_family = none)]
        fn contextHelpForKey(
            &self,
            key: &NSHelpManagerContextHelpKey,
        ) -> Option<Retained<NSAttributedString>>;
    );
}

impl private_NSBundleHelpExtension::Sealed for NSBundle {}
unsafe impl NSBundleHelpExtension for NSBundle {}

/// NSApplicationHelpExtension.
#[cfg(all(feature = "NSApplication", feature = "NSResponder"))]
impl NSApplication {
    extern_methods!(
        /// # Safety
        ///
        /// `sender` should be of the correct type.
        #[unsafe(method(activateContextHelpMode:))]
        #[unsafe(method_family = none)]
        pub unsafe fn activateContextHelpMode(&self, sender: Option<&AnyObject>);

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