use objc2::__framework_prelude::*;
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" {
pub static UISheetPresentationControllerDetentInactive: CGFloat;
}
extern_protocol!(
pub unsafe trait UISheetPresentationControllerDetentResolutionContext:
NSObjectProtocol + IsMainThreadOnly
{
#[cfg(feature = "UITraitCollection")]
#[method_id(@__retain_semantics Other containerTraitCollection)]
unsafe fn containerTraitCollection(&self) -> Retained<UITraitCollection>;
#[method(maximumDetentValue)]
unsafe fn maximumDetentValue(&self) -> CGFloat;
}
unsafe impl ProtocolType for dyn UISheetPresentationControllerDetentResolutionContext {}
);
extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct UISheetPresentationControllerDetent;
unsafe impl ClassType for UISheetPresentationControllerDetent {
type Super = NSObject;
type Mutability = MainThreadOnly;
}
);
unsafe impl NSObjectProtocol for UISheetPresentationControllerDetent {}
extern_methods!(
unsafe impl UISheetPresentationControllerDetent {
#[method_id(@__retain_semantics Init init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
#[method_id(@__retain_semantics New new)]
pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
#[method_id(@__retain_semantics Other mediumDetent)]
pub unsafe fn mediumDetent(mtm: MainThreadMarker) -> Retained<Self>;
#[method_id(@__retain_semantics Other largeDetent)]
pub unsafe fn largeDetent(mtm: MainThreadMarker) -> Retained<Self>;
#[cfg(feature = "block2")]
#[method_id(@__retain_semantics Other customDetentWithIdentifier:resolver:)]
pub unsafe fn customDetentWithIdentifier_resolver(
identifier: Option<&UISheetPresentationControllerDetentIdentifier>,
resolver: &block2::Block<
dyn Fn(
NonNull<
ProtocolObject<dyn UISheetPresentationControllerDetentResolutionContext>,
>,
) -> CGFloat,
>,
mtm: MainThreadMarker,
) -> Retained<Self>;
#[method_id(@__retain_semantics Other identifier)]
pub unsafe fn identifier(&self) -> Retained<UISheetPresentationControllerDetentIdentifier>;
#[method(resolvedValueInContext:)]
pub unsafe fn resolvedValueInContext(
&self,
context: &ProtocolObject<dyn UISheetPresentationControllerDetentResolutionContext>,
) -> CGFloat;
}
);
extern "C" {
pub static UISheetPresentationControllerAutomaticDimension: CGFloat;
}
extern_protocol!(
#[cfg(feature = "UIPresentationController")]
pub unsafe trait UISheetPresentationControllerDelegate:
UIAdaptivePresentationControllerDelegate + IsMainThreadOnly
{
#[optional]
#[method(sheetPresentationControllerDidChangeSelectedDetentIdentifier:)]
unsafe fn sheetPresentationControllerDidChangeSelectedDetentIdentifier(
&self,
sheet_presentation_controller: &UISheetPresentationController,
);
}
#[cfg(feature = "UIPresentationController")]
unsafe impl ProtocolType for dyn UISheetPresentationControllerDelegate {}
);
extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
#[cfg(feature = "UIPresentationController")]
pub struct UISheetPresentationController;
#[cfg(feature = "UIPresentationController")]
unsafe impl ClassType for UISheetPresentationController {
#[inherits(NSObject)]
type Super = UIPresentationController;
type Mutability = MainThreadOnly;
}
);
#[cfg(feature = "UIPresentationController")]
unsafe impl NSObjectProtocol for UISheetPresentationController {}
#[cfg(all(feature = "UIAppearance", feature = "UIPresentationController"))]
unsafe impl UIAppearanceContainer for UISheetPresentationController {}
#[cfg(all(feature = "UIPresentationController", feature = "UIViewController"))]
unsafe impl UIContentContainer for UISheetPresentationController {}
#[cfg(all(feature = "UIFocus", feature = "UIPresentationController"))]
unsafe impl UIFocusEnvironment for UISheetPresentationController {}
#[cfg(all(feature = "UIPresentationController", feature = "UITraitCollection"))]
unsafe impl UITraitEnvironment for UISheetPresentationController {}
extern_methods!(
#[cfg(feature = "UIPresentationController")]
unsafe impl UISheetPresentationController {
#[method_id(@__retain_semantics Other delegate)]
pub unsafe fn delegate(
&self,
) -> Option<Retained<ProtocolObject<dyn UISheetPresentationControllerDelegate>>>;
#[method(setDelegate:)]
pub unsafe fn setDelegate(
&self,
delegate: Option<&ProtocolObject<dyn UISheetPresentationControllerDelegate>>,
);
#[cfg(all(feature = "UIResponder", feature = "UIView"))]
#[method_id(@__retain_semantics Other sourceView)]
pub unsafe fn sourceView(&self) -> Option<Retained<UIView>>;
#[cfg(all(feature = "UIResponder", feature = "UIView"))]
#[method(setSourceView:)]
pub unsafe fn setSourceView(&self, source_view: Option<&UIView>);
#[method(prefersPageSizing)]
pub unsafe fn prefersPageSizing(&self) -> bool;
#[method(setPrefersPageSizing:)]
pub unsafe fn setPrefersPageSizing(&self, prefers_page_sizing: bool);
#[method(prefersEdgeAttachedInCompactHeight)]
pub unsafe fn prefersEdgeAttachedInCompactHeight(&self) -> bool;
#[method(setPrefersEdgeAttachedInCompactHeight:)]
pub unsafe fn setPrefersEdgeAttachedInCompactHeight(
&self,
prefers_edge_attached_in_compact_height: bool,
);
#[method(widthFollowsPreferredContentSizeWhenEdgeAttached)]
pub unsafe fn widthFollowsPreferredContentSizeWhenEdgeAttached(&self) -> bool;
#[method(setWidthFollowsPreferredContentSizeWhenEdgeAttached:)]
pub unsafe fn setWidthFollowsPreferredContentSizeWhenEdgeAttached(
&self,
width_follows_preferred_content_size_when_edge_attached: bool,
);
#[method(prefersGrabberVisible)]
pub unsafe fn prefersGrabberVisible(&self) -> bool;
#[method(setPrefersGrabberVisible:)]
pub unsafe fn setPrefersGrabberVisible(&self, prefers_grabber_visible: bool);
#[method(preferredCornerRadius)]
pub unsafe fn preferredCornerRadius(&self) -> CGFloat;
#[method(setPreferredCornerRadius:)]
pub unsafe fn setPreferredCornerRadius(&self, preferred_corner_radius: CGFloat);
#[method_id(@__retain_semantics Other detents)]
pub unsafe fn detents(&self) -> Retained<NSArray<UISheetPresentationControllerDetent>>;
#[method(setDetents:)]
pub unsafe fn setDetents(&self, detents: &NSArray<UISheetPresentationControllerDetent>);
#[method(invalidateDetents)]
pub unsafe fn invalidateDetents(&self);
#[method_id(@__retain_semantics Other selectedDetentIdentifier)]
pub unsafe fn selectedDetentIdentifier(
&self,
) -> Option<Retained<UISheetPresentationControllerDetentIdentifier>>;
#[method(setSelectedDetentIdentifier:)]
pub unsafe fn setSelectedDetentIdentifier(
&self,
selected_detent_identifier: Option<&UISheetPresentationControllerDetentIdentifier>,
);
#[method_id(@__retain_semantics Other largestUndimmedDetentIdentifier)]
pub unsafe fn largestUndimmedDetentIdentifier(
&self,
) -> Option<Retained<UISheetPresentationControllerDetentIdentifier>>;
#[method(setLargestUndimmedDetentIdentifier:)]
pub unsafe fn setLargestUndimmedDetentIdentifier(
&self,
largest_undimmed_detent_identifier: Option<
&UISheetPresentationControllerDetentIdentifier,
>,
);
#[method(prefersScrollingExpandsWhenScrolledToEdge)]
pub unsafe fn prefersScrollingExpandsWhenScrolledToEdge(&self) -> bool;
#[method(setPrefersScrollingExpandsWhenScrolledToEdge:)]
pub unsafe fn setPrefersScrollingExpandsWhenScrolledToEdge(
&self,
prefers_scrolling_expands_when_scrolled_to_edge: bool,
);
#[cfg(feature = "block2")]
#[method(animateChanges:)]
pub unsafe fn animateChanges(&self, changes: &block2::Block<dyn Fn() + '_>);
}
);
extern_methods!(
#[cfg(feature = "UIPresentationController")]
unsafe impl UISheetPresentationController {
#[cfg(all(feature = "UIResponder", feature = "UIViewController"))]
#[method_id(@__retain_semantics Init initWithPresentedViewController:presentingViewController:)]
pub unsafe fn initWithPresentedViewController_presentingViewController(
this: Allocated<Self>,
presented_view_controller: &UIViewController,
presenting_view_controller: Option<&UIViewController>,
) -> Retained<Self>;
#[method_id(@__retain_semantics Init init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
}
);
extern_methods!(
#[cfg(feature = "UIPresentationController")]
unsafe impl UISheetPresentationController {
#[method_id(@__retain_semantics New new)]
pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
}
);