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"))]
55unsafe impl CALayerDelegate for UIAlertView {}
56
57#[cfg(all(feature = "UIResponder", feature = "UIView"))]
58unsafe impl NSCoding for UIAlertView {}
59
60#[cfg(all(feature = "UIResponder", feature = "UIView"))]
61unsafe impl NSObjectProtocol for UIAlertView {}
62
63#[cfg(all(feature = "UIAppearance", feature = "UIResponder", feature = "UIView"))]
64unsafe impl UIAppearance for UIAlertView {}
65
66#[cfg(all(feature = "UIAppearance", feature = "UIResponder", feature = "UIView"))]
67unsafe impl UIAppearanceContainer for UIAlertView {}
68
69#[cfg(all(feature = "UIResponder", feature = "UIView"))]
70unsafe impl UICoordinateSpace for UIAlertView {}
71
72#[cfg(all(
73    feature = "UIDynamicBehavior",
74    feature = "UIResponder",
75    feature = "UIView"
76))]
77unsafe impl UIDynamicItem for UIAlertView {}
78
79#[cfg(all(feature = "UIFocus", feature = "UIResponder", feature = "UIView"))]
80unsafe impl UIFocusEnvironment for UIAlertView {}
81
82#[cfg(all(feature = "UIFocus", feature = "UIResponder", feature = "UIView"))]
83unsafe impl UIFocusItem for UIAlertView {}
84
85#[cfg(all(feature = "UIFocus", feature = "UIResponder", feature = "UIView"))]
86unsafe impl UIFocusItemContainer for UIAlertView {}
87
88#[cfg(all(feature = "UIResponder", feature = "UIView"))]
89unsafe impl UIResponderStandardEditActions for UIAlertView {}
90
91#[cfg(all(
92    feature = "UIResponder",
93    feature = "UITraitCollection",
94    feature = "UIView"
95))]
96unsafe impl UITraitEnvironment for UIAlertView {}
97
98#[cfg(all(feature = "UIResponder", feature = "UIView"))]
99impl UIAlertView {
100    extern_methods!(
101        #[cfg(feature = "objc2-core-foundation")]
102        #[deprecated = "UIAlertView is deprecated. Use UIAlertController with a preferredStyle of UIAlertControllerStyleAlert instead"]
103        #[unsafe(method(initWithFrame:))]
104        #[unsafe(method_family = init)]
105        pub unsafe fn initWithFrame(this: Allocated<Self>, frame: CGRect) -> Retained<Self>;
106
107        #[deprecated = "UIAlertView is deprecated. Use UIAlertController with a preferredStyle of UIAlertControllerStyleAlert instead"]
108        #[unsafe(method(initWithCoder:))]
109        #[unsafe(method_family = init)]
110        pub unsafe fn initWithCoder(
111            this: Allocated<Self>,
112            coder: &NSCoder,
113        ) -> Option<Retained<Self>>;
114
115        #[deprecated = "UIAlertView is deprecated. Use UIAlertController with a preferredStyle of UIAlertControllerStyleAlert instead"]
116        #[unsafe(method(delegate))]
117        #[unsafe(method_family = none)]
118        pub unsafe fn delegate(&self) -> Option<Retained<AnyObject>>;
119
120        /// This is a [weak property][objc2::topics::weak_property].
121        /// Setter for [`delegate`][Self::delegate].
122        #[deprecated = "UIAlertView is deprecated. Use UIAlertController with a preferredStyle of UIAlertControllerStyleAlert instead"]
123        #[unsafe(method(setDelegate:))]
124        #[unsafe(method_family = none)]
125        pub unsafe fn setDelegate(&self, delegate: Option<&AnyObject>);
126
127        #[deprecated = "UIAlertView is deprecated. Use UIAlertController with a preferredStyle of UIAlertControllerStyleAlert instead"]
128        #[unsafe(method(title))]
129        #[unsafe(method_family = none)]
130        pub unsafe fn title(&self) -> Retained<NSString>;
131
132        /// Setter for [`title`][Self::title].
133        #[deprecated = "UIAlertView is deprecated. Use UIAlertController with a preferredStyle of UIAlertControllerStyleAlert instead"]
134        #[unsafe(method(setTitle:))]
135        #[unsafe(method_family = none)]
136        pub unsafe fn setTitle(&self, title: &NSString);
137
138        #[deprecated = "UIAlertView is deprecated. Use UIAlertController with a preferredStyle of UIAlertControllerStyleAlert instead"]
139        #[unsafe(method(message))]
140        #[unsafe(method_family = none)]
141        pub unsafe fn message(&self) -> Option<Retained<NSString>>;
142
143        /// Setter for [`message`][Self::message].
144        #[deprecated = "UIAlertView is deprecated. Use UIAlertController with a preferredStyle of UIAlertControllerStyleAlert instead"]
145        #[unsafe(method(setMessage:))]
146        #[unsafe(method_family = none)]
147        pub unsafe fn setMessage(&self, message: Option<&NSString>);
148
149        #[deprecated = "UIAlertView is deprecated. Use UIAlertController with a preferredStyle of UIAlertControllerStyleAlert instead"]
150        #[unsafe(method(addButtonWithTitle:))]
151        #[unsafe(method_family = none)]
152        pub unsafe fn addButtonWithTitle(&self, title: Option<&NSString>) -> NSInteger;
153
154        #[deprecated = "UIAlertView is deprecated. Use UIAlertController with a preferredStyle of UIAlertControllerStyleAlert instead"]
155        #[unsafe(method(buttonTitleAtIndex:))]
156        #[unsafe(method_family = none)]
157        pub unsafe fn buttonTitleAtIndex(
158            &self,
159            button_index: NSInteger,
160        ) -> Option<Retained<NSString>>;
161
162        #[deprecated = "UIAlertView is deprecated. Use UIAlertController with a preferredStyle of UIAlertControllerStyleAlert instead"]
163        #[unsafe(method(numberOfButtons))]
164        #[unsafe(method_family = none)]
165        pub unsafe fn numberOfButtons(&self) -> NSInteger;
166
167        #[deprecated = "UIAlertView is deprecated. Use UIAlertController with a preferredStyle of UIAlertControllerStyleAlert instead"]
168        #[unsafe(method(cancelButtonIndex))]
169        #[unsafe(method_family = none)]
170        pub unsafe fn cancelButtonIndex(&self) -> NSInteger;
171
172        /// Setter for [`cancelButtonIndex`][Self::cancelButtonIndex].
173        #[deprecated = "UIAlertView is deprecated. Use UIAlertController with a preferredStyle of UIAlertControllerStyleAlert instead"]
174        #[unsafe(method(setCancelButtonIndex:))]
175        #[unsafe(method_family = none)]
176        pub unsafe fn setCancelButtonIndex(&self, cancel_button_index: NSInteger);
177
178        #[deprecated = "UIAlertView is deprecated. Use UIAlertController with a preferredStyle of UIAlertControllerStyleAlert instead"]
179        #[unsafe(method(firstOtherButtonIndex))]
180        #[unsafe(method_family = none)]
181        pub unsafe fn firstOtherButtonIndex(&self) -> NSInteger;
182
183        #[deprecated = "UIAlertView is deprecated. Use UIAlertController with a preferredStyle of UIAlertControllerStyleAlert instead"]
184        #[unsafe(method(isVisible))]
185        #[unsafe(method_family = none)]
186        pub unsafe fn isVisible(&self) -> bool;
187
188        #[deprecated = "UIAlertView is deprecated. Use UIAlertController with a preferredStyle of UIAlertControllerStyleAlert instead"]
189        #[unsafe(method(show))]
190        #[unsafe(method_family = none)]
191        pub unsafe fn show(&self);
192
193        #[deprecated = "UIAlertView is deprecated. Use UIAlertController with a preferredStyle of UIAlertControllerStyleAlert instead"]
194        #[unsafe(method(dismissWithClickedButtonIndex:animated:))]
195        #[unsafe(method_family = none)]
196        pub unsafe fn dismissWithClickedButtonIndex_animated(
197            &self,
198            button_index: NSInteger,
199            animated: bool,
200        );
201
202        #[unsafe(method(alertViewStyle))]
203        #[unsafe(method_family = none)]
204        pub unsafe fn alertViewStyle(&self) -> UIAlertViewStyle;
205
206        /// Setter for [`alertViewStyle`][Self::alertViewStyle].
207        #[unsafe(method(setAlertViewStyle:))]
208        #[unsafe(method_family = none)]
209        pub unsafe fn setAlertViewStyle(&self, alert_view_style: UIAlertViewStyle);
210
211        #[cfg(all(feature = "UIControl", feature = "UITextField"))]
212        #[unsafe(method(textFieldAtIndex:))]
213        #[unsafe(method_family = none)]
214        pub unsafe fn textFieldAtIndex(
215            &self,
216            text_field_index: NSInteger,
217        ) -> Option<Retained<UITextField>>;
218    );
219}
220
221/// Methods declared on superclass `NSObject`.
222#[cfg(all(feature = "UIResponder", feature = "UIView"))]
223impl UIAlertView {
224    extern_methods!(
225        #[unsafe(method(init))]
226        #[unsafe(method_family = init)]
227        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
228
229        #[unsafe(method(new))]
230        #[unsafe(method_family = new)]
231        pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
232    );
233}
234
235extern_protocol!(
236    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uialertviewdelegate?language=objc)
237    pub unsafe trait UIAlertViewDelegate: NSObjectProtocol + MainThreadOnly {
238        #[cfg(all(feature = "UIResponder", feature = "UIView"))]
239        #[deprecated = "Use UIAlertController instead."]
240        #[optional]
241        #[unsafe(method(alertView:clickedButtonAtIndex:))]
242        #[unsafe(method_family = none)]
243        unsafe fn alertView_clickedButtonAtIndex(
244            &self,
245            alert_view: &UIAlertView,
246            button_index: NSInteger,
247        );
248
249        #[cfg(all(feature = "UIResponder", feature = "UIView"))]
250        #[deprecated = "Use UIAlertController instead."]
251        #[optional]
252        #[unsafe(method(alertViewCancel:))]
253        #[unsafe(method_family = none)]
254        unsafe fn alertViewCancel(&self, alert_view: &UIAlertView);
255
256        #[cfg(all(feature = "UIResponder", feature = "UIView"))]
257        #[deprecated = "Use UIAlertController instead."]
258        #[optional]
259        #[unsafe(method(willPresentAlertView:))]
260        #[unsafe(method_family = none)]
261        unsafe fn willPresentAlertView(&self, alert_view: &UIAlertView);
262
263        #[cfg(all(feature = "UIResponder", feature = "UIView"))]
264        #[deprecated = "Use UIAlertController instead."]
265        #[optional]
266        #[unsafe(method(didPresentAlertView:))]
267        #[unsafe(method_family = none)]
268        unsafe fn didPresentAlertView(&self, alert_view: &UIAlertView);
269
270        #[cfg(all(feature = "UIResponder", feature = "UIView"))]
271        #[deprecated = "Use UIAlertController instead."]
272        #[optional]
273        #[unsafe(method(alertView:willDismissWithButtonIndex:))]
274        #[unsafe(method_family = none)]
275        unsafe fn alertView_willDismissWithButtonIndex(
276            &self,
277            alert_view: &UIAlertView,
278            button_index: NSInteger,
279        );
280
281        #[cfg(all(feature = "UIResponder", feature = "UIView"))]
282        #[deprecated = "Use UIAlertController instead."]
283        #[optional]
284        #[unsafe(method(alertView:didDismissWithButtonIndex:))]
285        #[unsafe(method_family = none)]
286        unsafe fn alertView_didDismissWithButtonIndex(
287            &self,
288            alert_view: &UIAlertView,
289            button_index: NSInteger,
290        );
291
292        #[cfg(all(feature = "UIResponder", feature = "UIView"))]
293        #[deprecated = "Use UIAlertController instead."]
294        #[optional]
295        #[unsafe(method(alertViewShouldEnableFirstOtherButton:))]
296        #[unsafe(method_family = none)]
297        unsafe fn alertViewShouldEnableFirstOtherButton(&self, alert_view: &UIAlertView) -> bool;
298    }
299);