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")]
20extern_conformance!(
21    unsafe impl NSObjectProtocol for UICalendarSelectionWeekOfYear {}
22);
23
24#[cfg(feature = "UICalendarSelection")]
25impl UICalendarSelectionWeekOfYear {
26    extern_methods!(
27        /// The currently selected week of year in the Calendar view. The components must include `[.yearForWeekOfYear, .weekOfYear]`.
28        #[unsafe(method(selectedWeekOfYear))]
29        #[unsafe(method_family = none)]
30        pub fn selectedWeekOfYear(&self) -> Option<Retained<NSDateComponents>>;
31
32        /// Setter for [`selectedWeekOfYear`][Self::selectedWeekOfYear].
33        ///
34        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
35        #[unsafe(method(setSelectedWeekOfYear:))]
36        #[unsafe(method_family = none)]
37        pub fn setSelectedWeekOfYear(&self, selected_week_of_year: Option<&NSDateComponents>);
38
39        /// Sets the dates to display in the calendar, with an option to animate the setting.
40        #[unsafe(method(setSelectedWeekOfYear:animated:))]
41        #[unsafe(method_family = none)]
42        pub fn setSelectedWeekOfYear_animated(
43            &self,
44            selected_week_of_year: Option<&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 UICalendarSelectionWeekOfYearDelegate>>>;
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 UICalendarSelectionWeekOfYearDelegate>>,
61        ) -> Retained<Self>;
62    );
63}
64
65/// Methods declared on superclass `UICalendarSelection`.
66#[cfg(feature = "UICalendarSelection")]
67impl UICalendarSelectionWeekOfYear {
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/uicalendarselectionweekofyeardelegate?language=objc)
81    pub unsafe trait UICalendarSelectionWeekOfYearDelegate:
82        NSObjectProtocol + MainThreadOnly
83    {
84        #[cfg(feature = "UICalendarSelection")]
85        /// Called after the user selects a week of year in the calendar view.
86        ///
87        ///
88        /// Parameter `selection`: The
89        /// `UICalendarSelectionWeekOfYear`
90        /// Parameter `dateComponents`: The date that was selected by the user.
91        #[unsafe(method(weekOfYearSelection:didSelectWeekOfYear:))]
92        #[unsafe(method_family = none)]
93        fn weekOfYearSelection_didSelectWeekOfYear(
94            &self,
95            selection: &UICalendarSelectionWeekOfYear,
96            week_of_year_components: Option<&NSDateComponents>,
97        );
98
99        #[cfg(feature = "UICalendarSelection")]
100        /// Determines if a week of year is selectable. Dates that are not selectable will be disabled in the calendar view.
101        ///
102        ///
103        /// Parameter `selection`: The
104        /// `UICalendarSelectionWeekOfYear`
105        /// Parameter `dateComponents`: The date to be checked by selection.
106        ///
107        ///
108        /// Returns: YES if the date can be selected, NO otherwise.
109        #[optional]
110        #[unsafe(method(weekOfYearSelection:canSelectWeekOfYear:))]
111        #[unsafe(method_family = none)]
112        fn weekOfYearSelection_canSelectWeekOfYear(
113            &self,
114            selection: &UICalendarSelectionWeekOfYear,
115            week_of_year_components: Option<&NSDateComponents>,
116        ) -> bool;
117    }
118);