objc2_ui_kit/generated/
UIAccessibilityCustomAction.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/uikit/uiaccessibilitycustomactionhandler?language=objc)
11#[cfg(feature = "block2")]
12pub type UIAccessibilityCustomActionHandler =
13    *mut block2::DynBlock<dyn Fn(NonNull<UIAccessibilityCustomAction>) -> Bool>;
14
15extern_class!(
16    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uiaccessibilitycustomaction?language=objc)
17    #[unsafe(super(NSObject))]
18    #[thread_kind = MainThreadOnly]
19    #[derive(Debug, PartialEq, Eq, Hash)]
20    pub struct UIAccessibilityCustomAction;
21);
22
23extern_conformance!(
24    unsafe impl NSObjectProtocol for UIAccessibilityCustomAction {}
25);
26
27impl UIAccessibilityCustomAction {
28    extern_methods!(
29        /// # Safety
30        ///
31        /// - `target` should be of the correct type.
32        /// - `selector` must be a valid selector.
33        #[unsafe(method(initWithName:target:selector:))]
34        #[unsafe(method_family = init)]
35        pub unsafe fn initWithName_target_selector(
36            this: Allocated<Self>,
37            name: &NSString,
38            target: Option<&AnyObject>,
39            selector: Sel,
40        ) -> Retained<Self>;
41
42        /// # Safety
43        ///
44        /// - `target` should be of the correct type.
45        /// - `selector` must be a valid selector.
46        #[unsafe(method(initWithAttributedName:target:selector:))]
47        #[unsafe(method_family = init)]
48        pub unsafe fn initWithAttributedName_target_selector(
49            this: Allocated<Self>,
50            attributed_name: &NSAttributedString,
51            target: Option<&AnyObject>,
52            selector: Sel,
53        ) -> Retained<Self>;
54
55        #[cfg(feature = "UIImage")]
56        /// # Safety
57        ///
58        /// - `target` should be of the correct type.
59        /// - `selector` must be a valid selector.
60        #[unsafe(method(initWithName:image:target:selector:))]
61        #[unsafe(method_family = init)]
62        pub unsafe fn initWithName_image_target_selector(
63            this: Allocated<Self>,
64            name: &NSString,
65            image: Option<&UIImage>,
66            target: Option<&AnyObject>,
67            selector: Sel,
68        ) -> Retained<Self>;
69
70        #[cfg(feature = "UIImage")]
71        /// # Safety
72        ///
73        /// - `target` should be of the correct type.
74        /// - `selector` must be a valid selector.
75        #[unsafe(method(initWithAttributedName:image:target:selector:))]
76        #[unsafe(method_family = init)]
77        pub unsafe fn initWithAttributedName_image_target_selector(
78            this: Allocated<Self>,
79            attributed_name: &NSAttributedString,
80            image: Option<&UIImage>,
81            target: Option<&AnyObject>,
82            selector: Sel,
83        ) -> Retained<Self>;
84
85        #[cfg(feature = "block2")]
86        /// # Safety
87        ///
88        /// `action_handler` must be a valid pointer.
89        #[unsafe(method(initWithName:actionHandler:))]
90        #[unsafe(method_family = init)]
91        pub unsafe fn initWithName_actionHandler(
92            this: Allocated<Self>,
93            name: &NSString,
94            action_handler: UIAccessibilityCustomActionHandler,
95        ) -> Retained<Self>;
96
97        #[cfg(feature = "block2")]
98        /// # Safety
99        ///
100        /// `action_handler` must be a valid pointer.
101        #[unsafe(method(initWithAttributedName:actionHandler:))]
102        #[unsafe(method_family = init)]
103        pub unsafe fn initWithAttributedName_actionHandler(
104            this: Allocated<Self>,
105            attributed_name: &NSAttributedString,
106            action_handler: UIAccessibilityCustomActionHandler,
107        ) -> Retained<Self>;
108
109        #[cfg(all(feature = "UIImage", feature = "block2"))]
110        /// # Safety
111        ///
112        /// `action_handler` must be a valid pointer.
113        #[unsafe(method(initWithName:image:actionHandler:))]
114        #[unsafe(method_family = init)]
115        pub unsafe fn initWithName_image_actionHandler(
116            this: Allocated<Self>,
117            name: &NSString,
118            image: Option<&UIImage>,
119            action_handler: UIAccessibilityCustomActionHandler,
120        ) -> Retained<Self>;
121
122        #[cfg(all(feature = "UIImage", feature = "block2"))]
123        /// # Safety
124        ///
125        /// `action_handler` must be a valid pointer.
126        #[unsafe(method(initWithAttributedName:image:actionHandler:))]
127        #[unsafe(method_family = init)]
128        pub unsafe fn initWithAttributedName_image_actionHandler(
129            this: Allocated<Self>,
130            attributed_name: &NSAttributedString,
131            image: Option<&UIImage>,
132            action_handler: UIAccessibilityCustomActionHandler,
133        ) -> Retained<Self>;
134
135        #[unsafe(method(name))]
136        #[unsafe(method_family = none)]
137        pub fn name(&self) -> Retained<NSString>;
138
139        /// Setter for [`name`][Self::name].
140        ///
141        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
142        #[unsafe(method(setName:))]
143        #[unsafe(method_family = none)]
144        pub fn setName(&self, name: &NSString);
145
146        #[cfg(feature = "UIImage")]
147        #[unsafe(method(image))]
148        #[unsafe(method_family = none)]
149        pub fn image(&self) -> Option<Retained<UIImage>>;
150
151        #[cfg(feature = "UIImage")]
152        /// Setter for [`image`][Self::image].
153        #[unsafe(method(setImage:))]
154        #[unsafe(method_family = none)]
155        pub fn setImage(&self, image: Option<&UIImage>);
156
157        #[unsafe(method(attributedName))]
158        #[unsafe(method_family = none)]
159        pub fn attributedName(&self) -> Retained<NSAttributedString>;
160
161        /// Setter for [`attributedName`][Self::attributedName].
162        ///
163        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
164        #[unsafe(method(setAttributedName:))]
165        #[unsafe(method_family = none)]
166        pub fn setAttributedName(&self, attributed_name: &NSAttributedString);
167
168        #[unsafe(method(target))]
169        #[unsafe(method_family = none)]
170        pub fn target(&self) -> Option<Retained<AnyObject>>;
171
172        /// Setter for [`target`][Self::target].
173        ///
174        /// This is a [weak property][objc2::topics::weak_property].
175        ///
176        /// # Safety
177        ///
178        /// `target` should be of the correct type.
179        #[unsafe(method(setTarget:))]
180        #[unsafe(method_family = none)]
181        pub unsafe fn setTarget(&self, target: Option<&AnyObject>);
182
183        /// # Safety
184        ///
185        /// You must ensure this is still alive.
186        #[unsafe(method(selector))]
187        #[unsafe(method_family = none)]
188        pub unsafe fn selector(&self) -> Sel;
189
190        /// Setter for [`selector`][Self::selector].
191        ///
192        /// # Safety
193        ///
194        /// - `selector` must be a valid selector.
195        /// - This is unretained, you must ensure the object is kept alive while in use.
196        #[unsafe(method(setSelector:))]
197        #[unsafe(method_family = none)]
198        pub unsafe fn setSelector(&self, selector: Sel);
199
200        #[cfg(feature = "block2")]
201        /// # Safety
202        ///
203        /// The returned block's argument must be a valid pointer.
204        #[unsafe(method(actionHandler))]
205        #[unsafe(method_family = none)]
206        pub unsafe fn actionHandler(&self) -> UIAccessibilityCustomActionHandler;
207
208        #[cfg(feature = "block2")]
209        /// Setter for [`actionHandler`][Self::actionHandler].
210        ///
211        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
212        ///
213        /// # Safety
214        ///
215        /// `action_handler` must be a valid pointer or null.
216        #[unsafe(method(setActionHandler:))]
217        #[unsafe(method_family = none)]
218        pub unsafe fn setActionHandler(&self, action_handler: UIAccessibilityCustomActionHandler);
219
220        #[unsafe(method(category))]
221        #[unsafe(method_family = none)]
222        pub fn category(&self) -> Option<Retained<NSString>>;
223
224        /// Setter for [`category`][Self::category].
225        ///
226        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
227        #[unsafe(method(setCategory:))]
228        #[unsafe(method_family = none)]
229        pub fn setCategory(&self, category: Option<&NSString>);
230    );
231}
232
233/// Methods declared on superclass `NSObject`.
234impl UIAccessibilityCustomAction {
235    extern_methods!(
236        #[unsafe(method(init))]
237        #[unsafe(method_family = init)]
238        pub fn init(this: Allocated<Self>) -> Retained<Self>;
239
240        #[unsafe(method(new))]
241        #[unsafe(method_family = new)]
242        pub fn new(mtm: MainThreadMarker) -> Retained<Self>;
243    );
244}
245
246extern "C" {
247    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uiaccessibilitycustomactioncategoryedit?language=objc)
248    pub static UIAccessibilityCustomActionCategoryEdit: &'static NSString;
249}