objc2_security_interface/generated/
SFChooseIdentityPanel.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    /// SFChooseIdentityPanel is a panel and sheet interface that allows a user to select an identity from a list.
15    ///
16    /// See also [Apple's documentation](https://developer.apple.com/documentation/securityinterface/sfchooseidentitypanel?language=objc)
17    #[unsafe(super(NSPanel, NSWindow, NSResponder, NSObject))]
18    #[derive(Debug, PartialEq, Eq, Hash)]
19    pub struct SFChooseIdentityPanel;
20);
21
22extern_conformance!(
23    unsafe impl NSAccessibility for SFChooseIdentityPanel {}
24);
25
26extern_conformance!(
27    unsafe impl NSAccessibilityElementProtocol for SFChooseIdentityPanel {}
28);
29
30extern_conformance!(
31    unsafe impl NSAnimatablePropertyContainer for SFChooseIdentityPanel {}
32);
33
34extern_conformance!(
35    unsafe impl NSAppearanceCustomization for SFChooseIdentityPanel {}
36);
37
38extern_conformance!(
39    unsafe impl NSCoding for SFChooseIdentityPanel {}
40);
41
42extern_conformance!(
43    unsafe impl NSMenuItemValidation for SFChooseIdentityPanel {}
44);
45
46extern_conformance!(
47    unsafe impl NSObjectProtocol for SFChooseIdentityPanel {}
48);
49
50extern_conformance!(
51    unsafe impl NSUserInterfaceItemIdentification for SFChooseIdentityPanel {}
52);
53
54extern_conformance!(
55    unsafe impl NSUserInterfaceValidations for SFChooseIdentityPanel {}
56);
57
58impl SFChooseIdentityPanel {
59    extern_methods!(
60        /// Returns a shared instance of SFChooseIdentityPanel.
61        ///
62        /// If your application can display multiple SFChooseIdentityPanels at once,
63        /// you should allocate (alloc) and initialize (init) separate object instances instead of using this class method.
64        #[unsafe(method(sharedChooseIdentityPanel))]
65        #[unsafe(method_family = none)]
66        pub unsafe fn sharedChooseIdentityPanel(
67            mtm: MainThreadMarker,
68        ) -> Option<Retained<SFChooseIdentityPanel>>;
69
70        /// Displays a supplied list of identities in a modal panel, returning NSOKButton or NSCancelButton when dismissed.
71        /// Use the -identity method to subsequently obtain the identity chosen by the user.
72        ///
73        /// Parameter `identities`: An array of SecIdentityRef objects, usually obtained from an identity search (see
74        /// <Security
75        /// /SecIdentitySearch.h>).
76        ///
77        /// Parameter `message`: Client-defined message string to display in the panel.
78        ///
79        /// # Safety
80        ///
81        /// - `identities` generic should be of the correct type.
82        /// - `identities` might not allow `None`.
83        /// - `message` might not allow `None`.
84        #[unsafe(method(runModalForIdentities:message:))]
85        #[unsafe(method_family = none)]
86        pub unsafe fn runModalForIdentities_message(
87            &self,
88            identities: Option<&NSArray>,
89            message: Option<&NSString>,
90        ) -> NSInteger;
91
92        /// Displays a sheet version of the SFChooseIdentityPanel. The didEndSelector returnCode will contain either NSOKButton or NSCancelButton.
93        ///
94        /// Parameter `docWindow`: The parent window to which the sheet is attached.
95        ///
96        /// Parameter `modalDelegate`: The object whose didEndSelector method will be called when the sheet is dismissed.
97        ///
98        /// Parameter `didEndSelector`: This method is called when the sheet is dismissed.
99        ///
100        /// Parameter `contextInfo`: Client-defined contextual data which will be passed to the didEndSelector method.
101        ///
102        /// Parameter `identities`: An array of SecIdentityRef objects, usually obtained from an identity search (see
103        /// <Security
104        /// /SecIdentitySearch.h>).
105        ///
106        /// Parameter `message`: Client-defined message string to display in the panel.
107        ///
108        /// The didEndSelector method should have the following signature:
109        /// - (void)chooseIdentitySheetDidEnd:(NSWindow *)sheet returnCode:(NSInteger)returnCode contextInfo:(void *)contextInfo
110        ///
111        /// # Safety
112        ///
113        /// - `doc_window` might not allow `None`.
114        /// - `delegate` should be of the correct type.
115        /// - `delegate` might not allow `None`.
116        /// - `did_end_selector` must be a valid selector.
117        /// - `context_info` must be a valid pointer.
118        /// - `identities` generic should be of the correct type.
119        /// - `identities` might not allow `None`.
120        /// - `message` might not allow `None`.
121        #[unsafe(method(beginSheetForWindow:modalDelegate:didEndSelector:contextInfo:identities:message:))]
122        #[unsafe(method_family = none)]
123        pub unsafe fn beginSheetForWindow_modalDelegate_didEndSelector_contextInfo_identities_message(
124            &self,
125            doc_window: Option<&NSWindow>,
126            delegate: Option<&AnyObject>,
127            did_end_selector: Option<Sel>,
128            context_info: *mut c_void,
129            identities: Option<&NSArray>,
130            message: Option<&NSString>,
131        );
132
133        #[cfg(feature = "objc2-security")]
134        /// Returns the identity that the user chose in the panel.
135        #[unsafe(method(identity))]
136        #[unsafe(method_family = none)]
137        pub unsafe fn identity(&self) -> Option<Retained<SecIdentity>>;
138
139        /// Specifies one or more policies that apply to the displayed certificates.
140        ///
141        /// Parameter `policies`: The policies to use when evaluating the certificates' status.
142        /// You can pass either a SecPolicyRef or a NSArray (containing one or more SecPolicyRef instances) in this parameter.
143        /// If policies is set to nil, the Apple X.509 Basic Policy will be used.
144        ///
145        /// Applications will typically display a SFChooseIdentityPanel in the context of a specific usage, such as SSL or S/MIME.
146        /// You should set only the policy references which apply to your intended usage.
147        ///
148        /// # Safety
149        ///
150        /// - `policies` should be of the correct type.
151        /// - `policies` might not allow `None`.
152        #[unsafe(method(setPolicies:))]
153        #[unsafe(method_family = none)]
154        pub unsafe fn setPolicies(&self, policies: Option<&AnyObject>);
155
156        /// Returns an array of policies used to evaluate the status of the displayed certificates.
157        ///
158        /// This method returns an autoreleased NSArray containing one or more SecPolicyRef instances, as set by a previous setPolicies: call.
159        #[unsafe(method(policies))]
160        #[unsafe(method_family = none)]
161        pub unsafe fn policies(&self) -> Option<Retained<NSArray>>;
162
163        /// Customizes the title of the default button.
164        ///
165        /// Parameter `title`: The new title for the default button.
166        ///
167        /// # Safety
168        ///
169        /// `title` might not allow `None`.
170        #[unsafe(method(setDefaultButtonTitle:))]
171        #[unsafe(method_family = none)]
172        pub unsafe fn setDefaultButtonTitle(&self, title: Option<&NSString>);
173
174        /// Customizes the title of the alternate button.
175        ///
176        /// Parameter `title`: The new title for the alternate button. If title is set to nil, the button will not be shown.
177        ///
178        /// # Safety
179        ///
180        /// `title` might not allow `None`.
181        #[unsafe(method(setAlternateButtonTitle:))]
182        #[unsafe(method_family = none)]
183        pub unsafe fn setAlternateButtonTitle(&self, title: Option<&NSString>);
184
185        #[unsafe(method(setShowsHelp:))]
186        #[unsafe(method_family = none)]
187        pub unsafe fn setShowsHelp(&self, shows_help: bool);
188
189        #[unsafe(method(showsHelp))]
190        #[unsafe(method_family = none)]
191        pub unsafe fn showsHelp(&self) -> bool;
192
193        /// # Safety
194        ///
195        /// `anchor` might not allow `None`.
196        #[unsafe(method(setHelpAnchor:))]
197        #[unsafe(method_family = none)]
198        pub unsafe fn setHelpAnchor(&self, anchor: Option<&NSString>);
199
200        #[unsafe(method(helpAnchor))]
201        #[unsafe(method_family = none)]
202        pub unsafe fn helpAnchor(&self) -> Option<Retained<NSString>>;
203
204        /// Sets the optional informative text displayed in the SFChooseIdentityPanel.
205        ///
206        /// Parameter `informativeText`: The informative text to display in the panel.
207        ///
208        /// Call this method to set the informative text to be displayed.
209        ///
210        /// # Safety
211        ///
212        /// `informative_text` might not allow `None`.
213        #[unsafe(method(setInformativeText:))]
214        #[unsafe(method_family = none)]
215        pub unsafe fn setInformativeText(&self, informative_text: Option<&NSString>);
216
217        /// Returns the informative text currently displayed in the SFChooseIdentityPanel.
218        #[unsafe(method(informativeText))]
219        #[unsafe(method_family = none)]
220        pub unsafe fn informativeText(&self) -> Option<Retained<NSString>>;
221
222        /// Sets an optional domain in which the identity is to be used.
223        ///
224        /// Parameter `domainString`: A string containing a hostname, RFC822 name (email address), URL, or similar identifier.
225        ///
226        /// Call this method to associate a domain with the chosen identity.
227        /// If the user chooses an identity and a domain has been set, an identity preference item will be created in the default keychain. Subsequently, calling SecIdentitySearchCreateWithPolicy and SecIdentitySearchCopyNext will return the preferred identity for this domain first.
228        ///
229        /// # Safety
230        ///
231        /// `domain_string` might not allow `None`.
232        #[unsafe(method(setDomain:))]
233        #[unsafe(method_family = none)]
234        pub unsafe fn setDomain(&self, domain_string: Option<&NSString>);
235
236        /// Returns the domain which will be associated with the chosen identity.
237        #[unsafe(method(domain))]
238        #[unsafe(method_family = none)]
239        pub unsafe fn domain(&self) -> Option<Retained<NSString>>;
240    );
241}
242
243/// Methods declared on superclass `NSWindow`.
244impl SFChooseIdentityPanel {
245    extern_methods!(
246        #[unsafe(method(initWithContentRect:styleMask:backing:defer:))]
247        #[unsafe(method_family = init)]
248        pub unsafe fn initWithContentRect_styleMask_backing_defer(
249            this: Allocated<Self>,
250            content_rect: NSRect,
251            style: NSWindowStyleMask,
252            backing_store_type: NSBackingStoreType,
253            flag: bool,
254        ) -> Retained<Self>;
255
256        #[unsafe(method(initWithContentRect:styleMask:backing:defer:screen:))]
257        #[unsafe(method_family = init)]
258        pub unsafe fn initWithContentRect_styleMask_backing_defer_screen(
259            this: Allocated<Self>,
260            content_rect: NSRect,
261            style: NSWindowStyleMask,
262            backing_store_type: NSBackingStoreType,
263            flag: bool,
264            screen: Option<&NSScreen>,
265        ) -> Retained<Self>;
266
267        /// # Safety
268        ///
269        /// `coder` possibly has further requirements.
270        #[unsafe(method(initWithCoder:))]
271        #[unsafe(method_family = init)]
272        pub unsafe fn initWithCoder(this: Allocated<Self>, coder: &NSCoder) -> Retained<Self>;
273
274        /// 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].
275        #[unsafe(method(windowWithContentViewController:))]
276        #[unsafe(method_family = none)]
277        pub unsafe fn windowWithContentViewController(
278            content_view_controller: &NSViewController,
279        ) -> Retained<Self>;
280    );
281}
282
283/// Methods declared on superclass `NSResponder`.
284impl SFChooseIdentityPanel {
285    extern_methods!(
286        #[unsafe(method(init))]
287        #[unsafe(method_family = init)]
288        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
289    );
290}
291
292/// Methods declared on superclass `NSObject`.
293impl SFChooseIdentityPanel {
294    extern_methods!(
295        #[unsafe(method(new))]
296        #[unsafe(method_family = new)]
297        pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
298    );
299}
300
301mod private_NSObjectSFChooseIdentityPanelDelegate {
302    pub trait Sealed {}
303}
304
305/// Category "SFChooseIdentityPanelDelegate" on [`NSObject`].
306#[doc(alias = "SFChooseIdentityPanelDelegate")]
307pub unsafe trait NSObjectSFChooseIdentityPanelDelegate:
308    ClassType + Sized + private_NSObjectSFChooseIdentityPanelDelegate::Sealed
309{
310    extern_methods!(
311        /// # Safety
312        ///
313        /// `sender` might not allow `None`.
314        #[unsafe(method(chooseIdentityPanelShowHelp:))]
315        #[unsafe(method_family = none)]
316        unsafe fn chooseIdentityPanelShowHelp(
317            &self,
318            sender: Option<&SFChooseIdentityPanel>,
319        ) -> bool;
320    );
321}
322
323impl private_NSObjectSFChooseIdentityPanelDelegate::Sealed for NSObject {}
324unsafe impl NSObjectSFChooseIdentityPanelDelegate for NSObject {}