objc2_security_interface/generated/SFKeychainSavePanel.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 /// SFKeychainSavePanel is a panel and sheet interface used to create a keychain using the NSSavePanel UI.
15 ///
16 /// See also [Apple's documentation](https://developer.apple.com/documentation/securityinterface/sfkeychainsavepanel?language=objc)
17 #[unsafe(super(NSSavePanel, NSPanel, NSWindow, NSResponder, NSObject))]
18 #[derive(Debug, PartialEq, Eq, Hash)]
19 pub struct SFKeychainSavePanel;
20);
21
22extern_conformance!(
23 unsafe impl NSAccessibility for SFKeychainSavePanel {}
24);
25
26extern_conformance!(
27 unsafe impl NSAccessibilityElementProtocol for SFKeychainSavePanel {}
28);
29
30extern_conformance!(
31 unsafe impl NSAnimatablePropertyContainer for SFKeychainSavePanel {}
32);
33
34extern_conformance!(
35 unsafe impl NSAppearanceCustomization for SFKeychainSavePanel {}
36);
37
38extern_conformance!(
39 unsafe impl NSCoding for SFKeychainSavePanel {}
40);
41
42extern_conformance!(
43 unsafe impl NSMenuItemValidation for SFKeychainSavePanel {}
44);
45
46extern_conformance!(
47 unsafe impl NSObjectProtocol for SFKeychainSavePanel {}
48);
49
50extern_conformance!(
51 unsafe impl NSUserInterfaceItemIdentification for SFKeychainSavePanel {}
52);
53
54extern_conformance!(
55 unsafe impl NSUserInterfaceValidations for SFKeychainSavePanel {}
56);
57
58impl SFKeychainSavePanel {
59 extern_methods!(
60 /// Returns a global instance of SFKeychainSavePanel object.
61 #[unsafe(method(sharedKeychainSavePanel))]
62 #[unsafe(method_family = none)]
63 pub unsafe fn sharedKeychainSavePanel(
64 mtm: MainThreadMarker,
65 ) -> Option<Retained<SFKeychainSavePanel>>;
66
67 /// Displays a keychain save panel.
68 ///
69 /// Parameter `path`: The path to where the keychain is created (nil for ~/Library/Keychains).
70 ///
71 /// Parameter `name`: The keychain name to be automatically filled out in the NSSave panel.
72 ///
73 /// Returns: a result code returned by NSSavePanel's runModalForDirectory method.
74 ///
75 /// # Safety
76 ///
77 /// - `path` might not allow `None`.
78 /// - `name` might not allow `None`.
79 #[unsafe(method(runModalForDirectory:file:))]
80 #[unsafe(method_family = none)]
81 pub unsafe fn runModalForDirectory_file(
82 &self,
83 path: Option<&NSString>,
84 name: Option<&NSString>,
85 ) -> NSInteger;
86
87 /// Specifies the password for the keychain that will be created.
88 ///
89 /// Parameter `The`: password string object.
90 ///
91 /// # Safety
92 ///
93 /// `password` might not allow `None`.
94 #[unsafe(method(setPassword:))]
95 #[unsafe(method_family = none)]
96 pub unsafe fn setPassword(&self, password: Option<&NSString>);
97
98 #[cfg(feature = "objc2-security")]
99 /// Returns the keychain created by the SFKeychainSavePanel.
100 ///
101 /// Returns: The keychain object.
102 #[unsafe(method(keychain))]
103 #[unsafe(method_family = none)]
104 pub unsafe fn keychain(&self) -> Option<Retained<SecKeychain>>;
105
106 /// Returns the last error encountered by SFKeychainSavePanel.
107 ///
108 /// Returns: The error object.
109 #[unsafe(method(error))]
110 #[unsafe(method_family = none)]
111 pub unsafe fn error(&self) -> Option<Retained<NSError>>;
112
113 /// Displays a keychain save panel as a sheet.
114 ///
115 /// Parameter `path`: The path to where the keychain is created (nil for ~/Library/Keychains).
116 ///
117 /// Parameter `name`: The keychain name to be automatically filled out in the NSSave panel.
118 ///
119 /// Parameter `docWindow`: The panel in which the save sheet slides down; acting as a document modal window. If docWindow is nil, the behavior defaults to a standalone modal window.
120 ///
121 /// Parameter `delegate`: Delegate object in which didEndSelector is a method.
122 ///
123 /// Parameter `didEndSelector`: The didEndSelector method is optional. If implemented by the delegate, this method is invoked after the modal session has ended, but before dismissing the same panel. didEndSelector may dismiss the keychain panel itself; otherwise it will be dismissed on return from the method. didEndSelector should have the following signature:
124 /// - (void)createPanelDidEnd:(NSWindow *)sheet returnCode:(NSInteger)returnCode contextInfo:(void *)contextInfo;
125 ///
126 /// Parameter `contextInfo`: Client-defined context pointer.
127 ///
128 /// # Safety
129 ///
130 /// - `path` might not allow `None`.
131 /// - `name` might not allow `None`.
132 /// - `doc_window` might not allow `None`.
133 /// - `delegate` should be of the correct type.
134 /// - `delegate` might not allow `None`.
135 /// - `did_end_selector` must be a valid selector.
136 /// - `context_info` must be a valid pointer.
137 #[unsafe(method(beginSheetForDirectory:file:modalForWindow:modalDelegate:didEndSelector:contextInfo:))]
138 #[unsafe(method_family = none)]
139 pub unsafe fn beginSheetForDirectory_file_modalForWindow_modalDelegate_didEndSelector_contextInfo(
140 &self,
141 path: Option<&NSString>,
142 name: Option<&NSString>,
143 doc_window: Option<&NSWindow>,
144 delegate: Option<&AnyObject>,
145 did_end_selector: Option<Sel>,
146 context_info: *mut c_void,
147 );
148 );
149}
150
151/// Methods declared on superclass `NSWindow`.
152impl SFKeychainSavePanel {
153 extern_methods!(
154 #[unsafe(method(initWithContentRect:styleMask:backing:defer:))]
155 #[unsafe(method_family = init)]
156 pub unsafe fn initWithContentRect_styleMask_backing_defer(
157 this: Allocated<Self>,
158 content_rect: NSRect,
159 style: NSWindowStyleMask,
160 backing_store_type: NSBackingStoreType,
161 flag: bool,
162 ) -> Retained<Self>;
163
164 #[unsafe(method(initWithContentRect:styleMask:backing:defer:screen:))]
165 #[unsafe(method_family = init)]
166 pub unsafe fn initWithContentRect_styleMask_backing_defer_screen(
167 this: Allocated<Self>,
168 content_rect: NSRect,
169 style: NSWindowStyleMask,
170 backing_store_type: NSBackingStoreType,
171 flag: bool,
172 screen: Option<&NSScreen>,
173 ) -> Retained<Self>;
174
175 /// # Safety
176 ///
177 /// `coder` possibly has further requirements.
178 #[unsafe(method(initWithCoder:))]
179 #[unsafe(method_family = init)]
180 pub unsafe fn initWithCoder(this: Allocated<Self>, coder: &NSCoder) -> Retained<Self>;
181
182 /// 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].
183 #[unsafe(method(windowWithContentViewController:))]
184 #[unsafe(method_family = none)]
185 pub unsafe fn windowWithContentViewController(
186 content_view_controller: &NSViewController,
187 ) -> Retained<Self>;
188 );
189}
190
191/// Methods declared on superclass `NSResponder`.
192impl SFKeychainSavePanel {
193 extern_methods!(
194 #[unsafe(method(init))]
195 #[unsafe(method_family = init)]
196 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
197 );
198}
199
200/// Methods declared on superclass `NSObject`.
201impl SFKeychainSavePanel {
202 extern_methods!(
203 #[unsafe(method(new))]
204 #[unsafe(method_family = new)]
205 pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
206 );
207}