objc2_ui_kit/generated/
UICalendarSelectionWeekOfYear.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/uicalendarselectionweekofyear?language=objc)
12    #[unsafe(super(UICalendarSelection, NSObject))]
13    #[thread_kind = MainThreadOnly]
14    #[derive(Debug, PartialEq, Eq, Hash)]
15    #[cfg(feature = "UICalendarSelection")]
16    pub struct UICalendarSelectionWeekOfYear;
17);
18
19#[cfg(feature = "UICalendarSelection")]
20unsafe impl NSObjectProtocol for UICalendarSelectionWeekOfYear {}
21
22#[cfg(feature = "UICalendarSelection")]
23impl UICalendarSelectionWeekOfYear {
24    extern_methods!(
25        /// The currently selected week of year in the Calendar view. The components must include `[.yearForWeekOfYear, .weekOfYear]`.
26        #[unsafe(method(selectedWeekOfYear))]
27        #[unsafe(method_family = none)]
28        pub unsafe fn selectedWeekOfYear(&self) -> Option<Retained<NSDateComponents>>;
29
30        /// Setter for [`selectedWeekOfYear`][Self::selectedWeekOfYear].
31        #[unsafe(method(setSelectedWeekOfYear:))]
32        #[unsafe(method_family = none)]
33        pub unsafe fn setSelectedWeekOfYear(
34            &self,
35            selected_week_of_year: Option<&NSDateComponents>,
36        );
37
38        /// Sets the dates to display in the calendar, with an option to animate the setting.
39        #[unsafe(method(setSelectedWeekOfYear:animated:))]
40        #[unsafe(method_family = none)]
41        pub unsafe fn setSelectedWeekOfYear_animated(
42            &self,
43            selected_week_of_year: Option<&NSDateComponents>,
44            animated: bool,
45        );
46
47        /// The object that acts as the delegate of the calendar view selection
48        #[unsafe(method(delegate))]
49        #[unsafe(method_family = none)]
50        pub unsafe fn delegate(
51            &self,
52        ) -> Option<Retained<ProtocolObject<dyn UICalendarSelectionWeekOfYearDelegate>>>;
53
54        /// Creates a new multi-date selection with the specified delegate.
55        #[unsafe(method(initWithDelegate:))]
56        #[unsafe(method_family = init)]
57        pub unsafe fn initWithDelegate(
58            this: Allocated<Self>,
59            delegate: Option<&ProtocolObject<dyn UICalendarSelectionWeekOfYearDelegate>>,
60        ) -> Retained<Self>;
61    );
62}
63
64/// Methods declared on superclass `UICalendarSelection`.
65#[cfg(feature = "UICalendarSelection")]
66impl UICalendarSelectionWeekOfYear {
67    extern_methods!(
68        #[unsafe(method(init))]
69        #[unsafe(method_family = init)]
70        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
71
72        #[unsafe(method(new))]
73        #[unsafe(method_family = new)]
74        pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
75    );
76}
77
78extern_protocol!(
79    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uicalendarselectionweekofyeardelegate?language=objc)
80    pub unsafe trait UICalendarSelectionWeekOfYearDelegate: NSObjectProtocol {
81        #[cfg(feature = "UICalendarSelection")]
82        /// Called after the user selects a week of year in the calendar view.
83        ///
84        ///
85        /// Parameter `selection`: The
86        /// `UICalendarSelectionWeekOfYear`
87        /// Parameter `dateComponents`: The date that was selected by the user.
88        #[unsafe(method(weekOfYearSelection:didSelectWeekOfYear:))]
89        #[unsafe(method_family = none)]
90        unsafe fn weekOfYearSelection_didSelectWeekOfYear(
91            &self,
92            selection: &UICalendarSelectionWeekOfYear,
93            week_of_year_components: Option<&NSDateComponents>,
94        );
95
96        #[cfg(feature = "UICalendarSelection")]
97        /// Determines if a week of year is selectable. Dates that are not selectable will be disabled in the calendar view.
98        ///
99        ///
100        /// Parameter `selection`: The
101        /// `UICalendarSelectionWeekOfYear`
102        /// Parameter `dateComponents`: The date to be checked by selection.
103        ///
104        ///
105        /// Returns: YES if the date can be selected, NO otherwise.
106        #[optional]
107        #[unsafe(method(weekOfYearSelection:canSelectWeekOfYear:))]
108        #[unsafe(method_family = none)]
109        unsafe fn weekOfYearSelection_canSelectWeekOfYear(
110            &self,
111            selection: &UICalendarSelectionWeekOfYear,
112            week_of_year_components: Option<&NSDateComponents>,
113        ) -> bool;
114    }
115);