objc2_ui_kit/generated/
UIActionSheet.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#[cfg(feature = "objc2-quartz-core")]
10#[cfg(not(target_os = "watchos"))]
11use objc2_quartz_core::*;
12
13use crate::*;
14
15/// [Apple's documentation](https://developer.apple.com/documentation/uikit/uiactionsheetstyle?language=objc)
16// NS_ENUM
17#[deprecated = "UIActionSheet is deprecated. Use UIAlertController with a preferredStyle of UIAlertControllerStyleActionSheet instead."]
18#[repr(transparent)]
19#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
20pub struct UIActionSheetStyle(pub NSInteger);
21impl UIActionSheetStyle {
22    #[doc(alias = "UIActionSheetStyleAutomatic")]
23    #[deprecated = "UIActionSheet is deprecated. Use UIAlertController with a preferredStyle of UIAlertControllerStyleActionSheet instead."]
24    pub const Automatic: Self = Self(-1);
25    #[doc(alias = "UIActionSheetStyleDefault")]
26    #[cfg(feature = "UIInterface")]
27    #[deprecated = "UIActionSheet is deprecated. Use UIAlertController with a preferredStyle of UIAlertControllerStyleActionSheet instead."]
28    pub const Default: Self = Self(UIBarStyle::Default.0);
29    #[doc(alias = "UIActionSheetStyleBlackTranslucent")]
30    #[cfg(feature = "UIInterface")]
31    #[deprecated = "UIActionSheet is deprecated. Use UIAlertController with a preferredStyle of UIAlertControllerStyleActionSheet instead."]
32    pub const BlackTranslucent: Self = Self(UIBarStyle::BlackTranslucent.0);
33    #[doc(alias = "UIActionSheetStyleBlackOpaque")]
34    #[cfg(feature = "UIInterface")]
35    #[deprecated = "UIActionSheet is deprecated. Use UIAlertController with a preferredStyle of UIAlertControllerStyleActionSheet instead."]
36    pub const BlackOpaque: Self = Self(UIBarStyle::BlackOpaque.0);
37}
38
39unsafe impl Encode for UIActionSheetStyle {
40    const ENCODING: Encoding = NSInteger::ENCODING;
41}
42
43unsafe impl RefEncode for UIActionSheetStyle {
44    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
45}
46
47extern_class!(
48    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uiactionsheet?language=objc)
49    #[unsafe(super(UIView, UIResponder, NSObject))]
50    #[thread_kind = MainThreadOnly]
51    #[derive(Debug, PartialEq, Eq, Hash)]
52    #[cfg(all(feature = "UIResponder", feature = "UIView"))]
53    #[deprecated = "UIActionSheet is deprecated. Use UIAlertController with a preferredStyle of UIAlertControllerStyleActionSheet instead"]
54    pub struct UIActionSheet;
55);
56
57#[cfg(all(
58    feature = "UIResponder",
59    feature = "UIView",
60    feature = "objc2-quartz-core"
61))]
62#[cfg(not(target_os = "watchos"))]
63extern_conformance!(
64    unsafe impl CALayerDelegate for UIActionSheet {}
65);
66
67#[cfg(all(feature = "UIResponder", feature = "UIView"))]
68extern_conformance!(
69    unsafe impl NSCoding for UIActionSheet {}
70);
71
72#[cfg(all(feature = "UIResponder", feature = "UIView"))]
73extern_conformance!(
74    unsafe impl NSObjectProtocol for UIActionSheet {}
75);
76
77#[cfg(all(feature = "UIAppearance", feature = "UIResponder", feature = "UIView"))]
78extern_conformance!(
79    unsafe impl UIAppearance for UIActionSheet {}
80);
81
82#[cfg(all(feature = "UIAppearance", feature = "UIResponder", feature = "UIView"))]
83extern_conformance!(
84    unsafe impl UIAppearanceContainer for UIActionSheet {}
85);
86
87#[cfg(all(feature = "UIResponder", feature = "UIView"))]
88extern_conformance!(
89    unsafe impl UICoordinateSpace for UIActionSheet {}
90);
91
92#[cfg(all(
93    feature = "UIDynamicBehavior",
94    feature = "UIResponder",
95    feature = "UIView"
96))]
97extern_conformance!(
98    unsafe impl UIDynamicItem for UIActionSheet {}
99);
100
101#[cfg(all(feature = "UIFocus", feature = "UIResponder", feature = "UIView"))]
102extern_conformance!(
103    unsafe impl UIFocusEnvironment for UIActionSheet {}
104);
105
106#[cfg(all(feature = "UIFocus", feature = "UIResponder", feature = "UIView"))]
107extern_conformance!(
108    unsafe impl UIFocusItem for UIActionSheet {}
109);
110
111#[cfg(all(feature = "UIFocus", feature = "UIResponder", feature = "UIView"))]
112extern_conformance!(
113    unsafe impl UIFocusItemContainer for UIActionSheet {}
114);
115
116#[cfg(all(feature = "UIResponder", feature = "UIView"))]
117extern_conformance!(
118    unsafe impl UIResponderStandardEditActions for UIActionSheet {}
119);
120
121#[cfg(all(
122    feature = "UIResponder",
123    feature = "UITraitCollection",
124    feature = "UIView"
125))]
126extern_conformance!(
127    unsafe impl UITraitEnvironment for UIActionSheet {}
128);
129
130#[cfg(all(feature = "UIResponder", feature = "UIView"))]
131impl UIActionSheet {
132    extern_methods!(
133        #[deprecated = "UIActionSheet is deprecated. Use UIAlertController with a preferredStyle of UIAlertControllerStyleActionSheet instead"]
134        #[unsafe(method(delegate))]
135        #[unsafe(method_family = none)]
136        pub unsafe fn delegate(
137            &self,
138        ) -> Option<Retained<ProtocolObject<dyn UIActionSheetDelegate>>>;
139
140        /// This is a [weak property][objc2::topics::weak_property].
141        /// Setter for [`delegate`][Self::delegate].
142        #[deprecated = "UIActionSheet is deprecated. Use UIAlertController with a preferredStyle of UIAlertControllerStyleActionSheet instead"]
143        #[unsafe(method(setDelegate:))]
144        #[unsafe(method_family = none)]
145        pub unsafe fn setDelegate(
146            &self,
147            delegate: Option<&ProtocolObject<dyn UIActionSheetDelegate>>,
148        );
149
150        #[deprecated = "UIActionSheet is deprecated. Use UIAlertController with a preferredStyle of UIAlertControllerStyleActionSheet instead"]
151        #[unsafe(method(title))]
152        #[unsafe(method_family = none)]
153        pub unsafe fn title(&self) -> Retained<NSString>;
154
155        /// Setter for [`title`][Self::title].
156        #[deprecated = "UIActionSheet is deprecated. Use UIAlertController with a preferredStyle of UIAlertControllerStyleActionSheet instead"]
157        #[unsafe(method(setTitle:))]
158        #[unsafe(method_family = none)]
159        pub unsafe fn setTitle(&self, title: &NSString);
160
161        #[deprecated = "UIActionSheet is deprecated. Use UIAlertController with a preferredStyle of UIAlertControllerStyleActionSheet instead"]
162        #[unsafe(method(actionSheetStyle))]
163        #[unsafe(method_family = none)]
164        pub unsafe fn actionSheetStyle(&self) -> UIActionSheetStyle;
165
166        /// Setter for [`actionSheetStyle`][Self::actionSheetStyle].
167        #[deprecated = "UIActionSheet is deprecated. Use UIAlertController with a preferredStyle of UIAlertControllerStyleActionSheet instead"]
168        #[unsafe(method(setActionSheetStyle:))]
169        #[unsafe(method_family = none)]
170        pub unsafe fn setActionSheetStyle(&self, action_sheet_style: UIActionSheetStyle);
171
172        #[deprecated = "UIActionSheet is deprecated. Use UIAlertController with a preferredStyle of UIAlertControllerStyleActionSheet instead"]
173        #[unsafe(method(addButtonWithTitle:))]
174        #[unsafe(method_family = none)]
175        pub unsafe fn addButtonWithTitle(&self, title: Option<&NSString>) -> NSInteger;
176
177        #[deprecated = "UIActionSheet is deprecated. Use UIAlertController with a preferredStyle of UIAlertControllerStyleActionSheet instead"]
178        #[unsafe(method(buttonTitleAtIndex:))]
179        #[unsafe(method_family = none)]
180        pub unsafe fn buttonTitleAtIndex(
181            &self,
182            button_index: NSInteger,
183        ) -> Option<Retained<NSString>>;
184
185        #[deprecated = "UIActionSheet is deprecated. Use UIAlertController with a preferredStyle of UIAlertControllerStyleActionSheet instead"]
186        #[unsafe(method(numberOfButtons))]
187        #[unsafe(method_family = none)]
188        pub unsafe fn numberOfButtons(&self) -> NSInteger;
189
190        #[deprecated = "UIActionSheet is deprecated. Use UIAlertController with a preferredStyle of UIAlertControllerStyleActionSheet instead"]
191        #[unsafe(method(cancelButtonIndex))]
192        #[unsafe(method_family = none)]
193        pub unsafe fn cancelButtonIndex(&self) -> NSInteger;
194
195        /// Setter for [`cancelButtonIndex`][Self::cancelButtonIndex].
196        #[deprecated = "UIActionSheet is deprecated. Use UIAlertController with a preferredStyle of UIAlertControllerStyleActionSheet instead"]
197        #[unsafe(method(setCancelButtonIndex:))]
198        #[unsafe(method_family = none)]
199        pub unsafe fn setCancelButtonIndex(&self, cancel_button_index: NSInteger);
200
201        #[deprecated = "UIActionSheet is deprecated. Use UIAlertController with a preferredStyle of UIAlertControllerStyleActionSheet instead"]
202        #[unsafe(method(destructiveButtonIndex))]
203        #[unsafe(method_family = none)]
204        pub unsafe fn destructiveButtonIndex(&self) -> NSInteger;
205
206        /// Setter for [`destructiveButtonIndex`][Self::destructiveButtonIndex].
207        #[deprecated = "UIActionSheet is deprecated. Use UIAlertController with a preferredStyle of UIAlertControllerStyleActionSheet instead"]
208        #[unsafe(method(setDestructiveButtonIndex:))]
209        #[unsafe(method_family = none)]
210        pub unsafe fn setDestructiveButtonIndex(&self, destructive_button_index: NSInteger);
211
212        #[deprecated = "UIActionSheet is deprecated. Use UIAlertController with a preferredStyle of UIAlertControllerStyleActionSheet instead"]
213        #[unsafe(method(firstOtherButtonIndex))]
214        #[unsafe(method_family = none)]
215        pub unsafe fn firstOtherButtonIndex(&self) -> NSInteger;
216
217        #[deprecated = "UIActionSheet is deprecated. Use UIAlertController with a preferredStyle of UIAlertControllerStyleActionSheet instead"]
218        #[unsafe(method(isVisible))]
219        #[unsafe(method_family = none)]
220        pub unsafe fn isVisible(&self) -> bool;
221
222        #[cfg(feature = "UIToolbar")]
223        #[deprecated = "UIActionSheet is deprecated. Use UIAlertController with a preferredStyle of UIAlertControllerStyleActionSheet instead"]
224        #[unsafe(method(showFromToolbar:))]
225        #[unsafe(method_family = none)]
226        pub unsafe fn showFromToolbar(&self, view: &UIToolbar);
227
228        #[cfg(feature = "UITabBar")]
229        #[deprecated = "UIActionSheet is deprecated. Use UIAlertController with a preferredStyle of UIAlertControllerStyleActionSheet instead"]
230        #[unsafe(method(showFromTabBar:))]
231        #[unsafe(method_family = none)]
232        pub unsafe fn showFromTabBar(&self, view: &UITabBar);
233
234        #[cfg(all(feature = "UIBarButtonItem", feature = "UIBarItem"))]
235        #[unsafe(method(showFromBarButtonItem:animated:))]
236        #[unsafe(method_family = none)]
237        pub unsafe fn showFromBarButtonItem_animated(&self, item: &UIBarButtonItem, animated: bool);
238
239        #[cfg(feature = "objc2-core-foundation")]
240        #[unsafe(method(showFromRect:inView:animated:))]
241        #[unsafe(method_family = none)]
242        pub unsafe fn showFromRect_inView_animated(
243            &self,
244            rect: CGRect,
245            view: &UIView,
246            animated: bool,
247        );
248
249        #[deprecated = "UIActionSheet is deprecated. Use UIAlertController with a preferredStyle of UIAlertControllerStyleActionSheet instead"]
250        #[unsafe(method(showInView:))]
251        #[unsafe(method_family = none)]
252        pub unsafe fn showInView(&self, view: &UIView);
253
254        #[deprecated = "UIActionSheet is deprecated. Use UIAlertController with a preferredStyle of UIAlertControllerStyleActionSheet instead"]
255        #[unsafe(method(dismissWithClickedButtonIndex:animated:))]
256        #[unsafe(method_family = none)]
257        pub unsafe fn dismissWithClickedButtonIndex_animated(
258            &self,
259            button_index: NSInteger,
260            animated: bool,
261        );
262    );
263}
264
265/// Methods declared on superclass `UIView`.
266#[cfg(all(feature = "UIResponder", feature = "UIView"))]
267impl UIActionSheet {
268    extern_methods!(
269        #[cfg(feature = "objc2-core-foundation")]
270        #[unsafe(method(initWithFrame:))]
271        #[unsafe(method_family = init)]
272        pub unsafe fn initWithFrame(this: Allocated<Self>, frame: CGRect) -> Retained<Self>;
273
274        #[unsafe(method(initWithCoder:))]
275        #[unsafe(method_family = init)]
276        pub unsafe fn initWithCoder(
277            this: Allocated<Self>,
278            coder: &NSCoder,
279        ) -> Option<Retained<Self>>;
280    );
281}
282
283/// Methods declared on superclass `NSObject`.
284#[cfg(all(feature = "UIResponder", feature = "UIView"))]
285impl UIActionSheet {
286    extern_methods!(
287        #[unsafe(method(init))]
288        #[unsafe(method_family = init)]
289        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
290
291        #[unsafe(method(new))]
292        #[unsafe(method_family = new)]
293        pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
294    );
295}
296
297extern_protocol!(
298    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uiactionsheetdelegate?language=objc)
299    pub unsafe trait UIActionSheetDelegate: NSObjectProtocol + MainThreadOnly {
300        #[cfg(all(feature = "UIResponder", feature = "UIView"))]
301        #[deprecated = "Use UIAlertController instead."]
302        #[optional]
303        #[unsafe(method(actionSheet:clickedButtonAtIndex:))]
304        #[unsafe(method_family = none)]
305        unsafe fn actionSheet_clickedButtonAtIndex(
306            &self,
307            action_sheet: &UIActionSheet,
308            button_index: NSInteger,
309        );
310
311        #[cfg(all(feature = "UIResponder", feature = "UIView"))]
312        #[deprecated = "Use UIAlertController instead."]
313        #[optional]
314        #[unsafe(method(actionSheetCancel:))]
315        #[unsafe(method_family = none)]
316        unsafe fn actionSheetCancel(&self, action_sheet: &UIActionSheet);
317
318        #[cfg(all(feature = "UIResponder", feature = "UIView"))]
319        #[deprecated = "Use UIAlertController instead."]
320        #[optional]
321        #[unsafe(method(willPresentActionSheet:))]
322        #[unsafe(method_family = none)]
323        unsafe fn willPresentActionSheet(&self, action_sheet: &UIActionSheet);
324
325        #[cfg(all(feature = "UIResponder", feature = "UIView"))]
326        #[deprecated = "Use UIAlertController instead."]
327        #[optional]
328        #[unsafe(method(didPresentActionSheet:))]
329        #[unsafe(method_family = none)]
330        unsafe fn didPresentActionSheet(&self, action_sheet: &UIActionSheet);
331
332        #[cfg(all(feature = "UIResponder", feature = "UIView"))]
333        #[deprecated = "Use UIAlertController instead."]
334        #[optional]
335        #[unsafe(method(actionSheet:willDismissWithButtonIndex:))]
336        #[unsafe(method_family = none)]
337        unsafe fn actionSheet_willDismissWithButtonIndex(
338            &self,
339            action_sheet: &UIActionSheet,
340            button_index: NSInteger,
341        );
342
343        #[cfg(all(feature = "UIResponder", feature = "UIView"))]
344        #[deprecated = "Use UIAlertController instead."]
345        #[optional]
346        #[unsafe(method(actionSheet:didDismissWithButtonIndex:))]
347        #[unsafe(method_family = none)]
348        unsafe fn actionSheet_didDismissWithButtonIndex(
349            &self,
350            action_sheet: &UIActionSheet,
351            button_index: NSInteger,
352        );
353    }
354);