objc2_app_kit/generated/
NSAccessibilityCustomAction.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
10extern_class!(
11    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsaccessibilitycustomaction?language=objc)
12    #[unsafe(super(NSObject))]
13    #[derive(Debug, PartialEq, Eq, Hash)]
14    pub struct NSAccessibilityCustomAction;
15);
16
17extern_conformance!(
18    unsafe impl NSObjectProtocol for NSAccessibilityCustomAction {}
19);
20
21impl NSAccessibilityCustomAction {
22    extern_methods!(
23        #[cfg(feature = "block2")]
24        #[unsafe(method(initWithName:handler:))]
25        #[unsafe(method_family = init)]
26        pub fn initWithName_handler(
27            this: Allocated<Self>,
28            name: &NSString,
29            handler: Option<&block2::DynBlock<dyn Fn() -> Bool>>,
30        ) -> Retained<Self>;
31
32        /// # Safety
33        ///
34        /// - `target` should be of the correct type.
35        /// - `selector` must be a valid selector.
36        #[unsafe(method(initWithName:target:selector:))]
37        #[unsafe(method_family = init)]
38        pub unsafe fn initWithName_target_selector(
39            this: Allocated<Self>,
40            name: &NSString,
41            target: &ProtocolObject<dyn NSObjectProtocol>,
42            selector: Sel,
43        ) -> Retained<Self>;
44
45        #[unsafe(method(name))]
46        #[unsafe(method_family = none)]
47        pub fn name(&self) -> Retained<NSString>;
48
49        /// Setter for [`name`][Self::name].
50        ///
51        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
52        #[unsafe(method(setName:))]
53        #[unsafe(method_family = none)]
54        pub fn setName(&self, name: &NSString);
55
56        #[cfg(feature = "block2")]
57        #[unsafe(method(handler))]
58        #[unsafe(method_family = none)]
59        pub fn handler(&self) -> *mut block2::DynBlock<dyn Fn() -> Bool>;
60
61        #[cfg(feature = "block2")]
62        /// Setter for [`handler`][Self::handler].
63        ///
64        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
65        #[unsafe(method(setHandler:))]
66        #[unsafe(method_family = none)]
67        pub fn setHandler(&self, handler: Option<&block2::DynBlock<dyn Fn() -> Bool>>);
68
69        #[unsafe(method(target))]
70        #[unsafe(method_family = none)]
71        pub fn target(&self) -> Option<Retained<ProtocolObject<dyn NSObjectProtocol>>>;
72
73        /// Setter for [`target`][Self::target].
74        ///
75        /// This is a [weak property][objc2::topics::weak_property].
76        ///
77        /// # Safety
78        ///
79        /// `target` should be of the correct type.
80        #[unsafe(method(setTarget:))]
81        #[unsafe(method_family = none)]
82        pub unsafe fn setTarget(&self, target: Option<&ProtocolObject<dyn NSObjectProtocol>>);
83
84        #[unsafe(method(selector))]
85        #[unsafe(method_family = none)]
86        pub fn selector(&self) -> Option<Sel>;
87
88        /// Setter for [`selector`][Self::selector].
89        ///
90        /// # Safety
91        ///
92        /// `selector` must be a valid selector.
93        #[unsafe(method(setSelector:))]
94        #[unsafe(method_family = none)]
95        pub unsafe fn setSelector(&self, selector: Option<Sel>);
96    );
97}
98
99/// Methods declared on superclass `NSObject`.
100impl NSAccessibilityCustomAction {
101    extern_methods!(
102        #[unsafe(method(init))]
103        #[unsafe(method_family = init)]
104        pub fn init(this: Allocated<Self>) -> Retained<Self>;
105
106        #[unsafe(method(new))]
107        #[unsafe(method_family = new)]
108        pub fn new() -> Retained<Self>;
109    );
110}
111
112impl DefaultRetained for NSAccessibilityCustomAction {
113    #[inline]
114    fn default_retained() -> Retained<Self> {
115        Self::new()
116    }
117}