objc2-app-kit 0.3.2

Bindings to the AppKit 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_foundation::*;

use crate::*;

/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsstoryboardsegueidentifier?language=objc)
pub type NSStoryboardSegueIdentifier = NSString;

extern_class!(
    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsstoryboardsegue?language=objc)
    #[unsafe(super(NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    pub struct NSStoryboardSegue;
);

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

impl NSStoryboardSegue {
    extern_methods!(
        #[cfg(feature = "block2")]
        /// # Safety
        ///
        /// - `source_controller` should be of the correct type.
        /// - `destination_controller` should be of the correct type.
        #[unsafe(method(segueWithIdentifier:source:destination:performHandler:))]
        #[unsafe(method_family = none)]
        pub unsafe fn segueWithIdentifier_source_destination_performHandler(
            identifier: &NSStoryboardSegueIdentifier,
            source_controller: &AnyObject,
            destination_controller: &AnyObject,
            perform_handler: &block2::DynBlock<dyn Fn()>,
        ) -> Retained<Self>;

        /// # Safety
        ///
        /// - `source_controller` should be of the correct type.
        /// - `destination_controller` should be of the correct type.
        #[unsafe(method(initWithIdentifier:source:destination:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithIdentifier_source_destination(
            this: Allocated<Self>,
            identifier: &NSStoryboardSegueIdentifier,
            source_controller: &AnyObject,
            destination_controller: &AnyObject,
        ) -> Retained<Self>;

        #[unsafe(method(identifier))]
        #[unsafe(method_family = none)]
        pub fn identifier(&self) -> Option<Retained<NSStoryboardSegueIdentifier>>;

        #[unsafe(method(sourceController))]
        #[unsafe(method_family = none)]
        pub fn sourceController(&self) -> Retained<AnyObject>;

        #[unsafe(method(destinationController))]
        #[unsafe(method_family = none)]
        pub fn destinationController(&self) -> Retained<AnyObject>;

        #[unsafe(method(perform))]
        #[unsafe(method_family = none)]
        pub fn perform(&self);
    );
}

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

        #[unsafe(method(new))]
        #[unsafe(method_family = new)]
        pub fn new() -> Retained<Self>;
    );
}

impl DefaultRetained for NSStoryboardSegue {
    #[inline]
    fn default_retained() -> Retained<Self> {
        Self::new()
    }
}

extern_protocol!(
    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nssegueperforming?language=objc)
    pub unsafe trait NSSeguePerforming: NSObjectProtocol + MainThreadOnly {
        /// # Safety
        ///
        /// `sender` should be of the correct type.
        #[optional]
        #[unsafe(method(prepareForSegue:sender:))]
        #[unsafe(method_family = none)]
        unsafe fn prepareForSegue_sender(
            &self,
            segue: &NSStoryboardSegue,
            sender: Option<&AnyObject>,
        );

        /// # Safety
        ///
        /// `sender` should be of the correct type.
        #[optional]
        #[unsafe(method(performSegueWithIdentifier:sender:))]
        #[unsafe(method_family = none)]
        unsafe fn performSegueWithIdentifier_sender(
            &self,
            identifier: &NSStoryboardSegueIdentifier,
            sender: Option<&AnyObject>,
        );

        /// # Safety
        ///
        /// `sender` should be of the correct type.
        #[optional]
        #[unsafe(method(shouldPerformSegueWithIdentifier:sender:))]
        #[unsafe(method_family = none)]
        unsafe fn shouldPerformSegueWithIdentifier_sender(
            &self,
            identifier: &NSStoryboardSegueIdentifier,
            sender: Option<&AnyObject>,
        ) -> bool;
    }
);