use core::ffi::*;
use core::ptr::NonNull;
use objc2::__framework_prelude::*;
use objc2_foundation::*;
use crate::*;
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct UIAlertActionStyle(pub NSInteger);
impl UIAlertActionStyle {
#[doc(alias = "UIAlertActionStyleDefault")]
pub const Default: Self = Self(0);
#[doc(alias = "UIAlertActionStyleCancel")]
pub const Cancel: Self = Self(1);
#[doc(alias = "UIAlertActionStyleDestructive")]
pub const Destructive: Self = Self(2);
}
unsafe impl Encode for UIAlertActionStyle {
const ENCODING: Encoding = NSInteger::ENCODING;
}
unsafe impl RefEncode for UIAlertActionStyle {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct UIAlertControllerStyle(pub NSInteger);
impl UIAlertControllerStyle {
#[doc(alias = "UIAlertControllerStyleActionSheet")]
pub const ActionSheet: Self = Self(0);
#[doc(alias = "UIAlertControllerStyleAlert")]
pub const Alert: Self = Self(1);
}
unsafe impl Encode for UIAlertControllerStyle {
const ENCODING: Encoding = NSInteger::ENCODING;
}
unsafe impl RefEncode for UIAlertControllerStyle {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct UIAlertControllerSeverity(pub NSInteger);
impl UIAlertControllerSeverity {
#[doc(alias = "UIAlertControllerSeverityDefault")]
pub const Default: Self = Self(0);
#[doc(alias = "UIAlertControllerSeverityCritical")]
pub const Critical: Self = Self(1);
}
unsafe impl Encode for UIAlertControllerSeverity {
const ENCODING: Encoding = NSInteger::ENCODING;
}
unsafe impl RefEncode for UIAlertControllerSeverity {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
extern_class!(
#[unsafe(super(NSObject))]
#[thread_kind = MainThreadOnly]
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct UIAlertAction;
);
extern_conformance!(
unsafe impl NSCopying for UIAlertAction {}
);
unsafe impl CopyingHelper for UIAlertAction {
type Result = Self;
}
extern_conformance!(
unsafe impl NSObjectProtocol for UIAlertAction {}
);
impl UIAlertAction {
extern_methods!(
#[cfg(feature = "block2")]
#[unsafe(method(actionWithTitle:style:handler:))]
#[unsafe(method_family = none)]
pub fn actionWithTitle_style_handler(
title: Option<&NSString>,
style: UIAlertActionStyle,
handler: Option<&block2::DynBlock<dyn Fn(NonNull<UIAlertAction>)>>,
mtm: MainThreadMarker,
) -> Retained<Self>;
#[unsafe(method(title))]
#[unsafe(method_family = none)]
pub fn title(&self) -> Option<Retained<NSString>>;
#[unsafe(method(style))]
#[unsafe(method_family = none)]
pub fn style(&self) -> UIAlertActionStyle;
#[unsafe(method(isEnabled))]
#[unsafe(method_family = none)]
pub fn isEnabled(&self) -> bool;
#[unsafe(method(setEnabled:))]
#[unsafe(method_family = none)]
pub fn setEnabled(&self, enabled: bool);
);
}
impl UIAlertAction {
extern_methods!(
#[unsafe(method(init))]
#[unsafe(method_family = init)]
pub fn init(this: Allocated<Self>) -> Retained<Self>;
#[unsafe(method(new))]
#[unsafe(method_family = new)]
pub fn new(mtm: MainThreadMarker) -> Retained<Self>;
);
}
extern_class!(
#[unsafe(super(UIViewController, UIResponder, NSObject))]
#[thread_kind = MainThreadOnly]
#[derive(Debug, PartialEq, Eq, Hash)]
#[cfg(all(feature = "UIResponder", feature = "UIViewController"))]
pub struct UIAlertController;
);
#[cfg(all(feature = "UIResponder", feature = "UIViewController"))]
extern_conformance!(
unsafe impl NSCoding for UIAlertController {}
);
#[cfg(all(feature = "UIResponder", feature = "UIViewController"))]
extern_conformance!(
unsafe impl NSObjectProtocol for UIAlertController {}
);
#[cfg(all(
feature = "UIAppearance",
feature = "UIResponder",
feature = "UIViewController"
))]
extern_conformance!(
unsafe impl UIAppearanceContainer for UIAlertController {}
);
#[cfg(all(feature = "UIResponder", feature = "UIViewController"))]
extern_conformance!(
unsafe impl UIContentContainer for UIAlertController {}
);
#[cfg(all(
feature = "UIFocus",
feature = "UIResponder",
feature = "UIViewController"
))]
extern_conformance!(
unsafe impl UIFocusEnvironment for UIAlertController {}
);
#[cfg(all(feature = "UIResponder", feature = "UIViewController"))]
extern_conformance!(
unsafe impl UIResponderStandardEditActions for UIAlertController {}
);
#[cfg(all(
feature = "UIResponder",
feature = "UITraitCollection",
feature = "UIViewController"
))]
extern_conformance!(
unsafe impl UITraitEnvironment for UIAlertController {}
);
#[cfg(all(feature = "UIResponder", feature = "UIViewController"))]
impl UIAlertController {
extern_methods!(
#[unsafe(method(alertControllerWithTitle:message:preferredStyle:))]
#[unsafe(method_family = none)]
pub fn alertControllerWithTitle_message_preferredStyle(
title: Option<&NSString>,
message: Option<&NSString>,
preferred_style: UIAlertControllerStyle,
mtm: MainThreadMarker,
) -> Retained<Self>;
#[unsafe(method(addAction:))]
#[unsafe(method_family = none)]
pub fn addAction(&self, action: &UIAlertAction);
#[unsafe(method(actions))]
#[unsafe(method_family = none)]
pub fn actions(&self) -> Retained<NSArray<UIAlertAction>>;
#[unsafe(method(preferredAction))]
#[unsafe(method_family = none)]
pub fn preferredAction(&self) -> Option<Retained<UIAlertAction>>;
#[unsafe(method(setPreferredAction:))]
#[unsafe(method_family = none)]
pub fn setPreferredAction(&self, preferred_action: Option<&UIAlertAction>);
#[cfg(all(
feature = "UIControl",
feature = "UITextField",
feature = "UIView",
feature = "block2"
))]
#[unsafe(method(addTextFieldWithConfigurationHandler:))]
#[unsafe(method_family = none)]
pub fn addTextFieldWithConfigurationHandler(
&self,
configuration_handler: Option<&block2::DynBlock<dyn Fn(NonNull<UITextField>)>>,
);
#[cfg(all(feature = "UIControl", feature = "UITextField", feature = "UIView"))]
#[unsafe(method(textFields))]
#[unsafe(method_family = none)]
pub fn textFields(&self) -> Option<Retained<NSArray<UITextField>>>;
#[unsafe(method(title))]
#[unsafe(method_family = none)]
pub fn title(&self) -> Option<Retained<NSString>>;
#[unsafe(method(setTitle:))]
#[unsafe(method_family = none)]
pub fn setTitle(&self, title: Option<&NSString>);
#[unsafe(method(message))]
#[unsafe(method_family = none)]
pub fn message(&self) -> Option<Retained<NSString>>;
#[unsafe(method(setMessage:))]
#[unsafe(method_family = none)]
pub fn setMessage(&self, message: Option<&NSString>);
#[unsafe(method(preferredStyle))]
#[unsafe(method_family = none)]
pub fn preferredStyle(&self) -> UIAlertControllerStyle;
#[unsafe(method(severity))]
#[unsafe(method_family = none)]
pub fn severity(&self) -> UIAlertControllerSeverity;
#[unsafe(method(setSeverity:))]
#[unsafe(method_family = none)]
pub fn setSeverity(&self, severity: UIAlertControllerSeverity);
);
}
#[cfg(all(feature = "UIResponder", feature = "UIViewController"))]
impl UIAlertController {
extern_methods!(
#[unsafe(method(initWithNibName:bundle:))]
#[unsafe(method_family = init)]
pub fn initWithNibName_bundle(
this: Allocated<Self>,
nib_name_or_nil: Option<&NSString>,
nib_bundle_or_nil: Option<&NSBundle>,
) -> Retained<Self>;
#[unsafe(method(initWithCoder:))]
#[unsafe(method_family = init)]
pub unsafe fn initWithCoder(
this: Allocated<Self>,
coder: &NSCoder,
) -> Option<Retained<Self>>;
);
}
#[cfg(all(feature = "UIResponder", feature = "UIViewController"))]
impl UIAlertController {
extern_methods!(
#[unsafe(method(init))]
#[unsafe(method_family = init)]
pub fn init(this: Allocated<Self>) -> Retained<Self>;
#[unsafe(method(new))]
#[unsafe(method_family = new)]
pub fn new(mtm: MainThreadMarker) -> Retained<Self>;
);
}
#[cfg(all(feature = "UIResponder", feature = "UIViewController"))]
impl UIAlertController {
extern_methods!();
}
#[cfg(all(
feature = "UIResponder",
feature = "UISpringLoadedInteractionSupporting",
feature = "UIViewController"
))]
extern_conformance!(
unsafe impl UISpringLoadedInteractionSupporting for UIAlertController {}
);