objc2_security_interface/generated/SFCertificateView.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 /// SFCertificateView is a NSView that displays the contents of a certificate.
15 ///
16 /// See also [Apple's documentation](https://developer.apple.com/documentation/securityinterface/sfcertificateview?language=objc)
17 #[unsafe(super(NSVisualEffectView, NSView, NSResponder, NSObject))]
18 #[derive(Debug, PartialEq, Eq, Hash)]
19 pub struct SFCertificateView;
20);
21
22extern_conformance!(
23 unsafe impl NSAccessibility for SFCertificateView {}
24);
25
26extern_conformance!(
27 unsafe impl NSAccessibilityElementProtocol for SFCertificateView {}
28);
29
30extern_conformance!(
31 unsafe impl NSAnimatablePropertyContainer for SFCertificateView {}
32);
33
34extern_conformance!(
35 unsafe impl NSAppearanceCustomization for SFCertificateView {}
36);
37
38extern_conformance!(
39 unsafe impl NSCoding for SFCertificateView {}
40);
41
42extern_conformance!(
43 unsafe impl NSDraggingDestination for SFCertificateView {}
44);
45
46extern_conformance!(
47 unsafe impl NSObjectProtocol for SFCertificateView {}
48);
49
50extern_conformance!(
51 unsafe impl NSUserInterfaceItemIdentification for SFCertificateView {}
52);
53
54impl SFCertificateView {
55 extern_methods!(
56 #[cfg(feature = "objc2-security")]
57 /// Specifies the certificate that's displayed in the view.
58 ///
59 /// Parameter `certificate`: The new certificate for the view.
60 ///
61 /// # Safety
62 ///
63 /// `certificate` might not allow `None`.
64 #[unsafe(method(setCertificate:))]
65 #[unsafe(method_family = none)]
66 pub unsafe fn setCertificate(&self, certificate: Option<&SecCertificate>);
67
68 #[cfg(feature = "objc2-security")]
69 /// Returns the certificate currently displayed in the view.
70 #[unsafe(method(certificate))]
71 #[unsafe(method_family = none)]
72 pub unsafe fn certificate(&self) -> Option<Retained<SecCertificate>>;
73
74 /// Specifies one or more policies that apply to the displayed certificate.
75 ///
76 /// Parameter `policies`: The policies to use when evaluating this certificate's status.
77 /// You can pass either a SecPolicyRef or a NSArray (containing one or more SecPolicyRef instances) in this parameter.
78 /// If policies is set to nil, the Apple X.509 Basic Policy will be used.
79 ///
80 /// Applications will typically display a SFCertificateView in the context of a specific usage, such as SSL or S/MIME.
81 /// You should set only the policy references which apply to your intended usage.
82 ///
83 /// # Safety
84 ///
85 /// - `policies` should be of the correct type.
86 /// - `policies` might not allow `None`.
87 #[unsafe(method(setPolicies:))]
88 #[unsafe(method_family = none)]
89 pub unsafe fn setPolicies(&self, policies: Option<&AnyObject>);
90
91 /// Returns an array of policies used to evaluate the status of the displayed certificate.
92 ///
93 /// This method returns an autoreleased NSArray containing one or more SecPolicyRef instances, as set by a previous
94 /// setPolicies: call. The array will always contain at least one item (the Apple X.509 Basic Policy).
95 #[unsafe(method(policies))]
96 #[unsafe(method_family = none)]
97 pub unsafe fn policies(&self) -> Option<Retained<NSArray>>;
98
99 /// Specifies whether the user can edit the certificate's trust settings.
100 ///
101 /// Parameter `editable`: Pass YES if the trust settings should be editable.
102 #[unsafe(method(setEditableTrust:))]
103 #[unsafe(method_family = none)]
104 pub unsafe fn setEditableTrust(&self, editable: bool);
105
106 /// Indicates if the view allows the user to edit the certificate's trust.
107 #[unsafe(method(isEditable))]
108 #[unsafe(method_family = none)]
109 pub unsafe fn isEditable(&self) -> bool;
110
111 /// Specifies whether the user can see the certificate's trust settings.
112 ///
113 /// Parameter `display`: Pass YES to display the trust settings, or NO to hide them.
114 ///
115 /// Certificate trust settings are not displayed by default.
116 /// To show the certificate's trust settings, you must explicitly set the display value to YES.
117 #[unsafe(method(setDisplayTrust:))]
118 #[unsafe(method_family = none)]
119 pub unsafe fn setDisplayTrust(&self, display: bool);
120
121 /// Indicates if the view currently shows the certificate's trust settings.
122 #[unsafe(method(isTrustDisplayed))]
123 #[unsafe(method_family = none)]
124 pub unsafe fn isTrustDisplayed(&self) -> bool;
125
126 /// Saves the user's current trust settings for the displayed certificate.
127 ///
128 /// If trust settings are not editable, this method effectively does nothing.
129 /// You can use SecTrustGetUserTrust (see
130 /// <Security
131 /// /SecTrust.h>) to subsequently retrieve the trust settings.
132 #[unsafe(method(saveTrustSettings))]
133 #[unsafe(method_family = none)]
134 pub unsafe fn saveTrustSettings(&self);
135
136 /// Specifies whether the user can see the certificate's entire contents.
137 ///
138 /// Parameter `display`: Pass YES to display the certificate's details, or NO to hide them.
139 ///
140 /// For behavioral compatibility with Panther, certificate details are displayed by default.
141 /// To hide the details of a certificate, you must explicitly set the display value to NO.
142 #[unsafe(method(setDisplayDetails:))]
143 #[unsafe(method_family = none)]
144 pub unsafe fn setDisplayDetails(&self, display: bool);
145
146 /// Indicates if the view currently shows the certificate's details.
147 #[unsafe(method(detailsDisplayed))]
148 #[unsafe(method_family = none)]
149 pub unsafe fn detailsDisplayed(&self) -> bool;
150
151 /// Specifies whether the certificate details subview is disclosed (i.e. the triangle is turned down).
152 ///
153 /// Parameter `disclosed`: Pass YES to disclose the certificate details subview, or NO to collapse it.
154 ///
155 /// By default, the certificate details subview is not disclosed.
156 /// Note that changing the disclosure state of a line item does not affect whether the item itself is shown;
157 /// use setDisplayDetails: to cause it to be displayed or hidden.
158 #[unsafe(method(setDetailsDisclosed:))]
159 #[unsafe(method_family = none)]
160 pub unsafe fn setDetailsDisclosed(&self, disclosed: bool);
161
162 /// Indicates if the view currently discloses the certificate's details.
163 #[unsafe(method(detailsDisclosed))]
164 #[unsafe(method_family = none)]
165 pub unsafe fn detailsDisclosed(&self) -> bool;
166
167 /// Specifies whether the trust policy settings are disclosed (i.e. the triangle is turned down).
168 ///
169 /// Parameter `disclosed`: Pass YES to disclose the trust policies subview, or NO to collapse it.
170 ///
171 /// By default, the trust policies subview is not disclosed.
172 /// Note that changing the disclosure state of a line item does not affect whether the item itself is shown;
173 /// use setDisplayTrust: to cause it to be displayed or hidden.
174 #[unsafe(method(setPoliciesDisclosed:))]
175 #[unsafe(method_family = none)]
176 pub unsafe fn setPoliciesDisclosed(&self, disclosed: bool);
177
178 /// Indicates if the view currently discloses the trust policy settings.
179 #[unsafe(method(policiesDisclosed))]
180 #[unsafe(method_family = none)]
181 pub unsafe fn policiesDisclosed(&self) -> bool;
182 );
183}
184
185/// Methods declared on superclass `NSView`.
186impl SFCertificateView {
187 extern_methods!(
188 #[unsafe(method(initWithFrame:))]
189 #[unsafe(method_family = init)]
190 pub unsafe fn initWithFrame(this: Allocated<Self>, frame_rect: NSRect) -> Retained<Self>;
191
192 /// # Safety
193 ///
194 /// `coder` possibly has further requirements.
195 #[unsafe(method(initWithCoder:))]
196 #[unsafe(method_family = init)]
197 pub unsafe fn initWithCoder(
198 this: Allocated<Self>,
199 coder: &NSCoder,
200 ) -> Option<Retained<Self>>;
201 );
202}
203
204/// Methods declared on superclass `NSResponder`.
205impl SFCertificateView {
206 extern_methods!(
207 #[unsafe(method(init))]
208 #[unsafe(method_family = init)]
209 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
210 );
211}
212
213/// Methods declared on superclass `NSObject`.
214impl SFCertificateView {
215 extern_methods!(
216 #[unsafe(method(new))]
217 #[unsafe(method_family = new)]
218 pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
219 );
220}
221
222extern "C" {
223 /// [Apple's documentation](https://developer.apple.com/documentation/securityinterface/sfcertificateviewdisclosurestatedidchange?language=objc)
224 pub static SFCertificateViewDisclosureStateDidChange: Option<&'static NSString>;
225}