objc2_ui_kit/generated/
UICalendarSelectionMultiDate.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    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uicalendarselectionmultidate?language=objc)
12    #[unsafe(super(UICalendarSelection, NSObject))]
13    #[thread_kind = MainThreadOnly]
14    #[derive(Debug, PartialEq, Eq, Hash)]
15    #[cfg(feature = "UICalendarSelection")]
16    pub struct UICalendarSelectionMultiDate;
17);
18
19#[cfg(feature = "UICalendarSelection")]
20extern_conformance!(
21    unsafe impl NSObjectProtocol for UICalendarSelectionMultiDate {}
22);
23
24#[cfg(feature = "UICalendarSelection")]
25impl UICalendarSelectionMultiDate {
26    extern_methods!(
27        /// The currently selected dates in the Calendar view.
28        #[unsafe(method(selectedDates))]
29        #[unsafe(method_family = none)]
30        pub fn selectedDates(&self) -> Retained<NSArray<NSDateComponents>>;
31
32        /// Setter for [`selectedDates`][Self::selectedDates].
33        ///
34        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
35        #[unsafe(method(setSelectedDates:))]
36        #[unsafe(method_family = none)]
37        pub fn setSelectedDates(&self, selected_dates: &NSArray<NSDateComponents>);
38
39        /// Sets the dates to display in the calendar, with an option to animate the setting.
40        #[unsafe(method(setSelectedDates:animated:))]
41        #[unsafe(method_family = none)]
42        pub fn setSelectedDates_animated(
43            &self,
44            selected_dates: &NSArray<NSDateComponents>,
45            animated: bool,
46        );
47
48        /// The object that acts as the delegate of the calendar view selection
49        #[unsafe(method(delegate))]
50        #[unsafe(method_family = none)]
51        pub fn delegate(
52            &self,
53        ) -> Option<Retained<ProtocolObject<dyn UICalendarSelectionMultiDateDelegate>>>;
54
55        /// Creates a new multi-date selection with the specified delegate.
56        #[unsafe(method(initWithDelegate:))]
57        #[unsafe(method_family = init)]
58        pub fn initWithDelegate(
59            this: Allocated<Self>,
60            delegate: Option<&ProtocolObject<dyn UICalendarSelectionMultiDateDelegate>>,
61        ) -> Retained<Self>;
62    );
63}
64
65/// Methods declared on superclass `UICalendarSelection`.
66#[cfg(feature = "UICalendarSelection")]
67impl UICalendarSelectionMultiDate {
68    extern_methods!(
69        #[unsafe(method(init))]
70        #[unsafe(method_family = init)]
71        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
72
73        #[unsafe(method(new))]
74        #[unsafe(method_family = new)]
75        pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
76    );
77}
78
79extern_protocol!(
80    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uicalendarselectionmultidatedelegate?language=objc)
81    pub unsafe trait UICalendarSelectionMultiDateDelegate:
82        NSObjectProtocol + MainThreadOnly
83    {
84        #[cfg(feature = "UICalendarSelection")]
85        /// Called after the user selects a date in the calendar view.
86        ///
87        ///
88        /// Parameter `selection`: The
89        /// `UICalendarSelectionMultiDate`
90        /// Parameter `dateComponents`: The date that was selected by the user.
91        #[unsafe(method(multiDateSelection:didSelectDate:))]
92        #[unsafe(method_family = none)]
93        fn multiDateSelection_didSelectDate(
94            &self,
95            selection: &UICalendarSelectionMultiDate,
96            date_components: &NSDateComponents,
97        );
98
99        #[cfg(feature = "UICalendarSelection")]
100        /// Called after the user removes selection from one of hte selected dates the calendar view.
101        ///
102        ///
103        /// Parameter `selection`: The
104        /// `UICalendarSelectionMultiDate`
105        /// Parameter `dateComponents`: The date that was deselected by the user.
106        #[unsafe(method(multiDateSelection:didDeselectDate:))]
107        #[unsafe(method_family = none)]
108        fn multiDateSelection_didDeselectDate(
109            &self,
110            selection: &UICalendarSelectionMultiDate,
111            date_components: &NSDateComponents,
112        );
113
114        #[cfg(feature = "UICalendarSelection")]
115        /// Determines if a date is selectable. Dates that are not selectable will be disabled in the calendar view.
116        ///
117        ///
118        /// Parameter `selection`: The
119        /// `UICalendarSelectionMultiDate`
120        /// Parameter `dateComponents`: The date to be checked by selection.
121        ///
122        ///
123        /// Returns: YES if the date can be selected, NO otherwise.
124        #[optional]
125        #[unsafe(method(multiDateSelection:canSelectDate:))]
126        #[unsafe(method_family = none)]
127        fn multiDateSelection_canSelectDate(
128            &self,
129            selection: &UICalendarSelectionMultiDate,
130            date_components: &NSDateComponents,
131        ) -> bool;
132
133        #[cfg(feature = "UICalendarSelection")]
134        /// Determines if a date can be deselected.
135        ///
136        ///
137        /// Parameter `selection`: The
138        /// `UICalendarSelectionMultiDate`
139        /// Parameter `dateComponents`: The date to be checked by selection.
140        ///
141        ///
142        /// Returns: YES if the date can be deselected, NO otherwise.
143        #[optional]
144        #[unsafe(method(multiDateSelection:canDeselectDate:))]
145        #[unsafe(method_family = none)]
146        fn multiDateSelection_canDeselectDate(
147            &self,
148            selection: &UICalendarSelectionMultiDate,
149            date_components: &NSDateComponents,
150        ) -> bool;
151    }
152);