objc2-ui-kit 0.3.2

Bindings to the UIKit 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::*;
#[cfg(feature = "objc2-core-foundation")]
use objc2_core_foundation::*;

use crate::*;

extern_protocol!(
    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uiadaptivepresentationcontrollerdelegate?language=objc)
    pub unsafe trait UIAdaptivePresentationControllerDelegate:
        NSObjectProtocol + MainThreadOnly
    {
        #[cfg(feature = "UIViewController")]
        #[optional]
        #[unsafe(method(adaptivePresentationStyleForPresentationController:))]
        #[unsafe(method_family = none)]
        fn adaptivePresentationStyleForPresentationController(
            &self,
            controller: &UIPresentationController,
        ) -> UIModalPresentationStyle;

        #[cfg(all(feature = "UITraitCollection", feature = "UIViewController"))]
        #[optional]
        #[unsafe(method(adaptivePresentationStyleForPresentationController:traitCollection:))]
        #[unsafe(method_family = none)]
        fn adaptivePresentationStyleForPresentationController_traitCollection(
            &self,
            controller: &UIPresentationController,
            trait_collection: &UITraitCollection,
        ) -> UIModalPresentationStyle;

        #[optional]
        #[unsafe(method(presentationController:prepareAdaptivePresentationController:))]
        #[unsafe(method_family = none)]
        fn presentationController_prepareAdaptivePresentationController(
            &self,
            presentation_controller: &UIPresentationController,
            adaptive_presentation_controller: &UIPresentationController,
        );

        #[cfg(all(feature = "UIResponder", feature = "UIViewController"))]
        #[optional]
        #[unsafe(method(presentationController:viewControllerForAdaptivePresentationStyle:))]
        #[unsafe(method_family = none)]
        fn presentationController_viewControllerForAdaptivePresentationStyle(
            &self,
            controller: &UIPresentationController,
            style: UIModalPresentationStyle,
        ) -> Option<Retained<UIViewController>>;

        #[cfg(all(
            feature = "UIViewController",
            feature = "UIViewControllerTransitionCoordinator"
        ))]
        #[optional]
        #[unsafe(method(presentationController:willPresentWithAdaptiveStyle:transitionCoordinator:))]
        #[unsafe(method_family = none)]
        fn presentationController_willPresentWithAdaptiveStyle_transitionCoordinator(
            &self,
            presentation_controller: &UIPresentationController,
            style: UIModalPresentationStyle,
            transition_coordinator: Option<
                &ProtocolObject<dyn UIViewControllerTransitionCoordinator>,
            >,
        );

        #[optional]
        #[unsafe(method(presentationControllerShouldDismiss:))]
        #[unsafe(method_family = none)]
        fn presentationControllerShouldDismiss(
            &self,
            presentation_controller: &UIPresentationController,
        ) -> bool;

        #[optional]
        #[unsafe(method(presentationControllerWillDismiss:))]
        #[unsafe(method_family = none)]
        fn presentationControllerWillDismiss(
            &self,
            presentation_controller: &UIPresentationController,
        );

        #[optional]
        #[unsafe(method(presentationControllerDidDismiss:))]
        #[unsafe(method_family = none)]
        fn presentationControllerDidDismiss(
            &self,
            presentation_controller: &UIPresentationController,
        );

        #[optional]
        #[unsafe(method(presentationControllerDidAttemptToDismiss:))]
        #[unsafe(method_family = none)]
        fn presentationControllerDidAttemptToDismiss(
            &self,
            presentation_controller: &UIPresentationController,
        );
    }
);

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

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

#[cfg(feature = "UIAppearance")]
extern_conformance!(
    unsafe impl UIAppearanceContainer for UIPresentationController {}
);

#[cfg(feature = "UIViewController")]
extern_conformance!(
    unsafe impl UIContentContainer for UIPresentationController {}
);

#[cfg(feature = "UIFocus")]
extern_conformance!(
    unsafe impl UIFocusEnvironment for UIPresentationController {}
);

#[cfg(feature = "UITraitCollection")]
extern_conformance!(
    unsafe impl UITraitEnvironment for UIPresentationController {}
);

impl UIPresentationController {
    extern_methods!(
        #[cfg(all(feature = "UIResponder", feature = "UIViewController"))]
        #[unsafe(method(presentingViewController))]
        #[unsafe(method_family = none)]
        pub fn presentingViewController(&self) -> Retained<UIViewController>;

        #[cfg(all(feature = "UIResponder", feature = "UIViewController"))]
        #[unsafe(method(presentedViewController))]
        #[unsafe(method_family = none)]
        pub fn presentedViewController(&self) -> Retained<UIViewController>;

        #[cfg(feature = "UIViewController")]
        #[unsafe(method(presentationStyle))]
        #[unsafe(method_family = none)]
        pub fn presentationStyle(&self) -> UIModalPresentationStyle;

        #[cfg(all(feature = "UIResponder", feature = "UIView"))]
        #[unsafe(method(containerView))]
        #[unsafe(method_family = none)]
        pub fn containerView(&self) -> Option<Retained<UIView>>;

        #[unsafe(method(delegate))]
        #[unsafe(method_family = none)]
        pub fn delegate(
            &self,
        ) -> Option<Retained<ProtocolObject<dyn UIAdaptivePresentationControllerDelegate>>>;

        /// Setter for [`delegate`][Self::delegate].
        ///
        /// This is a [weak property][objc2::topics::weak_property].
        #[unsafe(method(setDelegate:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setDelegate(
            &self,
            delegate: Option<&ProtocolObject<dyn UIAdaptivePresentationControllerDelegate>>,
        );

        #[cfg(all(feature = "UIResponder", feature = "UIViewController"))]
        #[unsafe(method(initWithPresentedViewController:presentingViewController:))]
        #[unsafe(method_family = init)]
        pub fn initWithPresentedViewController_presentingViewController(
            this: Allocated<Self>,
            presented_view_controller: &UIViewController,
            presenting_view_controller: Option<&UIViewController>,
        ) -> Retained<Self>;

        #[unsafe(method(init))]
        #[unsafe(method_family = init)]
        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;

        #[cfg(feature = "UIViewController")]
        #[unsafe(method(adaptivePresentationStyle))]
        #[unsafe(method_family = none)]
        pub fn adaptivePresentationStyle(&self) -> UIModalPresentationStyle;

        #[cfg(all(feature = "UITraitCollection", feature = "UIViewController"))]
        #[unsafe(method(adaptivePresentationStyleForTraitCollection:))]
        #[unsafe(method_family = none)]
        pub fn adaptivePresentationStyleForTraitCollection(
            &self,
            trait_collection: &UITraitCollection,
        ) -> UIModalPresentationStyle;

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

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

        #[cfg(all(feature = "UIResponder", feature = "UIView"))]
        #[unsafe(method(presentedView))]
        #[unsafe(method_family = none)]
        pub fn presentedView(&self) -> Option<Retained<UIView>>;

        #[cfg(feature = "objc2-core-foundation")]
        #[unsafe(method(frameOfPresentedViewInContainerView))]
        #[unsafe(method_family = none)]
        pub fn frameOfPresentedViewInContainerView(&self) -> CGRect;

        #[unsafe(method(shouldPresentInFullscreen))]
        #[unsafe(method_family = none)]
        pub fn shouldPresentInFullscreen(&self) -> bool;

        #[unsafe(method(shouldRemovePresentersView))]
        #[unsafe(method_family = none)]
        pub fn shouldRemovePresentersView(&self) -> bool;

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

        #[unsafe(method(presentationTransitionDidEnd:))]
        #[unsafe(method_family = none)]
        pub fn presentationTransitionDidEnd(&self, completed: bool);

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

        #[unsafe(method(dismissalTransitionDidEnd:))]
        #[unsafe(method_family = none)]
        pub fn dismissalTransitionDidEnd(&self, completed: bool);

        #[cfg(feature = "UITraitCollection")]
        #[deprecated = "Use the traitOverrides property instead"]
        #[unsafe(method(overrideTraitCollection))]
        #[unsafe(method_family = none)]
        pub fn overrideTraitCollection(&self) -> Option<Retained<UITraitCollection>>;

        #[cfg(feature = "UITraitCollection")]
        /// Setter for [`overrideTraitCollection`][Self::overrideTraitCollection].
        ///
        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
        #[deprecated = "Use the traitOverrides property instead"]
        #[unsafe(method(setOverrideTraitCollection:))]
        #[unsafe(method_family = none)]
        pub fn setOverrideTraitCollection(
            &self,
            override_trait_collection: Option<&UITraitCollection>,
        );
    );
}

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

impl UIPresentationController {
    extern_methods!(
        #[cfg(feature = "UITraitCollection")]
        #[unsafe(method(traitOverrides))]
        #[unsafe(method_family = none)]
        pub fn traitOverrides(&self) -> Retained<ProtocolObject<dyn UITraitOverrides>>;
    );
}

#[cfg(feature = "UITraitCollection")]
extern_conformance!(
    unsafe impl UITraitChangeObservable for UIPresentationController {}
);