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