1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use core::ffi::*;
use core::ptr::NonNull;
use objc2::__framework_prelude::*;
#[cfg(feature = "objc2-core-foundation")]
use objc2_core_foundation::*;
use objc2_foundation::*;
#[cfg(feature = "objc2-quartz-core")]
#[cfg(not(target_os = "watchos"))]
use objc2_quartz_core::*;
use crate::*;
extern_class!(
/// [Apple's documentation](https://developer.apple.com/documentation/uikit/uicalendarview?language=objc)
#[unsafe(super(UIView, UIResponder, NSObject))]
#[thread_kind = MainThreadOnly]
#[derive(Debug, PartialEq, Eq, Hash)]
#[cfg(all(feature = "UIResponder", feature = "UIView"))]
pub struct UICalendarView;
);
#[cfg(all(
feature = "UIResponder",
feature = "UIView",
feature = "objc2-quartz-core"
))]
#[cfg(not(target_os = "watchos"))]
extern_conformance!(
unsafe impl CALayerDelegate for UICalendarView {}
);
#[cfg(all(feature = "UIResponder", feature = "UIView"))]
extern_conformance!(
unsafe impl NSCoding for UICalendarView {}
);
#[cfg(all(feature = "UIResponder", feature = "UIView"))]
extern_conformance!(
unsafe impl NSObjectProtocol for UICalendarView {}
);
#[cfg(all(feature = "UIAppearance", feature = "UIResponder", feature = "UIView"))]
extern_conformance!(
unsafe impl UIAppearance for UICalendarView {}
);
#[cfg(all(feature = "UIAppearance", feature = "UIResponder", feature = "UIView"))]
extern_conformance!(
unsafe impl UIAppearanceContainer for UICalendarView {}
);
#[cfg(all(feature = "UIResponder", feature = "UIView"))]
extern_conformance!(
unsafe impl UICoordinateSpace for UICalendarView {}
);
#[cfg(all(
feature = "UIDynamicBehavior",
feature = "UIResponder",
feature = "UIView"
))]
extern_conformance!(
unsafe impl UIDynamicItem for UICalendarView {}
);
#[cfg(all(feature = "UIFocus", feature = "UIResponder", feature = "UIView"))]
extern_conformance!(
unsafe impl UIFocusEnvironment for UICalendarView {}
);
#[cfg(all(feature = "UIFocus", feature = "UIResponder", feature = "UIView"))]
extern_conformance!(
unsafe impl UIFocusItem for UICalendarView {}
);
#[cfg(all(feature = "UIFocus", feature = "UIResponder", feature = "UIView"))]
extern_conformance!(
unsafe impl UIFocusItemContainer for UICalendarView {}
);
#[cfg(all(feature = "UIResponder", feature = "UIView"))]
extern_conformance!(
unsafe impl UIResponderStandardEditActions for UICalendarView {}
);
#[cfg(all(
feature = "UIResponder",
feature = "UITraitCollection",
feature = "UIView"
))]
extern_conformance!(
unsafe impl UITraitEnvironment for UICalendarView {}
);
#[cfg(all(feature = "UIResponder", feature = "UIView"))]
impl UICalendarView {
extern_methods!(
/// The object that defines the delegate of the calendar view.
#[unsafe(method(delegate))]
#[unsafe(method_family = none)]
pub fn delegate(&self) -> Option<Retained<ProtocolObject<dyn UICalendarViewDelegate>>>;
/// Setter for [`delegate`][Self::delegate].
///
/// This is a [weak property][objc2::topics::weak_property].
#[unsafe(method(setDelegate:))]
#[unsafe(method_family = none)]
pub fn setDelegate(&self, delegate: Option<&ProtocolObject<dyn UICalendarViewDelegate>>);
#[cfg(feature = "UICalendarSelection")]
/// The object that defines the selection behavior of the calendar view.
#[unsafe(method(selectionBehavior))]
#[unsafe(method_family = none)]
pub fn selectionBehavior(&self) -> Option<Retained<UICalendarSelection>>;
#[cfg(feature = "UICalendarSelection")]
/// Setter for [`selectionBehavior`][Self::selectionBehavior].
#[unsafe(method(setSelectionBehavior:))]
#[unsafe(method_family = none)]
pub fn setSelectionBehavior(&self, selection_behavior: Option<&UICalendarSelection>);
/// The backing locale of the calendar view. The default value is
/// `NSLocale.currentLocale`
#[unsafe(method(locale))]
#[unsafe(method_family = none)]
pub fn locale(&self) -> Retained<NSLocale>;
/// Setter for [`locale`][Self::locale].
#[unsafe(method(setLocale:))]
#[unsafe(method_family = none)]
pub fn setLocale(&self, locale: &NSLocale);
/// The backing calendar of the calendar view. The default value is
/// `NSCalendar.currentCalendar`
#[unsafe(method(calendar))]
#[unsafe(method_family = none)]
pub fn calendar(&self) -> Retained<NSCalendar>;
/// Setter for [`calendar`][Self::calendar].
///
/// This is [copied][objc2_foundation::NSCopying::copy] when set.
#[unsafe(method(setCalendar:))]
#[unsafe(method_family = none)]
pub fn setCalendar(&self, calendar: &NSCalendar);
/// The backing time zone of the calendar view. Default is nil
#[unsafe(method(timeZone))]
#[unsafe(method_family = none)]
pub fn timeZone(&self) -> Option<Retained<NSTimeZone>>;
/// Setter for [`timeZone`][Self::timeZone].
#[unsafe(method(setTimeZone:))]
#[unsafe(method_family = none)]
pub fn setTimeZone(&self, time_zone: Option<&NSTimeZone>);
#[cfg(feature = "UIFontDescriptor")]
/// The font design of the calendar view. The default value is
/// `UIFontDescriptorSystemDesignDefault`
#[unsafe(method(fontDesign))]
#[unsafe(method_family = none)]
pub fn fontDesign(&self) -> Retained<UIFontDescriptorSystemDesign>;
#[cfg(feature = "UIFontDescriptor")]
/// Setter for [`fontDesign`][Self::fontDesign].
///
/// This is [copied][objc2_foundation::NSCopying::copy] when set.
#[unsafe(method(setFontDesign:))]
#[unsafe(method_family = none)]
pub fn setFontDesign(&self, font_design: &UIFontDescriptorSystemDesign);
/// The available date range of the calendar view. The default is a date interval from
/// `NSDate.distantPast`to
/// `NSDate.distantFuture`
#[unsafe(method(availableDateRange))]
#[unsafe(method_family = none)]
pub fn availableDateRange(&self) -> Retained<NSDateInterval>;
/// Setter for [`availableDateRange`][Self::availableDateRange].
///
/// This is [copied][objc2_foundation::NSCopying::copy] when set.
#[unsafe(method(setAvailableDateRange:))]
#[unsafe(method_family = none)]
pub fn setAvailableDateRange(&self, available_date_range: &NSDateInterval);
/// The date components representing the current visible date of the calendar view. The default value is the
/// NSDateComponents representation of the current date given the granularity of the displayed component.
/// The
/// `visibleDateComponents`must also be a valid date within
/// `availableDateRange`
///
/// Note: If
/// `visibleDateComponents.calendar`and
/// `UICalendarView.calendar`are not equal,the input date components
/// will be converted to use
/// `UICalendarView.calendar`upon assignment. UICalendarView will use
/// `UICalendarView.calendar`if
/// `visibleDateComponents.calendar`is not explicitly marked, and may result
/// in incorrect dates if the dateComponents is not valid in
/// `UICalendarView.calendar.`
#[unsafe(method(visibleDateComponents))]
#[unsafe(method_family = none)]
pub fn visibleDateComponents(&self) -> Retained<NSDateComponents>;
/// Setter for [`visibleDateComponents`][Self::visibleDateComponents].
///
/// This is [copied][objc2_foundation::NSCopying::copy] when set.
#[unsafe(method(setVisibleDateComponents:))]
#[unsafe(method_family = none)]
pub fn setVisibleDateComponents(&self, visible_date_components: &NSDateComponents);
/// Sets the visible date components of the calendar view, with an option to animate the setting.
/// The
/// `visibleDateComponents`must also be a valid date within
/// `availableDateRange`
///
/// Note: If
/// `visibleDateComponents.calendar`and
/// `UICalendarView.calendar`are not equal,the input date components
/// will be converted to use
/// `UICalendarView.calendar`upon assignment. UICalendarView will use
/// `UICalendarView.calendar`if
/// `visibleDateComponents.calendar`is not explicitly marked, and may result
/// in incorrect dates if the dateComponents is not valid in
/// `UICalendarView.calendar.`
#[unsafe(method(setVisibleDateComponents:animated:))]
#[unsafe(method_family = none)]
pub fn setVisibleDateComponents_animated(
&self,
date_components: &NSDateComponents,
animated: bool,
);
/// Determines if we show date decorations. By default, this value returns
/// `YES,`but you must also implement
/// the delegate method
/// `calendarView:decorationForDate:`to show decorations.
#[unsafe(method(wantsDateDecorations))]
#[unsafe(method_family = none)]
pub fn wantsDateDecorations(&self) -> bool;
/// Setter for [`wantsDateDecorations`][Self::wantsDateDecorations].
#[unsafe(method(setWantsDateDecorations:))]
#[unsafe(method_family = none)]
pub fn setWantsDateDecorations(&self, wants_date_decorations: bool);
/// Reloads the decorations for the specified dates, with an option to animate the action.
/// Decorations are only available if you implement the delegate method
/// `calendarView:decorationForDate:`
#[unsafe(method(reloadDecorationsForDateComponents:animated:))]
#[unsafe(method_family = none)]
pub fn reloadDecorationsForDateComponents_animated(
&self,
dates: &NSArray<NSDateComponents>,
animated: bool,
);
);
}
/// Methods declared on superclass `UIView`.
#[cfg(all(feature = "UIResponder", feature = "UIView"))]
impl UICalendarView {
extern_methods!(
#[cfg(feature = "objc2-core-foundation")]
#[unsafe(method(initWithFrame:))]
#[unsafe(method_family = init)]
pub fn initWithFrame(this: Allocated<Self>, frame: CGRect) -> Retained<Self>;
/// # Safety
///
/// `coder` possibly has further requirements.
#[unsafe(method(initWithCoder:))]
#[unsafe(method_family = init)]
pub unsafe fn initWithCoder(
this: Allocated<Self>,
coder: &NSCoder,
) -> Option<Retained<Self>>;
#[unsafe(method(init))]
#[unsafe(method_family = init)]
pub fn init(this: Allocated<Self>) -> Retained<Self>;
);
}
/// Methods declared on superclass `NSObject`.
#[cfg(all(feature = "UIResponder", feature = "UIView"))]
impl UICalendarView {
extern_methods!(
#[unsafe(method(new))]
#[unsafe(method_family = new)]
pub fn new(mtm: MainThreadMarker) -> Retained<Self>;
);
}
extern_protocol!(
/// [Apple's documentation](https://developer.apple.com/documentation/uikit/uicalendarviewdelegate?language=objc)
pub unsafe trait UICalendarViewDelegate: NSObjectProtocol + MainThreadOnly {
#[cfg(all(
feature = "UICalendarViewDecoration",
feature = "UIResponder",
feature = "UIView"
))]
/// Called when the calendar view is preparing decorations.
///
///
/// Parameter `calendarView`: The
/// `UICalendarView`
/// Parameter `dateComponents`: The date for which the decoration is prepared for.
///
///
/// Returns: A
/// `UICalendarViewDecoration`to annotate the specific date. Return
/// `nil`for no decoration.
#[optional]
#[unsafe(method(calendarView:decorationForDateComponents:))]
#[unsafe(method_family = none)]
fn calendarView_decorationForDateComponents(
&self,
calendar_view: &UICalendarView,
date_components: &NSDateComponents,
) -> Option<Retained<UICalendarViewDecoration>>;
#[cfg(all(feature = "UIResponder", feature = "UIView"))]
/// Called when the visible date has changed from
/// `previousDateComponents`from user interaction.
///
///
/// Parameter `calendarView`: The
/// `UICalendarView`
/// Parameter `previousDateComponents`: The previous date components before the visible date components changed.
#[optional]
#[unsafe(method(calendarView:didChangeVisibleDateComponentsFrom:))]
#[unsafe(method_family = none)]
fn calendarView_didChangeVisibleDateComponentsFrom(
&self,
calendar_view: &UICalendarView,
previous_date_components: &NSDateComponents,
);
}
);