objc2_app_kit/generated/
NSHelpManager.rs

1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::ffi::*;
4use core::ptr::NonNull;
5use objc2::__framework_prelude::*;
6use objc2_foundation::*;
7
8use crate::*;
9
10/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nshelpbookname?language=objc)
11pub type NSHelpBookName = NSString;
12
13/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nshelpanchorname?language=objc)
14pub type NSHelpAnchorName = NSString;
15
16/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nshelpmanagercontexthelpkey?language=objc)
17pub type NSHelpManagerContextHelpKey = NSString;
18
19extern_class!(
20    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nshelpmanager?language=objc)
21    #[unsafe(super(NSObject))]
22    #[thread_kind = MainThreadOnly]
23    #[derive(Debug, PartialEq, Eq, Hash)]
24    pub struct NSHelpManager;
25);
26
27extern_conformance!(
28    unsafe impl NSObjectProtocol for NSHelpManager {}
29);
30
31impl NSHelpManager {
32    extern_methods!(
33        #[unsafe(method(sharedHelpManager))]
34        #[unsafe(method_family = none)]
35        pub unsafe fn sharedHelpManager(mtm: MainThreadMarker) -> Retained<NSHelpManager>;
36
37        #[unsafe(method(isContextHelpModeActive))]
38        #[unsafe(method_family = none)]
39        pub unsafe fn isContextHelpModeActive(mtm: MainThreadMarker) -> bool;
40
41        /// Setter for [`isContextHelpModeActive`][Self::isContextHelpModeActive].
42        #[unsafe(method(setContextHelpModeActive:))]
43        #[unsafe(method_family = none)]
44        pub unsafe fn setContextHelpModeActive(
45            context_help_mode_active: bool,
46            mtm: MainThreadMarker,
47        );
48
49        #[unsafe(method(setContextHelp:forObject:))]
50        #[unsafe(method_family = none)]
51        pub unsafe fn setContextHelp_forObject(
52            &self,
53            attr_string: &NSAttributedString,
54            object: &AnyObject,
55        );
56
57        #[unsafe(method(removeContextHelpForObject:))]
58        #[unsafe(method_family = none)]
59        pub unsafe fn removeContextHelpForObject(&self, object: &AnyObject);
60
61        #[unsafe(method(contextHelpForObject:))]
62        #[unsafe(method_family = none)]
63        pub unsafe fn contextHelpForObject(
64            &self,
65            object: &AnyObject,
66        ) -> Option<Retained<NSAttributedString>>;
67
68        #[unsafe(method(showContextHelpForObject:locationHint:))]
69        #[unsafe(method_family = none)]
70        pub unsafe fn showContextHelpForObject_locationHint(
71            &self,
72            object: &AnyObject,
73            pt: NSPoint,
74        ) -> bool;
75
76        #[unsafe(method(openHelpAnchor:inBook:))]
77        #[unsafe(method_family = none)]
78        pub unsafe fn openHelpAnchor_inBook(
79            &self,
80            anchor: &NSHelpAnchorName,
81            book: Option<&NSHelpBookName>,
82        );
83
84        #[unsafe(method(findString:inBook:))]
85        #[unsafe(method_family = none)]
86        pub unsafe fn findString_inBook(&self, query: &NSString, book: Option<&NSHelpBookName>);
87
88        #[unsafe(method(registerBooksInBundle:))]
89        #[unsafe(method_family = none)]
90        pub unsafe fn registerBooksInBundle(&self, bundle: &NSBundle) -> bool;
91    );
92}
93
94/// Methods declared on superclass `NSObject`.
95impl NSHelpManager {
96    extern_methods!(
97        #[unsafe(method(init))]
98        #[unsafe(method_family = init)]
99        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
100
101        #[unsafe(method(new))]
102        #[unsafe(method_family = new)]
103        pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
104    );
105}
106
107extern "C" {
108    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nscontexthelpmodedidactivatenotification?language=objc)
109    pub static NSContextHelpModeDidActivateNotification: &'static NSNotificationName;
110}
111
112extern "C" {
113    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nscontexthelpmodediddeactivatenotification?language=objc)
114    pub static NSContextHelpModeDidDeactivateNotification: &'static NSNotificationName;
115}
116
117mod private_NSBundleHelpExtension {
118    pub trait Sealed {}
119}
120
121/// Category on [`NSBundle`].
122pub unsafe trait NSBundleHelpExtension:
123    ClassType + Sized + private_NSBundleHelpExtension::Sealed
124{
125    extern_methods!(
126        #[unsafe(method(contextHelpForKey:))]
127        #[unsafe(method_family = none)]
128        unsafe fn contextHelpForKey(
129            &self,
130            key: &NSHelpManagerContextHelpKey,
131        ) -> Option<Retained<NSAttributedString>>;
132    );
133}
134
135impl private_NSBundleHelpExtension::Sealed for NSBundle {}
136unsafe impl NSBundleHelpExtension for NSBundle {}
137
138/// NSApplicationHelpExtension.
139#[cfg(all(feature = "NSApplication", feature = "NSResponder"))]
140impl NSApplication {
141    extern_methods!(
142        #[unsafe(method(activateContextHelpMode:))]
143        #[unsafe(method_family = none)]
144        pub unsafe fn activateContextHelpMode(&self, sender: Option<&AnyObject>);
145
146        #[unsafe(method(showHelp:))]
147        #[unsafe(method_family = none)]
148        pub unsafe fn showHelp(&self, sender: Option<&AnyObject>);
149    );
150}