objc2-security-interface 0.3.2

Bindings to the SecurityInterface framework
Documentation
//! 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!(
    /// [Apple's documentation](https://developer.apple.com/documentation/securityinterface/sfkeychainsettingspanel?language=objc)
    #[unsafe(super(NSPanel, NSWindow, NSResponder, NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    pub struct SFKeychainSettingsPanel;
);

extern_conformance!(
    unsafe impl NSAccessibility for SFKeychainSettingsPanel {}
);

extern_conformance!(
    unsafe impl NSAccessibilityElementProtocol for SFKeychainSettingsPanel {}
);

extern_conformance!(
    unsafe impl NSAnimatablePropertyContainer for SFKeychainSettingsPanel {}
);

extern_conformance!(
    unsafe impl NSAppearanceCustomization for SFKeychainSettingsPanel {}
);

extern_conformance!(
    unsafe impl NSCoding for SFKeychainSettingsPanel {}
);

extern_conformance!(
    unsafe impl NSMenuItemValidation for SFKeychainSettingsPanel {}
);

extern_conformance!(
    unsafe impl NSObjectProtocol for SFKeychainSettingsPanel {}
);

extern_conformance!(
    unsafe impl NSUserInterfaceItemIdentification for SFKeychainSettingsPanel {}
);

extern_conformance!(
    unsafe impl NSUserInterfaceValidations for SFKeychainSettingsPanel {}
);

impl SFKeychainSettingsPanel {
    extern_methods!(
        /// Returns a global instance of SFKeychainSettingsPanel object.
        #[unsafe(method(sharedKeychainSettingsPanel))]
        #[unsafe(method_family = none)]
        pub unsafe fn sharedKeychainSettingsPanel(
            mtm: MainThreadMarker,
        ) -> Option<Retained<SFKeychainSettingsPanel>>;

        #[cfg(feature = "objc2-security")]
        /// 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.
        ///
        /// 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.
        ///
        /// Parameter `keychain`: The keychain that will have its settings changed.
        ///
        /// # Safety
        ///
        /// - `settings` must be a valid pointer.
        /// - `keychain` might not allow `None`.
        #[unsafe(method(runModalForSettings:keychain:))]
        #[unsafe(method_family = none)]
        pub unsafe fn runModalForSettings_keychain(
            &self,
            settings: *mut SecKeychainSettings,
            keychain: Option<&SecKeychain>,
        ) -> NSInteger;

        #[cfg(feature = "objc2-security")]
        /// Presents a sheet version of SFKeychainSettingsPanel. The didEndSelector returnCode will contain either NSOKButton or NSCancelButton.
        ///
        /// 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.
        ///
        /// Parameter `delegate`: Delegate object in which didEndSelector is a method.
        ///
        /// 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:
        /// - (void)settingsPanelDidEnd:(NSWindow *)sheet returnCode:(NSInteger)returnCode contextInfo:(void *)contextInfo;
        ///
        /// Parameter `contextInfo`: A client-defined context.
        ///
        /// 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.
        ///
        /// Parameter `keychain`: The keychain that will have its settings changed.
        ///
        /// # Safety
        ///
        /// - `doc_window` might not allow `None`.
        /// - `delegate` should be of the correct type.
        /// - `delegate` might not allow `None`.
        /// - `did_end_selector` must be a valid selector.
        /// - `context_info` must be a valid pointer.
        /// - `settings` must be a valid pointer.
        /// - `keychain` might not allow `None`.
        #[unsafe(method(beginSheetForWindow:modalDelegate:didEndSelector:contextInfo:settings:keychain:))]
        #[unsafe(method_family = none)]
        pub unsafe fn beginSheetForWindow_modalDelegate_didEndSelector_contextInfo_settings_keychain(
            &self,
            doc_window: Option<&NSWindow>,
            delegate: Option<&AnyObject>,
            did_end_selector: Option<Sel>,
            context_info: *mut c_void,
            settings: *mut SecKeychainSettings,
            keychain: Option<&SecKeychain>,
        );
    );
}

/// Methods declared on superclass `NSWindow`.
impl SFKeychainSettingsPanel {
    extern_methods!(
        #[unsafe(method(initWithContentRect:styleMask:backing:defer:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithContentRect_styleMask_backing_defer(
            this: Allocated<Self>,
            content_rect: NSRect,
            style: NSWindowStyleMask,
            backing_store_type: NSBackingStoreType,
            flag: bool,
        ) -> Retained<Self>;

        #[unsafe(method(initWithContentRect:styleMask:backing:defer:screen:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithContentRect_styleMask_backing_defer_screen(
            this: Allocated<Self>,
            content_rect: NSRect,
            style: NSWindowStyleMask,
            backing_store_type: NSBackingStoreType,
            flag: bool,
            screen: Option<&NSScreen>,
        ) -> Retained<Self>;

        /// # Safety
        ///
        /// `coder` possibly has further requirements.
        #[unsafe(method(initWithCoder:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithCoder(this: Allocated<Self>, coder: &NSCoder) -> Retained<Self>;

        /// 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].
        #[unsafe(method(windowWithContentViewController:))]
        #[unsafe(method_family = none)]
        pub unsafe fn windowWithContentViewController(
            content_view_controller: &NSViewController,
        ) -> Retained<Self>;
    );
}

/// Methods declared on superclass `NSResponder`.
impl SFKeychainSettingsPanel {
    extern_methods!(
        #[unsafe(method(init))]
        #[unsafe(method_family = init)]
        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
    );
}

/// Methods declared on superclass `NSObject`.
impl SFKeychainSettingsPanel {
    extern_methods!(
        #[unsafe(method(new))]
        #[unsafe(method_family = new)]
        pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
    );
}