objc2_event_kit/generated/
EKAlarm.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
10extern_class!(
11    /// The EKAlarm class provides an interface for accessing and manipulating calendar event alarms.
12    ///
13    /// The EKAlarm class represents alarms on an event. An alarm can be relative (e.g. 15 mins before)
14    /// or absolute (specific time).
15    ///
16    /// See also [Apple's documentation](https://developer.apple.com/documentation/eventkit/ekalarm?language=objc)
17    #[unsafe(super(EKObject, NSObject))]
18    #[derive(Debug, PartialEq, Eq, Hash)]
19    #[cfg(feature = "EKObject")]
20    pub struct EKAlarm;
21);
22
23#[cfg(feature = "EKObject")]
24extern_conformance!(
25    unsafe impl NSCopying for EKAlarm {}
26);
27
28#[cfg(feature = "EKObject")]
29unsafe impl CopyingHelper for EKAlarm {
30    type Result = Self;
31}
32
33#[cfg(feature = "EKObject")]
34extern_conformance!(
35    unsafe impl NSObjectProtocol for EKAlarm {}
36);
37
38#[cfg(feature = "EKObject")]
39impl EKAlarm {
40    extern_methods!(
41        /// Creates a new autoreleased alarm with an absolute trigger time.
42        ///
43        /// Parameter `date`: The date the alarm should fire.
44        #[unsafe(method(alarmWithAbsoluteDate:))]
45        #[unsafe(method_family = none)]
46        pub unsafe fn alarmWithAbsoluteDate(date: &NSDate) -> Retained<EKAlarm>;
47
48        /// Creates a new autoreleased alarm with a relative trigger time.
49        ///
50        /// Creates a new autoreleased alarm with a relative trigger time. This offset
51        /// is added to the start date of the event.
52        ///
53        ///
54        /// Parameter `offset`: The offset from the event start that the alarm should fire.
55        #[unsafe(method(alarmWithRelativeOffset:))]
56        #[unsafe(method_family = none)]
57        pub unsafe fn alarmWithRelativeOffset(offset: NSTimeInterval) -> Retained<EKAlarm>;
58
59        /// Specifies a relative offset from an event start date to fire an alarm.
60        ///
61        /// Set this property to an appropriate negative value to establish an alarm trigger
62        /// relative to the start date/time of an event. Setting this clears any existing
63        /// date trigger.
64        #[unsafe(method(relativeOffset))]
65        #[unsafe(method_family = none)]
66        pub unsafe fn relativeOffset(&self) -> NSTimeInterval;
67
68        /// Setter for [`relativeOffset`][Self::relativeOffset].
69        #[unsafe(method(setRelativeOffset:))]
70        #[unsafe(method_family = none)]
71        pub unsafe fn setRelativeOffset(&self, relative_offset: NSTimeInterval);
72
73        /// Represents an alarm that fires at a specific date.
74        ///
75        /// Set this property to a date to establish an absolute alarm trigger. Setting this
76        /// clears any relative interval trigger.
77        #[unsafe(method(absoluteDate))]
78        #[unsafe(method_family = none)]
79        pub unsafe fn absoluteDate(&self) -> Option<Retained<NSDate>>;
80
81        /// Setter for [`absoluteDate`][Self::absoluteDate].
82        ///
83        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
84        #[unsafe(method(setAbsoluteDate:))]
85        #[unsafe(method_family = none)]
86        pub unsafe fn setAbsoluteDate(&self, absolute_date: Option<&NSDate>);
87
88        #[cfg(feature = "EKStructuredLocation")]
89        /// Allows you to set a structured location (a location with a potential geo-coordinate)
90        /// on an alarm. This is used in conjunction with proximity to do geofence-based
91        /// triggering of reminders.
92        #[unsafe(method(structuredLocation))]
93        #[unsafe(method_family = none)]
94        pub unsafe fn structuredLocation(&self) -> Option<Retained<EKStructuredLocation>>;
95
96        #[cfg(feature = "EKStructuredLocation")]
97        /// Setter for [`structuredLocation`][Self::structuredLocation].
98        ///
99        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
100        #[unsafe(method(setStructuredLocation:))]
101        #[unsafe(method_family = none)]
102        pub unsafe fn setStructuredLocation(
103            &self,
104            structured_location: Option<&EKStructuredLocation>,
105        );
106
107        #[cfg(feature = "EKTypes")]
108        /// Defines whether this alarm triggers via entering/exiting a geofence as defined by
109        /// structuredLocation.
110        #[unsafe(method(proximity))]
111        #[unsafe(method_family = none)]
112        pub unsafe fn proximity(&self) -> EKAlarmProximity;
113
114        #[cfg(feature = "EKTypes")]
115        /// Setter for [`proximity`][Self::proximity].
116        #[unsafe(method(setProximity:))]
117        #[unsafe(method_family = none)]
118        pub unsafe fn setProximity(&self, proximity: EKAlarmProximity);
119
120        #[cfg(feature = "EKTypes")]
121        /// The type of alarm, based on the action taken when triggering the alarm.
122        ///
123        /// This field is read-only; to change the type of alarm, set emailAddress for EKAlarmTypeEmail,
124        /// soundName for EKAlarmTypeAudio or url for EKAlarmTypeProcedure.
125        /// Setting all of those to nil will change it to EKAlarmTypeDisplay.
126        #[unsafe(method(type))]
127        #[unsafe(method_family = none)]
128        pub unsafe fn r#type(&self) -> EKAlarmType;
129
130        /// An email address that is the recipient of an email alarm, which is an alarm that triggers an email message.
131        ///
132        /// When you set the emailAddress property, the action property is set to EKAlarmTypeEmail,
133        /// and the soundName and url properties are set to nil.
134        #[unsafe(method(emailAddress))]
135        #[unsafe(method_family = none)]
136        pub unsafe fn emailAddress(&self) -> Option<Retained<NSString>>;
137
138        /// Setter for [`emailAddress`][Self::emailAddress].
139        ///
140        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
141        #[unsafe(method(setEmailAddress:))]
142        #[unsafe(method_family = none)]
143        pub unsafe fn setEmailAddress(&self, email_address: Option<&NSString>);
144
145        /// The name of the sound to play when the alarm triggers.
146        ///
147        /// The value of this property is the name of a system sound that can be used with
148        /// the soundNamed: class method to create an NSSound object. When you set the soundName property,
149        /// the action property is set to EKAlarmTypeAudio, and the emailAddress and url properties are set to nil.
150        #[unsafe(method(soundName))]
151        #[unsafe(method_family = none)]
152        pub unsafe fn soundName(&self) -> Option<Retained<NSString>>;
153
154        /// Setter for [`soundName`][Self::soundName].
155        ///
156        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
157        #[unsafe(method(setSoundName:))]
158        #[unsafe(method_family = none)]
159        pub unsafe fn setSoundName(&self, sound_name: Option<&NSString>);
160
161        /// The URL to open when the alarm triggers.
162        ///
163        /// When you set the url property, the action property is set to EKAlarmTypeProcedure,
164        /// and the emailAddress and soundName properties are set to nil.
165        /// Note: Starting with OS X 10.9, it is not possible to create new procedure alarms or view URLs for existing procedure alarms.
166        /// Trying to save or modify a procedure alarm will result in a save error.
167        /// Editing other aspects of events or reminders that have existing procedure alarms is allowed as long as the alarm isn't modified.
168        #[deprecated]
169        #[unsafe(method(url))]
170        #[unsafe(method_family = none)]
171        pub unsafe fn url(&self) -> Option<Retained<NSURL>>;
172
173        /// Setter for [`url`][Self::url].
174        ///
175        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
176        #[deprecated]
177        #[unsafe(method(setUrl:))]
178        #[unsafe(method_family = none)]
179        pub unsafe fn setUrl(&self, url: Option<&NSURL>);
180    );
181}
182
183/// Methods declared on superclass `NSObject`.
184#[cfg(feature = "EKObject")]
185impl EKAlarm {
186    extern_methods!(
187        #[unsafe(method(init))]
188        #[unsafe(method_family = init)]
189        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
190
191        #[unsafe(method(new))]
192        #[unsafe(method_family = new)]
193        pub unsafe fn new() -> Retained<Self>;
194    );
195}