//! 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!(
/// SFCertificateTrustPanel is a panel and sheet interface that allows a user to make trust decisions
/// when one or more certificates involved in an operation are invalid or cannot be verified. It should be used
/// whenever confirmation is required before proceeding with a certificate-related operation. It can also be
/// displayed as an informative alert without requiring a decision to be made (if the operation or transaction
/// has already occurred.)
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/securityinterface/sfcertificatetrustpanel?language=objc)
#[unsafe(super(SFCertificatePanel, NSPanel, NSWindow, NSResponder, NSObject))]
#[derive(Debug, PartialEq, Eq, Hash)]
#[cfg(feature = "SFCertificatePanel")]
pub struct SFCertificateTrustPanel;
);
#[cfg(feature = "SFCertificatePanel")]
extern_conformance!(
unsafe impl NSAccessibility for SFCertificateTrustPanel {}
);
#[cfg(feature = "SFCertificatePanel")]
extern_conformance!(
unsafe impl NSAccessibilityElementProtocol for SFCertificateTrustPanel {}
);
#[cfg(feature = "SFCertificatePanel")]
extern_conformance!(
unsafe impl NSAnimatablePropertyContainer for SFCertificateTrustPanel {}
);
#[cfg(feature = "SFCertificatePanel")]
extern_conformance!(
unsafe impl NSAppearanceCustomization for SFCertificateTrustPanel {}
);
#[cfg(feature = "SFCertificatePanel")]
extern_conformance!(
unsafe impl NSCoding for SFCertificateTrustPanel {}
);
#[cfg(feature = "SFCertificatePanel")]
extern_conformance!(
unsafe impl NSMenuItemValidation for SFCertificateTrustPanel {}
);
#[cfg(feature = "SFCertificatePanel")]
extern_conformance!(
unsafe impl NSObjectProtocol for SFCertificateTrustPanel {}
);
#[cfg(feature = "SFCertificatePanel")]
extern_conformance!(
unsafe impl NSUserInterfaceItemIdentification for SFCertificateTrustPanel {}
);
#[cfg(feature = "SFCertificatePanel")]
extern_conformance!(
unsafe impl NSUserInterfaceValidations for SFCertificateTrustPanel {}
);
#[cfg(feature = "SFCertificatePanel")]
impl SFCertificateTrustPanel {
extern_methods!(
/// Returns a shared instance of SFCertificateTrustPanel.
///
/// If your application can display multiple SFCertificateTrustPanels at once,
/// you should allocate (alloc) and initialize (init) separate object instances instead of using this class method.
#[unsafe(method(sharedCertificateTrustPanel))]
#[unsafe(method_family = none)]
pub unsafe fn sharedCertificateTrustPanel(
mtm: MainThreadMarker,
) -> Option<Retained<SFCertificateTrustPanel>>;
#[cfg(feature = "objc2-security")]
/// Displays a modal panel that shows the results of a certificate trust evaluation.
/// Returns NSOKButton if the default button is pressed, or NSCancelButton if the alternate button is pressed.
/// Note that the user can edit trust decisions in this panel; call SecTrustGetResult after the panel is dismissed
/// to obtain the current trust result for the SecTrustRef.
///
/// Parameter `trust`: A trust reference, previously created with SecTrustCreateWithCertificates (see
/// <Security
/// /SecTrust.h>).
///
/// Parameter `message`: Client-defined message string to display in the panel.
///
/// # Safety
///
/// - `trust` might not allow `None`.
/// - `message` might not allow `None`.
#[unsafe(method(runModalForTrust:message:))]
#[unsafe(method_family = none)]
pub unsafe fn runModalForTrust_message(
&self,
trust: Option<&SecTrust>,
message: Option<&NSString>,
) -> NSInteger;
#[cfg(feature = "objc2-security")]
/// Displays a modal sheet that shows the results of a certificate trust evaluation.
///
/// The didEndSelector method should have the following signature:
/// - (void)certificateTrustSheetDidEnd:(NSWindow *)sheet returnCode:(NSInteger)returnCode contextInfo:(void *)contextInfo
/// returnCode will contain either NSOKButton or NSCancelButton.
/// Note that the user can edit trust decisions in this panel; call SecTrustGetResult after the panel is dismissed
/// to obtain the current trust result for the SecTrustRef.
///
/// Parameter `docWindow`: The parent window to which the sheet is attached.
///
/// Parameter `modalDelegate`: The object whose didEndSelector method will be called when the sheet is dismissed.
///
/// Parameter `didEndSelector`: This method is called when the sheet is dismissed.
///
/// Parameter `contextInfo`: Client-defined contextual data which will be passed to the didEndSelector method.
///
/// Parameter `trust`: A trust reference, previously created with SecTrustCreateWithCertificates (see
/// <Security
/// /SecTrust.h>).
///
/// Parameter `message`: Client-defined message string to display in the panel.
///
/// # 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.
/// - `trust` might not allow `None`.
/// - `message` might not allow `None`.
#[unsafe(method(beginSheetForWindow:modalDelegate:didEndSelector:contextInfo:trust:message:))]
#[unsafe(method_family = none)]
pub unsafe fn beginSheetForWindow_modalDelegate_didEndSelector_contextInfo_trust_message(
&self,
doc_window: Option<&NSWindow>,
delegate: Option<&AnyObject>,
did_end_selector: Option<Sel>,
context_info: *mut c_void,
trust: Option<&SecTrust>,
message: Option<&NSString>,
);
/// Sets the optional informative text displayed in the SFCertificateTrustPanel.
///
/// Parameter `informativeText`: The informative text to display in the panel.
///
/// By default, informative text describing the current certificate trust status is displayed.
/// Call this method only if your application needs to customize the displayed informative text.
///
/// # Safety
///
/// `informative_text` might not allow `None`.
#[unsafe(method(setInformativeText:))]
#[unsafe(method_family = none)]
pub unsafe fn setInformativeText(&self, informative_text: Option<&NSString>);
/// Returns the informative text currently displayed in the SFCertificateTrustPanel.
#[unsafe(method(informativeText))]
#[unsafe(method_family = none)]
pub unsafe fn informativeText(&self) -> Option<Retained<NSString>>;
);
}
/// Methods declared on superclass `NSWindow`.
#[cfg(feature = "SFCertificatePanel")]
impl SFCertificateTrustPanel {
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`.
#[cfg(feature = "SFCertificatePanel")]
impl SFCertificateTrustPanel {
extern_methods!(
#[unsafe(method(init))]
#[unsafe(method_family = init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
);
}
/// Methods declared on superclass `NSObject`.
#[cfg(feature = "SFCertificatePanel")]
impl SFCertificateTrustPanel {
extern_methods!(
#[unsafe(method(new))]
#[unsafe(method_family = new)]
pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
);
}