objc2_event_kit/generated/EKCalendar.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-app-kit")]
7#[cfg(target_os = "macos")]
8use objc2_app_kit::*;
9#[cfg(feature = "objc2-core-graphics")]
10use objc2_core_graphics::*;
11use objc2_foundation::*;
12
13use crate::*;
14
15extern_class!(
16 /// The EKCalendar class represents a calendar for events.
17 ///
18 /// See also [Apple's documentation](https://developer.apple.com/documentation/eventkit/ekcalendar?language=objc)
19 #[unsafe(super(EKObject, NSObject))]
20 #[derive(Debug, PartialEq, Eq, Hash)]
21 #[cfg(feature = "EKObject")]
22 pub struct EKCalendar;
23);
24
25#[cfg(feature = "EKObject")]
26extern_conformance!(
27 unsafe impl NSObjectProtocol for EKCalendar {}
28);
29
30#[cfg(feature = "EKObject")]
31impl EKCalendar {
32 extern_methods!(
33 #[cfg(feature = "EKEventStore")]
34 #[unsafe(method(calendarWithEventStore:))]
35 #[unsafe(method_family = none)]
36 pub unsafe fn calendarWithEventStore(event_store: &EKEventStore) -> Retained<EKCalendar>;
37
38 #[cfg(all(feature = "EKEventStore", feature = "EKTypes"))]
39 /// Creates a new autoreleased calendar that may contain the given entity type.
40 ///
41 /// You can only create calendars that accept either reminders or events via our API.
42 /// However, other servers might allow mixing the two (though it is not common).
43 ///
44 ///
45 /// Parameter `entityType`: The entity type that this calendar may support.
46 ///
47 /// Parameter `eventStore`: The event store in which to create this calendar.
48 #[unsafe(method(calendarForEntityType:eventStore:))]
49 #[unsafe(method_family = none)]
50 pub unsafe fn calendarForEntityType_eventStore(
51 entity_type: EKEntityType,
52 event_store: &EKEventStore,
53 ) -> Retained<EKCalendar>;
54
55 #[cfg(feature = "EKSource")]
56 /// The source representing the 'account' this calendar belongs to.
57 /// This is only settable when initially creating a calendar and then
58 /// effectively read-only after that. That is, you can create a calendar,
59 /// but you cannot move it to another source.
60 ///
61 /// This will be nil for new calendars until you set it.
62 #[unsafe(method(source))]
63 #[unsafe(method_family = none)]
64 pub unsafe fn source(&self) -> Option<Retained<EKSource>>;
65
66 #[cfg(feature = "EKSource")]
67 /// Setter for [`source`][Self::source].
68 ///
69 /// # Safety
70 ///
71 /// `source` might not allow `None`.
72 #[unsafe(method(setSource:))]
73 #[unsafe(method_family = none)]
74 pub unsafe fn setSource(&self, source: Option<&EKSource>);
75
76 /// A unique identifier for the calendar. It is not sync-proof in that a full
77 /// sync will lose this identifier, so you should always have a back up plan for dealing
78 /// with a calendar that is no longer fetchable by this property, e.g. by title, type, color, etc.
79 /// Use [EKEventStore calendarWithIdentifier:] to look up the calendar by this value.
80 #[unsafe(method(calendarIdentifier))]
81 #[unsafe(method_family = none)]
82 pub unsafe fn calendarIdentifier(&self) -> Retained<NSString>;
83
84 /// The title of the calendar.
85 #[unsafe(method(title))]
86 #[unsafe(method_family = none)]
87 pub unsafe fn title(&self) -> Retained<NSString>;
88
89 /// Setter for [`title`][Self::title].
90 ///
91 /// This is [copied][objc2_foundation::NSCopying::copy] when set.
92 #[unsafe(method(setTitle:))]
93 #[unsafe(method_family = none)]
94 pub unsafe fn setTitle(&self, title: &NSString);
95
96 #[cfg(feature = "EKTypes")]
97 /// The type of the calendar as a EKCalendarType. This is actually based on
98 /// what source the calendar is in, as well as whether it is a subscribed calendar.
99 ///
100 /// CalDAV subscribed calendars have type EKCalendarTypeCalDAV with isSubscribed = YES.
101 #[unsafe(method(type))]
102 #[unsafe(method_family = none)]
103 pub unsafe fn r#type(&self) -> EKCalendarType;
104
105 /// Represents whether you can this add, remove, or modify items in this calendar.
106 #[unsafe(method(allowsContentModifications))]
107 #[unsafe(method_family = none)]
108 pub unsafe fn allowsContentModifications(&self) -> bool;
109
110 /// YES if this calendar is a subscribed calendar.
111 #[unsafe(method(isSubscribed))]
112 #[unsafe(method_family = none)]
113 pub unsafe fn isSubscribed(&self) -> bool;
114
115 /// If this is set to YES, it means you cannot modify any attributes of
116 /// the calendar or delete it. It does NOT imply that you cannot add events
117 /// or reminders to the calendar.
118 #[unsafe(method(isImmutable))]
119 #[unsafe(method_family = none)]
120 pub unsafe fn isImmutable(&self) -> bool;
121
122 #[cfg(feature = "objc2-core-graphics")]
123 /// Returns the calendar color as a CGColorRef.
124 ///
125 /// This will be nil for new calendars until you set it.
126 #[unsafe(method(CGColor))]
127 #[unsafe(method_family = none)]
128 pub unsafe fn CGColor(&self) -> Option<Retained<CGColor>>;
129
130 #[cfg(feature = "objc2-core-graphics")]
131 /// Setter for [`CGColor`][Self::CGColor].
132 ///
133 /// # Safety
134 ///
135 /// `cg_color` might not allow `None`.
136 #[unsafe(method(setCGColor:))]
137 #[unsafe(method_family = none)]
138 pub unsafe fn setCGColor(&self, cg_color: Option<&CGColor>);
139
140 #[cfg(feature = "objc2-app-kit")]
141 #[cfg(target_os = "macos")]
142 /// Returns the calendar color as a NSColor.
143 ///
144 /// This will be nil for new calendars until you set it.
145 #[unsafe(method(color))]
146 #[unsafe(method_family = none)]
147 pub unsafe fn color(&self) -> Retained<NSColor>;
148
149 #[cfg(feature = "objc2-app-kit")]
150 #[cfg(target_os = "macos")]
151 /// Setter for [`color`][Self::color].
152 ///
153 /// This is [copied][objc2_foundation::NSCopying::copy] when set.
154 #[unsafe(method(setColor:))]
155 #[unsafe(method_family = none)]
156 pub unsafe fn setColor(&self, color: Option<&NSColor>);
157
158 #[cfg(feature = "EKTypes")]
159 /// Returns a bitfield of supported event availabilities, or EKCalendarEventAvailabilityNone
160 /// if this calendar does not support setting availability on an event.
161 #[unsafe(method(supportedEventAvailabilities))]
162 #[unsafe(method_family = none)]
163 pub unsafe fn supportedEventAvailabilities(&self) -> EKCalendarEventAvailabilityMask;
164
165 #[cfg(feature = "EKTypes")]
166 #[unsafe(method(allowedEntityTypes))]
167 #[unsafe(method_family = none)]
168 pub unsafe fn allowedEntityTypes(&self) -> EKEntityMask;
169 );
170}
171
172/// Methods declared on superclass `NSObject`.
173#[cfg(feature = "EKObject")]
174impl EKCalendar {
175 extern_methods!(
176 #[unsafe(method(init))]
177 #[unsafe(method_family = init)]
178 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
179
180 #[unsafe(method(new))]
181 #[unsafe(method_family = new)]
182 pub unsafe fn new() -> Retained<Self>;
183 );
184}