objc2_watch_kit/generated/
WKAlertAction.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::*;
6use objc2_foundation::*;
7
8use crate::*;
9
10/// [Apple's documentation](https://developer.apple.com/documentation/watchkit/wkalertactionstyle?language=objc)
11// NS_ENUM
12#[repr(transparent)]
13#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
14pub struct WKAlertActionStyle(pub NSInteger);
15impl WKAlertActionStyle {
16    #[doc(alias = "WKAlertActionStyleDefault")]
17    pub const Default: Self = Self(0);
18    #[doc(alias = "WKAlertActionStyleCancel")]
19    pub const Cancel: Self = Self(1);
20    #[doc(alias = "WKAlertActionStyleDestructive")]
21    pub const Destructive: Self = Self(2);
22}
23
24unsafe impl Encode for WKAlertActionStyle {
25    const ENCODING: Encoding = NSInteger::ENCODING;
26}
27
28unsafe impl RefEncode for WKAlertActionStyle {
29    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
30}
31
32/// [Apple's documentation](https://developer.apple.com/documentation/watchkit/wkalertactionhandler?language=objc)
33#[cfg(feature = "block2")]
34pub type WKAlertActionHandler = *mut block2::DynBlock<dyn Fn()>;
35
36extern_class!(
37    /// [Apple's documentation](https://developer.apple.com/documentation/watchkit/wkalertaction?language=objc)
38    #[unsafe(super(NSObject))]
39    #[derive(Debug, PartialEq, Eq, Hash)]
40    pub struct WKAlertAction;
41);
42
43extern_conformance!(
44    unsafe impl NSObjectProtocol for WKAlertAction {}
45);
46
47impl WKAlertAction {
48    extern_methods!(
49        #[cfg(feature = "block2")]
50        /// # Safety
51        ///
52        /// `handler` must be a valid pointer.
53        #[unsafe(method(actionWithTitle:style:handler:))]
54        #[unsafe(method_family = none)]
55        pub unsafe fn actionWithTitle_style_handler(
56            title: &NSString,
57            style: WKAlertActionStyle,
58            handler: WKAlertActionHandler,
59        ) -> Retained<Self>;
60
61        #[unsafe(method(init))]
62        #[unsafe(method_family = init)]
63        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
64    );
65}
66
67/// Methods declared on superclass `NSObject`.
68impl WKAlertAction {
69    extern_methods!(
70        #[unsafe(method(new))]
71        #[unsafe(method_family = new)]
72        pub unsafe fn new() -> Retained<Self>;
73    );
74}