objc2_event_kit_ui/generated/
EKEventViewController.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-event-kit")]
7use objc2_event_kit::*;
8use objc2_foundation::*;
9#[cfg(feature = "objc2-ui-kit")]
10use objc2_ui_kit::*;
11
12use crate::*;
13
14/// [Apple's documentation](https://developer.apple.com/documentation/eventkitui/ekeventviewaction?language=objc)
15// NS_ENUM
16#[repr(transparent)]
17#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
18pub struct EKEventViewAction(pub NSInteger);
19impl EKEventViewAction {
20    #[doc(alias = "EKEventViewActionDone")]
21    pub const Done: Self = Self(0);
22    #[doc(alias = "EKEventViewActionResponded")]
23    pub const Responded: Self = Self(1);
24    #[doc(alias = "EKEventViewActionDeleted")]
25    pub const Deleted: Self = Self(2);
26}
27
28unsafe impl Encode for EKEventViewAction {
29    const ENCODING: Encoding = NSInteger::ENCODING;
30}
31
32unsafe impl RefEncode for EKEventViewAction {
33    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
34}
35
36extern_class!(
37    /// [Apple's documentation](https://developer.apple.com/documentation/eventkitui/ekeventviewcontroller?language=objc)
38    #[unsafe(super(UIViewController, UIResponder, NSObject))]
39    #[derive(Debug, PartialEq, Eq, Hash)]
40    #[cfg(feature = "objc2-ui-kit")]
41    pub struct EKEventViewController;
42);
43
44#[cfg(feature = "objc2-ui-kit")]
45extern_conformance!(
46    unsafe impl NSCoding for EKEventViewController {}
47);
48
49#[cfg(feature = "objc2-ui-kit")]
50extern_conformance!(
51    unsafe impl NSObjectProtocol for EKEventViewController {}
52);
53
54#[cfg(feature = "objc2-ui-kit")]
55extern_conformance!(
56    unsafe impl UIAppearanceContainer for EKEventViewController {}
57);
58
59#[cfg(feature = "objc2-ui-kit")]
60extern_conformance!(
61    unsafe impl UIContentContainer for EKEventViewController {}
62);
63
64#[cfg(feature = "objc2-ui-kit")]
65extern_conformance!(
66    unsafe impl UIFocusEnvironment for EKEventViewController {}
67);
68
69#[cfg(feature = "objc2-ui-kit")]
70extern_conformance!(
71    unsafe impl UIResponderStandardEditActions for EKEventViewController {}
72);
73
74#[cfg(feature = "objc2-ui-kit")]
75extern_conformance!(
76    unsafe impl UITraitEnvironment for EKEventViewController {}
77);
78
79#[cfg(feature = "objc2-ui-kit")]
80impl EKEventViewController {
81    extern_methods!(
82        #[unsafe(method(delegate))]
83        #[unsafe(method_family = none)]
84        pub unsafe fn delegate(&self) -> Option<Retained<ProtocolObject<dyn EKEventViewDelegate>>>;
85
86        /// Setter for [`delegate`][Self::delegate].
87        ///
88        /// This is a [weak property][objc2::topics::weak_property].
89        #[unsafe(method(setDelegate:))]
90        #[unsafe(method_family = none)]
91        pub unsafe fn setDelegate(
92            &self,
93            delegate: Option<&ProtocolObject<dyn EKEventViewDelegate>>,
94        );
95
96        #[cfg(feature = "objc2-event-kit")]
97        /// Specifies the event to view.
98        ///
99        /// You must set this prior to displaying the view controller.
100        #[unsafe(method(event))]
101        #[unsafe(method_family = none)]
102        pub unsafe fn event(&self) -> Option<Retained<EKEvent>>;
103
104        #[cfg(feature = "objc2-event-kit")]
105        /// Setter for [`event`][Self::event].
106        ///
107        /// # Safety
108        ///
109        /// `event` might not allow `None`.
110        #[unsafe(method(setEvent:))]
111        #[unsafe(method_family = none)]
112        pub unsafe fn setEvent(&self, event: Option<&EKEvent>);
113
114        /// Determines whether Edit button can be shown.
115        ///
116        /// Note that even if this is enabled, the edit button may not appear if this event
117        /// is in a read-only calendar, such as a subscribed calendar. It may also not appear
118        /// if the event was not created by the current user (i.e. it's an event they were
119        /// invited to). And lastly, if the event was never saved, the edit button will not
120        /// appear.
121        #[unsafe(method(allowsEditing))]
122        #[unsafe(method_family = none)]
123        pub unsafe fn allowsEditing(&self) -> bool;
124
125        /// Setter for [`allowsEditing`][Self::allowsEditing].
126        #[unsafe(method(setAllowsEditing:))]
127        #[unsafe(method_family = none)]
128        pub unsafe fn setAllowsEditing(&self, allows_editing: bool);
129
130        /// Determines whether event can be shown in calendar day view preview.
131        ///
132        /// This option only affects calendar invites at present. If the event is an invite,
133        /// and this option is set, a table cell will appear that allows the user to preview
134        /// the event along with their other events for the day.
135        #[unsafe(method(allowsCalendarPreview))]
136        #[unsafe(method_family = none)]
137        pub unsafe fn allowsCalendarPreview(&self) -> bool;
138
139        /// Setter for [`allowsCalendarPreview`][Self::allowsCalendarPreview].
140        #[unsafe(method(setAllowsCalendarPreview:))]
141        #[unsafe(method_family = none)]
142        pub unsafe fn setAllowsCalendarPreview(&self, allows_calendar_preview: bool);
143    );
144}
145
146/// Methods declared on superclass `UIViewController`.
147#[cfg(feature = "objc2-ui-kit")]
148impl EKEventViewController {
149    extern_methods!(
150        #[unsafe(method(initWithNibName:bundle:))]
151        #[unsafe(method_family = init)]
152        pub unsafe fn initWithNibName_bundle(
153            this: Allocated<Self>,
154            nib_name_or_nil: Option<&NSString>,
155            nib_bundle_or_nil: Option<&NSBundle>,
156        ) -> Retained<Self>;
157
158        /// # Safety
159        ///
160        /// `coder` possibly has further requirements.
161        #[unsafe(method(initWithCoder:))]
162        #[unsafe(method_family = init)]
163        pub unsafe fn initWithCoder(
164            this: Allocated<Self>,
165            coder: &NSCoder,
166        ) -> Option<Retained<Self>>;
167    );
168}
169
170/// Methods declared on superclass `NSObject`.
171#[cfg(feature = "objc2-ui-kit")]
172impl EKEventViewController {
173    extern_methods!(
174        #[unsafe(method(init))]
175        #[unsafe(method_family = init)]
176        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
177
178        #[unsafe(method(new))]
179        #[unsafe(method_family = new)]
180        pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
181    );
182}
183
184extern_protocol!(
185    /// View controller to view event detail.
186    ///
187    /// You can use this view controller to display the details of an event. You
188    /// can also optionally choose to allow the user to edit the event by displaying
189    /// an edit button. While you can use this view controller to display events that
190    /// have not been saved, the edit button will not appear in this situation. If
191    /// you have pushed this view controller onto a navigation controller stack, and
192    /// the underlying event gets deleted, this controller will remove itself from
193    /// the stack and clear its event property.
194    ///
195    /// See also [Apple's documentation](https://developer.apple.com/documentation/eventkitui/ekeventviewdelegate?language=objc)
196    pub unsafe trait EKEventViewDelegate: NSObjectProtocol {
197        #[cfg(feature = "objc2-ui-kit")]
198        /// Called to let delegate know that an action has occurred that should cause the
199        /// controller to be dismissed.
200        ///
201        /// If the user taps a button which deletes the event, or responds to an invite, this
202        /// method is called on the delegate so that the delegate can decide to dismiss
203        /// the view controller. When presented in a popover, it also reports when the Done
204        /// button is pressed.
205        ///
206        ///
207        /// Parameter `controller`: the controller in question
208        ///
209        /// Parameter `action`: the action that is triggering the dismissal
210        #[unsafe(method(eventViewController:didCompleteWithAction:))]
211        #[unsafe(method_family = none)]
212        unsafe fn eventViewController_didCompleteWithAction(
213            &self,
214            controller: &EKEventViewController,
215            action: EKEventViewAction,
216        );
217    }
218);