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 objc2_foundation::*;

use crate::*;

/// [Apple's documentation](https://developer.apple.com/documentation/uikit/uisheetpresentationcontrollerdetentidentifier?language=objc)
// NS_TYPED_EXTENSIBLE_ENUM
pub type UISheetPresentationControllerDetentIdentifier = NSString;

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uisheetpresentationcontrollerdetentidentifiermedium?language=objc)
    pub static UISheetPresentationControllerDetentIdentifierMedium:
        &'static UISheetPresentationControllerDetentIdentifier;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uisheetpresentationcontrollerdetentidentifierlarge?language=objc)
    pub static UISheetPresentationControllerDetentIdentifierLarge:
        &'static UISheetPresentationControllerDetentIdentifier;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uisheetpresentationcontrollerdetentinactive?language=objc)
    #[cfg(feature = "objc2-core-foundation")]
    pub static UISheetPresentationControllerDetentInactive: CGFloat;
}

extern_protocol!(
    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uisheetpresentationcontrollerdetentresolutioncontext?language=objc)
    pub unsafe trait UISheetPresentationControllerDetentResolutionContext:
        NSObjectProtocol + MainThreadOnly
    {
        #[cfg(feature = "UITraitCollection")]
        #[unsafe(method(containerTraitCollection))]
        #[unsafe(method_family = none)]
        fn containerTraitCollection(&self) -> Retained<UITraitCollection>;

        #[cfg(feature = "objc2-core-foundation")]
        #[unsafe(method(maximumDetentValue))]
        #[unsafe(method_family = none)]
        fn maximumDetentValue(&self) -> CGFloat;
    }
);

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

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

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

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

        #[unsafe(method(mediumDetent))]
        #[unsafe(method_family = none)]
        pub fn mediumDetent(mtm: MainThreadMarker) -> Retained<Self>;

        #[unsafe(method(largeDetent))]
        #[unsafe(method_family = none)]
        pub fn largeDetent(mtm: MainThreadMarker) -> Retained<Self>;

        #[cfg(all(feature = "block2", feature = "objc2-core-foundation"))]
        #[unsafe(method(customDetentWithIdentifier:resolver:))]
        #[unsafe(method_family = none)]
        pub fn customDetentWithIdentifier_resolver(
            identifier: Option<&UISheetPresentationControllerDetentIdentifier>,
            resolver: &block2::DynBlock<
                dyn Fn(
                    NonNull<
                        ProtocolObject<dyn UISheetPresentationControllerDetentResolutionContext>,
                    >,
                ) -> CGFloat,
            >,
            mtm: MainThreadMarker,
        ) -> Retained<Self>;

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

        #[cfg(feature = "objc2-core-foundation")]
        #[unsafe(method(resolvedValueInContext:))]
        #[unsafe(method_family = none)]
        pub fn resolvedValueInContext(
            &self,
            context: &ProtocolObject<dyn UISheetPresentationControllerDetentResolutionContext>,
        ) -> CGFloat;
    );
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uisheetpresentationcontrollerautomaticdimension?language=objc)
    #[cfg(feature = "objc2-core-foundation")]
    pub static UISheetPresentationControllerAutomaticDimension: CGFloat;
}

extern_protocol!(
    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uisheetpresentationcontrollerdelegate?language=objc)
    #[cfg(feature = "UIPresentationController")]
    pub unsafe trait UISheetPresentationControllerDelegate:
        UIAdaptivePresentationControllerDelegate + MainThreadOnly
    {
        #[optional]
        #[unsafe(method(sheetPresentationControllerDidChangeSelectedDetentIdentifier:))]
        #[unsafe(method_family = none)]
        fn sheetPresentationControllerDidChangeSelectedDetentIdentifier(
            &self,
            sheet_presentation_controller: &UISheetPresentationController,
        );
    }
);

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

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

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

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

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

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

#[cfg(feature = "UIPresentationController")]
impl UISheetPresentationController {
    extern_methods!(
        #[unsafe(method(delegate))]
        #[unsafe(method_family = none)]
        pub fn delegate(
            &self,
        ) -> Option<Retained<ProtocolObject<dyn UISheetPresentationControllerDelegate>>>;

        /// 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 UISheetPresentationControllerDelegate>>,
        );

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

        #[cfg(all(feature = "UIResponder", feature = "UIView"))]
        /// Setter for [`sourceView`][Self::sourceView].
        #[unsafe(method(setSourceView:))]
        #[unsafe(method_family = none)]
        pub fn setSourceView(&self, source_view: Option<&UIView>);

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

        /// Setter for [`prefersPageSizing`][Self::prefersPageSizing].
        #[unsafe(method(setPrefersPageSizing:))]
        #[unsafe(method_family = none)]
        pub fn setPrefersPageSizing(&self, prefers_page_sizing: bool);

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

        /// Setter for [`prefersEdgeAttachedInCompactHeight`][Self::prefersEdgeAttachedInCompactHeight].
        #[unsafe(method(setPrefersEdgeAttachedInCompactHeight:))]
        #[unsafe(method_family = none)]
        pub fn setPrefersEdgeAttachedInCompactHeight(
            &self,
            prefers_edge_attached_in_compact_height: bool,
        );

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

        /// Setter for [`widthFollowsPreferredContentSizeWhenEdgeAttached`][Self::widthFollowsPreferredContentSizeWhenEdgeAttached].
        #[unsafe(method(setWidthFollowsPreferredContentSizeWhenEdgeAttached:))]
        #[unsafe(method_family = none)]
        pub fn setWidthFollowsPreferredContentSizeWhenEdgeAttached(
            &self,
            width_follows_preferred_content_size_when_edge_attached: bool,
        );

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

        /// Setter for [`prefersGrabberVisible`][Self::prefersGrabberVisible].
        #[unsafe(method(setPrefersGrabberVisible:))]
        #[unsafe(method_family = none)]
        pub fn setPrefersGrabberVisible(&self, prefers_grabber_visible: bool);

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

        #[cfg(feature = "objc2-core-foundation")]
        /// Setter for [`preferredCornerRadius`][Self::preferredCornerRadius].
        #[unsafe(method(setPreferredCornerRadius:))]
        #[unsafe(method_family = none)]
        pub fn setPreferredCornerRadius(&self, preferred_corner_radius: CGFloat);

        #[unsafe(method(detents))]
        #[unsafe(method_family = none)]
        pub fn detents(&self) -> Retained<NSArray<UISheetPresentationControllerDetent>>;

        /// Setter for [`detents`][Self::detents].
        ///
        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
        #[unsafe(method(setDetents:))]
        #[unsafe(method_family = none)]
        pub fn setDetents(&self, detents: &NSArray<UISheetPresentationControllerDetent>);

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

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

        /// Setter for [`selectedDetentIdentifier`][Self::selectedDetentIdentifier].
        ///
        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
        #[unsafe(method(setSelectedDetentIdentifier:))]
        #[unsafe(method_family = none)]
        pub fn setSelectedDetentIdentifier(
            &self,
            selected_detent_identifier: Option<&UISheetPresentationControllerDetentIdentifier>,
        );

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

        /// Setter for [`largestUndimmedDetentIdentifier`][Self::largestUndimmedDetentIdentifier].
        ///
        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
        #[unsafe(method(setLargestUndimmedDetentIdentifier:))]
        #[unsafe(method_family = none)]
        pub fn setLargestUndimmedDetentIdentifier(
            &self,
            largest_undimmed_detent_identifier: Option<
                &UISheetPresentationControllerDetentIdentifier,
            >,
        );

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

        /// Setter for [`prefersScrollingExpandsWhenScrolledToEdge`][Self::prefersScrollingExpandsWhenScrolledToEdge].
        #[unsafe(method(setPrefersScrollingExpandsWhenScrolledToEdge:))]
        #[unsafe(method_family = none)]
        pub fn setPrefersScrollingExpandsWhenScrolledToEdge(
            &self,
            prefers_scrolling_expands_when_scrolled_to_edge: bool,
        );

        #[cfg(feature = "block2")]
        #[unsafe(method(animateChanges:))]
        #[unsafe(method_family = none)]
        pub fn animateChanges(&self, changes: &block2::DynBlock<dyn Fn() + '_>);
    );
}

/// Methods declared on superclass `UIPresentationController`.
#[cfg(feature = "UIPresentationController")]
impl UISheetPresentationController {
    extern_methods!(
        #[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>;
    );
}

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