objc2_security_interface/generated/
SFCertificatePanel.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_app_kit::*;
7use objc2_foundation::*;
8#[cfg(feature = "objc2-security")]
9use objc2_security::*;
10
11use crate::*;
12
13extern_class!(
14    /// SFCertificatePanel is a panel and sheet interface that displays one or more certificates.
15    ///
16    /// See also [Apple's documentation](https://developer.apple.com/documentation/securityinterface/sfcertificatepanel?language=objc)
17    #[unsafe(super(NSPanel, NSWindow, NSResponder, NSObject))]
18    #[derive(Debug, PartialEq, Eq, Hash)]
19    pub struct SFCertificatePanel;
20);
21
22extern_conformance!(
23    unsafe impl NSAccessibility for SFCertificatePanel {}
24);
25
26extern_conformance!(
27    unsafe impl NSAccessibilityElementProtocol for SFCertificatePanel {}
28);
29
30extern_conformance!(
31    unsafe impl NSAnimatablePropertyContainer for SFCertificatePanel {}
32);
33
34extern_conformance!(
35    unsafe impl NSAppearanceCustomization for SFCertificatePanel {}
36);
37
38extern_conformance!(
39    unsafe impl NSCoding for SFCertificatePanel {}
40);
41
42extern_conformance!(
43    unsafe impl NSMenuItemValidation for SFCertificatePanel {}
44);
45
46extern_conformance!(
47    unsafe impl NSObjectProtocol for SFCertificatePanel {}
48);
49
50extern_conformance!(
51    unsafe impl NSUserInterfaceItemIdentification for SFCertificatePanel {}
52);
53
54extern_conformance!(
55    unsafe impl NSUserInterfaceValidations for SFCertificatePanel {}
56);
57
58impl SFCertificatePanel {
59    extern_methods!(
60        /// Returns a shared instance of SFCertificatePanel.
61        ///
62        /// If your application can display multiple SFCertificatePanels at once,
63        /// you should allocate (alloc) and initialize (init) separate object instances instead of using this class method.
64        #[unsafe(method(sharedCertificatePanel))]
65        #[unsafe(method_family = none)]
66        pub unsafe fn sharedCertificatePanel(
67            mtm: MainThreadMarker,
68        ) -> Option<Retained<SFCertificatePanel>>;
69
70        #[cfg(feature = "objc2-security")]
71        /// Displays a certificate chain in a modal panel, returning NSOKButton when dismissed.
72        /// This method is preferred over runModalForCertificates, since the SecTrustRef parameter lets you
73        /// specify policies that determine whether the certificate is valid within your application's context.
74        ///
75        /// Parameter `trust`: A trust reference which contains the certificates to display.
76        ///
77        /// Parameter `showGroup`: Specifies whether additional certificates (other than the leaf certificate) are displayed.
78        ///
79        /// # Safety
80        ///
81        /// `trust` might not allow `None`.
82        #[unsafe(method(runModalForTrust:showGroup:))]
83        #[unsafe(method_family = none)]
84        pub unsafe fn runModalForTrust_showGroup(
85            &self,
86            trust: Option<&SecTrust>,
87            show_group: bool,
88        ) -> NSInteger;
89
90        /// Displays one or more specified certificates in a modal panel, returning NSOKButton when dismissed.
91        ///
92        /// Parameter `certificates`: The certificates to display.
93        /// Pass a NSArray containing one or more SecCertificateRef instances in this parameter.
94        /// The leaf certificate is assumed to be at index 0; the order of additional certificates in the array is not critical.
95        ///
96        /// Parameter `showGroup`: Specifies whether additional certificates (other than the leaf certificate) are displayed.
97        /// To show only a single certificate, specify only one SecCertificateRef in the array and set showGroup to NO.
98        ///
99        /// # Safety
100        ///
101        /// - `certificates` generic should be of the correct type.
102        /// - `certificates` might not allow `None`.
103        #[unsafe(method(runModalForCertificates:showGroup:))]
104        #[unsafe(method_family = none)]
105        pub unsafe fn runModalForCertificates_showGroup(
106            &self,
107            certificates: Option<&NSArray>,
108            show_group: bool,
109        ) -> NSInteger;
110
111        #[cfg(feature = "objc2-security")]
112        /// Displays a certificate chain in a modal sheet.
113        /// This is the preferred sheet method for SFCertificatePanel, since the SecTrustRef parameter lets you
114        /// specify policies that determine whether the certificate is valid within your application's context.
115        ///
116        /// Parameter `docWindow`: The parent window to which the sheet is attached.
117        ///
118        /// Parameter `modalDelegate`: The object whose didEndSelector method will be called when the sheet is dismissed.
119        ///
120        /// Parameter `didEndSelector`: This method is called when the sheet is dismissed.
121        ///
122        /// Parameter `contextInfo`: Client-defined contextual data which will be passed to the didEndSelector method.
123        ///
124        /// Parameter `trust`: A trust reference which contains the certificates to display.
125        ///
126        /// Parameter `showGroup`: Specifies whether additional certificates (other than the leaf certificate) are displayed.
127        ///
128        /// The didEndSelector method should have the following signature:
129        /// - (void)certificateSheetDidEnd:(NSWindow *)sheet returnCode:(NSInteger)returnCode contextInfo:(void *)contextInfo
130        ///
131        /// # Safety
132        ///
133        /// - `doc_window` might not allow `None`.
134        /// - `delegate` should be of the correct type.
135        /// - `delegate` might not allow `None`.
136        /// - `did_end_selector` must be a valid selector.
137        /// - `context_info` must be a valid pointer.
138        /// - `trust` might not allow `None`.
139        #[unsafe(method(beginSheetForWindow:modalDelegate:didEndSelector:contextInfo:trust:showGroup:))]
140        #[unsafe(method_family = none)]
141        pub unsafe fn beginSheetForWindow_modalDelegate_didEndSelector_contextInfo_trust_showGroup(
142            &self,
143            doc_window: Option<&NSWindow>,
144            delegate: Option<&AnyObject>,
145            did_end_selector: Option<Sel>,
146            context_info: *mut c_void,
147            trust: Option<&SecTrust>,
148            show_group: bool,
149        );
150
151        /// Displays one or more specified certificates in a modal sheet.
152        ///
153        /// Parameter `docWindow`: The parent window to which the sheet is attached.
154        ///
155        /// Parameter `modalDelegate`: The object whose didEndSelector method will be called when the sheet is dismissed.
156        ///
157        /// Parameter `didEndSelector`: This method is called when the sheet is dismissed.
158        ///
159        /// Parameter `contextInfo`: Client-defined contextual data which will be passed to the didEndSelector method.
160        ///
161        /// Parameter `certificates`: The certificates to display.
162        /// Pass a NSArray containing one or more SecCertificateRef instances in this parameter.
163        ///
164        /// Parameter `showGroup`: Specifies whether additional certificates (other than the leaf certificate) are displayed.
165        ///
166        /// The didEndSelector method should have the following signature:
167        /// - (void)certificateSheetDidEnd:(NSWindow *)sheet returnCode:(NSInteger)returnCode contextInfo:(void *)contextInfo
168        ///
169        /// # Safety
170        ///
171        /// - `doc_window` might not allow `None`.
172        /// - `delegate` should be of the correct type.
173        /// - `delegate` might not allow `None`.
174        /// - `did_end_selector` must be a valid selector.
175        /// - `context_info` must be a valid pointer.
176        /// - `certificates` generic should be of the correct type.
177        /// - `certificates` might not allow `None`.
178        #[unsafe(method(beginSheetForWindow:modalDelegate:didEndSelector:contextInfo:certificates:showGroup:))]
179        #[unsafe(method_family = none)]
180        pub unsafe fn beginSheetForWindow_modalDelegate_didEndSelector_contextInfo_certificates_showGroup(
181            &self,
182            doc_window: Option<&NSWindow>,
183            delegate: Option<&AnyObject>,
184            did_end_selector: Option<Sel>,
185            context_info: *mut c_void,
186            certificates: Option<&NSArray>,
187            show_group: bool,
188        );
189
190        /// Specifies one or more policies that apply to the displayed certificates.
191        ///
192        /// Parameter `policies`: The policies to use when evaluating the certificates' status.
193        /// You can pass either a SecPolicyRef or a NSArray (containing one or more SecPolicyRef instances) in this parameter.
194        /// If policies is set to nil, the Apple X.509 Basic Policy will be used.
195        ///
196        /// Applications will typically display a SFCertificatePanel in the context of a specific usage, such as SSL or S/MIME.
197        /// You should set only the policy references which apply to your intended usage.
198        ///
199        /// # Safety
200        ///
201        /// - `policies` should be of the correct type.
202        /// - `policies` might not allow `None`.
203        #[unsafe(method(setPolicies:))]
204        #[unsafe(method_family = none)]
205        pub unsafe fn setPolicies(&self, policies: Option<&AnyObject>);
206
207        /// Returns an array of policies used to evaluate the status of the displayed certificates.
208        ///
209        /// This method returns an autoreleased NSArray containing one or more SecPolicyRef instances, as set by a previous setPolicies: call.
210        #[unsafe(method(policies))]
211        #[unsafe(method_family = none)]
212        pub unsafe fn policies(&self) -> Option<Retained<NSArray>>;
213
214        /// Customizes the title of the default button.
215        ///
216        /// Parameter `title`: The new title for the default button.
217        ///
218        /// # Safety
219        ///
220        /// `title` might not allow `None`.
221        #[unsafe(method(setDefaultButtonTitle:))]
222        #[unsafe(method_family = none)]
223        pub unsafe fn setDefaultButtonTitle(&self, title: Option<&NSString>);
224
225        /// Customizes the title of the alternate button.
226        ///
227        /// Parameter `title`: The new title for the alternate button. If title is set to nil, the button will not be shown.
228        ///
229        /// # Safety
230        ///
231        /// `title` might not allow `None`.
232        #[unsafe(method(setAlternateButtonTitle:))]
233        #[unsafe(method_family = none)]
234        pub unsafe fn setAlternateButtonTitle(&self, title: Option<&NSString>);
235
236        #[unsafe(method(setShowsHelp:))]
237        #[unsafe(method_family = none)]
238        pub unsafe fn setShowsHelp(&self, shows_help: bool);
239
240        #[unsafe(method(showsHelp))]
241        #[unsafe(method_family = none)]
242        pub unsafe fn showsHelp(&self) -> bool;
243
244        /// # Safety
245        ///
246        /// `anchor` might not allow `None`.
247        #[unsafe(method(setHelpAnchor:))]
248        #[unsafe(method_family = none)]
249        pub unsafe fn setHelpAnchor(&self, anchor: Option<&NSString>);
250
251        #[unsafe(method(helpAnchor))]
252        #[unsafe(method_family = none)]
253        pub unsafe fn helpAnchor(&self) -> Option<Retained<NSString>>;
254
255        #[cfg(feature = "SFCertificateView")]
256        #[unsafe(method(certificateView))]
257        #[unsafe(method_family = none)]
258        pub unsafe fn certificateView(&self) -> Option<Retained<SFCertificateView>>;
259    );
260}
261
262/// Methods declared on superclass `NSWindow`.
263impl SFCertificatePanel {
264    extern_methods!(
265        #[unsafe(method(initWithContentRect:styleMask:backing:defer:))]
266        #[unsafe(method_family = init)]
267        pub unsafe fn initWithContentRect_styleMask_backing_defer(
268            this: Allocated<Self>,
269            content_rect: NSRect,
270            style: NSWindowStyleMask,
271            backing_store_type: NSBackingStoreType,
272            flag: bool,
273        ) -> Retained<Self>;
274
275        #[unsafe(method(initWithContentRect:styleMask:backing:defer:screen:))]
276        #[unsafe(method_family = init)]
277        pub unsafe fn initWithContentRect_styleMask_backing_defer_screen(
278            this: Allocated<Self>,
279            content_rect: NSRect,
280            style: NSWindowStyleMask,
281            backing_store_type: NSBackingStoreType,
282            flag: bool,
283            screen: Option<&NSScreen>,
284        ) -> Retained<Self>;
285
286        /// # Safety
287        ///
288        /// `coder` possibly has further requirements.
289        #[unsafe(method(initWithCoder:))]
290        #[unsafe(method_family = init)]
291        pub unsafe fn initWithCoder(this: Allocated<Self>, coder: &NSCoder) -> Retained<Self>;
292
293        /// Convenience method for creating an autoreleased titled window with the given contentViewController. A basic NSWindow with the following attributes is made: titled, closable, resizable, miniaturizable. The window's title is automatically bound to the contentViewController's title. The size of the window can easily be controlled by utilizing autolayout and applying size constraints to the view (or its subviews). The window has isReleasedWhenClosed set to NO, and it must be explicitly retained to keep the window instance alive. To have it automatically be freed when it is closed, do the following: [window retain] and [window setReleasedWhenClosed:YES].
294        #[unsafe(method(windowWithContentViewController:))]
295        #[unsafe(method_family = none)]
296        pub unsafe fn windowWithContentViewController(
297            content_view_controller: &NSViewController,
298        ) -> Retained<Self>;
299    );
300}
301
302/// Methods declared on superclass `NSResponder`.
303impl SFCertificatePanel {
304    extern_methods!(
305        #[unsafe(method(init))]
306        #[unsafe(method_family = init)]
307        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
308    );
309}
310
311/// Methods declared on superclass `NSObject`.
312impl SFCertificatePanel {
313    extern_methods!(
314        #[unsafe(method(new))]
315        #[unsafe(method_family = new)]
316        pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
317    );
318}
319
320mod private_NSObjectSFCertificatePanelDelegate {
321    pub trait Sealed {}
322}
323
324/// Category "SFCertificatePanelDelegate" on [`NSObject`].
325#[doc(alias = "SFCertificatePanelDelegate")]
326pub unsafe trait NSObjectSFCertificatePanelDelegate:
327    ClassType + Sized + private_NSObjectSFCertificatePanelDelegate::Sealed
328{
329    extern_methods!(
330        /// # Safety
331        ///
332        /// `sender` might not allow `None`.
333        #[unsafe(method(certificatePanelShowHelp:))]
334        #[unsafe(method_family = none)]
335        unsafe fn certificatePanelShowHelp(&self, sender: Option<&SFCertificatePanel>) -> bool;
336    );
337}
338
339impl private_NSObjectSFCertificatePanelDelegate::Sealed for NSObject {}
340unsafe impl NSObjectSFCertificatePanelDelegate for NSObject {}