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"))]
52extern_conformance!(
53 unsafe impl CALayerDelegate for UICollectionReusableView {}
54);
55
56#[cfg(all(feature = "UIResponder", feature = "UIView"))]
57extern_conformance!(
58 unsafe impl NSCoding for UICollectionReusableView {}
59);
60
61#[cfg(all(feature = "UIResponder", feature = "UIView"))]
62extern_conformance!(
63 unsafe impl NSObjectProtocol for UICollectionReusableView {}
64);
65
66#[cfg(all(feature = "UIAppearance", feature = "UIResponder", feature = "UIView"))]
67extern_conformance!(
68 unsafe impl UIAppearance for UICollectionReusableView {}
69);
70
71#[cfg(all(feature = "UIAppearance", feature = "UIResponder", feature = "UIView"))]
72extern_conformance!(
73 unsafe impl UIAppearanceContainer for UICollectionReusableView {}
74);
75
76#[cfg(all(feature = "UIResponder", feature = "UIView"))]
77extern_conformance!(
78 unsafe impl UICoordinateSpace for UICollectionReusableView {}
79);
80
81#[cfg(all(
82 feature = "UIDynamicBehavior",
83 feature = "UIResponder",
84 feature = "UIView"
85))]
86extern_conformance!(
87 unsafe impl UIDynamicItem for UICollectionReusableView {}
88);
89
90#[cfg(all(feature = "UIFocus", feature = "UIResponder", feature = "UIView"))]
91extern_conformance!(
92 unsafe impl UIFocusEnvironment for UICollectionReusableView {}
93);
94
95#[cfg(all(feature = "UIFocus", feature = "UIResponder", feature = "UIView"))]
96extern_conformance!(
97 unsafe impl UIFocusItem for UICollectionReusableView {}
98);
99
100#[cfg(all(feature = "UIFocus", feature = "UIResponder", feature = "UIView"))]
101extern_conformance!(
102 unsafe impl UIFocusItemContainer for UICollectionReusableView {}
103);
104
105#[cfg(all(feature = "UIResponder", feature = "UIView"))]
106extern_conformance!(
107 unsafe impl UIResponderStandardEditActions for UICollectionReusableView {}
108);
109
110#[cfg(all(
111 feature = "UIResponder",
112 feature = "UITraitCollection",
113 feature = "UIView"
114))]
115extern_conformance!(
116 unsafe impl UITraitEnvironment for UICollectionReusableView {}
117);
118
119#[cfg(all(feature = "UIResponder", feature = "UIView"))]
120impl UICollectionReusableView {
121 extern_methods!(
122 #[unsafe(method(reuseIdentifier))]
123 #[unsafe(method_family = none)]
124 pub unsafe fn reuseIdentifier(&self) -> Option<Retained<NSString>>;
125
126 #[unsafe(method(prepareForReuse))]
127 #[unsafe(method_family = none)]
128 pub unsafe fn prepareForReuse(&self);
129
130 #[cfg(feature = "UICollectionViewLayout")]
131 #[unsafe(method(applyLayoutAttributes:))]
132 #[unsafe(method_family = none)]
133 pub unsafe fn applyLayoutAttributes(
134 &self,
135 layout_attributes: &UICollectionViewLayoutAttributes,
136 );
137
138 #[cfg(feature = "UICollectionViewLayout")]
139 #[unsafe(method(willTransitionFromLayout:toLayout:))]
140 #[unsafe(method_family = none)]
141 pub unsafe fn willTransitionFromLayout_toLayout(
142 &self,
143 old_layout: &UICollectionViewLayout,
144 new_layout: &UICollectionViewLayout,
145 );
146
147 #[cfg(feature = "UICollectionViewLayout")]
148 #[unsafe(method(didTransitionFromLayout:toLayout:))]
149 #[unsafe(method_family = none)]
150 pub unsafe fn didTransitionFromLayout_toLayout(
151 &self,
152 old_layout: &UICollectionViewLayout,
153 new_layout: &UICollectionViewLayout,
154 );
155
156 #[cfg(feature = "UICollectionViewLayout")]
157 #[unsafe(method(preferredLayoutAttributesFittingAttributes:))]
158 #[unsafe(method_family = none)]
159 pub unsafe fn preferredLayoutAttributesFittingAttributes(
160 &self,
161 layout_attributes: &UICollectionViewLayoutAttributes,
162 ) -> Retained<UICollectionViewLayoutAttributes>;
163 );
164}
165
166#[cfg(all(feature = "UIResponder", feature = "UIView"))]
168impl UICollectionReusableView {
169 extern_methods!(
170 #[cfg(feature = "objc2-core-foundation")]
171 #[unsafe(method(initWithFrame:))]
172 #[unsafe(method_family = init)]
173 pub unsafe fn initWithFrame(this: Allocated<Self>, frame: CGRect) -> Retained<Self>;
174
175 #[unsafe(method(initWithCoder:))]
176 #[unsafe(method_family = init)]
177 pub unsafe fn initWithCoder(
178 this: Allocated<Self>,
179 coder: &NSCoder,
180 ) -> Option<Retained<Self>>;
181 );
182}
183
184#[cfg(all(feature = "UIResponder", feature = "UIView"))]
186impl UICollectionReusableView {
187 extern_methods!(
188 #[unsafe(method(init))]
189 #[unsafe(method_family = init)]
190 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
191
192 #[unsafe(method(new))]
193 #[unsafe(method_family = new)]
194 pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
195 );
196}
197
198#[cfg(all(
200 feature = "UICellConfigurationState",
201 feature = "UIResponder",
202 feature = "UIView",
203 feature = "UIViewConfigurationState",
204 feature = "block2"
205))]
206pub type UICollectionViewCellConfigurationUpdateHandler =
207 *mut block2::DynBlock<dyn Fn(NonNull<UICollectionViewCell>, NonNull<UICellConfigurationState>)>;
208
209extern_class!(
210 #[unsafe(super(UICollectionReusableView, UIView, UIResponder, NSObject))]
212 #[thread_kind = MainThreadOnly]
213 #[derive(Debug, PartialEq, Eq, Hash)]
214 #[cfg(all(feature = "UIResponder", feature = "UIView"))]
215 pub struct UICollectionViewCell;
216);
217
218#[cfg(all(
219 feature = "UIResponder",
220 feature = "UIView",
221 feature = "objc2-quartz-core"
222))]
223#[cfg(not(target_os = "watchos"))]
224extern_conformance!(
225 unsafe impl CALayerDelegate for UICollectionViewCell {}
226);
227
228#[cfg(all(feature = "UIResponder", feature = "UIView"))]
229extern_conformance!(
230 unsafe impl NSCoding for UICollectionViewCell {}
231);
232
233#[cfg(all(feature = "UIResponder", feature = "UIView"))]
234extern_conformance!(
235 unsafe impl NSObjectProtocol for UICollectionViewCell {}
236);
237
238#[cfg(all(feature = "UIAppearance", feature = "UIResponder", feature = "UIView"))]
239extern_conformance!(
240 unsafe impl UIAppearance for UICollectionViewCell {}
241);
242
243#[cfg(all(feature = "UIAppearance", feature = "UIResponder", feature = "UIView"))]
244extern_conformance!(
245 unsafe impl UIAppearanceContainer for UICollectionViewCell {}
246);
247
248#[cfg(all(feature = "UIResponder", feature = "UIView"))]
249extern_conformance!(
250 unsafe impl UICoordinateSpace for UICollectionViewCell {}
251);
252
253#[cfg(all(
254 feature = "UIDynamicBehavior",
255 feature = "UIResponder",
256 feature = "UIView"
257))]
258extern_conformance!(
259 unsafe impl UIDynamicItem for UICollectionViewCell {}
260);
261
262#[cfg(all(feature = "UIFocus", feature = "UIResponder", feature = "UIView"))]
263extern_conformance!(
264 unsafe impl UIFocusEnvironment for UICollectionViewCell {}
265);
266
267#[cfg(all(feature = "UIFocus", feature = "UIResponder", feature = "UIView"))]
268extern_conformance!(
269 unsafe impl UIFocusItem for UICollectionViewCell {}
270);
271
272#[cfg(all(feature = "UIFocus", feature = "UIResponder", feature = "UIView"))]
273extern_conformance!(
274 unsafe impl UIFocusItemContainer for UICollectionViewCell {}
275);
276
277#[cfg(all(feature = "UIResponder", feature = "UIView"))]
278extern_conformance!(
279 unsafe impl UIResponderStandardEditActions for UICollectionViewCell {}
280);
281
282#[cfg(all(
283 feature = "UIResponder",
284 feature = "UITraitCollection",
285 feature = "UIView"
286))]
287extern_conformance!(
288 unsafe impl UITraitEnvironment for UICollectionViewCell {}
289);
290
291#[cfg(all(feature = "UIResponder", feature = "UIView"))]
292impl UICollectionViewCell {
293 extern_methods!(
294 #[cfg(all(
295 feature = "UICellConfigurationState",
296 feature = "UIViewConfigurationState"
297 ))]
298 #[unsafe(method(configurationState))]
302 #[unsafe(method_family = none)]
303 pub unsafe fn configurationState(&self) -> Retained<UICellConfigurationState>;
304
305 #[unsafe(method(setNeedsUpdateConfiguration))]
309 #[unsafe(method_family = none)]
310 pub unsafe fn setNeedsUpdateConfiguration(&self);
311
312 #[cfg(all(
313 feature = "UICellConfigurationState",
314 feature = "UIViewConfigurationState"
315 ))]
316 #[unsafe(method(updateConfigurationUsingState:))]
319 #[unsafe(method_family = none)]
320 pub unsafe fn updateConfigurationUsingState(&self, state: &UICellConfigurationState);
321
322 #[cfg(all(
323 feature = "UICellConfigurationState",
324 feature = "UIViewConfigurationState",
325 feature = "block2"
326 ))]
327 #[unsafe(method(configurationUpdateHandler))]
330 #[unsafe(method_family = none)]
331 pub unsafe fn configurationUpdateHandler(
332 &self,
333 ) -> UICollectionViewCellConfigurationUpdateHandler;
334
335 #[cfg(all(
336 feature = "UICellConfigurationState",
337 feature = "UIViewConfigurationState",
338 feature = "block2"
339 ))]
340 #[unsafe(method(setConfigurationUpdateHandler:))]
342 #[unsafe(method_family = none)]
343 pub unsafe fn setConfigurationUpdateHandler(
344 &self,
345 configuration_update_handler: UICollectionViewCellConfigurationUpdateHandler,
346 );
347
348 #[cfg(feature = "UIContentConfiguration")]
349 #[unsafe(method(contentConfiguration))]
353 #[unsafe(method_family = none)]
354 pub unsafe fn contentConfiguration(
355 &self,
356 ) -> Option<Retained<ProtocolObject<dyn UIContentConfiguration>>>;
357
358 #[cfg(feature = "UIContentConfiguration")]
359 #[unsafe(method(setContentConfiguration:))]
361 #[unsafe(method_family = none)]
362 pub unsafe fn setContentConfiguration(
363 &self,
364 content_configuration: Option<&ProtocolObject<dyn UIContentConfiguration>>,
365 );
366
367 #[unsafe(method(automaticallyUpdatesContentConfiguration))]
370 #[unsafe(method_family = none)]
371 pub unsafe fn automaticallyUpdatesContentConfiguration(&self) -> bool;
372
373 #[unsafe(method(setAutomaticallyUpdatesContentConfiguration:))]
375 #[unsafe(method_family = none)]
376 pub unsafe fn setAutomaticallyUpdatesContentConfiguration(
377 &self,
378 automatically_updates_content_configuration: bool,
379 );
380
381 #[unsafe(method(contentView))]
382 #[unsafe(method_family = none)]
383 pub unsafe fn contentView(&self) -> Retained<UIView>;
384
385 #[unsafe(method(isSelected))]
386 #[unsafe(method_family = none)]
387 pub unsafe fn isSelected(&self) -> bool;
388
389 #[unsafe(method(setSelected:))]
391 #[unsafe(method_family = none)]
392 pub unsafe fn setSelected(&self, selected: bool);
393
394 #[unsafe(method(isHighlighted))]
395 #[unsafe(method_family = none)]
396 pub unsafe fn isHighlighted(&self) -> bool;
397
398 #[unsafe(method(setHighlighted:))]
400 #[unsafe(method_family = none)]
401 pub unsafe fn setHighlighted(&self, highlighted: bool);
402
403 #[unsafe(method(dragStateDidChange:))]
404 #[unsafe(method_family = none)]
405 pub unsafe fn dragStateDidChange(&self, drag_state: UICollectionViewCellDragState);
406
407 #[cfg(feature = "UIBackgroundConfiguration")]
408 #[unsafe(method(defaultBackgroundConfiguration))]
411 #[unsafe(method_family = none)]
412 pub unsafe fn defaultBackgroundConfiguration(&self) -> Retained<UIBackgroundConfiguration>;
413
414 #[cfg(feature = "UIBackgroundConfiguration")]
415 #[unsafe(method(backgroundConfiguration))]
417 #[unsafe(method_family = none)]
418 pub unsafe fn backgroundConfiguration(&self)
419 -> Option<Retained<UIBackgroundConfiguration>>;
420
421 #[cfg(feature = "UIBackgroundConfiguration")]
422 #[unsafe(method(setBackgroundConfiguration:))]
424 #[unsafe(method_family = none)]
425 pub unsafe fn setBackgroundConfiguration(
426 &self,
427 background_configuration: Option<&UIBackgroundConfiguration>,
428 );
429
430 #[unsafe(method(automaticallyUpdatesBackgroundConfiguration))]
433 #[unsafe(method_family = none)]
434 pub unsafe fn automaticallyUpdatesBackgroundConfiguration(&self) -> bool;
435
436 #[unsafe(method(setAutomaticallyUpdatesBackgroundConfiguration:))]
438 #[unsafe(method_family = none)]
439 pub unsafe fn setAutomaticallyUpdatesBackgroundConfiguration(
440 &self,
441 automatically_updates_background_configuration: bool,
442 );
443
444 #[unsafe(method(backgroundView))]
445 #[unsafe(method_family = none)]
446 pub unsafe fn backgroundView(&self) -> Option<Retained<UIView>>;
447
448 #[unsafe(method(setBackgroundView:))]
450 #[unsafe(method_family = none)]
451 pub unsafe fn setBackgroundView(&self, background_view: Option<&UIView>);
452
453 #[unsafe(method(selectedBackgroundView))]
454 #[unsafe(method_family = none)]
455 pub unsafe fn selectedBackgroundView(&self) -> Option<Retained<UIView>>;
456
457 #[unsafe(method(setSelectedBackgroundView:))]
459 #[unsafe(method_family = none)]
460 pub unsafe fn setSelectedBackgroundView(&self, selected_background_view: Option<&UIView>);
461 );
462}
463
464#[cfg(all(feature = "UIResponder", feature = "UIView"))]
466impl UICollectionViewCell {
467 extern_methods!(
468 #[cfg(feature = "objc2-core-foundation")]
469 #[unsafe(method(initWithFrame:))]
470 #[unsafe(method_family = init)]
471 pub unsafe fn initWithFrame(this: Allocated<Self>, frame: CGRect) -> Retained<Self>;
472
473 #[unsafe(method(initWithCoder:))]
474 #[unsafe(method_family = init)]
475 pub unsafe fn initWithCoder(
476 this: Allocated<Self>,
477 coder: &NSCoder,
478 ) -> Option<Retained<Self>>;
479 );
480}
481
482#[cfg(all(feature = "UIResponder", feature = "UIView"))]
484impl UICollectionViewCell {
485 extern_methods!(
486 #[unsafe(method(init))]
487 #[unsafe(method_family = init)]
488 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
489
490 #[unsafe(method(new))]
491 #[unsafe(method_family = new)]
492 pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
493 );
494}