use core::ffi::*;
use core::ptr::NonNull;
use objc2::__framework_prelude::*;
use objc2_foundation::*;
use crate::*;
pub type NSHelpBookName = NSString;
pub type NSHelpAnchorName = NSString;
pub type NSHelpManagerContextHelpKey = NSString;
extern_class!(
#[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;
#[unsafe(method(setContextHelpModeActive:))]
#[unsafe(method_family = none)]
pub fn setContextHelpModeActive(context_help_mode_active: bool, mtm: MainThreadMarker);
#[unsafe(method(setContextHelp:forObject:))]
#[unsafe(method_family = none)]
pub unsafe fn setContextHelp_forObject(
&self,
attr_string: &NSAttributedString,
object: &AnyObject,
);
#[unsafe(method(removeContextHelpForObject:))]
#[unsafe(method_family = none)]
pub unsafe fn removeContextHelpForObject(&self, object: &AnyObject);
#[unsafe(method(contextHelpForObject:))]
#[unsafe(method_family = none)]
pub unsafe fn contextHelpForObject(
&self,
object: &AnyObject,
) -> Option<Retained<NSAttributedString>>;
#[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;
);
}
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" {
pub static NSContextHelpModeDidActivateNotification: &'static NSNotificationName;
}
extern "C" {
pub static NSContextHelpModeDidDeactivateNotification: &'static NSNotificationName;
}
mod private_NSBundleHelpExtension {
pub trait Sealed {}
}
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 {}
#[cfg(all(feature = "NSApplication", feature = "NSResponder"))]
impl NSApplication {
extern_methods!(
#[unsafe(method(activateContextHelpMode:))]
#[unsafe(method_family = none)]
pub unsafe fn activateContextHelpMode(&self, sender: Option<&AnyObject>);
#[unsafe(method(showHelp:))]
#[unsafe(method_family = none)]
pub unsafe fn showHelp(&self, sender: Option<&AnyObject>);
);
}