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 fn sharedHelpManager(mtm: MainThreadMarker) -> Retained<NSHelpManager>;
36
37        #[unsafe(method(isContextHelpModeActive))]
38        #[unsafe(method_family = none)]
39        pub fn isContextHelpModeActive(mtm: MainThreadMarker) -> bool;
40
41        /// Setter for [`isContextHelpModeActive`][Self::isContextHelpModeActive].
42        #[unsafe(method(setContextHelpModeActive:))]
43        #[unsafe(method_family = none)]
44        pub fn setContextHelpModeActive(context_help_mode_active: bool, mtm: MainThreadMarker);
45
46        /// # Safety
47        ///
48        /// `object` should be of the correct type.
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        /// # Safety
58        ///
59        /// `object` should be of the correct type.
60        #[unsafe(method(removeContextHelpForObject:))]
61        #[unsafe(method_family = none)]
62        pub unsafe fn removeContextHelpForObject(&self, object: &AnyObject);
63
64        /// # Safety
65        ///
66        /// `object` should be of the correct type.
67        #[unsafe(method(contextHelpForObject:))]
68        #[unsafe(method_family = none)]
69        pub unsafe fn contextHelpForObject(
70            &self,
71            object: &AnyObject,
72        ) -> Option<Retained<NSAttributedString>>;
73
74        /// # Safety
75        ///
76        /// `object` should be of the correct type.
77        #[unsafe(method(showContextHelpForObject:locationHint:))]
78        #[unsafe(method_family = none)]
79        pub unsafe fn showContextHelpForObject_locationHint(
80            &self,
81            object: &AnyObject,
82            pt: NSPoint,
83        ) -> bool;
84
85        #[unsafe(method(openHelpAnchor:inBook:))]
86        #[unsafe(method_family = none)]
87        pub fn openHelpAnchor_inBook(
88            &self,
89            anchor: &NSHelpAnchorName,
90            book: Option<&NSHelpBookName>,
91        );
92
93        #[unsafe(method(findString:inBook:))]
94        #[unsafe(method_family = none)]
95        pub fn findString_inBook(&self, query: &NSString, book: Option<&NSHelpBookName>);
96
97        #[unsafe(method(registerBooksInBundle:))]
98        #[unsafe(method_family = none)]
99        pub fn registerBooksInBundle(&self, bundle: &NSBundle) -> bool;
100    );
101}
102
103/// Methods declared on superclass `NSObject`.
104impl NSHelpManager {
105    extern_methods!(
106        #[unsafe(method(init))]
107        #[unsafe(method_family = init)]
108        pub fn init(this: Allocated<Self>) -> Retained<Self>;
109
110        #[unsafe(method(new))]
111        #[unsafe(method_family = new)]
112        pub fn new(mtm: MainThreadMarker) -> Retained<Self>;
113    );
114}
115
116extern "C" {
117    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nscontexthelpmodedidactivatenotification?language=objc)
118    pub static NSContextHelpModeDidActivateNotification: &'static NSNotificationName;
119}
120
121extern "C" {
122    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nscontexthelpmodediddeactivatenotification?language=objc)
123    pub static NSContextHelpModeDidDeactivateNotification: &'static NSNotificationName;
124}
125
126mod private_NSBundleHelpExtension {
127    pub trait Sealed {}
128}
129
130/// Category on [`NSBundle`].
131pub unsafe trait NSBundleHelpExtension:
132    ClassType + Sized + private_NSBundleHelpExtension::Sealed
133{
134    extern_methods!(
135        #[unsafe(method(contextHelpForKey:))]
136        #[unsafe(method_family = none)]
137        fn contextHelpForKey(
138            &self,
139            key: &NSHelpManagerContextHelpKey,
140        ) -> Option<Retained<NSAttributedString>>;
141    );
142}
143
144impl private_NSBundleHelpExtension::Sealed for NSBundle {}
145unsafe impl NSBundleHelpExtension for NSBundle {}
146
147/// NSApplicationHelpExtension.
148#[cfg(all(feature = "NSApplication", feature = "NSResponder"))]
149impl NSApplication {
150    extern_methods!(
151        /// # Safety
152        ///
153        /// `sender` should be of the correct type.
154        #[unsafe(method(activateContextHelpMode:))]
155        #[unsafe(method_family = none)]
156        pub unsafe fn activateContextHelpMode(&self, sender: Option<&AnyObject>);
157
158        /// # Safety
159        ///
160        /// `sender` should be of the correct type.
161        #[unsafe(method(showHelp:))]
162        #[unsafe(method_family = none)]
163        pub unsafe fn showHelp(&self, sender: Option<&AnyObject>);
164    );
165}