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 fn delegate(&self) -> Option<Retained<ProtocolObject<dyn UIActionSheetDelegate>>>;
137
138        /// Setter for [`delegate`][Self::delegate].
139        ///
140        /// This is a [weak property][objc2::topics::weak_property].
141        #[deprecated = "UIActionSheet is deprecated. Use UIAlertController with a preferredStyle of UIAlertControllerStyleActionSheet instead"]
142        #[unsafe(method(setDelegate:))]
143        #[unsafe(method_family = none)]
144        pub fn setDelegate(&self, delegate: Option<&ProtocolObject<dyn UIActionSheetDelegate>>);
145
146        #[deprecated = "UIActionSheet is deprecated. Use UIAlertController with a preferredStyle of UIAlertControllerStyleActionSheet instead"]
147        #[unsafe(method(title))]
148        #[unsafe(method_family = none)]
149        pub fn title(&self) -> Retained<NSString>;
150
151        /// Setter for [`title`][Self::title].
152        ///
153        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
154        #[deprecated = "UIActionSheet is deprecated. Use UIAlertController with a preferredStyle of UIAlertControllerStyleActionSheet instead"]
155        #[unsafe(method(setTitle:))]
156        #[unsafe(method_family = none)]
157        pub fn setTitle(&self, title: &NSString);
158
159        #[deprecated = "UIActionSheet is deprecated. Use UIAlertController with a preferredStyle of UIAlertControllerStyleActionSheet instead"]
160        #[unsafe(method(actionSheetStyle))]
161        #[unsafe(method_family = none)]
162        pub fn actionSheetStyle(&self) -> UIActionSheetStyle;
163
164        /// Setter for [`actionSheetStyle`][Self::actionSheetStyle].
165        #[deprecated = "UIActionSheet is deprecated. Use UIAlertController with a preferredStyle of UIAlertControllerStyleActionSheet instead"]
166        #[unsafe(method(setActionSheetStyle:))]
167        #[unsafe(method_family = none)]
168        pub fn setActionSheetStyle(&self, action_sheet_style: UIActionSheetStyle);
169
170        #[deprecated = "UIActionSheet is deprecated. Use UIAlertController with a preferredStyle of UIAlertControllerStyleActionSheet instead"]
171        #[unsafe(method(addButtonWithTitle:))]
172        #[unsafe(method_family = none)]
173        pub fn addButtonWithTitle(&self, title: Option<&NSString>) -> NSInteger;
174
175        #[deprecated = "UIActionSheet is deprecated. Use UIAlertController with a preferredStyle of UIAlertControllerStyleActionSheet instead"]
176        #[unsafe(method(buttonTitleAtIndex:))]
177        #[unsafe(method_family = none)]
178        pub fn buttonTitleAtIndex(&self, button_index: NSInteger) -> Option<Retained<NSString>>;
179
180        #[deprecated = "UIActionSheet is deprecated. Use UIAlertController with a preferredStyle of UIAlertControllerStyleActionSheet instead"]
181        #[unsafe(method(numberOfButtons))]
182        #[unsafe(method_family = none)]
183        pub fn numberOfButtons(&self) -> NSInteger;
184
185        #[deprecated = "UIActionSheet is deprecated. Use UIAlertController with a preferredStyle of UIAlertControllerStyleActionSheet instead"]
186        #[unsafe(method(cancelButtonIndex))]
187        #[unsafe(method_family = none)]
188        pub fn cancelButtonIndex(&self) -> NSInteger;
189
190        /// Setter for [`cancelButtonIndex`][Self::cancelButtonIndex].
191        #[deprecated = "UIActionSheet is deprecated. Use UIAlertController with a preferredStyle of UIAlertControllerStyleActionSheet instead"]
192        #[unsafe(method(setCancelButtonIndex:))]
193        #[unsafe(method_family = none)]
194        pub fn setCancelButtonIndex(&self, cancel_button_index: NSInteger);
195
196        #[deprecated = "UIActionSheet is deprecated. Use UIAlertController with a preferredStyle of UIAlertControllerStyleActionSheet instead"]
197        #[unsafe(method(destructiveButtonIndex))]
198        #[unsafe(method_family = none)]
199        pub fn destructiveButtonIndex(&self) -> NSInteger;
200
201        /// Setter for [`destructiveButtonIndex`][Self::destructiveButtonIndex].
202        #[deprecated = "UIActionSheet is deprecated. Use UIAlertController with a preferredStyle of UIAlertControllerStyleActionSheet instead"]
203        #[unsafe(method(setDestructiveButtonIndex:))]
204        #[unsafe(method_family = none)]
205        pub fn setDestructiveButtonIndex(&self, destructive_button_index: NSInteger);
206
207        #[deprecated = "UIActionSheet is deprecated. Use UIAlertController with a preferredStyle of UIAlertControllerStyleActionSheet instead"]
208        #[unsafe(method(firstOtherButtonIndex))]
209        #[unsafe(method_family = none)]
210        pub fn firstOtherButtonIndex(&self) -> NSInteger;
211
212        #[deprecated = "UIActionSheet is deprecated. Use UIAlertController with a preferredStyle of UIAlertControllerStyleActionSheet instead"]
213        #[unsafe(method(isVisible))]
214        #[unsafe(method_family = none)]
215        pub fn isVisible(&self) -> bool;
216
217        #[cfg(feature = "UIToolbar")]
218        #[deprecated = "UIActionSheet is deprecated. Use UIAlertController with a preferredStyle of UIAlertControllerStyleActionSheet instead"]
219        #[unsafe(method(showFromToolbar:))]
220        #[unsafe(method_family = none)]
221        pub fn showFromToolbar(&self, view: &UIToolbar);
222
223        #[cfg(feature = "UITabBar")]
224        #[deprecated = "UIActionSheet is deprecated. Use UIAlertController with a preferredStyle of UIAlertControllerStyleActionSheet instead"]
225        #[unsafe(method(showFromTabBar:))]
226        #[unsafe(method_family = none)]
227        pub fn showFromTabBar(&self, view: &UITabBar);
228
229        #[cfg(all(feature = "UIBarButtonItem", feature = "UIBarItem"))]
230        #[unsafe(method(showFromBarButtonItem:animated:))]
231        #[unsafe(method_family = none)]
232        pub fn showFromBarButtonItem_animated(&self, item: &UIBarButtonItem, animated: bool);
233
234        #[cfg(feature = "objc2-core-foundation")]
235        #[unsafe(method(showFromRect:inView:animated:))]
236        #[unsafe(method_family = none)]
237        pub fn showFromRect_inView_animated(&self, rect: CGRect, view: &UIView, animated: bool);
238
239        #[deprecated = "UIActionSheet is deprecated. Use UIAlertController with a preferredStyle of UIAlertControllerStyleActionSheet instead"]
240        #[unsafe(method(showInView:))]
241        #[unsafe(method_family = none)]
242        pub fn showInView(&self, view: &UIView);
243
244        #[deprecated = "UIActionSheet is deprecated. Use UIAlertController with a preferredStyle of UIAlertControllerStyleActionSheet instead"]
245        #[unsafe(method(dismissWithClickedButtonIndex:animated:))]
246        #[unsafe(method_family = none)]
247        pub fn dismissWithClickedButtonIndex_animated(
248            &self,
249            button_index: NSInteger,
250            animated: bool,
251        );
252    );
253}
254
255/// Methods declared on superclass `UIView`.
256#[cfg(all(feature = "UIResponder", feature = "UIView"))]
257impl UIActionSheet {
258    extern_methods!(
259        #[cfg(feature = "objc2-core-foundation")]
260        #[unsafe(method(initWithFrame:))]
261        #[unsafe(method_family = init)]
262        pub fn initWithFrame(this: Allocated<Self>, frame: CGRect) -> Retained<Self>;
263
264        /// # Safety
265        ///
266        /// `coder` possibly has further requirements.
267        #[unsafe(method(initWithCoder:))]
268        #[unsafe(method_family = init)]
269        pub unsafe fn initWithCoder(
270            this: Allocated<Self>,
271            coder: &NSCoder,
272        ) -> Option<Retained<Self>>;
273
274        #[unsafe(method(init))]
275        #[unsafe(method_family = init)]
276        pub fn init(this: Allocated<Self>) -> Retained<Self>;
277    );
278}
279
280/// Methods declared on superclass `NSObject`.
281#[cfg(all(feature = "UIResponder", feature = "UIView"))]
282impl UIActionSheet {
283    extern_methods!(
284        #[unsafe(method(new))]
285        #[unsafe(method_family = new)]
286        pub fn new(mtm: MainThreadMarker) -> Retained<Self>;
287    );
288}
289
290extern_protocol!(
291    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uiactionsheetdelegate?language=objc)
292    pub unsafe trait UIActionSheetDelegate: NSObjectProtocol + MainThreadOnly {
293        #[cfg(all(feature = "UIResponder", feature = "UIView"))]
294        #[deprecated = "Use UIAlertController instead."]
295        #[optional]
296        #[unsafe(method(actionSheet:clickedButtonAtIndex:))]
297        #[unsafe(method_family = none)]
298        fn actionSheet_clickedButtonAtIndex(
299            &self,
300            action_sheet: &UIActionSheet,
301            button_index: NSInteger,
302        );
303
304        #[cfg(all(feature = "UIResponder", feature = "UIView"))]
305        #[deprecated = "Use UIAlertController instead."]
306        #[optional]
307        #[unsafe(method(actionSheetCancel:))]
308        #[unsafe(method_family = none)]
309        fn actionSheetCancel(&self, action_sheet: &UIActionSheet);
310
311        #[cfg(all(feature = "UIResponder", feature = "UIView"))]
312        #[deprecated = "Use UIAlertController instead."]
313        #[optional]
314        #[unsafe(method(willPresentActionSheet:))]
315        #[unsafe(method_family = none)]
316        fn willPresentActionSheet(&self, action_sheet: &UIActionSheet);
317
318        #[cfg(all(feature = "UIResponder", feature = "UIView"))]
319        #[deprecated = "Use UIAlertController instead."]
320        #[optional]
321        #[unsafe(method(didPresentActionSheet:))]
322        #[unsafe(method_family = none)]
323        fn didPresentActionSheet(&self, action_sheet: &UIActionSheet);
324
325        #[cfg(all(feature = "UIResponder", feature = "UIView"))]
326        #[deprecated = "Use UIAlertController instead."]
327        #[optional]
328        #[unsafe(method(actionSheet:willDismissWithButtonIndex:))]
329        #[unsafe(method_family = none)]
330        fn actionSheet_willDismissWithButtonIndex(
331            &self,
332            action_sheet: &UIActionSheet,
333            button_index: NSInteger,
334        );
335
336        #[cfg(all(feature = "UIResponder", feature = "UIView"))]
337        #[deprecated = "Use UIAlertController instead."]
338        #[optional]
339        #[unsafe(method(actionSheet:didDismissWithButtonIndex:))]
340        #[unsafe(method_family = none)]
341        fn actionSheet_didDismissWithButtonIndex(
342            &self,
343            action_sheet: &UIActionSheet,
344            button_index: NSInteger,
345        );
346    }
347);