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