Skip to main content

objc2_ui_kit/generated/
UICalendarViewDecoration.rs

1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::ptr::NonNull;
4use objc2::__framework_prelude::*;
5
6use crate::*;
7
8/// [Apple's documentation](https://developer.apple.com/documentation/uikit/uicalendarviewdecorationsize?language=objc)
9// NS_ENUM
10#[repr(transparent)]
11#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
12pub struct UICalendarViewDecorationSize(pub NSInteger);
13impl UICalendarViewDecorationSize {
14    #[doc(alias = "UICalendarViewDecorationSizeSmall")]
15    pub const Small: Self = Self(0);
16    #[doc(alias = "UICalendarViewDecorationSizeMedium")]
17    pub const Medium: Self = Self(1);
18    #[doc(alias = "UICalendarViewDecorationSizeLarge")]
19    pub const Large: Self = Self(2);
20}
21
22unsafe impl Encode for UICalendarViewDecorationSize {
23    const ENCODING: Encoding = NSInteger::ENCODING;
24}
25
26unsafe impl RefEncode for UICalendarViewDecorationSize {
27    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
28}
29
30extern_class!(
31    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uicalendarviewdecoration?language=objc)
32    #[unsafe(super(NSObject))]
33    #[thread_kind = MainThreadOnly]
34    #[derive(Debug, PartialEq, Eq, Hash)]
35    pub struct UICalendarViewDecoration;
36);
37
38extern_conformance!(
39    unsafe impl NSObjectProtocol for UICalendarViewDecoration {}
40);
41
42impl UICalendarViewDecoration {
43    extern_methods!(
44        /// Creates a default decoration with a circle image.
45        #[unsafe(method(init))]
46        #[unsafe(method_family = init)]
47        pub fn init(this: Allocated<Self>) -> Retained<Self>;
48
49        #[cfg(all(feature = "UIColor", feature = "UIImage"))]
50        /// Creates a new image-based decoration with the specified image, color, and size.
51        ///
52        ///
53        /// Parameter `image`: The image of the decoration, defaults to
54        /// `circ`lebadge.fill if nil.
55        ///
56        /// Parameter `color`: The color of the the decoration. defaults to
57        /// `UIColor.systemFillColor`if nil.
58        ///
59        /// Parameter `size`: The preferred size of the decoration. The default is UICalendarViewDecorationSizeMedium
60        #[unsafe(method(initWithImage:color:size:))]
61        #[unsafe(method_family = init)]
62        pub fn initWithImage_color_size(
63            this: Allocated<Self>,
64            image: Option<&UIImage>,
65            color: Option<&UIColor>,
66            size: UICalendarViewDecorationSize,
67        ) -> Retained<Self>;
68
69        #[cfg(all(feature = "UIResponder", feature = "UIView", feature = "block2"))]
70        /// Creates a new custom view decoration using the provided view provider. The provider will
71        /// be called once when the decoration view is first loaded. The decoration will be clipped to
72        /// its parent's bounds, and cannot have interaction.
73        ///
74        /// # Safety
75        ///
76        /// `custom_view_provider` block's return must be a valid pointer.
77        #[unsafe(method(initWithCustomViewProvider:))]
78        #[unsafe(method_family = init)]
79        pub unsafe fn initWithCustomViewProvider(
80            this: Allocated<Self>,
81            custom_view_provider: &block2::DynBlock<dyn Fn() -> NonNull<UIView>>,
82        ) -> Retained<Self>;
83
84        #[cfg(feature = "UIColor")]
85        /// Creates a default image accessory with a circle image, and the specified color and size.
86        #[unsafe(method(decorationWithColor:size:))]
87        #[unsafe(method_family = none)]
88        pub fn decorationWithColor_size(
89            color: Option<&UIColor>,
90            size: UICalendarViewDecorationSize,
91            mtm: MainThreadMarker,
92        ) -> Retained<Self>;
93
94        #[cfg(feature = "UIImage")]
95        /// Creates an accessory with the specified image, and default color, and size.
96        #[unsafe(method(decorationWithImage:))]
97        #[unsafe(method_family = none)]
98        pub fn decorationWithImage(
99            image: Option<&UIImage>,
100            mtm: MainThreadMarker,
101        ) -> Retained<Self>;
102
103        #[cfg(all(feature = "UIColor", feature = "UIImage"))]
104        /// Creates an accessory with the specified image, color, and size.
105        #[unsafe(method(decorationWithImage:color:size:))]
106        #[unsafe(method_family = none)]
107        pub fn decorationWithImage_color_size(
108            image: Option<&UIImage>,
109            color: Option<&UIColor>,
110            size: UICalendarViewDecorationSize,
111            mtm: MainThreadMarker,
112        ) -> Retained<Self>;
113
114        #[cfg(all(feature = "UIResponder", feature = "UIView", feature = "block2"))]
115        /// Creates a new custom view decoration using the specified custom view provider. The provider will be called once
116        /// when the decoration view is first loaded. The decoration will be clipped to its parent's bounds, and cannot have
117        /// user interaction.
118        ///
119        /// # Safety
120        ///
121        /// `custom_view_provider` block's return must be a valid pointer.
122        #[unsafe(method(decorationWithCustomViewProvider:))]
123        #[unsafe(method_family = none)]
124        pub unsafe fn decorationWithCustomViewProvider(
125            custom_view_provider: &block2::DynBlock<dyn Fn() -> NonNull<UIView>>,
126            mtm: MainThreadMarker,
127        ) -> Retained<Self>;
128    );
129}
130
131/// Methods declared on superclass `NSObject`.
132impl UICalendarViewDecoration {
133    extern_methods!(
134        #[unsafe(method(new))]
135        #[unsafe(method_family = new)]
136        pub fn new(mtm: MainThreadMarker) -> Retained<Self>;
137    );
138}