objc2_car_play/generated/
CPAlertAction.rs1use core::ffi::*;
4use core::ptr::NonNull;
5use objc2::__framework_prelude::*;
6use objc2_foundation::*;
7#[cfg(feature = "objc2-ui-kit")]
8use objc2_ui_kit::*;
9
10use crate::*;
11
12#[repr(transparent)]
15#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
16pub struct CPAlertActionStyle(pub NSUInteger);
17impl CPAlertActionStyle {
18 #[doc(alias = "CPAlertActionStyleDefault")]
19 pub const Default: Self = Self(0);
20 #[doc(alias = "CPAlertActionStyleCancel")]
21 pub const Cancel: Self = Self(1);
22 #[doc(alias = "CPAlertActionStyleDestructive")]
23 pub const Destructive: Self = Self(2);
24}
25
26unsafe impl Encode for CPAlertActionStyle {
27 const ENCODING: Encoding = NSUInteger::ENCODING;
28}
29
30unsafe impl RefEncode for CPAlertActionStyle {
31 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
32}
33
34#[cfg(feature = "block2")]
36pub type CPAlertActionHandler = *mut block2::DynBlock<dyn Fn(NonNull<CPAlertAction>)>;
37
38extern_class!(
39 #[unsafe(super(NSObject))]
51 #[derive(Debug, PartialEq, Eq, Hash)]
52 pub struct CPAlertAction;
53);
54
55extern_conformance!(
56 unsafe impl NSCoding for CPAlertAction {}
57);
58
59extern_conformance!(
60 unsafe impl NSObjectProtocol for CPAlertAction {}
61);
62
63extern_conformance!(
64 unsafe impl NSSecureCoding for CPAlertAction {}
65);
66
67impl CPAlertAction {
68 extern_methods!(
69 #[unsafe(method(init))]
70 #[unsafe(method_family = init)]
71 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
72
73 #[unsafe(method(new))]
74 #[unsafe(method_family = new)]
75 pub unsafe fn new() -> Retained<Self>;
76
77 #[cfg(feature = "block2")]
78 #[unsafe(method(initWithTitle:style:handler:))]
85 #[unsafe(method_family = init)]
86 pub unsafe fn initWithTitle_style_handler(
87 this: Allocated<Self>,
88 title: &NSString,
89 style: CPAlertActionStyle,
90 handler: CPAlertActionHandler,
91 ) -> Retained<Self>;
92
93 #[cfg(all(feature = "block2", feature = "objc2-ui-kit"))]
94 #[unsafe(method(initWithTitle:color:handler:))]
106 #[unsafe(method_family = init)]
107 pub unsafe fn initWithTitle_color_handler(
108 this: Allocated<Self>,
109 title: &NSString,
110 color: &UIColor,
111 handler: CPAlertActionHandler,
112 ) -> Retained<Self>;
113
114 #[unsafe(method(title))]
115 #[unsafe(method_family = none)]
116 pub unsafe fn title(&self) -> Retained<NSString>;
117
118 #[unsafe(method(style))]
119 #[unsafe(method_family = none)]
120 pub unsafe fn style(&self) -> CPAlertActionStyle;
121
122 #[cfg(feature = "block2")]
123 #[unsafe(method(handler))]
127 #[unsafe(method_family = none)]
128 pub unsafe fn handler(&self) -> CPAlertActionHandler;
129
130 #[cfg(feature = "objc2-ui-kit")]
131 #[unsafe(method(color))]
132 #[unsafe(method_family = none)]
133 pub unsafe fn color(&self) -> Option<Retained<UIColor>>;
134 );
135}