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::*;
pub type UISheetPresentationControllerDetentIdentifier = NSString;
extern "C" {
pub static UISheetPresentationControllerDetentIdentifierMedium:
&'static UISheetPresentationControllerDetentIdentifier;
}
extern "C" {
pub static UISheetPresentationControllerDetentIdentifierLarge:
&'static UISheetPresentationControllerDetentIdentifier;
}
extern "C" {
#[cfg(feature = "objc2-core-foundation")]
pub static UISheetPresentationControllerDetentInactive: CGFloat;
}
extern_protocol!(
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!(
#[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" {
#[cfg(feature = "objc2-core-foundation")]
pub static UISheetPresentationControllerAutomaticDimension: CGFloat;
}
extern_protocol!(
#[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!(
#[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>>>;
#[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"))]
#[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;
#[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;
#[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;
#[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;
#[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")]
#[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>>;
#[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>>;
#[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>>;
#[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;
#[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() + '_>);
);
}
#[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>;
);
}
#[cfg(feature = "UIPresentationController")]
impl UISheetPresentationController {
extern_methods!(
#[unsafe(method(new))]
#[unsafe(method_family = new)]
pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
);
}