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