objc2_security_interface/generated/SFCertificateTrustPanel.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 /// SFCertificateTrustPanel is a panel and sheet interface that allows a user to make trust decisions
15 /// when one or more certificates involved in an operation are invalid or cannot be verified. It should be used
16 /// whenever confirmation is required before proceeding with a certificate-related operation. It can also be
17 /// displayed as an informative alert without requiring a decision to be made (if the operation or transaction
18 /// has already occurred.)
19 ///
20 /// See also [Apple's documentation](https://developer.apple.com/documentation/securityinterface/sfcertificatetrustpanel?language=objc)
21 #[unsafe(super(SFCertificatePanel, NSPanel, NSWindow, NSResponder, NSObject))]
22 #[derive(Debug, PartialEq, Eq, Hash)]
23 #[cfg(feature = "SFCertificatePanel")]
24 pub struct SFCertificateTrustPanel;
25);
26
27#[cfg(feature = "SFCertificatePanel")]
28extern_conformance!(
29 unsafe impl NSAccessibility for SFCertificateTrustPanel {}
30);
31
32#[cfg(feature = "SFCertificatePanel")]
33extern_conformance!(
34 unsafe impl NSAccessibilityElementProtocol for SFCertificateTrustPanel {}
35);
36
37#[cfg(feature = "SFCertificatePanel")]
38extern_conformance!(
39 unsafe impl NSAnimatablePropertyContainer for SFCertificateTrustPanel {}
40);
41
42#[cfg(feature = "SFCertificatePanel")]
43extern_conformance!(
44 unsafe impl NSAppearanceCustomization for SFCertificateTrustPanel {}
45);
46
47#[cfg(feature = "SFCertificatePanel")]
48extern_conformance!(
49 unsafe impl NSCoding for SFCertificateTrustPanel {}
50);
51
52#[cfg(feature = "SFCertificatePanel")]
53extern_conformance!(
54 unsafe impl NSMenuItemValidation for SFCertificateTrustPanel {}
55);
56
57#[cfg(feature = "SFCertificatePanel")]
58extern_conformance!(
59 unsafe impl NSObjectProtocol for SFCertificateTrustPanel {}
60);
61
62#[cfg(feature = "SFCertificatePanel")]
63extern_conformance!(
64 unsafe impl NSUserInterfaceItemIdentification for SFCertificateTrustPanel {}
65);
66
67#[cfg(feature = "SFCertificatePanel")]
68extern_conformance!(
69 unsafe impl NSUserInterfaceValidations for SFCertificateTrustPanel {}
70);
71
72#[cfg(feature = "SFCertificatePanel")]
73impl SFCertificateTrustPanel {
74 extern_methods!(
75 /// Returns a shared instance of SFCertificateTrustPanel.
76 ///
77 /// If your application can display multiple SFCertificateTrustPanels at once,
78 /// you should allocate (alloc) and initialize (init) separate object instances instead of using this class method.
79 #[unsafe(method(sharedCertificateTrustPanel))]
80 #[unsafe(method_family = none)]
81 pub unsafe fn sharedCertificateTrustPanel(
82 mtm: MainThreadMarker,
83 ) -> Option<Retained<SFCertificateTrustPanel>>;
84
85 #[cfg(feature = "objc2-security")]
86 /// Displays a modal panel that shows the results of a certificate trust evaluation.
87 /// Returns NSOKButton if the default button is pressed, or NSCancelButton if the alternate button is pressed.
88 /// Note that the user can edit trust decisions in this panel; call SecTrustGetResult after the panel is dismissed
89 /// to obtain the current trust result for the SecTrustRef.
90 ///
91 /// Parameter `trust`: A trust reference, previously created with SecTrustCreateWithCertificates (see
92 /// <Security
93 /// /SecTrust.h>).
94 ///
95 /// Parameter `message`: Client-defined message string to display in the panel.
96 ///
97 /// # Safety
98 ///
99 /// - `trust` might not allow `None`.
100 /// - `message` might not allow `None`.
101 #[unsafe(method(runModalForTrust:message:))]
102 #[unsafe(method_family = none)]
103 pub unsafe fn runModalForTrust_message(
104 &self,
105 trust: Option<&SecTrust>,
106 message: Option<&NSString>,
107 ) -> NSInteger;
108
109 #[cfg(feature = "objc2-security")]
110 /// Displays a modal sheet that shows the results of a certificate trust evaluation.
111 ///
112 /// The didEndSelector method should have the following signature:
113 /// - (void)certificateTrustSheetDidEnd:(NSWindow *)sheet returnCode:(NSInteger)returnCode contextInfo:(void *)contextInfo
114 /// returnCode will contain either NSOKButton or NSCancelButton.
115 /// Note that the user can edit trust decisions in this panel; call SecTrustGetResult after the panel is dismissed
116 /// to obtain the current trust result for the SecTrustRef.
117 ///
118 /// Parameter `docWindow`: The parent window to which the sheet is attached.
119 ///
120 /// Parameter `modalDelegate`: The object whose didEndSelector method will be called when the sheet is dismissed.
121 ///
122 /// Parameter `didEndSelector`: This method is called when the sheet is dismissed.
123 ///
124 /// Parameter `contextInfo`: Client-defined contextual data which will be passed to the didEndSelector method.
125 ///
126 /// Parameter `trust`: A trust reference, previously created with SecTrustCreateWithCertificates (see
127 /// <Security
128 /// /SecTrust.h>).
129 ///
130 /// Parameter `message`: Client-defined message string to display in the panel.
131 ///
132 /// # Safety
133 ///
134 /// - `doc_window` might not allow `None`.
135 /// - `delegate` should be of the correct type.
136 /// - `delegate` might not allow `None`.
137 /// - `did_end_selector` must be a valid selector.
138 /// - `context_info` must be a valid pointer.
139 /// - `trust` might not allow `None`.
140 /// - `message` might not allow `None`.
141 #[unsafe(method(beginSheetForWindow:modalDelegate:didEndSelector:contextInfo:trust:message:))]
142 #[unsafe(method_family = none)]
143 pub unsafe fn beginSheetForWindow_modalDelegate_didEndSelector_contextInfo_trust_message(
144 &self,
145 doc_window: Option<&NSWindow>,
146 delegate: Option<&AnyObject>,
147 did_end_selector: Option<Sel>,
148 context_info: *mut c_void,
149 trust: Option<&SecTrust>,
150 message: Option<&NSString>,
151 );
152
153 /// Sets the optional informative text displayed in the SFCertificateTrustPanel.
154 ///
155 /// Parameter `informativeText`: The informative text to display in the panel.
156 ///
157 /// By default, informative text describing the current certificate trust status is displayed.
158 /// Call this method only if your application needs to customize the displayed informative text.
159 ///
160 /// # Safety
161 ///
162 /// `informative_text` might not allow `None`.
163 #[unsafe(method(setInformativeText:))]
164 #[unsafe(method_family = none)]
165 pub unsafe fn setInformativeText(&self, informative_text: Option<&NSString>);
166
167 /// Returns the informative text currently displayed in the SFCertificateTrustPanel.
168 #[unsafe(method(informativeText))]
169 #[unsafe(method_family = none)]
170 pub unsafe fn informativeText(&self) -> Option<Retained<NSString>>;
171 );
172}
173
174/// Methods declared on superclass `NSWindow`.
175#[cfg(feature = "SFCertificatePanel")]
176impl SFCertificateTrustPanel {
177 extern_methods!(
178 #[unsafe(method(initWithContentRect:styleMask:backing:defer:))]
179 #[unsafe(method_family = init)]
180 pub unsafe fn initWithContentRect_styleMask_backing_defer(
181 this: Allocated<Self>,
182 content_rect: NSRect,
183 style: NSWindowStyleMask,
184 backing_store_type: NSBackingStoreType,
185 flag: bool,
186 ) -> Retained<Self>;
187
188 #[unsafe(method(initWithContentRect:styleMask:backing:defer:screen:))]
189 #[unsafe(method_family = init)]
190 pub unsafe fn initWithContentRect_styleMask_backing_defer_screen(
191 this: Allocated<Self>,
192 content_rect: NSRect,
193 style: NSWindowStyleMask,
194 backing_store_type: NSBackingStoreType,
195 flag: bool,
196 screen: Option<&NSScreen>,
197 ) -> Retained<Self>;
198
199 /// # Safety
200 ///
201 /// `coder` possibly has further requirements.
202 #[unsafe(method(initWithCoder:))]
203 #[unsafe(method_family = init)]
204 pub unsafe fn initWithCoder(this: Allocated<Self>, coder: &NSCoder) -> Retained<Self>;
205
206 /// 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].
207 #[unsafe(method(windowWithContentViewController:))]
208 #[unsafe(method_family = none)]
209 pub unsafe fn windowWithContentViewController(
210 content_view_controller: &NSViewController,
211 ) -> Retained<Self>;
212 );
213}
214
215/// Methods declared on superclass `NSResponder`.
216#[cfg(feature = "SFCertificatePanel")]
217impl SFCertificateTrustPanel {
218 extern_methods!(
219 #[unsafe(method(init))]
220 #[unsafe(method_family = init)]
221 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
222 );
223}
224
225/// Methods declared on superclass `NSObject`.
226#[cfg(feature = "SFCertificatePanel")]
227impl SFCertificateTrustPanel {
228 extern_methods!(
229 #[unsafe(method(new))]
230 #[unsafe(method_family = new)]
231 pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
232 );
233}