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