1use core::ffi::*;
4use core::ptr::NonNull;
5use objc2::__framework_prelude::*;
6#[cfg(feature = "objc2-core-foundation")]
7use objc2_core_foundation::*;
8use objc2_foundation::*;
9#[cfg(feature = "objc2-quartz-core")]
10#[cfg(not(target_os = "watchos"))]
11use objc2_quartz_core::*;
12
13use crate::*;
14
15#[repr(transparent)]
18#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
19pub struct UICollectionViewCellDragState(pub NSInteger);
20impl UICollectionViewCellDragState {
21 #[doc(alias = "UICollectionViewCellDragStateNone")]
22 pub const None: Self = Self(0);
23 #[doc(alias = "UICollectionViewCellDragStateLifting")]
24 pub const Lifting: Self = Self(1);
25 #[doc(alias = "UICollectionViewCellDragStateDragging")]
26 pub const Dragging: Self = Self(2);
27}
28
29unsafe impl Encode for UICollectionViewCellDragState {
30 const ENCODING: Encoding = NSInteger::ENCODING;
31}
32
33unsafe impl RefEncode for UICollectionViewCellDragState {
34 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
35}
36
37extern_class!(
38 #[unsafe(super(UIView, UIResponder, NSObject))]
40 #[thread_kind = MainThreadOnly]
41 #[derive(Debug, PartialEq, Eq, Hash)]
42 #[cfg(all(feature = "UIResponder", feature = "UIView"))]
43 pub struct UICollectionReusableView;
44);
45
46#[cfg(all(
47 feature = "UIResponder",
48 feature = "UIView",
49 feature = "objc2-quartz-core"
50))]
51#[cfg(not(target_os = "watchos"))]
52unsafe impl CALayerDelegate for UICollectionReusableView {}
53
54#[cfg(all(feature = "UIResponder", feature = "UIView"))]
55unsafe impl NSCoding for UICollectionReusableView {}
56
57#[cfg(all(feature = "UIResponder", feature = "UIView"))]
58unsafe impl NSObjectProtocol for UICollectionReusableView {}
59
60#[cfg(all(feature = "UIAppearance", feature = "UIResponder", feature = "UIView"))]
61unsafe impl UIAppearance for UICollectionReusableView {}
62
63#[cfg(all(feature = "UIAppearance", feature = "UIResponder", feature = "UIView"))]
64unsafe impl UIAppearanceContainer for UICollectionReusableView {}
65
66#[cfg(all(feature = "UIResponder", feature = "UIView"))]
67unsafe impl UICoordinateSpace for UICollectionReusableView {}
68
69#[cfg(all(
70 feature = "UIDynamicBehavior",
71 feature = "UIResponder",
72 feature = "UIView"
73))]
74unsafe impl UIDynamicItem for UICollectionReusableView {}
75
76#[cfg(all(feature = "UIFocus", feature = "UIResponder", feature = "UIView"))]
77unsafe impl UIFocusEnvironment for UICollectionReusableView {}
78
79#[cfg(all(feature = "UIFocus", feature = "UIResponder", feature = "UIView"))]
80unsafe impl UIFocusItem for UICollectionReusableView {}
81
82#[cfg(all(feature = "UIFocus", feature = "UIResponder", feature = "UIView"))]
83unsafe impl UIFocusItemContainer for UICollectionReusableView {}
84
85#[cfg(all(feature = "UIResponder", feature = "UIView"))]
86unsafe impl UIResponderStandardEditActions for UICollectionReusableView {}
87
88#[cfg(all(
89 feature = "UIResponder",
90 feature = "UITraitCollection",
91 feature = "UIView"
92))]
93unsafe impl UITraitEnvironment for UICollectionReusableView {}
94
95#[cfg(all(feature = "UIResponder", feature = "UIView"))]
96impl UICollectionReusableView {
97 extern_methods!(
98 #[unsafe(method(reuseIdentifier))]
99 #[unsafe(method_family = none)]
100 pub unsafe fn reuseIdentifier(&self) -> Option<Retained<NSString>>;
101
102 #[unsafe(method(prepareForReuse))]
103 #[unsafe(method_family = none)]
104 pub unsafe fn prepareForReuse(&self);
105
106 #[cfg(feature = "UICollectionViewLayout")]
107 #[unsafe(method(applyLayoutAttributes:))]
108 #[unsafe(method_family = none)]
109 pub unsafe fn applyLayoutAttributes(
110 &self,
111 layout_attributes: &UICollectionViewLayoutAttributes,
112 );
113
114 #[cfg(feature = "UICollectionViewLayout")]
115 #[unsafe(method(willTransitionFromLayout:toLayout:))]
116 #[unsafe(method_family = none)]
117 pub unsafe fn willTransitionFromLayout_toLayout(
118 &self,
119 old_layout: &UICollectionViewLayout,
120 new_layout: &UICollectionViewLayout,
121 );
122
123 #[cfg(feature = "UICollectionViewLayout")]
124 #[unsafe(method(didTransitionFromLayout:toLayout:))]
125 #[unsafe(method_family = none)]
126 pub unsafe fn didTransitionFromLayout_toLayout(
127 &self,
128 old_layout: &UICollectionViewLayout,
129 new_layout: &UICollectionViewLayout,
130 );
131
132 #[cfg(feature = "UICollectionViewLayout")]
133 #[unsafe(method(preferredLayoutAttributesFittingAttributes:))]
134 #[unsafe(method_family = none)]
135 pub unsafe fn preferredLayoutAttributesFittingAttributes(
136 &self,
137 layout_attributes: &UICollectionViewLayoutAttributes,
138 ) -> Retained<UICollectionViewLayoutAttributes>;
139 );
140}
141
142#[cfg(all(feature = "UIResponder", feature = "UIView"))]
144impl UICollectionReusableView {
145 extern_methods!(
146 #[cfg(feature = "objc2-core-foundation")]
147 #[unsafe(method(initWithFrame:))]
148 #[unsafe(method_family = init)]
149 pub unsafe fn initWithFrame(this: Allocated<Self>, frame: CGRect) -> Retained<Self>;
150
151 #[unsafe(method(initWithCoder:))]
152 #[unsafe(method_family = init)]
153 pub unsafe fn initWithCoder(
154 this: Allocated<Self>,
155 coder: &NSCoder,
156 ) -> Option<Retained<Self>>;
157 );
158}
159
160#[cfg(all(feature = "UIResponder", feature = "UIView"))]
162impl UICollectionReusableView {
163 extern_methods!(
164 #[unsafe(method(init))]
165 #[unsafe(method_family = init)]
166 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
167
168 #[unsafe(method(new))]
169 #[unsafe(method_family = new)]
170 pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
171 );
172}
173
174#[cfg(all(
176 feature = "UICellConfigurationState",
177 feature = "UIResponder",
178 feature = "UIView",
179 feature = "UIViewConfigurationState",
180 feature = "block2"
181))]
182pub type UICollectionViewCellConfigurationUpdateHandler =
183 *mut block2::Block<dyn Fn(NonNull<UICollectionViewCell>, NonNull<UICellConfigurationState>)>;
184
185extern_class!(
186 #[unsafe(super(UICollectionReusableView, UIView, UIResponder, NSObject))]
188 #[thread_kind = MainThreadOnly]
189 #[derive(Debug, PartialEq, Eq, Hash)]
190 #[cfg(all(feature = "UIResponder", feature = "UIView"))]
191 pub struct UICollectionViewCell;
192);
193
194#[cfg(all(
195 feature = "UIResponder",
196 feature = "UIView",
197 feature = "objc2-quartz-core"
198))]
199#[cfg(not(target_os = "watchos"))]
200unsafe impl CALayerDelegate for UICollectionViewCell {}
201
202#[cfg(all(feature = "UIResponder", feature = "UIView"))]
203unsafe impl NSCoding for UICollectionViewCell {}
204
205#[cfg(all(feature = "UIResponder", feature = "UIView"))]
206unsafe impl NSObjectProtocol for UICollectionViewCell {}
207
208#[cfg(all(feature = "UIAppearance", feature = "UIResponder", feature = "UIView"))]
209unsafe impl UIAppearance for UICollectionViewCell {}
210
211#[cfg(all(feature = "UIAppearance", feature = "UIResponder", feature = "UIView"))]
212unsafe impl UIAppearanceContainer for UICollectionViewCell {}
213
214#[cfg(all(feature = "UIResponder", feature = "UIView"))]
215unsafe impl UICoordinateSpace for UICollectionViewCell {}
216
217#[cfg(all(
218 feature = "UIDynamicBehavior",
219 feature = "UIResponder",
220 feature = "UIView"
221))]
222unsafe impl UIDynamicItem for UICollectionViewCell {}
223
224#[cfg(all(feature = "UIFocus", feature = "UIResponder", feature = "UIView"))]
225unsafe impl UIFocusEnvironment for UICollectionViewCell {}
226
227#[cfg(all(feature = "UIFocus", feature = "UIResponder", feature = "UIView"))]
228unsafe impl UIFocusItem for UICollectionViewCell {}
229
230#[cfg(all(feature = "UIFocus", feature = "UIResponder", feature = "UIView"))]
231unsafe impl UIFocusItemContainer for UICollectionViewCell {}
232
233#[cfg(all(feature = "UIResponder", feature = "UIView"))]
234unsafe impl UIResponderStandardEditActions for UICollectionViewCell {}
235
236#[cfg(all(
237 feature = "UIResponder",
238 feature = "UITraitCollection",
239 feature = "UIView"
240))]
241unsafe impl UITraitEnvironment for UICollectionViewCell {}
242
243#[cfg(all(feature = "UIResponder", feature = "UIView"))]
244impl UICollectionViewCell {
245 extern_methods!(
246 #[cfg(all(
247 feature = "UICellConfigurationState",
248 feature = "UIViewConfigurationState"
249 ))]
250 #[unsafe(method(configurationState))]
254 #[unsafe(method_family = none)]
255 pub unsafe fn configurationState(&self) -> Retained<UICellConfigurationState>;
256
257 #[unsafe(method(setNeedsUpdateConfiguration))]
261 #[unsafe(method_family = none)]
262 pub unsafe fn setNeedsUpdateConfiguration(&self);
263
264 #[cfg(all(
265 feature = "UICellConfigurationState",
266 feature = "UIViewConfigurationState"
267 ))]
268 #[unsafe(method(updateConfigurationUsingState:))]
271 #[unsafe(method_family = none)]
272 pub unsafe fn updateConfigurationUsingState(&self, state: &UICellConfigurationState);
273
274 #[cfg(all(
275 feature = "UICellConfigurationState",
276 feature = "UIViewConfigurationState",
277 feature = "block2"
278 ))]
279 #[unsafe(method(configurationUpdateHandler))]
282 #[unsafe(method_family = none)]
283 pub unsafe fn configurationUpdateHandler(
284 &self,
285 ) -> UICollectionViewCellConfigurationUpdateHandler;
286
287 #[cfg(all(
288 feature = "UICellConfigurationState",
289 feature = "UIViewConfigurationState",
290 feature = "block2"
291 ))]
292 #[unsafe(method(setConfigurationUpdateHandler:))]
294 #[unsafe(method_family = none)]
295 pub unsafe fn setConfigurationUpdateHandler(
296 &self,
297 configuration_update_handler: UICollectionViewCellConfigurationUpdateHandler,
298 );
299
300 #[cfg(feature = "UIContentConfiguration")]
301 #[unsafe(method(contentConfiguration))]
305 #[unsafe(method_family = none)]
306 pub unsafe fn contentConfiguration(
307 &self,
308 ) -> Option<Retained<ProtocolObject<dyn UIContentConfiguration>>>;
309
310 #[cfg(feature = "UIContentConfiguration")]
311 #[unsafe(method(setContentConfiguration:))]
313 #[unsafe(method_family = none)]
314 pub unsafe fn setContentConfiguration(
315 &self,
316 content_configuration: Option<&ProtocolObject<dyn UIContentConfiguration>>,
317 );
318
319 #[unsafe(method(automaticallyUpdatesContentConfiguration))]
322 #[unsafe(method_family = none)]
323 pub unsafe fn automaticallyUpdatesContentConfiguration(&self) -> bool;
324
325 #[unsafe(method(setAutomaticallyUpdatesContentConfiguration:))]
327 #[unsafe(method_family = none)]
328 pub unsafe fn setAutomaticallyUpdatesContentConfiguration(
329 &self,
330 automatically_updates_content_configuration: bool,
331 );
332
333 #[unsafe(method(contentView))]
334 #[unsafe(method_family = none)]
335 pub unsafe fn contentView(&self) -> Retained<UIView>;
336
337 #[unsafe(method(isSelected))]
338 #[unsafe(method_family = none)]
339 pub unsafe fn isSelected(&self) -> bool;
340
341 #[unsafe(method(setSelected:))]
343 #[unsafe(method_family = none)]
344 pub unsafe fn setSelected(&self, selected: bool);
345
346 #[unsafe(method(isHighlighted))]
347 #[unsafe(method_family = none)]
348 pub unsafe fn isHighlighted(&self) -> bool;
349
350 #[unsafe(method(setHighlighted:))]
352 #[unsafe(method_family = none)]
353 pub unsafe fn setHighlighted(&self, highlighted: bool);
354
355 #[unsafe(method(dragStateDidChange:))]
356 #[unsafe(method_family = none)]
357 pub unsafe fn dragStateDidChange(&self, drag_state: UICollectionViewCellDragState);
358
359 #[cfg(feature = "UIBackgroundConfiguration")]
360 #[unsafe(method(defaultBackgroundConfiguration))]
363 #[unsafe(method_family = none)]
364 pub unsafe fn defaultBackgroundConfiguration(&self) -> Retained<UIBackgroundConfiguration>;
365
366 #[cfg(feature = "UIBackgroundConfiguration")]
367 #[unsafe(method(backgroundConfiguration))]
369 #[unsafe(method_family = none)]
370 pub unsafe fn backgroundConfiguration(&self)
371 -> Option<Retained<UIBackgroundConfiguration>>;
372
373 #[cfg(feature = "UIBackgroundConfiguration")]
374 #[unsafe(method(setBackgroundConfiguration:))]
376 #[unsafe(method_family = none)]
377 pub unsafe fn setBackgroundConfiguration(
378 &self,
379 background_configuration: Option<&UIBackgroundConfiguration>,
380 );
381
382 #[unsafe(method(automaticallyUpdatesBackgroundConfiguration))]
385 #[unsafe(method_family = none)]
386 pub unsafe fn automaticallyUpdatesBackgroundConfiguration(&self) -> bool;
387
388 #[unsafe(method(setAutomaticallyUpdatesBackgroundConfiguration:))]
390 #[unsafe(method_family = none)]
391 pub unsafe fn setAutomaticallyUpdatesBackgroundConfiguration(
392 &self,
393 automatically_updates_background_configuration: bool,
394 );
395
396 #[unsafe(method(backgroundView))]
397 #[unsafe(method_family = none)]
398 pub unsafe fn backgroundView(&self) -> Option<Retained<UIView>>;
399
400 #[unsafe(method(setBackgroundView:))]
402 #[unsafe(method_family = none)]
403 pub unsafe fn setBackgroundView(&self, background_view: Option<&UIView>);
404
405 #[unsafe(method(selectedBackgroundView))]
406 #[unsafe(method_family = none)]
407 pub unsafe fn selectedBackgroundView(&self) -> Option<Retained<UIView>>;
408
409 #[unsafe(method(setSelectedBackgroundView:))]
411 #[unsafe(method_family = none)]
412 pub unsafe fn setSelectedBackgroundView(&self, selected_background_view: Option<&UIView>);
413 );
414}
415
416#[cfg(all(feature = "UIResponder", feature = "UIView"))]
418impl UICollectionViewCell {
419 extern_methods!(
420 #[cfg(feature = "objc2-core-foundation")]
421 #[unsafe(method(initWithFrame:))]
422 #[unsafe(method_family = init)]
423 pub unsafe fn initWithFrame(this: Allocated<Self>, frame: CGRect) -> Retained<Self>;
424
425 #[unsafe(method(initWithCoder:))]
426 #[unsafe(method_family = init)]
427 pub unsafe fn initWithCoder(
428 this: Allocated<Self>,
429 coder: &NSCoder,
430 ) -> Option<Retained<Self>>;
431 );
432}
433
434#[cfg(all(feature = "UIResponder", feature = "UIView"))]
436impl UICollectionViewCell {
437 extern_methods!(
438 #[unsafe(method(init))]
439 #[unsafe(method_family = init)]
440 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
441
442 #[unsafe(method(new))]
443 #[unsafe(method_family = new)]
444 pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
445 );
446}