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::*;
extern_protocol!(
#[cfg(feature = "UIPresentationController")]
pub unsafe trait UIPopoverPresentationControllerDelegate:
UIAdaptivePresentationControllerDelegate + MainThreadOnly
{
#[optional]
#[unsafe(method(prepareForPopoverPresentation:))]
#[unsafe(method_family = none)]
fn prepareForPopoverPresentation(
&self,
popover_presentation_controller: &UIPopoverPresentationController,
);
#[deprecated]
#[optional]
#[unsafe(method(popoverPresentationControllerShouldDismissPopover:))]
#[unsafe(method_family = none)]
fn popoverPresentationControllerShouldDismissPopover(
&self,
popover_presentation_controller: &UIPopoverPresentationController,
) -> bool;
#[deprecated]
#[optional]
#[unsafe(method(popoverPresentationControllerDidDismissPopover:))]
#[unsafe(method_family = none)]
fn popoverPresentationControllerDidDismissPopover(
&self,
popover_presentation_controller: &UIPopoverPresentationController,
);
#[cfg(all(
feature = "UIResponder",
feature = "UIView",
feature = "objc2-core-foundation"
))]
#[optional]
#[unsafe(method(popoverPresentationController:willRepositionPopoverToRect:inView:))]
#[unsafe(method_family = none)]
unsafe fn popoverPresentationController_willRepositionPopoverToRect_inView(
&self,
popover_presentation_controller: &UIPopoverPresentationController,
rect: NonNull<CGRect>,
view: &mut Retained<UIView>,
);
}
);
extern_class!(
#[unsafe(super(UIPresentationController, NSObject))]
#[thread_kind = MainThreadOnly]
#[derive(Debug, PartialEq, Eq, Hash)]
#[cfg(feature = "UIPresentationController")]
pub struct UIPopoverPresentationController;
);
#[cfg(feature = "UIPresentationController")]
extern_conformance!(
unsafe impl NSObjectProtocol for UIPopoverPresentationController {}
);
#[cfg(all(feature = "UIAppearance", feature = "UIPresentationController"))]
extern_conformance!(
unsafe impl UIAppearanceContainer for UIPopoverPresentationController {}
);
#[cfg(all(feature = "UIPresentationController", feature = "UIViewController"))]
extern_conformance!(
unsafe impl UIContentContainer for UIPopoverPresentationController {}
);
#[cfg(all(feature = "UIFocus", feature = "UIPresentationController"))]
extern_conformance!(
unsafe impl UIFocusEnvironment for UIPopoverPresentationController {}
);
#[cfg(all(feature = "UIPresentationController", feature = "UITraitCollection"))]
extern_conformance!(
unsafe impl UITraitEnvironment for UIPopoverPresentationController {}
);
#[cfg(feature = "UIPresentationController")]
impl UIPopoverPresentationController {
extern_methods!(
#[unsafe(method(delegate))]
#[unsafe(method_family = none)]
pub fn delegate(
&self,
) -> Option<Retained<ProtocolObject<dyn UIPopoverPresentationControllerDelegate>>>;
#[unsafe(method(setDelegate:))]
#[unsafe(method_family = none)]
pub unsafe fn setDelegate(
&self,
delegate: Option<&ProtocolObject<dyn UIPopoverPresentationControllerDelegate>>,
);
#[cfg(feature = "UIPopoverSupport")]
#[unsafe(method(permittedArrowDirections))]
#[unsafe(method_family = none)]
pub fn permittedArrowDirections(&self) -> UIPopoverArrowDirection;
#[cfg(feature = "UIPopoverSupport")]
#[unsafe(method(setPermittedArrowDirections:))]
#[unsafe(method_family = none)]
pub fn setPermittedArrowDirections(
&self,
permitted_arrow_directions: UIPopoverArrowDirection,
);
#[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>);
#[cfg(feature = "objc2-core-foundation")]
#[unsafe(method(sourceRect))]
#[unsafe(method_family = none)]
pub fn sourceRect(&self) -> CGRect;
#[cfg(feature = "objc2-core-foundation")]
#[unsafe(method(setSourceRect:))]
#[unsafe(method_family = none)]
pub fn setSourceRect(&self, source_rect: CGRect);
#[unsafe(method(canOverlapSourceViewRect))]
#[unsafe(method_family = none)]
pub fn canOverlapSourceViewRect(&self) -> bool;
#[unsafe(method(setCanOverlapSourceViewRect:))]
#[unsafe(method_family = none)]
pub fn setCanOverlapSourceViewRect(&self, can_overlap_source_view_rect: bool);
#[cfg(feature = "UIPopoverPresentationControllerSourceItem")]
#[unsafe(method(sourceItem))]
#[unsafe(method_family = none)]
pub fn sourceItem(
&self,
) -> Option<Retained<ProtocolObject<dyn UIPopoverPresentationControllerSourceItem>>>;
#[cfg(feature = "UIPopoverPresentationControllerSourceItem")]
#[unsafe(method(setSourceItem:))]
#[unsafe(method_family = none)]
pub fn setSourceItem(
&self,
source_item: Option<&ProtocolObject<dyn UIPopoverPresentationControllerSourceItem>>,
);
#[cfg(all(feature = "UIBarButtonItem", feature = "UIBarItem"))]
#[deprecated]
#[unsafe(method(barButtonItem))]
#[unsafe(method_family = none)]
pub fn barButtonItem(&self) -> Option<Retained<UIBarButtonItem>>;
#[cfg(all(feature = "UIBarButtonItem", feature = "UIBarItem"))]
#[deprecated]
#[unsafe(method(setBarButtonItem:))]
#[unsafe(method_family = none)]
pub fn setBarButtonItem(&self, bar_button_item: Option<&UIBarButtonItem>);
#[cfg(feature = "UIPopoverSupport")]
#[unsafe(method(arrowDirection))]
#[unsafe(method_family = none)]
pub fn arrowDirection(&self) -> UIPopoverArrowDirection;
#[cfg(all(feature = "UIResponder", feature = "UIView"))]
#[unsafe(method(passthroughViews))]
#[unsafe(method_family = none)]
pub fn passthroughViews(&self) -> Option<Retained<NSArray<UIView>>>;
#[cfg(all(feature = "UIResponder", feature = "UIView"))]
#[unsafe(method(setPassthroughViews:))]
#[unsafe(method_family = none)]
pub fn setPassthroughViews(&self, passthrough_views: Option<&NSArray<UIView>>);
#[cfg(feature = "UIColor")]
#[unsafe(method(backgroundColor))]
#[unsafe(method_family = none)]
pub fn backgroundColor(&self) -> Option<Retained<UIColor>>;
#[cfg(feature = "UIColor")]
#[unsafe(method(setBackgroundColor:))]
#[unsafe(method_family = none)]
pub fn setBackgroundColor(&self, background_color: Option<&UIColor>);
#[cfg(all(feature = "UIGeometry", feature = "objc2-core-foundation"))]
#[unsafe(method(popoverLayoutMargins))]
#[unsafe(method_family = none)]
pub fn popoverLayoutMargins(&self) -> UIEdgeInsets;
#[cfg(all(feature = "UIGeometry", feature = "objc2-core-foundation"))]
#[unsafe(method(setPopoverLayoutMargins:))]
#[unsafe(method_family = none)]
pub fn setPopoverLayoutMargins(&self, popover_layout_margins: UIEdgeInsets);
#[cfg(feature = "UIPopoverBackgroundView")]
#[unsafe(method(popoverBackgroundViewClass))]
#[unsafe(method_family = none)]
pub fn popoverBackgroundViewClass(&self) -> Option<&'static AnyClass>;
#[cfg(feature = "UIPopoverBackgroundView")]
#[unsafe(method(setPopoverBackgroundViewClass:))]
#[unsafe(method_family = none)]
pub unsafe fn setPopoverBackgroundViewClass(
&self,
popover_background_view_class: Option<&AnyClass>,
);
#[cfg(feature = "UISheetPresentationController")]
#[unsafe(method(adaptiveSheetPresentationController))]
#[unsafe(method_family = none)]
pub fn adaptiveSheetPresentationController(
&self,
) -> Retained<UISheetPresentationController>;
);
}
#[cfg(feature = "UIPresentationController")]
impl UIPopoverPresentationController {
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 UIPopoverPresentationController {
extern_methods!(
#[unsafe(method(new))]
#[unsafe(method_family = new)]
pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
);
}