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