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