objc2_ui_kit/generated/
UIPreviewInteraction.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::*;
6#[cfg(feature = "objc2-core-foundation")]
7use objc2_core_foundation::*;
8
9use crate::*;
10
11extern_class!(
12    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uipreviewinteraction?language=objc)
13    #[unsafe(super(NSObject))]
14    #[thread_kind = MainThreadOnly]
15    #[derive(Debug, PartialEq, Eq, Hash)]
16    pub struct UIPreviewInteraction;
17);
18
19extern_conformance!(
20    unsafe impl NSObjectProtocol for UIPreviewInteraction {}
21);
22
23impl UIPreviewInteraction {
24    extern_methods!(
25        #[cfg(all(feature = "UIResponder", feature = "UIView"))]
26        #[unsafe(method(initWithView:))]
27        #[unsafe(method_family = init)]
28        pub fn initWithView(this: Allocated<Self>, view: &UIView) -> Retained<Self>;
29
30        #[cfg(all(feature = "UIResponder", feature = "UIView"))]
31        #[unsafe(method(view))]
32        #[unsafe(method_family = none)]
33        pub fn view(&self) -> Option<Retained<UIView>>;
34
35        #[unsafe(method(init))]
36        #[unsafe(method_family = init)]
37        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
38
39        #[unsafe(method(delegate))]
40        #[unsafe(method_family = none)]
41        pub fn delegate(
42            &self,
43        ) -> Option<Retained<ProtocolObject<dyn UIPreviewInteractionDelegate>>>;
44
45        /// Setter for [`delegate`][Self::delegate].
46        ///
47        /// This is a [weak property][objc2::topics::weak_property].
48        #[unsafe(method(setDelegate:))]
49        #[unsafe(method_family = none)]
50        pub fn setDelegate(
51            &self,
52            delegate: Option<&ProtocolObject<dyn UIPreviewInteractionDelegate>>,
53        );
54
55        #[cfg(all(feature = "UIView", feature = "objc2-core-foundation"))]
56        #[unsafe(method(locationInCoordinateSpace:))]
57        #[unsafe(method_family = none)]
58        pub fn locationInCoordinateSpace(
59            &self,
60            coordinate_space: Option<&ProtocolObject<dyn UICoordinateSpace>>,
61        ) -> CGPoint;
62
63        #[unsafe(method(cancelInteraction))]
64        #[unsafe(method_family = none)]
65        pub fn cancelInteraction(&self);
66    );
67}
68
69/// Methods declared on superclass `NSObject`.
70impl UIPreviewInteraction {
71    extern_methods!(
72        #[unsafe(method(new))]
73        #[unsafe(method_family = new)]
74        pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
75    );
76}
77
78extern_protocol!(
79    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uipreviewinteractiondelegate?language=objc)
80    pub unsafe trait UIPreviewInteractionDelegate:
81        NSObjectProtocol + MainThreadOnly
82    {
83        #[cfg(feature = "objc2-core-foundation")]
84        #[unsafe(method(previewInteraction:didUpdatePreviewTransition:ended:))]
85        #[unsafe(method_family = none)]
86        fn previewInteraction_didUpdatePreviewTransition_ended(
87            &self,
88            preview_interaction: &UIPreviewInteraction,
89            transition_progress: CGFloat,
90            ended: bool,
91        );
92
93        #[unsafe(method(previewInteractionDidCancel:))]
94        #[unsafe(method_family = none)]
95        fn previewInteractionDidCancel(&self, preview_interaction: &UIPreviewInteraction);
96
97        #[optional]
98        #[unsafe(method(previewInteractionShouldBegin:))]
99        #[unsafe(method_family = none)]
100        fn previewInteractionShouldBegin(&self, preview_interaction: &UIPreviewInteraction)
101            -> bool;
102
103        #[cfg(feature = "objc2-core-foundation")]
104        #[optional]
105        #[unsafe(method(previewInteraction:didUpdateCommitTransition:ended:))]
106        #[unsafe(method_family = none)]
107        fn previewInteraction_didUpdateCommitTransition_ended(
108            &self,
109            preview_interaction: &UIPreviewInteraction,
110            transition_progress: CGFloat,
111            ended: bool,
112        );
113    }
114);