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