objc2_ui_kit/generated/
UIAlertView.rs1use 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#[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 #[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 #[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 #[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 #[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 #[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 #[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 #[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#[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#[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 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);