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")]
45unsafe impl NSCoding for EKEventViewController {}
46
47#[cfg(feature = "objc2-ui-kit")]
48unsafe impl NSObjectProtocol for EKEventViewController {}
49
50#[cfg(feature = "objc2-ui-kit")]
51unsafe impl UIAppearanceContainer for EKEventViewController {}
52
53#[cfg(feature = "objc2-ui-kit")]
54unsafe impl UIContentContainer for EKEventViewController {}
55
56#[cfg(feature = "objc2-ui-kit")]
57unsafe impl UIFocusEnvironment for EKEventViewController {}
58
59#[cfg(feature = "objc2-ui-kit")]
60unsafe impl UIResponderStandardEditActions for EKEventViewController {}
61
62#[cfg(feature = "objc2-ui-kit")]
63unsafe impl UITraitEnvironment for EKEventViewController {}
64
65#[cfg(feature = "objc2-ui-kit")]
66impl EKEventViewController {
67    extern_methods!(
68        #[unsafe(method(delegate))]
69        #[unsafe(method_family = none)]
70        pub unsafe fn delegate(&self) -> Option<Retained<ProtocolObject<dyn EKEventViewDelegate>>>;
71
72        /// This is a [weak property][objc2::topics::weak_property].
73        /// Setter for [`delegate`][Self::delegate].
74        #[unsafe(method(setDelegate:))]
75        #[unsafe(method_family = none)]
76        pub unsafe fn setDelegate(
77            &self,
78            delegate: Option<&ProtocolObject<dyn EKEventViewDelegate>>,
79        );
80
81        #[cfg(feature = "objc2-event-kit")]
82        /// Specifies the event to view.
83        ///
84        /// You must set this prior to displaying the view controller.
85        #[unsafe(method(event))]
86        #[unsafe(method_family = none)]
87        pub unsafe fn event(&self) -> Option<Retained<EKEvent>>;
88
89        #[cfg(feature = "objc2-event-kit")]
90        /// Setter for [`event`][Self::event].
91        #[unsafe(method(setEvent:))]
92        #[unsafe(method_family = none)]
93        pub unsafe fn setEvent(&self, event: Option<&EKEvent>);
94
95        /// Determines whether Edit button can be shown.
96        ///
97        /// Note that even if this is enabled, the edit button may not appear if this event
98        /// is in a read-only calendar, such as a subscribed calendar. It may also not appear
99        /// if the event was not created by the current user (i.e. it's an event they were
100        /// invited to). And lastly, if the event was never saved, the edit button will not
101        /// appear.
102        #[unsafe(method(allowsEditing))]
103        #[unsafe(method_family = none)]
104        pub unsafe fn allowsEditing(&self) -> bool;
105
106        /// Setter for [`allowsEditing`][Self::allowsEditing].
107        #[unsafe(method(setAllowsEditing:))]
108        #[unsafe(method_family = none)]
109        pub unsafe fn setAllowsEditing(&self, allows_editing: bool);
110
111        /// Determines whether event can be shown in calendar day view preview.
112        ///
113        /// This option only affects calendar invites at present. If the event is an invite,
114        /// and this option is set, a table cell will appear that allows the user to preview
115        /// the event along with their other events for the day.
116        #[unsafe(method(allowsCalendarPreview))]
117        #[unsafe(method_family = none)]
118        pub unsafe fn allowsCalendarPreview(&self) -> bool;
119
120        /// Setter for [`allowsCalendarPreview`][Self::allowsCalendarPreview].
121        #[unsafe(method(setAllowsCalendarPreview:))]
122        #[unsafe(method_family = none)]
123        pub unsafe fn setAllowsCalendarPreview(&self, allows_calendar_preview: bool);
124    );
125}
126
127/// Methods declared on superclass `UIViewController`.
128#[cfg(feature = "objc2-ui-kit")]
129impl EKEventViewController {
130    extern_methods!(
131        #[unsafe(method(initWithNibName:bundle:))]
132        #[unsafe(method_family = init)]
133        pub unsafe fn initWithNibName_bundle(
134            this: Allocated<Self>,
135            nib_name_or_nil: Option<&NSString>,
136            nib_bundle_or_nil: Option<&NSBundle>,
137        ) -> Retained<Self>;
138
139        #[unsafe(method(initWithCoder:))]
140        #[unsafe(method_family = init)]
141        pub unsafe fn initWithCoder(
142            this: Allocated<Self>,
143            coder: &NSCoder,
144        ) -> Option<Retained<Self>>;
145    );
146}
147
148/// Methods declared on superclass `NSObject`.
149#[cfg(feature = "objc2-ui-kit")]
150impl EKEventViewController {
151    extern_methods!(
152        #[unsafe(method(init))]
153        #[unsafe(method_family = init)]
154        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
155
156        #[unsafe(method(new))]
157        #[unsafe(method_family = new)]
158        pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
159    );
160}
161
162extern_protocol!(
163    /// View controller to view event detail.
164    ///
165    /// You can use this view controller to display the details of an event. You
166    /// can also optionally choose to allow the user to edit the event by displaying
167    /// an edit button. While you can use this view controller to display events that
168    /// have not been saved, the edit button will not appear in this situation. If
169    /// you have pushed this view controller onto a navigation controller stack, and
170    /// the underlying event gets deleted, this controller will remove itself from
171    /// the stack and clear its event property.
172    ///
173    /// See also [Apple's documentation](https://developer.apple.com/documentation/eventkitui/ekeventviewdelegate?language=objc)
174    pub unsafe trait EKEventViewDelegate: NSObjectProtocol {
175        #[cfg(feature = "objc2-ui-kit")]
176        /// Called to let delegate know that an action has occurred that should cause the
177        /// controller to be dismissed.
178        ///
179        /// If the user taps a button which deletes the event, or responds to an invite, this
180        /// method is called on the delegate so that the delegate can decide to dismiss
181        /// the view controller. When presented in a popover, it also reports when the Done
182        /// button is pressed.
183        ///
184        ///
185        /// Parameter `controller`: the controller in question
186        ///
187        /// Parameter `action`: the action that is triggering the dismissal
188        #[unsafe(method(eventViewController:didCompleteWithAction:))]
189        #[unsafe(method_family = none)]
190        unsafe fn eventViewController_didCompleteWithAction(
191            &self,
192            controller: &EKEventViewController,
193            action: EKEventViewAction,
194        );
195    }
196);