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
38unsafe impl NSObjectProtocol for UICalendarViewDecoration {}
39
40impl UICalendarViewDecoration {
41    extern_methods!(
42        /// Creates a default decoration with a circle image.
43        #[unsafe(method(init))]
44        #[unsafe(method_family = init)]
45        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
46
47        #[cfg(all(feature = "UIColor", feature = "UIImage"))]
48        /// Creates a new image-based decoration with the specified image, color, and size.
49        ///
50        ///
51        /// Parameter `image`: The image of the decoration, defaults to
52        /// `circ`lebadge.fill if nil.
53        ///
54        /// Parameter `color`: The color of the the decoration. defaults to
55        /// `UIColor.systemFillColor`if nil.
56        ///
57        /// Parameter `size`: The preferred size of the decoration. The default is UICalendarViewDecorationSizeMedium
58        #[unsafe(method(initWithImage:color:size:))]
59        #[unsafe(method_family = init)]
60        pub unsafe fn initWithImage_color_size(
61            this: Allocated<Self>,
62            image: Option<&UIImage>,
63            color: Option<&UIColor>,
64            size: UICalendarViewDecorationSize,
65        ) -> Retained<Self>;
66
67        #[cfg(all(feature = "UIResponder", feature = "UIView", feature = "block2"))]
68        /// Creates a new custom view decoration using the provided view provider. The provider will
69        /// be called once when the decoration view is first loaded. The decoration will be clipped to
70        /// its parent's bounds, and cannot have interaction.
71        #[unsafe(method(initWithCustomViewProvider:))]
72        #[unsafe(method_family = init)]
73        pub unsafe fn initWithCustomViewProvider(
74            this: Allocated<Self>,
75            custom_view_provider: &block2::Block<dyn Fn() -> NonNull<UIView>>,
76        ) -> Retained<Self>;
77
78        #[cfg(feature = "UIColor")]
79        /// Creates a default image accessory with a circle image, and the specified color and size.
80        #[unsafe(method(decorationWithColor:size:))]
81        #[unsafe(method_family = none)]
82        pub unsafe fn decorationWithColor_size(
83            color: Option<&UIColor>,
84            size: UICalendarViewDecorationSize,
85            mtm: MainThreadMarker,
86        ) -> Retained<Self>;
87
88        #[cfg(feature = "UIImage")]
89        /// Creates an accessory with the specified image, and default color, and size.
90        #[unsafe(method(decorationWithImage:))]
91        #[unsafe(method_family = none)]
92        pub unsafe fn decorationWithImage(
93            image: Option<&UIImage>,
94            mtm: MainThreadMarker,
95        ) -> Retained<Self>;
96
97        #[cfg(all(feature = "UIColor", feature = "UIImage"))]
98        /// Creates an accessory with the specified image, color, and size.
99        #[unsafe(method(decorationWithImage:color:size:))]
100        #[unsafe(method_family = none)]
101        pub unsafe fn decorationWithImage_color_size(
102            image: Option<&UIImage>,
103            color: Option<&UIColor>,
104            size: UICalendarViewDecorationSize,
105            mtm: MainThreadMarker,
106        ) -> Retained<Self>;
107
108        #[cfg(all(feature = "UIResponder", feature = "UIView", feature = "block2"))]
109        /// Creates a new custom view decoration using the specified custom view provider. The provider will be called once
110        /// when the decoration view is first loaded. The decoration will be clipped to its parent's bounds, and cannot have
111        /// user interaction.
112        #[unsafe(method(decorationWithCustomViewProvider:))]
113        #[unsafe(method_family = none)]
114        pub unsafe fn decorationWithCustomViewProvider(
115            custom_view_provider: &block2::Block<dyn Fn() -> NonNull<UIView>>,
116            mtm: MainThreadMarker,
117        ) -> Retained<Self>;
118    );
119}
120
121/// Methods declared on superclass `NSObject`.
122impl UICalendarViewDecoration {
123    extern_methods!(
124        #[unsafe(method(new))]
125        #[unsafe(method_family = new)]
126        pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
127    );
128}