objc2_security_interface/generated/
SFKeychainSettingsPanel.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    /// [Apple's documentation](https://developer.apple.com/documentation/securityinterface/sfkeychainsettingspanel?language=objc)
15    #[unsafe(super(NSPanel, NSWindow, NSResponder, NSObject))]
16    #[derive(Debug, PartialEq, Eq, Hash)]
17    pub struct SFKeychainSettingsPanel;
18);
19
20extern_conformance!(
21    unsafe impl NSAccessibility for SFKeychainSettingsPanel {}
22);
23
24extern_conformance!(
25    unsafe impl NSAccessibilityElementProtocol for SFKeychainSettingsPanel {}
26);
27
28extern_conformance!(
29    unsafe impl NSAnimatablePropertyContainer for SFKeychainSettingsPanel {}
30);
31
32extern_conformance!(
33    unsafe impl NSAppearanceCustomization for SFKeychainSettingsPanel {}
34);
35
36extern_conformance!(
37    unsafe impl NSCoding for SFKeychainSettingsPanel {}
38);
39
40extern_conformance!(
41    unsafe impl NSMenuItemValidation for SFKeychainSettingsPanel {}
42);
43
44extern_conformance!(
45    unsafe impl NSObjectProtocol for SFKeychainSettingsPanel {}
46);
47
48extern_conformance!(
49    unsafe impl NSUserInterfaceItemIdentification for SFKeychainSettingsPanel {}
50);
51
52extern_conformance!(
53    unsafe impl NSUserInterfaceValidations for SFKeychainSettingsPanel {}
54);
55
56impl SFKeychainSettingsPanel {
57    extern_methods!(
58        /// Returns a global instance of SFKeychainSettingsPanel object.
59        #[unsafe(method(sharedKeychainSettingsPanel))]
60        #[unsafe(method_family = none)]
61        pub unsafe fn sharedKeychainSettingsPanel(
62            mtm: MainThreadMarker,
63        ) -> Option<Retained<SFKeychainSettingsPanel>>;
64
65        #[cfg(feature = "objc2-security")]
66        /// Changes the keychain settings using the settings panel. The panel contains settings such as "lock on sleep", "automatic lock", etc. If the user attempts to change the settings of a locked keychain, the unlock panel will be presented. It returns NSOKButton or NSCancelButton.
67        ///
68        /// Parameter `settings`: A pointer to a keychain settings structure. Since this structure is versioned, you must preallocate it and fill in the version of the structure.
69        ///
70        /// Parameter `keychain`: The keychain that will have its settings changed.
71        ///
72        /// # Safety
73        ///
74        /// - `settings` must be a valid pointer.
75        /// - `keychain` might not allow `None`.
76        #[unsafe(method(runModalForSettings:keychain:))]
77        #[unsafe(method_family = none)]
78        pub unsafe fn runModalForSettings_keychain(
79            &self,
80            settings: *mut SecKeychainSettings,
81            keychain: Option<&SecKeychain>,
82        ) -> NSInteger;
83
84        #[cfg(feature = "objc2-security")]
85        /// Presents a sheet version of SFKeychainSettingsPanel. The didEndSelector returnCode will contain either NSOKButton or NSCancelButton.
86        ///
87        /// Parameter `docWindow`: The panel in which the settings sheet slides down; acting as a document modal window. If docWindow is nil, the behavior defaults to a standalone modal window.
88        ///
89        /// Parameter `delegate`: Delegate object in which didEndSelector is a method.
90        ///
91        /// 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. The didEndSelector may dismiss the keychain panel itself; otherwise it will be dismissed on return from the method. The didEndSelector should have the following signature:
92        /// - (void)settingsPanelDidEnd:(NSWindow *)sheet returnCode:(NSInteger)returnCode contextInfo:(void *)contextInfo;
93        ///
94        /// Parameter `contextInfo`: A client-defined context.
95        ///
96        /// Parameter `settings`: A pointer to a keychain settings structure. Since this structure is versioned, you must preallocate it and fill in the version of the structure.
97        ///
98        /// Parameter `keychain`: The keychain that will have its settings changed.
99        ///
100        /// # Safety
101        ///
102        /// - `doc_window` might not allow `None`.
103        /// - `delegate` should be of the correct type.
104        /// - `delegate` might not allow `None`.
105        /// - `did_end_selector` must be a valid selector.
106        /// - `context_info` must be a valid pointer.
107        /// - `settings` must be a valid pointer.
108        /// - `keychain` might not allow `None`.
109        #[unsafe(method(beginSheetForWindow:modalDelegate:didEndSelector:contextInfo:settings:keychain:))]
110        #[unsafe(method_family = none)]
111        pub unsafe fn beginSheetForWindow_modalDelegate_didEndSelector_contextInfo_settings_keychain(
112            &self,
113            doc_window: Option<&NSWindow>,
114            delegate: Option<&AnyObject>,
115            did_end_selector: Option<Sel>,
116            context_info: *mut c_void,
117            settings: *mut SecKeychainSettings,
118            keychain: Option<&SecKeychain>,
119        );
120    );
121}
122
123/// Methods declared on superclass `NSWindow`.
124impl SFKeychainSettingsPanel {
125    extern_methods!(
126        #[unsafe(method(initWithContentRect:styleMask:backing:defer:))]
127        #[unsafe(method_family = init)]
128        pub unsafe fn initWithContentRect_styleMask_backing_defer(
129            this: Allocated<Self>,
130            content_rect: NSRect,
131            style: NSWindowStyleMask,
132            backing_store_type: NSBackingStoreType,
133            flag: bool,
134        ) -> Retained<Self>;
135
136        #[unsafe(method(initWithContentRect:styleMask:backing:defer:screen:))]
137        #[unsafe(method_family = init)]
138        pub unsafe fn initWithContentRect_styleMask_backing_defer_screen(
139            this: Allocated<Self>,
140            content_rect: NSRect,
141            style: NSWindowStyleMask,
142            backing_store_type: NSBackingStoreType,
143            flag: bool,
144            screen: Option<&NSScreen>,
145        ) -> Retained<Self>;
146
147        /// # Safety
148        ///
149        /// `coder` possibly has further requirements.
150        #[unsafe(method(initWithCoder:))]
151        #[unsafe(method_family = init)]
152        pub unsafe fn initWithCoder(this: Allocated<Self>, coder: &NSCoder) -> Retained<Self>;
153
154        /// 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].
155        #[unsafe(method(windowWithContentViewController:))]
156        #[unsafe(method_family = none)]
157        pub unsafe fn windowWithContentViewController(
158            content_view_controller: &NSViewController,
159        ) -> Retained<Self>;
160    );
161}
162
163/// Methods declared on superclass `NSResponder`.
164impl SFKeychainSettingsPanel {
165    extern_methods!(
166        #[unsafe(method(init))]
167        #[unsafe(method_family = init)]
168        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
169    );
170}
171
172/// Methods declared on superclass `NSObject`.
173impl SFKeychainSettingsPanel {
174    extern_methods!(
175        #[unsafe(method(new))]
176        #[unsafe(method_family = new)]
177        pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
178    );
179}