objc2_ui_kit/generated/
UIPageViewController.rs

1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::ffi::*;
4use core::ptr::NonNull;
5use objc2::__framework_prelude::*;
6use objc2_foundation::*;
7
8use crate::*;
9
10/// [Apple's documentation](https://developer.apple.com/documentation/uikit/uipageviewcontrollernavigationorientation?language=objc)
11// NS_ENUM
12#[repr(transparent)]
13#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
14pub struct UIPageViewControllerNavigationOrientation(pub NSInteger);
15impl UIPageViewControllerNavigationOrientation {
16    #[doc(alias = "UIPageViewControllerNavigationOrientationHorizontal")]
17    pub const Horizontal: Self = Self(0);
18    #[doc(alias = "UIPageViewControllerNavigationOrientationVertical")]
19    pub const Vertical: Self = Self(1);
20}
21
22unsafe impl Encode for UIPageViewControllerNavigationOrientation {
23    const ENCODING: Encoding = NSInteger::ENCODING;
24}
25
26unsafe impl RefEncode for UIPageViewControllerNavigationOrientation {
27    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
28}
29
30/// [Apple's documentation](https://developer.apple.com/documentation/uikit/uipageviewcontrollerspinelocation?language=objc)
31// NS_ENUM
32#[repr(transparent)]
33#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
34pub struct UIPageViewControllerSpineLocation(pub NSInteger);
35impl UIPageViewControllerSpineLocation {
36    #[doc(alias = "UIPageViewControllerSpineLocationNone")]
37    pub const None: Self = Self(0);
38    #[doc(alias = "UIPageViewControllerSpineLocationMin")]
39    pub const Min: Self = Self(1);
40    #[doc(alias = "UIPageViewControllerSpineLocationMid")]
41    pub const Mid: Self = Self(2);
42    #[doc(alias = "UIPageViewControllerSpineLocationMax")]
43    pub const Max: Self = Self(3);
44}
45
46unsafe impl Encode for UIPageViewControllerSpineLocation {
47    const ENCODING: Encoding = NSInteger::ENCODING;
48}
49
50unsafe impl RefEncode for UIPageViewControllerSpineLocation {
51    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
52}
53
54/// [Apple's documentation](https://developer.apple.com/documentation/uikit/uipageviewcontrollernavigationdirection?language=objc)
55// NS_ENUM
56#[repr(transparent)]
57#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
58pub struct UIPageViewControllerNavigationDirection(pub NSInteger);
59impl UIPageViewControllerNavigationDirection {
60    #[doc(alias = "UIPageViewControllerNavigationDirectionForward")]
61    pub const Forward: Self = Self(0);
62    #[doc(alias = "UIPageViewControllerNavigationDirectionReverse")]
63    pub const Reverse: Self = Self(1);
64}
65
66unsafe impl Encode for UIPageViewControllerNavigationDirection {
67    const ENCODING: Encoding = NSInteger::ENCODING;
68}
69
70unsafe impl RefEncode for UIPageViewControllerNavigationDirection {
71    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
72}
73
74/// [Apple's documentation](https://developer.apple.com/documentation/uikit/uipageviewcontrollertransitionstyle?language=objc)
75// NS_ENUM
76#[repr(transparent)]
77#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
78pub struct UIPageViewControllerTransitionStyle(pub NSInteger);
79impl UIPageViewControllerTransitionStyle {
80    #[doc(alias = "UIPageViewControllerTransitionStylePageCurl")]
81    pub const PageCurl: Self = Self(0);
82    #[doc(alias = "UIPageViewControllerTransitionStyleScroll")]
83    pub const Scroll: Self = Self(1);
84}
85
86unsafe impl Encode for UIPageViewControllerTransitionStyle {
87    const ENCODING: Encoding = NSInteger::ENCODING;
88}
89
90unsafe impl RefEncode for UIPageViewControllerTransitionStyle {
91    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
92}
93
94/// [Apple's documentation](https://developer.apple.com/documentation/uikit/uipageviewcontrolleroptionskey?language=objc)
95// NS_TYPED_ENUM
96pub type UIPageViewControllerOptionsKey = NSString;
97
98extern "C" {
99    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uipageviewcontrolleroptionspinelocationkey?language=objc)
100    pub static UIPageViewControllerOptionSpineLocationKey: &'static UIPageViewControllerOptionsKey;
101}
102
103extern "C" {
104    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uipageviewcontrolleroptioninterpagespacingkey?language=objc)
105    pub static UIPageViewControllerOptionInterPageSpacingKey:
106        &'static UIPageViewControllerOptionsKey;
107}
108
109extern_class!(
110    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uipageviewcontroller?language=objc)
111    #[unsafe(super(UIViewController, UIResponder, NSObject))]
112    #[thread_kind = MainThreadOnly]
113    #[derive(Debug, PartialEq, Eq, Hash)]
114    #[cfg(all(feature = "UIResponder", feature = "UIViewController"))]
115    pub struct UIPageViewController;
116);
117
118#[cfg(all(feature = "UIResponder", feature = "UIViewController"))]
119extern_conformance!(
120    unsafe impl NSCoding for UIPageViewController {}
121);
122
123#[cfg(all(feature = "UIResponder", feature = "UIViewController"))]
124extern_conformance!(
125    unsafe impl NSObjectProtocol for UIPageViewController {}
126);
127
128#[cfg(all(
129    feature = "UIAppearance",
130    feature = "UIResponder",
131    feature = "UIViewController"
132))]
133extern_conformance!(
134    unsafe impl UIAppearanceContainer for UIPageViewController {}
135);
136
137#[cfg(all(feature = "UIResponder", feature = "UIViewController"))]
138extern_conformance!(
139    unsafe impl UIContentContainer for UIPageViewController {}
140);
141
142#[cfg(all(
143    feature = "UIFocus",
144    feature = "UIResponder",
145    feature = "UIViewController"
146))]
147extern_conformance!(
148    unsafe impl UIFocusEnvironment for UIPageViewController {}
149);
150
151#[cfg(all(feature = "UIResponder", feature = "UIViewController"))]
152extern_conformance!(
153    unsafe impl UIResponderStandardEditActions for UIPageViewController {}
154);
155
156#[cfg(all(
157    feature = "UIResponder",
158    feature = "UITraitCollection",
159    feature = "UIViewController"
160))]
161extern_conformance!(
162    unsafe impl UITraitEnvironment for UIPageViewController {}
163);
164
165#[cfg(all(feature = "UIResponder", feature = "UIViewController"))]
166impl UIPageViewController {
167    extern_methods!(
168        /// # Safety
169        ///
170        /// `options` generic should be of the correct type.
171        #[unsafe(method(initWithTransitionStyle:navigationOrientation:options:))]
172        #[unsafe(method_family = init)]
173        pub unsafe fn initWithTransitionStyle_navigationOrientation_options(
174            this: Allocated<Self>,
175            style: UIPageViewControllerTransitionStyle,
176            navigation_orientation: UIPageViewControllerNavigationOrientation,
177            options: Option<&NSDictionary<UIPageViewControllerOptionsKey, AnyObject>>,
178        ) -> Retained<Self>;
179
180        /// # Safety
181        ///
182        /// `coder` possibly has further requirements.
183        #[unsafe(method(initWithCoder:))]
184        #[unsafe(method_family = init)]
185        pub unsafe fn initWithCoder(
186            this: Allocated<Self>,
187            coder: &NSCoder,
188        ) -> Option<Retained<Self>>;
189
190        #[unsafe(method(delegate))]
191        #[unsafe(method_family = none)]
192        pub fn delegate(
193            &self,
194        ) -> Option<Retained<ProtocolObject<dyn UIPageViewControllerDelegate>>>;
195
196        /// Setter for [`delegate`][Self::delegate].
197        ///
198        /// This is a [weak property][objc2::topics::weak_property].
199        #[unsafe(method(setDelegate:))]
200        #[unsafe(method_family = none)]
201        pub fn setDelegate(
202            &self,
203            delegate: Option<&ProtocolObject<dyn UIPageViewControllerDelegate>>,
204        );
205
206        #[unsafe(method(dataSource))]
207        #[unsafe(method_family = none)]
208        pub fn dataSource(
209            &self,
210        ) -> Option<Retained<ProtocolObject<dyn UIPageViewControllerDataSource>>>;
211
212        /// Setter for [`dataSource`][Self::dataSource].
213        ///
214        /// This is a [weak property][objc2::topics::weak_property].
215        #[unsafe(method(setDataSource:))]
216        #[unsafe(method_family = none)]
217        pub fn setDataSource(
218            &self,
219            data_source: Option<&ProtocolObject<dyn UIPageViewControllerDataSource>>,
220        );
221
222        #[unsafe(method(transitionStyle))]
223        #[unsafe(method_family = none)]
224        pub fn transitionStyle(&self) -> UIPageViewControllerTransitionStyle;
225
226        #[unsafe(method(navigationOrientation))]
227        #[unsafe(method_family = none)]
228        pub fn navigationOrientation(&self) -> UIPageViewControllerNavigationOrientation;
229
230        #[unsafe(method(spineLocation))]
231        #[unsafe(method_family = none)]
232        pub fn spineLocation(&self) -> UIPageViewControllerSpineLocation;
233
234        #[unsafe(method(isDoubleSided))]
235        #[unsafe(method_family = none)]
236        pub fn isDoubleSided(&self) -> bool;
237
238        /// Setter for [`isDoubleSided`][Self::isDoubleSided].
239        #[unsafe(method(setDoubleSided:))]
240        #[unsafe(method_family = none)]
241        pub fn setDoubleSided(&self, double_sided: bool);
242
243        #[cfg(feature = "UIGestureRecognizer")]
244        #[unsafe(method(gestureRecognizers))]
245        #[unsafe(method_family = none)]
246        pub fn gestureRecognizers(&self) -> Retained<NSArray<UIGestureRecognizer>>;
247
248        #[unsafe(method(viewControllers))]
249        #[unsafe(method_family = none)]
250        pub fn viewControllers(&self) -> Option<Retained<NSArray<UIViewController>>>;
251
252        #[cfg(feature = "block2")]
253        #[unsafe(method(setViewControllers:direction:animated:completion:))]
254        #[unsafe(method_family = none)]
255        pub fn setViewControllers_direction_animated_completion(
256            &self,
257            view_controllers: Option<&NSArray<UIViewController>>,
258            direction: UIPageViewControllerNavigationDirection,
259            animated: bool,
260            completion: Option<&block2::DynBlock<dyn Fn(Bool)>>,
261        );
262    );
263}
264
265/// Methods declared on superclass `UIViewController`.
266#[cfg(all(feature = "UIResponder", feature = "UIViewController"))]
267impl UIPageViewController {
268    extern_methods!(
269        #[unsafe(method(initWithNibName:bundle:))]
270        #[unsafe(method_family = init)]
271        pub fn initWithNibName_bundle(
272            this: Allocated<Self>,
273            nib_name_or_nil: Option<&NSString>,
274            nib_bundle_or_nil: Option<&NSBundle>,
275        ) -> Retained<Self>;
276    );
277}
278
279/// Methods declared on superclass `NSObject`.
280#[cfg(all(feature = "UIResponder", feature = "UIViewController"))]
281impl UIPageViewController {
282    extern_methods!(
283        #[unsafe(method(init))]
284        #[unsafe(method_family = init)]
285        pub fn init(this: Allocated<Self>) -> Retained<Self>;
286
287        #[unsafe(method(new))]
288        #[unsafe(method_family = new)]
289        pub fn new(mtm: MainThreadMarker) -> Retained<Self>;
290    );
291}
292
293extern_protocol!(
294    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uipageviewcontrollerdelegate?language=objc)
295    pub unsafe trait UIPageViewControllerDelegate:
296        NSObjectProtocol + MainThreadOnly
297    {
298        #[cfg(all(feature = "UIResponder", feature = "UIViewController"))]
299        #[optional]
300        #[unsafe(method(pageViewController:willTransitionToViewControllers:))]
301        #[unsafe(method_family = none)]
302        fn pageViewController_willTransitionToViewControllers(
303            &self,
304            page_view_controller: &UIPageViewController,
305            pending_view_controllers: &NSArray<UIViewController>,
306        );
307
308        #[cfg(all(feature = "UIResponder", feature = "UIViewController"))]
309        #[optional]
310        #[unsafe(method(pageViewController:didFinishAnimating:previousViewControllers:transitionCompleted:))]
311        #[unsafe(method_family = none)]
312        fn pageViewController_didFinishAnimating_previousViewControllers_transitionCompleted(
313            &self,
314            page_view_controller: &UIPageViewController,
315            finished: bool,
316            previous_view_controllers: &NSArray<UIViewController>,
317            completed: bool,
318        );
319
320        #[cfg(all(
321            feature = "UIOrientation",
322            feature = "UIResponder",
323            feature = "UIViewController"
324        ))]
325        #[optional]
326        #[unsafe(method(pageViewController:spineLocationForInterfaceOrientation:))]
327        #[unsafe(method_family = none)]
328        fn pageViewController_spineLocationForInterfaceOrientation(
329            &self,
330            page_view_controller: &UIPageViewController,
331            orientation: UIInterfaceOrientation,
332        ) -> UIPageViewControllerSpineLocation;
333
334        #[cfg(all(
335            feature = "UIOrientation",
336            feature = "UIResponder",
337            feature = "UIViewController"
338        ))]
339        #[optional]
340        #[unsafe(method(pageViewControllerSupportedInterfaceOrientations:))]
341        #[unsafe(method_family = none)]
342        fn pageViewControllerSupportedInterfaceOrientations(
343            &self,
344            page_view_controller: &UIPageViewController,
345        ) -> UIInterfaceOrientationMask;
346
347        #[cfg(all(
348            feature = "UIOrientation",
349            feature = "UIResponder",
350            feature = "UIViewController"
351        ))]
352        #[optional]
353        #[unsafe(method(pageViewControllerPreferredInterfaceOrientationForPresentation:))]
354        #[unsafe(method_family = none)]
355        fn pageViewControllerPreferredInterfaceOrientationForPresentation(
356            &self,
357            page_view_controller: &UIPageViewController,
358        ) -> UIInterfaceOrientation;
359    }
360);
361
362extern_protocol!(
363    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uipageviewcontrollerdatasource?language=objc)
364    pub unsafe trait UIPageViewControllerDataSource:
365        NSObjectProtocol + MainThreadOnly
366    {
367        #[cfg(all(feature = "UIResponder", feature = "UIViewController"))]
368        #[unsafe(method(pageViewController:viewControllerBeforeViewController:))]
369        #[unsafe(method_family = none)]
370        fn pageViewController_viewControllerBeforeViewController(
371            &self,
372            page_view_controller: &UIPageViewController,
373            view_controller: &UIViewController,
374        ) -> Option<Retained<UIViewController>>;
375
376        #[cfg(all(feature = "UIResponder", feature = "UIViewController"))]
377        #[unsafe(method(pageViewController:viewControllerAfterViewController:))]
378        #[unsafe(method_family = none)]
379        fn pageViewController_viewControllerAfterViewController(
380            &self,
381            page_view_controller: &UIPageViewController,
382            view_controller: &UIViewController,
383        ) -> Option<Retained<UIViewController>>;
384
385        #[cfg(all(feature = "UIResponder", feature = "UIViewController"))]
386        #[optional]
387        #[unsafe(method(presentationCountForPageViewController:))]
388        #[unsafe(method_family = none)]
389        fn presentationCountForPageViewController(
390            &self,
391            page_view_controller: &UIPageViewController,
392        ) -> NSInteger;
393
394        #[cfg(all(feature = "UIResponder", feature = "UIViewController"))]
395        #[optional]
396        #[unsafe(method(presentationIndexForPageViewController:))]
397        #[unsafe(method_family = none)]
398        fn presentationIndexForPageViewController(
399            &self,
400            page_view_controller: &UIPageViewController,
401        ) -> NSInteger;
402    }
403);