use core::ffi::*;
use core::ptr::NonNull;
use objc2::__framework_prelude::*;
use objc2_foundation::*;
use crate::*;
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct UIPageViewControllerNavigationOrientation(pub NSInteger);
impl UIPageViewControllerNavigationOrientation {
#[doc(alias = "UIPageViewControllerNavigationOrientationHorizontal")]
pub const Horizontal: Self = Self(0);
#[doc(alias = "UIPageViewControllerNavigationOrientationVertical")]
pub const Vertical: Self = Self(1);
}
unsafe impl Encode for UIPageViewControllerNavigationOrientation {
const ENCODING: Encoding = NSInteger::ENCODING;
}
unsafe impl RefEncode for UIPageViewControllerNavigationOrientation {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct UIPageViewControllerSpineLocation(pub NSInteger);
impl UIPageViewControllerSpineLocation {
#[doc(alias = "UIPageViewControllerSpineLocationNone")]
pub const None: Self = Self(0);
#[doc(alias = "UIPageViewControllerSpineLocationMin")]
pub const Min: Self = Self(1);
#[doc(alias = "UIPageViewControllerSpineLocationMid")]
pub const Mid: Self = Self(2);
#[doc(alias = "UIPageViewControllerSpineLocationMax")]
pub const Max: Self = Self(3);
}
unsafe impl Encode for UIPageViewControllerSpineLocation {
const ENCODING: Encoding = NSInteger::ENCODING;
}
unsafe impl RefEncode for UIPageViewControllerSpineLocation {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct UIPageViewControllerNavigationDirection(pub NSInteger);
impl UIPageViewControllerNavigationDirection {
#[doc(alias = "UIPageViewControllerNavigationDirectionForward")]
pub const Forward: Self = Self(0);
#[doc(alias = "UIPageViewControllerNavigationDirectionReverse")]
pub const Reverse: Self = Self(1);
}
unsafe impl Encode for UIPageViewControllerNavigationDirection {
const ENCODING: Encoding = NSInteger::ENCODING;
}
unsafe impl RefEncode for UIPageViewControllerNavigationDirection {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct UIPageViewControllerTransitionStyle(pub NSInteger);
impl UIPageViewControllerTransitionStyle {
#[doc(alias = "UIPageViewControllerTransitionStylePageCurl")]
pub const PageCurl: Self = Self(0);
#[doc(alias = "UIPageViewControllerTransitionStyleScroll")]
pub const Scroll: Self = Self(1);
}
unsafe impl Encode for UIPageViewControllerTransitionStyle {
const ENCODING: Encoding = NSInteger::ENCODING;
}
unsafe impl RefEncode for UIPageViewControllerTransitionStyle {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
pub type UIPageViewControllerOptionsKey = NSString;
extern "C" {
pub static UIPageViewControllerOptionSpineLocationKey: &'static UIPageViewControllerOptionsKey;
}
extern "C" {
pub static UIPageViewControllerOptionInterPageSpacingKey:
&'static UIPageViewControllerOptionsKey;
}
extern_class!(
#[unsafe(super(UIViewController, UIResponder, NSObject))]
#[thread_kind = MainThreadOnly]
#[derive(Debug, PartialEq, Eq, Hash)]
#[cfg(all(feature = "UIResponder", feature = "UIViewController"))]
pub struct UIPageViewController;
);
#[cfg(all(feature = "UIResponder", feature = "UIViewController"))]
extern_conformance!(
unsafe impl NSCoding for UIPageViewController {}
);
#[cfg(all(feature = "UIResponder", feature = "UIViewController"))]
extern_conformance!(
unsafe impl NSObjectProtocol for UIPageViewController {}
);
#[cfg(all(
feature = "UIAppearance",
feature = "UIResponder",
feature = "UIViewController"
))]
extern_conformance!(
unsafe impl UIAppearanceContainer for UIPageViewController {}
);
#[cfg(all(feature = "UIResponder", feature = "UIViewController"))]
extern_conformance!(
unsafe impl UIContentContainer for UIPageViewController {}
);
#[cfg(all(
feature = "UIFocus",
feature = "UIResponder",
feature = "UIViewController"
))]
extern_conformance!(
unsafe impl UIFocusEnvironment for UIPageViewController {}
);
#[cfg(all(feature = "UIResponder", feature = "UIViewController"))]
extern_conformance!(
unsafe impl UIResponderStandardEditActions for UIPageViewController {}
);
#[cfg(all(
feature = "UIResponder",
feature = "UITraitCollection",
feature = "UIViewController"
))]
extern_conformance!(
unsafe impl UITraitEnvironment for UIPageViewController {}
);
#[cfg(all(feature = "UIResponder", feature = "UIViewController"))]
impl UIPageViewController {
extern_methods!(
#[unsafe(method(initWithTransitionStyle:navigationOrientation:options:))]
#[unsafe(method_family = init)]
pub unsafe fn initWithTransitionStyle_navigationOrientation_options(
this: Allocated<Self>,
style: UIPageViewControllerTransitionStyle,
navigation_orientation: UIPageViewControllerNavigationOrientation,
options: Option<&NSDictionary<UIPageViewControllerOptionsKey, AnyObject>>,
) -> Retained<Self>;
#[unsafe(method(initWithCoder:))]
#[unsafe(method_family = init)]
pub unsafe fn initWithCoder(
this: Allocated<Self>,
coder: &NSCoder,
) -> Option<Retained<Self>>;
#[unsafe(method(delegate))]
#[unsafe(method_family = none)]
pub fn delegate(
&self,
) -> Option<Retained<ProtocolObject<dyn UIPageViewControllerDelegate>>>;
#[unsafe(method(setDelegate:))]
#[unsafe(method_family = none)]
pub fn setDelegate(
&self,
delegate: Option<&ProtocolObject<dyn UIPageViewControllerDelegate>>,
);
#[unsafe(method(dataSource))]
#[unsafe(method_family = none)]
pub fn dataSource(
&self,
) -> Option<Retained<ProtocolObject<dyn UIPageViewControllerDataSource>>>;
#[unsafe(method(setDataSource:))]
#[unsafe(method_family = none)]
pub fn setDataSource(
&self,
data_source: Option<&ProtocolObject<dyn UIPageViewControllerDataSource>>,
);
#[unsafe(method(transitionStyle))]
#[unsafe(method_family = none)]
pub fn transitionStyle(&self) -> UIPageViewControllerTransitionStyle;
#[unsafe(method(navigationOrientation))]
#[unsafe(method_family = none)]
pub fn navigationOrientation(&self) -> UIPageViewControllerNavigationOrientation;
#[unsafe(method(spineLocation))]
#[unsafe(method_family = none)]
pub fn spineLocation(&self) -> UIPageViewControllerSpineLocation;
#[unsafe(method(isDoubleSided))]
#[unsafe(method_family = none)]
pub fn isDoubleSided(&self) -> bool;
#[unsafe(method(setDoubleSided:))]
#[unsafe(method_family = none)]
pub fn setDoubleSided(&self, double_sided: bool);
#[cfg(feature = "UIGestureRecognizer")]
#[unsafe(method(gestureRecognizers))]
#[unsafe(method_family = none)]
pub fn gestureRecognizers(&self) -> Retained<NSArray<UIGestureRecognizer>>;
#[unsafe(method(viewControllers))]
#[unsafe(method_family = none)]
pub fn viewControllers(&self) -> Option<Retained<NSArray<UIViewController>>>;
#[cfg(feature = "block2")]
#[unsafe(method(setViewControllers:direction:animated:completion:))]
#[unsafe(method_family = none)]
pub fn setViewControllers_direction_animated_completion(
&self,
view_controllers: Option<&NSArray<UIViewController>>,
direction: UIPageViewControllerNavigationDirection,
animated: bool,
completion: Option<&block2::DynBlock<dyn Fn(Bool)>>,
);
);
}
#[cfg(all(feature = "UIResponder", feature = "UIViewController"))]
impl UIPageViewController {
extern_methods!(
#[unsafe(method(initWithNibName:bundle:))]
#[unsafe(method_family = init)]
pub fn initWithNibName_bundle(
this: Allocated<Self>,
nib_name_or_nil: Option<&NSString>,
nib_bundle_or_nil: Option<&NSBundle>,
) -> Retained<Self>;
);
}
#[cfg(all(feature = "UIResponder", feature = "UIViewController"))]
impl UIPageViewController {
extern_methods!(
#[unsafe(method(init))]
#[unsafe(method_family = init)]
pub fn init(this: Allocated<Self>) -> Retained<Self>;
#[unsafe(method(new))]
#[unsafe(method_family = new)]
pub fn new(mtm: MainThreadMarker) -> Retained<Self>;
);
}
extern_protocol!(
pub unsafe trait UIPageViewControllerDelegate:
NSObjectProtocol + MainThreadOnly
{
#[cfg(all(feature = "UIResponder", feature = "UIViewController"))]
#[optional]
#[unsafe(method(pageViewController:willTransitionToViewControllers:))]
#[unsafe(method_family = none)]
fn pageViewController_willTransitionToViewControllers(
&self,
page_view_controller: &UIPageViewController,
pending_view_controllers: &NSArray<UIViewController>,
);
#[cfg(all(feature = "UIResponder", feature = "UIViewController"))]
#[optional]
#[unsafe(method(pageViewController:didFinishAnimating:previousViewControllers:transitionCompleted:))]
#[unsafe(method_family = none)]
fn pageViewController_didFinishAnimating_previousViewControllers_transitionCompleted(
&self,
page_view_controller: &UIPageViewController,
finished: bool,
previous_view_controllers: &NSArray<UIViewController>,
completed: bool,
);
#[cfg(all(
feature = "UIOrientation",
feature = "UIResponder",
feature = "UIViewController"
))]
#[optional]
#[unsafe(method(pageViewController:spineLocationForInterfaceOrientation:))]
#[unsafe(method_family = none)]
fn pageViewController_spineLocationForInterfaceOrientation(
&self,
page_view_controller: &UIPageViewController,
orientation: UIInterfaceOrientation,
) -> UIPageViewControllerSpineLocation;
#[cfg(all(
feature = "UIOrientation",
feature = "UIResponder",
feature = "UIViewController"
))]
#[optional]
#[unsafe(method(pageViewControllerSupportedInterfaceOrientations:))]
#[unsafe(method_family = none)]
fn pageViewControllerSupportedInterfaceOrientations(
&self,
page_view_controller: &UIPageViewController,
) -> UIInterfaceOrientationMask;
#[cfg(all(
feature = "UIOrientation",
feature = "UIResponder",
feature = "UIViewController"
))]
#[optional]
#[unsafe(method(pageViewControllerPreferredInterfaceOrientationForPresentation:))]
#[unsafe(method_family = none)]
fn pageViewControllerPreferredInterfaceOrientationForPresentation(
&self,
page_view_controller: &UIPageViewController,
) -> UIInterfaceOrientation;
}
);
extern_protocol!(
pub unsafe trait UIPageViewControllerDataSource:
NSObjectProtocol + MainThreadOnly
{
#[cfg(all(feature = "UIResponder", feature = "UIViewController"))]
#[unsafe(method(pageViewController:viewControllerBeforeViewController:))]
#[unsafe(method_family = none)]
fn pageViewController_viewControllerBeforeViewController(
&self,
page_view_controller: &UIPageViewController,
view_controller: &UIViewController,
) -> Option<Retained<UIViewController>>;
#[cfg(all(feature = "UIResponder", feature = "UIViewController"))]
#[unsafe(method(pageViewController:viewControllerAfterViewController:))]
#[unsafe(method_family = none)]
fn pageViewController_viewControllerAfterViewController(
&self,
page_view_controller: &UIPageViewController,
view_controller: &UIViewController,
) -> Option<Retained<UIViewController>>;
#[cfg(all(feature = "UIResponder", feature = "UIViewController"))]
#[optional]
#[unsafe(method(presentationCountForPageViewController:))]
#[unsafe(method_family = none)]
fn presentationCountForPageViewController(
&self,
page_view_controller: &UIPageViewController,
) -> NSInteger;
#[cfg(all(feature = "UIResponder", feature = "UIViewController"))]
#[optional]
#[unsafe(method(presentationIndexForPageViewController:))]
#[unsafe(method_family = none)]
fn presentationIndexForPageViewController(
&self,
page_view_controller: &UIPageViewController,
) -> NSInteger;
}
);