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