objc2_ui_kit/generated/
UICellAccessory.rs

1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::ffi::*;
4use core::ptr::NonNull;
5use objc2::__framework_prelude::*;
6#[cfg(feature = "objc2-core-foundation")]
7use objc2_core_foundation::*;
8use objc2_foundation::*;
9
10use crate::*;
11
12/// [Apple's documentation](https://developer.apple.com/documentation/uikit/uicellaccessorydisplayedstate?language=objc)
13// NS_ENUM
14#[repr(transparent)]
15#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
16pub struct UICellAccessoryDisplayedState(pub NSInteger);
17impl UICellAccessoryDisplayedState {
18    /// The accessory is always displayed.
19    #[doc(alias = "UICellAccessoryDisplayedAlways")]
20    pub const Always: Self = Self(0);
21    /// The accessory is displayed only when the cell is editing.
22    #[doc(alias = "UICellAccessoryDisplayedWhenEditing")]
23    pub const WhenEditing: Self = Self(1);
24    /// The accessory is displayed only when the cell is not editing.
25    #[doc(alias = "UICellAccessoryDisplayedWhenNotEditing")]
26    pub const WhenNotEditing: Self = Self(2);
27}
28
29unsafe impl Encode for UICellAccessoryDisplayedState {
30    const ENCODING: Encoding = NSInteger::ENCODING;
31}
32
33unsafe impl RefEncode for UICellAccessoryDisplayedState {
34    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
35}
36
37extern "C" {
38    /// A special constant that can be set to the `reservedLayoutWidth` property. This requests the
39    /// system standard layout width.
40    ///
41    /// See also [Apple's documentation](https://developer.apple.com/documentation/uikit/uicellaccessorystandarddimension?language=objc)
42    #[cfg(feature = "objc2-core-foundation")]
43    pub static UICellAccessoryStandardDimension: CGFloat;
44}
45
46extern_class!(
47    /// Abstract base class. Do not instantiate directly.
48    ///
49    /// See also [Apple's documentation](https://developer.apple.com/documentation/uikit/uicellaccessory?language=objc)
50    #[unsafe(super(NSObject))]
51    #[thread_kind = MainThreadOnly]
52    #[derive(Debug, PartialEq, Eq, Hash)]
53    pub struct UICellAccessory;
54);
55
56unsafe impl NSCoding for UICellAccessory {}
57
58unsafe impl NSCopying for UICellAccessory {}
59
60unsafe impl CopyingHelper for UICellAccessory {
61    type Result = Self;
62}
63
64unsafe impl NSObjectProtocol for UICellAccessory {}
65
66unsafe impl NSSecureCoding for UICellAccessory {}
67
68impl UICellAccessory {
69    extern_methods!(
70        /// The state(s) for which the accessory should be displayed.
71        #[unsafe(method(displayedState))]
72        #[unsafe(method_family = none)]
73        pub unsafe fn displayedState(&self) -> UICellAccessoryDisplayedState;
74
75        /// Setter for [`displayedState`][Self::displayedState].
76        #[unsafe(method(setDisplayedState:))]
77        #[unsafe(method_family = none)]
78        pub unsafe fn setDisplayedState(&self, displayed_state: UICellAccessoryDisplayedState);
79
80        /// Hidden accessories take up space in the layout, but are not visible and do not provide any behaviors.
81        /// Use this property to achieve a consistent layout across cells when some show the accessory and others do not.
82        #[unsafe(method(isHidden))]
83        #[unsafe(method_family = none)]
84        pub unsafe fn isHidden(&self) -> bool;
85
86        /// Setter for [`isHidden`][Self::isHidden].
87        #[unsafe(method(setHidden:))]
88        #[unsafe(method_family = none)]
89        pub unsafe fn setHidden(&self, hidden: bool);
90
91        #[cfg(feature = "objc2-core-foundation")]
92        /// The layout width that is reserved for the accessory, inside which the accessory will be centered.
93        /// This is used to ensure horizontal alignment of different accessories in adjacent cells, even when
94        /// the actual accessory view width varies slightly. A value of 0 means the actual width of the
95        /// accessory will be used. Use UICellAccessoryStandardDimension to request the standard width.
96        #[unsafe(method(reservedLayoutWidth))]
97        #[unsafe(method_family = none)]
98        pub unsafe fn reservedLayoutWidth(&self) -> CGFloat;
99
100        #[cfg(feature = "objc2-core-foundation")]
101        /// Setter for [`reservedLayoutWidth`][Self::reservedLayoutWidth].
102        #[unsafe(method(setReservedLayoutWidth:))]
103        #[unsafe(method_family = none)]
104        pub unsafe fn setReservedLayoutWidth(&self, reserved_layout_width: CGFloat);
105
106        #[cfg(feature = "UIColor")]
107        /// The tint color to apply to the accessory. Default value is nil, which uses the system default.
108        #[unsafe(method(tintColor))]
109        #[unsafe(method_family = none)]
110        pub unsafe fn tintColor(&self) -> Option<Retained<UIColor>>;
111
112        #[cfg(feature = "UIColor")]
113        /// Setter for [`tintColor`][Self::tintColor].
114        #[unsafe(method(setTintColor:))]
115        #[unsafe(method_family = none)]
116        pub unsafe fn setTintColor(&self, tint_color: Option<&UIColor>);
117
118        #[unsafe(method(initWithCoder:))]
119        #[unsafe(method_family = init)]
120        pub unsafe fn initWithCoder(
121            this: Allocated<Self>,
122            coder: &NSCoder,
123        ) -> Option<Retained<Self>>;
124
125        #[unsafe(method(init))]
126        #[unsafe(method_family = init)]
127        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
128    );
129}
130
131/// Methods declared on superclass `NSObject`.
132impl UICellAccessory {
133    extern_methods!(
134        #[unsafe(method(new))]
135        #[unsafe(method_family = new)]
136        pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
137    );
138}
139
140extern_class!(
141    /// A disclosure chevron that points in the trailing direction.
142    ///
143    /// See also [Apple's documentation](https://developer.apple.com/documentation/uikit/uicellaccessorydisclosureindicator?language=objc)
144    #[unsafe(super(UICellAccessory, NSObject))]
145    #[thread_kind = MainThreadOnly]
146    #[derive(Debug, PartialEq, Eq, Hash)]
147    pub struct UICellAccessoryDisclosureIndicator;
148);
149
150unsafe impl NSCoding for UICellAccessoryDisclosureIndicator {}
151
152unsafe impl NSCopying for UICellAccessoryDisclosureIndicator {}
153
154unsafe impl CopyingHelper for UICellAccessoryDisclosureIndicator {
155    type Result = Self;
156}
157
158unsafe impl NSObjectProtocol for UICellAccessoryDisclosureIndicator {}
159
160unsafe impl NSSecureCoding for UICellAccessoryDisclosureIndicator {}
161
162impl UICellAccessoryDisclosureIndicator {
163    extern_methods!();
164}
165
166/// Methods declared on superclass `UICellAccessory`.
167impl UICellAccessoryDisclosureIndicator {
168    extern_methods!(
169        #[unsafe(method(initWithCoder:))]
170        #[unsafe(method_family = init)]
171        pub unsafe fn initWithCoder(
172            this: Allocated<Self>,
173            coder: &NSCoder,
174        ) -> Option<Retained<Self>>;
175
176        #[unsafe(method(init))]
177        #[unsafe(method_family = init)]
178        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
179    );
180}
181
182/// Methods declared on superclass `NSObject`.
183impl UICellAccessoryDisclosureIndicator {
184    extern_methods!(
185        #[unsafe(method(new))]
186        #[unsafe(method_family = new)]
187        pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
188    );
189}
190
191extern_class!(
192    /// A detail (info) button.
193    ///
194    /// See also [Apple's documentation](https://developer.apple.com/documentation/uikit/uicellaccessorydetail?language=objc)
195    #[unsafe(super(UICellAccessory, NSObject))]
196    #[thread_kind = MainThreadOnly]
197    #[derive(Debug, PartialEq, Eq, Hash)]
198    pub struct UICellAccessoryDetail;
199);
200
201unsafe impl NSCoding for UICellAccessoryDetail {}
202
203unsafe impl NSCopying for UICellAccessoryDetail {}
204
205unsafe impl CopyingHelper for UICellAccessoryDetail {
206    type Result = Self;
207}
208
209unsafe impl NSObjectProtocol for UICellAccessoryDetail {}
210
211unsafe impl NSSecureCoding for UICellAccessoryDetail {}
212
213impl UICellAccessoryDetail {
214    extern_methods!(
215        #[cfg(feature = "block2")]
216        /// An optional handler to call when the detail accessory is tapped. If nil, taps on the accessory are ignored.
217        #[unsafe(method(actionHandler))]
218        #[unsafe(method_family = none)]
219        pub unsafe fn actionHandler(&self) -> *mut block2::Block<dyn Fn()>;
220
221        #[cfg(feature = "block2")]
222        /// Setter for [`actionHandler`][Self::actionHandler].
223        #[unsafe(method(setActionHandler:))]
224        #[unsafe(method_family = none)]
225        pub unsafe fn setActionHandler(&self, action_handler: Option<&block2::Block<dyn Fn()>>);
226    );
227}
228
229/// Methods declared on superclass `UICellAccessory`.
230impl UICellAccessoryDetail {
231    extern_methods!(
232        #[unsafe(method(initWithCoder:))]
233        #[unsafe(method_family = init)]
234        pub unsafe fn initWithCoder(
235            this: Allocated<Self>,
236            coder: &NSCoder,
237        ) -> Option<Retained<Self>>;
238
239        #[unsafe(method(init))]
240        #[unsafe(method_family = init)]
241        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
242    );
243}
244
245/// Methods declared on superclass `NSObject`.
246impl UICellAccessoryDetail {
247    extern_methods!(
248        #[unsafe(method(new))]
249        #[unsafe(method_family = new)]
250        pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
251    );
252}
253
254extern_class!(
255    /// A checkmark with default green color.
256    ///
257    /// See also [Apple's documentation](https://developer.apple.com/documentation/uikit/uicellaccessorycheckmark?language=objc)
258    #[unsafe(super(UICellAccessory, NSObject))]
259    #[thread_kind = MainThreadOnly]
260    #[derive(Debug, PartialEq, Eq, Hash)]
261    pub struct UICellAccessoryCheckmark;
262);
263
264unsafe impl NSCoding for UICellAccessoryCheckmark {}
265
266unsafe impl NSCopying for UICellAccessoryCheckmark {}
267
268unsafe impl CopyingHelper for UICellAccessoryCheckmark {
269    type Result = Self;
270}
271
272unsafe impl NSObjectProtocol for UICellAccessoryCheckmark {}
273
274unsafe impl NSSecureCoding for UICellAccessoryCheckmark {}
275
276impl UICellAccessoryCheckmark {
277    extern_methods!();
278}
279
280/// Methods declared on superclass `UICellAccessory`.
281impl UICellAccessoryCheckmark {
282    extern_methods!(
283        #[unsafe(method(initWithCoder:))]
284        #[unsafe(method_family = init)]
285        pub unsafe fn initWithCoder(
286            this: Allocated<Self>,
287            coder: &NSCoder,
288        ) -> Option<Retained<Self>>;
289
290        #[unsafe(method(init))]
291        #[unsafe(method_family = init)]
292        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
293    );
294}
295
296/// Methods declared on superclass `NSObject`.
297impl UICellAccessoryCheckmark {
298    extern_methods!(
299        #[unsafe(method(new))]
300        #[unsafe(method_family = new)]
301        pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
302    );
303}
304
305extern_class!(
306    /// A delete control (minus sign inside a circle) with default red color.
307    ///
308    /// See also [Apple's documentation](https://developer.apple.com/documentation/uikit/uicellaccessorydelete?language=objc)
309    #[unsafe(super(UICellAccessory, NSObject))]
310    #[thread_kind = MainThreadOnly]
311    #[derive(Debug, PartialEq, Eq, Hash)]
312    pub struct UICellAccessoryDelete;
313);
314
315unsafe impl NSCoding for UICellAccessoryDelete {}
316
317unsafe impl NSCopying for UICellAccessoryDelete {}
318
319unsafe impl CopyingHelper for UICellAccessoryDelete {
320    type Result = Self;
321}
322
323unsafe impl NSObjectProtocol for UICellAccessoryDelete {}
324
325unsafe impl NSSecureCoding for UICellAccessoryDelete {}
326
327impl UICellAccessoryDelete {
328    extern_methods!(
329        #[cfg(feature = "UIColor")]
330        /// The background color to apply to the accessory. Default value is nil, which uses the system default.
331        #[unsafe(method(backgroundColor))]
332        #[unsafe(method_family = none)]
333        pub unsafe fn backgroundColor(&self) -> Option<Retained<UIColor>>;
334
335        #[cfg(feature = "UIColor")]
336        /// Setter for [`backgroundColor`][Self::backgroundColor].
337        #[unsafe(method(setBackgroundColor:))]
338        #[unsafe(method_family = none)]
339        pub unsafe fn setBackgroundColor(&self, background_color: Option<&UIColor>);
340
341        #[cfg(feature = "block2")]
342        /// An optional handler to call when the delete accessory is tapped. If nil, a tap will reveal any trailing swipe actions for the cell.
343        #[unsafe(method(actionHandler))]
344        #[unsafe(method_family = none)]
345        pub unsafe fn actionHandler(&self) -> *mut block2::Block<dyn Fn()>;
346
347        #[cfg(feature = "block2")]
348        /// Setter for [`actionHandler`][Self::actionHandler].
349        #[unsafe(method(setActionHandler:))]
350        #[unsafe(method_family = none)]
351        pub unsafe fn setActionHandler(&self, action_handler: Option<&block2::Block<dyn Fn()>>);
352    );
353}
354
355/// Methods declared on superclass `UICellAccessory`.
356impl UICellAccessoryDelete {
357    extern_methods!(
358        #[unsafe(method(initWithCoder:))]
359        #[unsafe(method_family = init)]
360        pub unsafe fn initWithCoder(
361            this: Allocated<Self>,
362            coder: &NSCoder,
363        ) -> Option<Retained<Self>>;
364
365        #[unsafe(method(init))]
366        #[unsafe(method_family = init)]
367        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
368    );
369}
370
371/// Methods declared on superclass `NSObject`.
372impl UICellAccessoryDelete {
373    extern_methods!(
374        #[unsafe(method(new))]
375        #[unsafe(method_family = new)]
376        pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
377    );
378}
379
380extern_class!(
381    /// An insert control (plus sign inside a circle) with default green color.
382    ///
383    /// See also [Apple's documentation](https://developer.apple.com/documentation/uikit/uicellaccessoryinsert?language=objc)
384    #[unsafe(super(UICellAccessory, NSObject))]
385    #[thread_kind = MainThreadOnly]
386    #[derive(Debug, PartialEq, Eq, Hash)]
387    pub struct UICellAccessoryInsert;
388);
389
390unsafe impl NSCoding for UICellAccessoryInsert {}
391
392unsafe impl NSCopying for UICellAccessoryInsert {}
393
394unsafe impl CopyingHelper for UICellAccessoryInsert {
395    type Result = Self;
396}
397
398unsafe impl NSObjectProtocol for UICellAccessoryInsert {}
399
400unsafe impl NSSecureCoding for UICellAccessoryInsert {}
401
402impl UICellAccessoryInsert {
403    extern_methods!(
404        #[cfg(feature = "UIColor")]
405        /// The background color to apply to the accessory. Default value is nil, which uses the system default.
406        #[unsafe(method(backgroundColor))]
407        #[unsafe(method_family = none)]
408        pub unsafe fn backgroundColor(&self) -> Option<Retained<UIColor>>;
409
410        #[cfg(feature = "UIColor")]
411        /// Setter for [`backgroundColor`][Self::backgroundColor].
412        #[unsafe(method(setBackgroundColor:))]
413        #[unsafe(method_family = none)]
414        pub unsafe fn setBackgroundColor(&self, background_color: Option<&UIColor>);
415
416        #[cfg(feature = "block2")]
417        /// An optional handler to call when the insert accessory is tapped. If nil, taps on the accessory are ignored.
418        #[unsafe(method(actionHandler))]
419        #[unsafe(method_family = none)]
420        pub unsafe fn actionHandler(&self) -> *mut block2::Block<dyn Fn()>;
421
422        #[cfg(feature = "block2")]
423        /// Setter for [`actionHandler`][Self::actionHandler].
424        #[unsafe(method(setActionHandler:))]
425        #[unsafe(method_family = none)]
426        pub unsafe fn setActionHandler(&self, action_handler: Option<&block2::Block<dyn Fn()>>);
427    );
428}
429
430/// Methods declared on superclass `UICellAccessory`.
431impl UICellAccessoryInsert {
432    extern_methods!(
433        #[unsafe(method(initWithCoder:))]
434        #[unsafe(method_family = init)]
435        pub unsafe fn initWithCoder(
436            this: Allocated<Self>,
437            coder: &NSCoder,
438        ) -> Option<Retained<Self>>;
439
440        #[unsafe(method(init))]
441        #[unsafe(method_family = init)]
442        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
443    );
444}
445
446/// Methods declared on superclass `NSObject`.
447impl UICellAccessoryInsert {
448    extern_methods!(
449        #[unsafe(method(new))]
450        #[unsafe(method_family = new)]
451        pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
452    );
453}
454
455extern_class!(
456    /// A reorder control (three horizontal lines) with default gray color that automatically initiates interactive
457    /// reordering on the collection view when dragged (if supported).
458    ///
459    /// See also [Apple's documentation](https://developer.apple.com/documentation/uikit/uicellaccessoryreorder?language=objc)
460    #[unsafe(super(UICellAccessory, NSObject))]
461    #[thread_kind = MainThreadOnly]
462    #[derive(Debug, PartialEq, Eq, Hash)]
463    pub struct UICellAccessoryReorder;
464);
465
466unsafe impl NSCoding for UICellAccessoryReorder {}
467
468unsafe impl NSCopying for UICellAccessoryReorder {}
469
470unsafe impl CopyingHelper for UICellAccessoryReorder {
471    type Result = Self;
472}
473
474unsafe impl NSObjectProtocol for UICellAccessoryReorder {}
475
476unsafe impl NSSecureCoding for UICellAccessoryReorder {}
477
478impl UICellAccessoryReorder {
479    extern_methods!(
480        /// Whether a vertical separator is displayed before the accessory when it is placed after another accessory. Default is YES.
481        #[unsafe(method(showsVerticalSeparator))]
482        #[unsafe(method_family = none)]
483        pub unsafe fn showsVerticalSeparator(&self) -> bool;
484
485        /// Setter for [`showsVerticalSeparator`][Self::showsVerticalSeparator].
486        #[unsafe(method(setShowsVerticalSeparator:))]
487        #[unsafe(method_family = none)]
488        pub unsafe fn setShowsVerticalSeparator(&self, shows_vertical_separator: bool);
489    );
490}
491
492/// Methods declared on superclass `UICellAccessory`.
493impl UICellAccessoryReorder {
494    extern_methods!(
495        #[unsafe(method(initWithCoder:))]
496        #[unsafe(method_family = init)]
497        pub unsafe fn initWithCoder(
498            this: Allocated<Self>,
499            coder: &NSCoder,
500        ) -> Option<Retained<Self>>;
501
502        #[unsafe(method(init))]
503        #[unsafe(method_family = init)]
504        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
505    );
506}
507
508/// Methods declared on superclass `NSObject`.
509impl UICellAccessoryReorder {
510    extern_methods!(
511        #[unsafe(method(new))]
512        #[unsafe(method_family = new)]
513        pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
514    );
515}
516
517extern_class!(
518    /// A two-state control whose appearance follows the selection state of the cell (empty circle when deselected,
519    /// filled circle with checkmark when selected).
520    ///
521    /// See also [Apple's documentation](https://developer.apple.com/documentation/uikit/uicellaccessorymultiselect?language=objc)
522    #[unsafe(super(UICellAccessory, NSObject))]
523    #[thread_kind = MainThreadOnly]
524    #[derive(Debug, PartialEq, Eq, Hash)]
525    pub struct UICellAccessoryMultiselect;
526);
527
528unsafe impl NSCoding for UICellAccessoryMultiselect {}
529
530unsafe impl NSCopying for UICellAccessoryMultiselect {}
531
532unsafe impl CopyingHelper for UICellAccessoryMultiselect {
533    type Result = Self;
534}
535
536unsafe impl NSObjectProtocol for UICellAccessoryMultiselect {}
537
538unsafe impl NSSecureCoding for UICellAccessoryMultiselect {}
539
540impl UICellAccessoryMultiselect {
541    extern_methods!(
542        #[cfg(feature = "UIColor")]
543        /// The background color to apply to the accessory. Default value is nil, which uses the system default.
544        #[unsafe(method(backgroundColor))]
545        #[unsafe(method_family = none)]
546        pub unsafe fn backgroundColor(&self) -> Option<Retained<UIColor>>;
547
548        #[cfg(feature = "UIColor")]
549        /// Setter for [`backgroundColor`][Self::backgroundColor].
550        #[unsafe(method(setBackgroundColor:))]
551        #[unsafe(method_family = none)]
552        pub unsafe fn setBackgroundColor(&self, background_color: Option<&UIColor>);
553    );
554}
555
556/// Methods declared on superclass `UICellAccessory`.
557impl UICellAccessoryMultiselect {
558    extern_methods!(
559        #[unsafe(method(initWithCoder:))]
560        #[unsafe(method_family = init)]
561        pub unsafe fn initWithCoder(
562            this: Allocated<Self>,
563            coder: &NSCoder,
564        ) -> Option<Retained<Self>>;
565
566        #[unsafe(method(init))]
567        #[unsafe(method_family = init)]
568        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
569    );
570}
571
572/// Methods declared on superclass `NSObject`.
573impl UICellAccessoryMultiselect {
574    extern_methods!(
575        #[unsafe(method(new))]
576        #[unsafe(method_family = new)]
577        pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
578    );
579}
580
581/// [Apple's documentation](https://developer.apple.com/documentation/uikit/uicellaccessoryoutlinedisclosurestyle?language=objc)
582// NS_ENUM
583#[repr(transparent)]
584#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
585pub struct UICellAccessoryOutlineDisclosureStyle(pub NSInteger);
586impl UICellAccessoryOutlineDisclosureStyle {
587    /// The style will be automatically determined based on whether the cell is configured to be a section header or not.
588    #[doc(alias = "UICellAccessoryOutlineDisclosureStyleAutomatic")]
589    pub const Automatic: Self = Self(0);
590    /// A style appropriate for a section header, where a tap anywhere in the header will toggle the expansion state
591    /// of the item (the cell cannot be selected).
592    #[doc(alias = "UICellAccessoryOutlineDisclosureStyleHeader")]
593    pub const Header: Self = Self(1);
594    /// A style appropriate for a cell which can be selected itself and also has nested children, where only taps on the
595    /// outline disclosure will toggle the expansion state of the item; taps on the cell will select the item as normal.
596    #[doc(alias = "UICellAccessoryOutlineDisclosureStyleCell")]
597    pub const Cell: Self = Self(2);
598}
599
600unsafe impl Encode for UICellAccessoryOutlineDisclosureStyle {
601    const ENCODING: Encoding = NSInteger::ENCODING;
602}
603
604unsafe impl RefEncode for UICellAccessoryOutlineDisclosureStyle {
605    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
606}
607
608extern_class!(
609    /// A rotating disclosure chevron for use with outlines, used to indicate and toggle the expanded/collapsed state of the item.
610    ///
611    /// See also [Apple's documentation](https://developer.apple.com/documentation/uikit/uicellaccessoryoutlinedisclosure?language=objc)
612    #[unsafe(super(UICellAccessory, NSObject))]
613    #[thread_kind = MainThreadOnly]
614    #[derive(Debug, PartialEq, Eq, Hash)]
615    pub struct UICellAccessoryOutlineDisclosure;
616);
617
618unsafe impl NSCoding for UICellAccessoryOutlineDisclosure {}
619
620unsafe impl NSCopying for UICellAccessoryOutlineDisclosure {}
621
622unsafe impl CopyingHelper for UICellAccessoryOutlineDisclosure {
623    type Result = Self;
624}
625
626unsafe impl NSObjectProtocol for UICellAccessoryOutlineDisclosure {}
627
628unsafe impl NSSecureCoding for UICellAccessoryOutlineDisclosure {}
629
630impl UICellAccessoryOutlineDisclosure {
631    extern_methods!(
632        /// The style of the outline disclosure accessory. Default is automatic.
633        #[unsafe(method(style))]
634        #[unsafe(method_family = none)]
635        pub unsafe fn style(&self) -> UICellAccessoryOutlineDisclosureStyle;
636
637        /// Setter for [`style`][Self::style].
638        #[unsafe(method(setStyle:))]
639        #[unsafe(method_family = none)]
640        pub unsafe fn setStyle(&self, style: UICellAccessoryOutlineDisclosureStyle);
641
642        #[cfg(feature = "block2")]
643        /// An optional handler to call when the outline disclosure accessory is tapped. If nil, the default behavior when using
644        /// a NSDiffableDataSourceSectionSnapshot is to toggle the expand/collapse state of the item in the section snapshot.
645        #[unsafe(method(actionHandler))]
646        #[unsafe(method_family = none)]
647        pub unsafe fn actionHandler(&self) -> *mut block2::Block<dyn Fn()>;
648
649        #[cfg(feature = "block2")]
650        /// Setter for [`actionHandler`][Self::actionHandler].
651        #[unsafe(method(setActionHandler:))]
652        #[unsafe(method_family = none)]
653        pub unsafe fn setActionHandler(&self, action_handler: Option<&block2::Block<dyn Fn()>>);
654    );
655}
656
657/// Methods declared on superclass `UICellAccessory`.
658impl UICellAccessoryOutlineDisclosure {
659    extern_methods!(
660        #[unsafe(method(initWithCoder:))]
661        #[unsafe(method_family = init)]
662        pub unsafe fn initWithCoder(
663            this: Allocated<Self>,
664            coder: &NSCoder,
665        ) -> Option<Retained<Self>>;
666
667        #[unsafe(method(init))]
668        #[unsafe(method_family = init)]
669        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
670    );
671}
672
673/// Methods declared on superclass `NSObject`.
674impl UICellAccessoryOutlineDisclosure {
675    extern_methods!(
676        #[unsafe(method(new))]
677        #[unsafe(method_family = new)]
678        pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
679    );
680}
681
682extern_class!(
683    /// Up/down chevrons that indicate a tap anywhere in the cell presents a pop-up menu.
684    ///
685    /// See also [Apple's documentation](https://developer.apple.com/documentation/uikit/uicellaccessorypopupmenu?language=objc)
686    #[unsafe(super(UICellAccessory, NSObject))]
687    #[thread_kind = MainThreadOnly]
688    #[derive(Debug, PartialEq, Eq, Hash)]
689    pub struct UICellAccessoryPopUpMenu;
690);
691
692unsafe impl NSCoding for UICellAccessoryPopUpMenu {}
693
694unsafe impl NSCopying for UICellAccessoryPopUpMenu {}
695
696unsafe impl CopyingHelper for UICellAccessoryPopUpMenu {
697    type Result = Self;
698}
699
700unsafe impl NSObjectProtocol for UICellAccessoryPopUpMenu {}
701
702unsafe impl NSSecureCoding for UICellAccessoryPopUpMenu {}
703
704impl UICellAccessoryPopUpMenu {
705    extern_methods!(
706        #[cfg(all(feature = "UIMenu", feature = "UIMenuElement"))]
707        /// Creates a new pop-up menu accessory using the provided menu.
708        #[unsafe(method(initWithMenu:))]
709        #[unsafe(method_family = init)]
710        pub unsafe fn initWithMenu(this: Allocated<Self>, menu: &UIMenu) -> Retained<Self>;
711
712        #[cfg(all(feature = "UIMenu", feature = "UIMenuElement"))]
713        #[unsafe(method(menu))]
714        #[unsafe(method_family = none)]
715        pub unsafe fn menu(&self) -> Retained<UIMenu>;
716
717        #[cfg(all(feature = "UIMenu", feature = "UIMenuElement", feature = "block2"))]
718        /// An optional handler to call when the selected element in the menu changes.
719        #[unsafe(method(selectedElementDidChangeHandler))]
720        #[unsafe(method_family = none)]
721        pub unsafe fn selectedElementDidChangeHandler(
722            &self,
723        ) -> *mut block2::Block<dyn Fn(NonNull<UIMenu>)>;
724
725        #[cfg(all(feature = "UIMenu", feature = "UIMenuElement", feature = "block2"))]
726        /// Setter for [`selectedElementDidChangeHandler`][Self::selectedElementDidChangeHandler].
727        #[unsafe(method(setSelectedElementDidChangeHandler:))]
728        #[unsafe(method_family = none)]
729        pub unsafe fn setSelectedElementDidChangeHandler(
730            &self,
731            selected_element_did_change_handler: Option<&block2::Block<dyn Fn(NonNull<UIMenu>)>>,
732        );
733
734        #[unsafe(method(initWithCoder:))]
735        #[unsafe(method_family = init)]
736        pub unsafe fn initWithCoder(
737            this: Allocated<Self>,
738            coder: &NSCoder,
739        ) -> Option<Retained<Self>>;
740
741        #[unsafe(method(init))]
742        #[unsafe(method_family = init)]
743        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
744
745        #[unsafe(method(new))]
746        #[unsafe(method_family = new)]
747        pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
748    );
749}
750
751extern_class!(
752    /// A label displaying a short string of text, typically a small number such as a count for the associated item.
753    ///
754    /// See also [Apple's documentation](https://developer.apple.com/documentation/uikit/uicellaccessorylabel?language=objc)
755    #[unsafe(super(UICellAccessory, NSObject))]
756    #[thread_kind = MainThreadOnly]
757    #[derive(Debug, PartialEq, Eq, Hash)]
758    pub struct UICellAccessoryLabel;
759);
760
761unsafe impl NSCoding for UICellAccessoryLabel {}
762
763unsafe impl NSCopying for UICellAccessoryLabel {}
764
765unsafe impl CopyingHelper for UICellAccessoryLabel {
766    type Result = Self;
767}
768
769unsafe impl NSObjectProtocol for UICellAccessoryLabel {}
770
771unsafe impl NSSecureCoding for UICellAccessoryLabel {}
772
773impl UICellAccessoryLabel {
774    extern_methods!(
775        /// Creates a new label accessory using the provided text.
776        #[unsafe(method(initWithText:))]
777        #[unsafe(method_family = init)]
778        pub unsafe fn initWithText(this: Allocated<Self>, text: &NSString) -> Retained<Self>;
779
780        #[unsafe(method(text))]
781        #[unsafe(method_family = none)]
782        pub unsafe fn text(&self) -> Retained<NSString>;
783
784        #[cfg(feature = "UIFont")]
785        /// The font used for the label. Default is the preferred font for UIFontTextStyleBody.
786        #[unsafe(method(font))]
787        #[unsafe(method_family = none)]
788        pub unsafe fn font(&self) -> Retained<UIFont>;
789
790        #[cfg(feature = "UIFont")]
791        /// Setter for [`font`][Self::font].
792        #[unsafe(method(setFont:))]
793        #[unsafe(method_family = none)]
794        pub unsafe fn setFont(&self, font: &UIFont);
795
796        /// Whether the label automatically adjusts its font based on the content size category. Default is YES.
797        #[unsafe(method(adjustsFontForContentSizeCategory))]
798        #[unsafe(method_family = none)]
799        pub unsafe fn adjustsFontForContentSizeCategory(&self) -> bool;
800
801        /// Setter for [`adjustsFontForContentSizeCategory`][Self::adjustsFontForContentSizeCategory].
802        #[unsafe(method(setAdjustsFontForContentSizeCategory:))]
803        #[unsafe(method_family = none)]
804        pub unsafe fn setAdjustsFontForContentSizeCategory(
805            &self,
806            adjusts_font_for_content_size_category: bool,
807        );
808
809        #[unsafe(method(initWithCoder:))]
810        #[unsafe(method_family = init)]
811        pub unsafe fn initWithCoder(
812            this: Allocated<Self>,
813            coder: &NSCoder,
814        ) -> Option<Retained<Self>>;
815
816        #[unsafe(method(init))]
817        #[unsafe(method_family = init)]
818        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
819
820        #[unsafe(method(new))]
821        #[unsafe(method_family = new)]
822        pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
823    );
824}
825
826/// [Apple's documentation](https://developer.apple.com/documentation/uikit/uicellaccessoryplacement?language=objc)
827// NS_ENUM
828#[repr(transparent)]
829#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
830pub struct UICellAccessoryPlacement(pub NSInteger);
831impl UICellAccessoryPlacement {
832    /// Accessory placed on the leading edge.
833    #[doc(alias = "UICellAccessoryPlacementLeading")]
834    pub const Leading: Self = Self(0);
835    /// Accessory placed on the trailing edge.
836    #[doc(alias = "UICellAccessoryPlacementTrailing")]
837    pub const Trailing: Self = Self(1);
838}
839
840unsafe impl Encode for UICellAccessoryPlacement {
841    const ENCODING: Encoding = NSInteger::ENCODING;
842}
843
844unsafe impl RefEncode for UICellAccessoryPlacement {
845    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
846}
847
848/// Return an index to insert the accessory at, given an array of the existing accessories on the edge (in leading to trailing order).
849///
850/// See also [Apple's documentation](https://developer.apple.com/documentation/uikit/uicellaccessoryposition?language=objc)
851#[cfg(feature = "block2")]
852pub type UICellAccessoryPosition =
853    *mut block2::Block<dyn Fn(NonNull<NSArray<UICellAccessory>>) -> NSUInteger>;
854
855extern "C-unwind" {
856    /// Positions the accessory before the accessory matching the class specified, or at the beginning if not found.
857    #[cfg(feature = "block2")]
858    pub fn UICellAccessoryPositionBeforeAccessoryOfClass(
859        accessory_class: &AnyClass,
860    ) -> UICellAccessoryPosition;
861}
862
863extern "C-unwind" {
864    /// Positions the accessory after the accessory matching the class specified, or at the end if not found.
865    #[cfg(feature = "block2")]
866    pub fn UICellAccessoryPositionAfterAccessoryOfClass(
867        accessory_class: &AnyClass,
868    ) -> UICellAccessoryPosition;
869}
870
871extern_class!(
872    /// An accessory using a custom view.
873    ///
874    /// See also [Apple's documentation](https://developer.apple.com/documentation/uikit/uicellaccessorycustomview?language=objc)
875    #[unsafe(super(UICellAccessory, NSObject))]
876    #[thread_kind = MainThreadOnly]
877    #[derive(Debug, PartialEq, Eq, Hash)]
878    pub struct UICellAccessoryCustomView;
879);
880
881unsafe impl NSCoding for UICellAccessoryCustomView {}
882
883unsafe impl NSCopying for UICellAccessoryCustomView {}
884
885unsafe impl CopyingHelper for UICellAccessoryCustomView {
886    type Result = Self;
887}
888
889unsafe impl NSObjectProtocol for UICellAccessoryCustomView {}
890
891unsafe impl NSSecureCoding for UICellAccessoryCustomView {}
892
893impl UICellAccessoryCustomView {
894    extern_methods!(
895        #[cfg(all(feature = "UIResponder", feature = "UIView"))]
896        /// Creates a new custom view accessory using the provided view and specified placement. The custom view must have translatesAutoresizingMaskIntoConstraints
897        /// enabled, but may use auto layout constraints internally for layout of subviews and/or to indicate its preferred size.
898        #[unsafe(method(initWithCustomView:placement:))]
899        #[unsafe(method_family = init)]
900        pub unsafe fn initWithCustomView_placement(
901            this: Allocated<Self>,
902            custom_view: &UIView,
903            placement: UICellAccessoryPlacement,
904        ) -> Retained<Self>;
905
906        #[cfg(all(feature = "UIResponder", feature = "UIView"))]
907        #[unsafe(method(customView))]
908        #[unsafe(method_family = none)]
909        pub unsafe fn customView(&self) -> Retained<UIView>;
910
911        #[unsafe(method(placement))]
912        #[unsafe(method_family = none)]
913        pub unsafe fn placement(&self) -> UICellAccessoryPlacement;
914
915        /// Whether the current frame size of the view is preserved (YES), or whether it is sized during layout of accessories (NO). Default is NO.
916        #[unsafe(method(maintainsFixedSize))]
917        #[unsafe(method_family = none)]
918        pub unsafe fn maintainsFixedSize(&self) -> bool;
919
920        /// Setter for [`maintainsFixedSize`][Self::maintainsFixedSize].
921        #[unsafe(method(setMaintainsFixedSize:))]
922        #[unsafe(method_family = none)]
923        pub unsafe fn setMaintainsFixedSize(&self, maintains_fixed_size: bool);
924
925        #[cfg(feature = "block2")]
926        /// Allows customizing the relative position of the accessory amongst any other accessories displayed on the same edge.
927        /// The default is to insert the accessory at a position closest to the inside of the cell.
928        #[unsafe(method(position))]
929        #[unsafe(method_family = none)]
930        pub unsafe fn position(&self) -> UICellAccessoryPosition;
931
932        #[cfg(feature = "block2")]
933        /// Setter for [`position`][Self::position].
934        #[unsafe(method(setPosition:))]
935        #[unsafe(method_family = none)]
936        pub unsafe fn setPosition(&self, position: UICellAccessoryPosition);
937
938        #[unsafe(method(initWithCoder:))]
939        #[unsafe(method_family = init)]
940        pub unsafe fn initWithCoder(
941            this: Allocated<Self>,
942            coder: &NSCoder,
943        ) -> Option<Retained<Self>>;
944
945        #[unsafe(method(init))]
946        #[unsafe(method_family = init)]
947        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
948
949        #[unsafe(method(new))]
950        #[unsafe(method_family = new)]
951        pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
952    );
953}