objc2_ui_kit/generated/
UIAlertView.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/uialertviewstyle?language=objc)
16// NS_ENUM
17#[repr(transparent)]
18#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
19pub struct UIAlertViewStyle(pub NSInteger);
20impl UIAlertViewStyle {
21    #[doc(alias = "UIAlertViewStyleDefault")]
22    pub const Default: Self = Self(0);
23    #[doc(alias = "UIAlertViewStyleSecureTextInput")]
24    pub const SecureTextInput: Self = Self(1);
25    #[doc(alias = "UIAlertViewStylePlainTextInput")]
26    pub const PlainTextInput: Self = Self(2);
27    #[doc(alias = "UIAlertViewStyleLoginAndPasswordInput")]
28    pub const LoginAndPasswordInput: Self = Self(3);
29}
30
31unsafe impl Encode for UIAlertViewStyle {
32    const ENCODING: Encoding = NSInteger::ENCODING;
33}
34
35unsafe impl RefEncode for UIAlertViewStyle {
36    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
37}
38
39extern_class!(
40    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uialertview?language=objc)
41    #[unsafe(super(UIView, UIResponder, NSObject))]
42    #[thread_kind = MainThreadOnly]
43    #[derive(Debug, PartialEq, Eq, Hash)]
44    #[cfg(all(feature = "UIResponder", feature = "UIView"))]
45    #[deprecated = "UIAlertView is deprecated. Use UIAlertController with a preferredStyle of UIAlertControllerStyleAlert instead"]
46    pub struct UIAlertView;
47);
48
49#[cfg(all(
50    feature = "UIResponder",
51    feature = "UIView",
52    feature = "objc2-quartz-core"
53))]
54#[cfg(not(target_os = "watchos"))]
55extern_conformance!(
56    unsafe impl CALayerDelegate for UIAlertView {}
57);
58
59#[cfg(all(feature = "UIResponder", feature = "UIView"))]
60extern_conformance!(
61    unsafe impl NSCoding for UIAlertView {}
62);
63
64#[cfg(all(feature = "UIResponder", feature = "UIView"))]
65extern_conformance!(
66    unsafe impl NSObjectProtocol for UIAlertView {}
67);
68
69#[cfg(all(feature = "UIAppearance", feature = "UIResponder", feature = "UIView"))]
70extern_conformance!(
71    unsafe impl UIAppearance for UIAlertView {}
72);
73
74#[cfg(all(feature = "UIAppearance", feature = "UIResponder", feature = "UIView"))]
75extern_conformance!(
76    unsafe impl UIAppearanceContainer for UIAlertView {}
77);
78
79#[cfg(all(feature = "UIResponder", feature = "UIView"))]
80extern_conformance!(
81    unsafe impl UICoordinateSpace for UIAlertView {}
82);
83
84#[cfg(all(
85    feature = "UIDynamicBehavior",
86    feature = "UIResponder",
87    feature = "UIView"
88))]
89extern_conformance!(
90    unsafe impl UIDynamicItem for UIAlertView {}
91);
92
93#[cfg(all(feature = "UIFocus", feature = "UIResponder", feature = "UIView"))]
94extern_conformance!(
95    unsafe impl UIFocusEnvironment for UIAlertView {}
96);
97
98#[cfg(all(feature = "UIFocus", feature = "UIResponder", feature = "UIView"))]
99extern_conformance!(
100    unsafe impl UIFocusItem for UIAlertView {}
101);
102
103#[cfg(all(feature = "UIFocus", feature = "UIResponder", feature = "UIView"))]
104extern_conformance!(
105    unsafe impl UIFocusItemContainer for UIAlertView {}
106);
107
108#[cfg(all(feature = "UIResponder", feature = "UIView"))]
109extern_conformance!(
110    unsafe impl UIResponderStandardEditActions for UIAlertView {}
111);
112
113#[cfg(all(
114    feature = "UIResponder",
115    feature = "UITraitCollection",
116    feature = "UIView"
117))]
118extern_conformance!(
119    unsafe impl UITraitEnvironment for UIAlertView {}
120);
121
122#[cfg(all(feature = "UIResponder", feature = "UIView"))]
123impl UIAlertView {
124    extern_methods!(
125        #[cfg(feature = "objc2-core-foundation")]
126        #[deprecated = "UIAlertView is deprecated. Use UIAlertController with a preferredStyle of UIAlertControllerStyleAlert instead"]
127        #[unsafe(method(initWithFrame:))]
128        #[unsafe(method_family = init)]
129        pub fn initWithFrame(this: Allocated<Self>, frame: CGRect) -> Retained<Self>;
130
131        /// # Safety
132        ///
133        /// `coder` possibly has further requirements.
134        #[deprecated = "UIAlertView is deprecated. Use UIAlertController with a preferredStyle of UIAlertControllerStyleAlert instead"]
135        #[unsafe(method(initWithCoder:))]
136        #[unsafe(method_family = init)]
137        pub unsafe fn initWithCoder(
138            this: Allocated<Self>,
139            coder: &NSCoder,
140        ) -> Option<Retained<Self>>;
141
142        #[deprecated = "UIAlertView is deprecated. Use UIAlertController with a preferredStyle of UIAlertControllerStyleAlert instead"]
143        #[unsafe(method(delegate))]
144        #[unsafe(method_family = none)]
145        pub fn delegate(&self) -> Option<Retained<AnyObject>>;
146
147        /// Setter for [`delegate`][Self::delegate].
148        ///
149        /// This is a [weak property][objc2::topics::weak_property].
150        ///
151        /// # Safety
152        ///
153        /// `delegate` should be of the correct type.
154        #[deprecated = "UIAlertView is deprecated. Use UIAlertController with a preferredStyle of UIAlertControllerStyleAlert instead"]
155        #[unsafe(method(setDelegate:))]
156        #[unsafe(method_family = none)]
157        pub unsafe fn setDelegate(&self, delegate: Option<&AnyObject>);
158
159        #[deprecated = "UIAlertView is deprecated. Use UIAlertController with a preferredStyle of UIAlertControllerStyleAlert instead"]
160        #[unsafe(method(title))]
161        #[unsafe(method_family = none)]
162        pub fn title(&self) -> Retained<NSString>;
163
164        /// Setter for [`title`][Self::title].
165        ///
166        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
167        #[deprecated = "UIAlertView is deprecated. Use UIAlertController with a preferredStyle of UIAlertControllerStyleAlert instead"]
168        #[unsafe(method(setTitle:))]
169        #[unsafe(method_family = none)]
170        pub fn setTitle(&self, title: &NSString);
171
172        #[deprecated = "UIAlertView is deprecated. Use UIAlertController with a preferredStyle of UIAlertControllerStyleAlert instead"]
173        #[unsafe(method(message))]
174        #[unsafe(method_family = none)]
175        pub fn message(&self) -> Option<Retained<NSString>>;
176
177        /// Setter for [`message`][Self::message].
178        ///
179        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
180        #[deprecated = "UIAlertView is deprecated. Use UIAlertController with a preferredStyle of UIAlertControllerStyleAlert instead"]
181        #[unsafe(method(setMessage:))]
182        #[unsafe(method_family = none)]
183        pub fn setMessage(&self, message: Option<&NSString>);
184
185        #[deprecated = "UIAlertView is deprecated. Use UIAlertController with a preferredStyle of UIAlertControllerStyleAlert instead"]
186        #[unsafe(method(addButtonWithTitle:))]
187        #[unsafe(method_family = none)]
188        pub fn addButtonWithTitle(&self, title: Option<&NSString>) -> NSInteger;
189
190        #[deprecated = "UIAlertView is deprecated. Use UIAlertController with a preferredStyle of UIAlertControllerStyleAlert instead"]
191        #[unsafe(method(buttonTitleAtIndex:))]
192        #[unsafe(method_family = none)]
193        pub fn buttonTitleAtIndex(&self, button_index: NSInteger) -> Option<Retained<NSString>>;
194
195        #[deprecated = "UIAlertView is deprecated. Use UIAlertController with a preferredStyle of UIAlertControllerStyleAlert instead"]
196        #[unsafe(method(numberOfButtons))]
197        #[unsafe(method_family = none)]
198        pub fn numberOfButtons(&self) -> NSInteger;
199
200        #[deprecated = "UIAlertView is deprecated. Use UIAlertController with a preferredStyle of UIAlertControllerStyleAlert instead"]
201        #[unsafe(method(cancelButtonIndex))]
202        #[unsafe(method_family = none)]
203        pub fn cancelButtonIndex(&self) -> NSInteger;
204
205        /// Setter for [`cancelButtonIndex`][Self::cancelButtonIndex].
206        #[deprecated = "UIAlertView is deprecated. Use UIAlertController with a preferredStyle of UIAlertControllerStyleAlert instead"]
207        #[unsafe(method(setCancelButtonIndex:))]
208        #[unsafe(method_family = none)]
209        pub fn setCancelButtonIndex(&self, cancel_button_index: NSInteger);
210
211        #[deprecated = "UIAlertView is deprecated. Use UIAlertController with a preferredStyle of UIAlertControllerStyleAlert instead"]
212        #[unsafe(method(firstOtherButtonIndex))]
213        #[unsafe(method_family = none)]
214        pub fn firstOtherButtonIndex(&self) -> NSInteger;
215
216        #[deprecated = "UIAlertView is deprecated. Use UIAlertController with a preferredStyle of UIAlertControllerStyleAlert instead"]
217        #[unsafe(method(isVisible))]
218        #[unsafe(method_family = none)]
219        pub fn isVisible(&self) -> bool;
220
221        #[deprecated = "UIAlertView is deprecated. Use UIAlertController with a preferredStyle of UIAlertControllerStyleAlert instead"]
222        #[unsafe(method(show))]
223        #[unsafe(method_family = none)]
224        pub fn show(&self);
225
226        #[deprecated = "UIAlertView is deprecated. Use UIAlertController with a preferredStyle of UIAlertControllerStyleAlert instead"]
227        #[unsafe(method(dismissWithClickedButtonIndex:animated:))]
228        #[unsafe(method_family = none)]
229        pub fn dismissWithClickedButtonIndex_animated(
230            &self,
231            button_index: NSInteger,
232            animated: bool,
233        );
234
235        #[unsafe(method(alertViewStyle))]
236        #[unsafe(method_family = none)]
237        pub fn alertViewStyle(&self) -> UIAlertViewStyle;
238
239        /// Setter for [`alertViewStyle`][Self::alertViewStyle].
240        #[unsafe(method(setAlertViewStyle:))]
241        #[unsafe(method_family = none)]
242        pub fn setAlertViewStyle(&self, alert_view_style: UIAlertViewStyle);
243
244        #[cfg(all(feature = "UIControl", feature = "UITextField"))]
245        #[unsafe(method(textFieldAtIndex:))]
246        #[unsafe(method_family = none)]
247        pub fn textFieldAtIndex(
248            &self,
249            text_field_index: NSInteger,
250        ) -> Option<Retained<UITextField>>;
251    );
252}
253
254/// Methods declared on superclass `UIView`.
255#[cfg(all(feature = "UIResponder", feature = "UIView"))]
256impl UIAlertView {
257    extern_methods!(
258        #[unsafe(method(init))]
259        #[unsafe(method_family = init)]
260        pub fn init(this: Allocated<Self>) -> Retained<Self>;
261    );
262}
263
264/// Methods declared on superclass `NSObject`.
265#[cfg(all(feature = "UIResponder", feature = "UIView"))]
266impl UIAlertView {
267    extern_methods!(
268        #[unsafe(method(new))]
269        #[unsafe(method_family = new)]
270        pub fn new(mtm: MainThreadMarker) -> Retained<Self>;
271    );
272}
273
274extern_protocol!(
275    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uialertviewdelegate?language=objc)
276    pub unsafe trait UIAlertViewDelegate: NSObjectProtocol + MainThreadOnly {
277        #[cfg(all(feature = "UIResponder", feature = "UIView"))]
278        #[deprecated = "Use UIAlertController instead."]
279        #[optional]
280        #[unsafe(method(alertView:clickedButtonAtIndex:))]
281        #[unsafe(method_family = none)]
282        fn alertView_clickedButtonAtIndex(&self, alert_view: &UIAlertView, button_index: NSInteger);
283
284        #[cfg(all(feature = "UIResponder", feature = "UIView"))]
285        #[deprecated = "Use UIAlertController instead."]
286        #[optional]
287        #[unsafe(method(alertViewCancel:))]
288        #[unsafe(method_family = none)]
289        fn alertViewCancel(&self, alert_view: &UIAlertView);
290
291        #[cfg(all(feature = "UIResponder", feature = "UIView"))]
292        #[deprecated = "Use UIAlertController instead."]
293        #[optional]
294        #[unsafe(method(willPresentAlertView:))]
295        #[unsafe(method_family = none)]
296        fn willPresentAlertView(&self, alert_view: &UIAlertView);
297
298        #[cfg(all(feature = "UIResponder", feature = "UIView"))]
299        #[deprecated = "Use UIAlertController instead."]
300        #[optional]
301        #[unsafe(method(didPresentAlertView:))]
302        #[unsafe(method_family = none)]
303        fn didPresentAlertView(&self, alert_view: &UIAlertView);
304
305        #[cfg(all(feature = "UIResponder", feature = "UIView"))]
306        #[deprecated = "Use UIAlertController instead."]
307        #[optional]
308        #[unsafe(method(alertView:willDismissWithButtonIndex:))]
309        #[unsafe(method_family = none)]
310        fn alertView_willDismissWithButtonIndex(
311            &self,
312            alert_view: &UIAlertView,
313            button_index: NSInteger,
314        );
315
316        #[cfg(all(feature = "UIResponder", feature = "UIView"))]
317        #[deprecated = "Use UIAlertController instead."]
318        #[optional]
319        #[unsafe(method(alertView:didDismissWithButtonIndex:))]
320        #[unsafe(method_family = none)]
321        fn alertView_didDismissWithButtonIndex(
322            &self,
323            alert_view: &UIAlertView,
324            button_index: NSInteger,
325        );
326
327        #[cfg(all(feature = "UIResponder", feature = "UIView"))]
328        #[deprecated = "Use UIAlertController instead."]
329        #[optional]
330        #[unsafe(method(alertViewShouldEnableFirstOtherButton:))]
331        #[unsafe(method_family = none)]
332        fn alertViewShouldEnableFirstOtherButton(&self, alert_view: &UIAlertView) -> bool;
333    }
334);