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        #[unsafe(method(runModalForTrust:showGroup:))]
79        #[unsafe(method_family = none)]
80        pub unsafe fn runModalForTrust_showGroup(
81            &self,
82            trust: Option<&SecTrust>,
83            show_group: bool,
84        ) -> NSInteger;
85
86        /// Displays one or more specified certificates in a modal panel, returning NSOKButton when dismissed.
87        ///
88        /// Parameter `certificates`: The certificates to display.
89        /// Pass a NSArray containing one or more SecCertificateRef instances in this parameter.
90        /// The leaf certificate is assumed to be at index 0; the order of additional certificates in the array is not critical.
91        ///
92        /// Parameter `showGroup`: Specifies whether additional certificates (other than the leaf certificate) are displayed.
93        /// To show only a single certificate, specify only one SecCertificateRef in the array and set showGroup to NO.
94        #[unsafe(method(runModalForCertificates:showGroup:))]
95        #[unsafe(method_family = none)]
96        pub unsafe fn runModalForCertificates_showGroup(
97            &self,
98            certificates: Option<&NSArray>,
99            show_group: bool,
100        ) -> NSInteger;
101
102        #[cfg(feature = "objc2-security")]
103        /// Displays a certificate chain in a modal sheet.
104        /// This is the preferred sheet method for SFCertificatePanel, since the SecTrustRef parameter lets you
105        /// specify policies that determine whether the certificate is valid within your application's context.
106        ///
107        /// Parameter `docWindow`: The parent window to which the sheet is attached.
108        ///
109        /// Parameter `modalDelegate`: The object whose didEndSelector method will be called when the sheet is dismissed.
110        ///
111        /// Parameter `didEndSelector`: This method is called when the sheet is dismissed.
112        ///
113        /// Parameter `contextInfo`: Client-defined contextual data which will be passed to the didEndSelector method.
114        ///
115        /// Parameter `trust`: A trust reference which contains the certificates to display.
116        ///
117        /// Parameter `showGroup`: Specifies whether additional certificates (other than the leaf certificate) are displayed.
118        ///
119        /// The didEndSelector method should have the following signature:
120        /// - (void)certificateSheetDidEnd:(NSWindow *)sheet returnCode:(NSInteger)returnCode contextInfo:(void *)contextInfo
121        #[unsafe(method(beginSheetForWindow:modalDelegate:didEndSelector:contextInfo:trust:showGroup:))]
122        #[unsafe(method_family = none)]
123        pub unsafe fn beginSheetForWindow_modalDelegate_didEndSelector_contextInfo_trust_showGroup(
124            &self,
125            doc_window: Option<&NSWindow>,
126            delegate: Option<&AnyObject>,
127            did_end_selector: Option<Sel>,
128            context_info: *mut c_void,
129            trust: Option<&SecTrust>,
130            show_group: bool,
131        );
132
133        /// Displays one or more specified certificates in a modal sheet.
134        ///
135        /// Parameter `docWindow`: The parent window to which the sheet is attached.
136        ///
137        /// Parameter `modalDelegate`: The object whose didEndSelector method will be called when the sheet is dismissed.
138        ///
139        /// Parameter `didEndSelector`: This method is called when the sheet is dismissed.
140        ///
141        /// Parameter `contextInfo`: Client-defined contextual data which will be passed to the didEndSelector method.
142        ///
143        /// Parameter `certificates`: The certificates to display.
144        /// Pass a NSArray containing one or more SecCertificateRef instances in this parameter.
145        ///
146        /// Parameter `showGroup`: Specifies whether additional certificates (other than the leaf certificate) are displayed.
147        ///
148        /// The didEndSelector method should have the following signature:
149        /// - (void)certificateSheetDidEnd:(NSWindow *)sheet returnCode:(NSInteger)returnCode contextInfo:(void *)contextInfo
150        #[unsafe(method(beginSheetForWindow:modalDelegate:didEndSelector:contextInfo:certificates:showGroup:))]
151        #[unsafe(method_family = none)]
152        pub unsafe fn beginSheetForWindow_modalDelegate_didEndSelector_contextInfo_certificates_showGroup(
153            &self,
154            doc_window: Option<&NSWindow>,
155            delegate: Option<&AnyObject>,
156            did_end_selector: Option<Sel>,
157            context_info: *mut c_void,
158            certificates: Option<&NSArray>,
159            show_group: bool,
160        );
161
162        /// Specifies one or more policies that apply to the displayed certificates.
163        ///
164        /// Parameter `policies`: The policies to use when evaluating the certificates' status.
165        /// You can pass either a SecPolicyRef or a NSArray (containing one or more SecPolicyRef instances) in this parameter.
166        /// If policies is set to nil, the Apple X.509 Basic Policy will be used.
167        ///
168        /// Applications will typically display a SFCertificatePanel in the context of a specific usage, such as SSL or S/MIME.
169        /// You should set only the policy references which apply to your intended usage.
170        #[unsafe(method(setPolicies:))]
171        #[unsafe(method_family = none)]
172        pub unsafe fn setPolicies(&self, policies: Option<&AnyObject>);
173
174        /// Returns an array of policies used to evaluate the status of the displayed certificates.
175        ///
176        /// This method returns an autoreleased NSArray containing one or more SecPolicyRef instances, as set by a previous setPolicies: call.
177        #[unsafe(method(policies))]
178        #[unsafe(method_family = none)]
179        pub unsafe fn policies(&self) -> Option<Retained<NSArray>>;
180
181        /// Customizes the title of the default button.
182        ///
183        /// Parameter `title`: The new title for the default button.
184        #[unsafe(method(setDefaultButtonTitle:))]
185        #[unsafe(method_family = none)]
186        pub unsafe fn setDefaultButtonTitle(&self, title: Option<&NSString>);
187
188        /// Customizes the title of the alternate button.
189        ///
190        /// Parameter `title`: The new title for the alternate button. If title is set to nil, the button will not be shown.
191        #[unsafe(method(setAlternateButtonTitle:))]
192        #[unsafe(method_family = none)]
193        pub unsafe fn setAlternateButtonTitle(&self, title: Option<&NSString>);
194
195        #[unsafe(method(setShowsHelp:))]
196        #[unsafe(method_family = none)]
197        pub unsafe fn setShowsHelp(&self, shows_help: bool);
198
199        #[unsafe(method(showsHelp))]
200        #[unsafe(method_family = none)]
201        pub unsafe fn showsHelp(&self) -> bool;
202
203        #[unsafe(method(setHelpAnchor:))]
204        #[unsafe(method_family = none)]
205        pub unsafe fn setHelpAnchor(&self, anchor: Option<&NSString>);
206
207        #[unsafe(method(helpAnchor))]
208        #[unsafe(method_family = none)]
209        pub unsafe fn helpAnchor(&self) -> Option<Retained<NSString>>;
210
211        #[cfg(feature = "SFCertificateView")]
212        #[unsafe(method(certificateView))]
213        #[unsafe(method_family = none)]
214        pub unsafe fn certificateView(&self) -> Option<Retained<SFCertificateView>>;
215    );
216}
217
218/// Methods declared on superclass `NSWindow`.
219impl SFCertificatePanel {
220    extern_methods!(
221        #[unsafe(method(initWithContentRect:styleMask:backing:defer:))]
222        #[unsafe(method_family = init)]
223        pub unsafe fn initWithContentRect_styleMask_backing_defer(
224            this: Allocated<Self>,
225            content_rect: NSRect,
226            style: NSWindowStyleMask,
227            backing_store_type: NSBackingStoreType,
228            flag: bool,
229        ) -> Retained<Self>;
230
231        #[unsafe(method(initWithContentRect:styleMask:backing:defer:screen:))]
232        #[unsafe(method_family = init)]
233        pub unsafe fn initWithContentRect_styleMask_backing_defer_screen(
234            this: Allocated<Self>,
235            content_rect: NSRect,
236            style: NSWindowStyleMask,
237            backing_store_type: NSBackingStoreType,
238            flag: bool,
239            screen: Option<&NSScreen>,
240        ) -> Retained<Self>;
241
242        #[unsafe(method(initWithCoder:))]
243        #[unsafe(method_family = init)]
244        pub unsafe fn initWithCoder(this: Allocated<Self>, coder: &NSCoder) -> Retained<Self>;
245
246        /// 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].
247        #[unsafe(method(windowWithContentViewController:))]
248        #[unsafe(method_family = none)]
249        pub unsafe fn windowWithContentViewController(
250            content_view_controller: &NSViewController,
251        ) -> Retained<Self>;
252    );
253}
254
255/// Methods declared on superclass `NSResponder`.
256impl SFCertificatePanel {
257    extern_methods!(
258        #[unsafe(method(init))]
259        #[unsafe(method_family = init)]
260        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
261    );
262}
263
264/// Methods declared on superclass `NSObject`.
265impl SFCertificatePanel {
266    extern_methods!(
267        #[unsafe(method(new))]
268        #[unsafe(method_family = new)]
269        pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
270    );
271}
272
273mod private_NSObjectSFCertificatePanelDelegate {
274    pub trait Sealed {}
275}
276
277/// Category "SFCertificatePanelDelegate" on [`NSObject`].
278#[doc(alias = "SFCertificatePanelDelegate")]
279pub unsafe trait NSObjectSFCertificatePanelDelegate:
280    ClassType + Sized + private_NSObjectSFCertificatePanelDelegate::Sealed
281{
282    extern_methods!(
283        #[unsafe(method(certificatePanelShowHelp:))]
284        #[unsafe(method_family = none)]
285        unsafe fn certificatePanelShowHelp(&self, sender: Option<&SFCertificatePanel>) -> bool;
286    );
287}
288
289impl private_NSObjectSFCertificatePanelDelegate::Sealed for NSObject {}
290unsafe impl NSObjectSFCertificatePanelDelegate for NSObject {}