objc2-ui-kit 0.3.2

Bindings to the UIKit framework
Documentation
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use core::ffi::*;
use core::ptr::NonNull;
use objc2::__framework_prelude::*;
#[cfg(feature = "objc2-core-foundation")]
use objc2_core_foundation::*;
use objc2_foundation::*;
#[cfg(feature = "objc2-quartz-core")]
#[cfg(not(target_os = "watchos"))]
use objc2_quartz_core::*;

use crate::*;

/// [Apple's documentation](https://developer.apple.com/documentation/uikit/uiactionsheetstyle?language=objc)
// NS_ENUM
#[deprecated = "UIActionSheet is deprecated. Use UIAlertController with a preferredStyle of UIAlertControllerStyleActionSheet instead."]
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct UIActionSheetStyle(pub NSInteger);
impl UIActionSheetStyle {
    #[doc(alias = "UIActionSheetStyleAutomatic")]
    #[deprecated = "UIActionSheet is deprecated. Use UIAlertController with a preferredStyle of UIAlertControllerStyleActionSheet instead."]
    pub const Automatic: Self = Self(-1);
    #[doc(alias = "UIActionSheetStyleDefault")]
    #[cfg(feature = "UIInterface")]
    #[deprecated = "UIActionSheet is deprecated. Use UIAlertController with a preferredStyle of UIAlertControllerStyleActionSheet instead."]
    pub const Default: Self = Self(UIBarStyle::Default.0);
    #[doc(alias = "UIActionSheetStyleBlackTranslucent")]
    #[cfg(feature = "UIInterface")]
    #[deprecated = "UIActionSheet is deprecated. Use UIAlertController with a preferredStyle of UIAlertControllerStyleActionSheet instead."]
    pub const BlackTranslucent: Self = Self(UIBarStyle::BlackTranslucent.0);
    #[doc(alias = "UIActionSheetStyleBlackOpaque")]
    #[cfg(feature = "UIInterface")]
    #[deprecated = "UIActionSheet is deprecated. Use UIAlertController with a preferredStyle of UIAlertControllerStyleActionSheet instead."]
    pub const BlackOpaque: Self = Self(UIBarStyle::BlackOpaque.0);
}

unsafe impl Encode for UIActionSheetStyle {
    const ENCODING: Encoding = NSInteger::ENCODING;
}

unsafe impl RefEncode for UIActionSheetStyle {
    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}

extern_class!(
    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uiactionsheet?language=objc)
    #[unsafe(super(UIView, UIResponder, NSObject))]
    #[thread_kind = MainThreadOnly]
    #[derive(Debug, PartialEq, Eq, Hash)]
    #[cfg(all(feature = "UIResponder", feature = "UIView"))]
    #[deprecated = "UIActionSheet is deprecated. Use UIAlertController with a preferredStyle of UIAlertControllerStyleActionSheet instead"]
    pub struct UIActionSheet;
);

#[cfg(all(
    feature = "UIResponder",
    feature = "UIView",
    feature = "objc2-quartz-core"
))]
#[cfg(not(target_os = "watchos"))]
extern_conformance!(
    unsafe impl CALayerDelegate for UIActionSheet {}
);

#[cfg(all(feature = "UIResponder", feature = "UIView"))]
extern_conformance!(
    unsafe impl NSCoding for UIActionSheet {}
);

#[cfg(all(feature = "UIResponder", feature = "UIView"))]
extern_conformance!(
    unsafe impl NSObjectProtocol for UIActionSheet {}
);

#[cfg(all(feature = "UIAppearance", feature = "UIResponder", feature = "UIView"))]
extern_conformance!(
    unsafe impl UIAppearance for UIActionSheet {}
);

#[cfg(all(feature = "UIAppearance", feature = "UIResponder", feature = "UIView"))]
extern_conformance!(
    unsafe impl UIAppearanceContainer for UIActionSheet {}
);

#[cfg(all(feature = "UIResponder", feature = "UIView"))]
extern_conformance!(
    unsafe impl UICoordinateSpace for UIActionSheet {}
);

#[cfg(all(
    feature = "UIDynamicBehavior",
    feature = "UIResponder",
    feature = "UIView"
))]
extern_conformance!(
    unsafe impl UIDynamicItem for UIActionSheet {}
);

#[cfg(all(feature = "UIFocus", feature = "UIResponder", feature = "UIView"))]
extern_conformance!(
    unsafe impl UIFocusEnvironment for UIActionSheet {}
);

#[cfg(all(feature = "UIFocus", feature = "UIResponder", feature = "UIView"))]
extern_conformance!(
    unsafe impl UIFocusItem for UIActionSheet {}
);

#[cfg(all(feature = "UIFocus", feature = "UIResponder", feature = "UIView"))]
extern_conformance!(
    unsafe impl UIFocusItemContainer for UIActionSheet {}
);

#[cfg(all(feature = "UIResponder", feature = "UIView"))]
extern_conformance!(
    unsafe impl UIResponderStandardEditActions for UIActionSheet {}
);

#[cfg(all(
    feature = "UIResponder",
    feature = "UITraitCollection",
    feature = "UIView"
))]
extern_conformance!(
    unsafe impl UITraitEnvironment for UIActionSheet {}
);

#[cfg(all(feature = "UIResponder", feature = "UIView"))]
impl UIActionSheet {
    extern_methods!(
        #[deprecated = "UIActionSheet is deprecated. Use UIAlertController with a preferredStyle of UIAlertControllerStyleActionSheet instead"]
        #[unsafe(method(delegate))]
        #[unsafe(method_family = none)]
        pub fn delegate(&self) -> Option<Retained<ProtocolObject<dyn UIActionSheetDelegate>>>;

        /// Setter for [`delegate`][Self::delegate].
        ///
        /// This is a [weak property][objc2::topics::weak_property].
        #[deprecated = "UIActionSheet is deprecated. Use UIAlertController with a preferredStyle of UIAlertControllerStyleActionSheet instead"]
        #[unsafe(method(setDelegate:))]
        #[unsafe(method_family = none)]
        pub fn setDelegate(&self, delegate: Option<&ProtocolObject<dyn UIActionSheetDelegate>>);

        #[deprecated = "UIActionSheet is deprecated. Use UIAlertController with a preferredStyle of UIAlertControllerStyleActionSheet instead"]
        #[unsafe(method(title))]
        #[unsafe(method_family = none)]
        pub fn title(&self) -> Retained<NSString>;

        /// Setter for [`title`][Self::title].
        ///
        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
        #[deprecated = "UIActionSheet is deprecated. Use UIAlertController with a preferredStyle of UIAlertControllerStyleActionSheet instead"]
        #[unsafe(method(setTitle:))]
        #[unsafe(method_family = none)]
        pub fn setTitle(&self, title: &NSString);

        #[deprecated = "UIActionSheet is deprecated. Use UIAlertController with a preferredStyle of UIAlertControllerStyleActionSheet instead"]
        #[unsafe(method(actionSheetStyle))]
        #[unsafe(method_family = none)]
        pub fn actionSheetStyle(&self) -> UIActionSheetStyle;

        /// Setter for [`actionSheetStyle`][Self::actionSheetStyle].
        #[deprecated = "UIActionSheet is deprecated. Use UIAlertController with a preferredStyle of UIAlertControllerStyleActionSheet instead"]
        #[unsafe(method(setActionSheetStyle:))]
        #[unsafe(method_family = none)]
        pub fn setActionSheetStyle(&self, action_sheet_style: UIActionSheetStyle);

        #[deprecated = "UIActionSheet is deprecated. Use UIAlertController with a preferredStyle of UIAlertControllerStyleActionSheet instead"]
        #[unsafe(method(addButtonWithTitle:))]
        #[unsafe(method_family = none)]
        pub fn addButtonWithTitle(&self, title: Option<&NSString>) -> NSInteger;

        #[deprecated = "UIActionSheet is deprecated. Use UIAlertController with a preferredStyle of UIAlertControllerStyleActionSheet instead"]
        #[unsafe(method(buttonTitleAtIndex:))]
        #[unsafe(method_family = none)]
        pub fn buttonTitleAtIndex(&self, button_index: NSInteger) -> Option<Retained<NSString>>;

        #[deprecated = "UIActionSheet is deprecated. Use UIAlertController with a preferredStyle of UIAlertControllerStyleActionSheet instead"]
        #[unsafe(method(numberOfButtons))]
        #[unsafe(method_family = none)]
        pub fn numberOfButtons(&self) -> NSInteger;

        #[deprecated = "UIActionSheet is deprecated. Use UIAlertController with a preferredStyle of UIAlertControllerStyleActionSheet instead"]
        #[unsafe(method(cancelButtonIndex))]
        #[unsafe(method_family = none)]
        pub fn cancelButtonIndex(&self) -> NSInteger;

        /// Setter for [`cancelButtonIndex`][Self::cancelButtonIndex].
        #[deprecated = "UIActionSheet is deprecated. Use UIAlertController with a preferredStyle of UIAlertControllerStyleActionSheet instead"]
        #[unsafe(method(setCancelButtonIndex:))]
        #[unsafe(method_family = none)]
        pub fn setCancelButtonIndex(&self, cancel_button_index: NSInteger);

        #[deprecated = "UIActionSheet is deprecated. Use UIAlertController with a preferredStyle of UIAlertControllerStyleActionSheet instead"]
        #[unsafe(method(destructiveButtonIndex))]
        #[unsafe(method_family = none)]
        pub fn destructiveButtonIndex(&self) -> NSInteger;

        /// Setter for [`destructiveButtonIndex`][Self::destructiveButtonIndex].
        #[deprecated = "UIActionSheet is deprecated. Use UIAlertController with a preferredStyle of UIAlertControllerStyleActionSheet instead"]
        #[unsafe(method(setDestructiveButtonIndex:))]
        #[unsafe(method_family = none)]
        pub fn setDestructiveButtonIndex(&self, destructive_button_index: NSInteger);

        #[deprecated = "UIActionSheet is deprecated. Use UIAlertController with a preferredStyle of UIAlertControllerStyleActionSheet instead"]
        #[unsafe(method(firstOtherButtonIndex))]
        #[unsafe(method_family = none)]
        pub fn firstOtherButtonIndex(&self) -> NSInteger;

        #[deprecated = "UIActionSheet is deprecated. Use UIAlertController with a preferredStyle of UIAlertControllerStyleActionSheet instead"]
        #[unsafe(method(isVisible))]
        #[unsafe(method_family = none)]
        pub fn isVisible(&self) -> bool;

        #[cfg(feature = "UIToolbar")]
        #[deprecated = "UIActionSheet is deprecated. Use UIAlertController with a preferredStyle of UIAlertControllerStyleActionSheet instead"]
        #[unsafe(method(showFromToolbar:))]
        #[unsafe(method_family = none)]
        pub fn showFromToolbar(&self, view: &UIToolbar);

        #[cfg(feature = "UITabBar")]
        #[deprecated = "UIActionSheet is deprecated. Use UIAlertController with a preferredStyle of UIAlertControllerStyleActionSheet instead"]
        #[unsafe(method(showFromTabBar:))]
        #[unsafe(method_family = none)]
        pub fn showFromTabBar(&self, view: &UITabBar);

        #[cfg(all(feature = "UIBarButtonItem", feature = "UIBarItem"))]
        #[unsafe(method(showFromBarButtonItem:animated:))]
        #[unsafe(method_family = none)]
        pub fn showFromBarButtonItem_animated(&self, item: &UIBarButtonItem, animated: bool);

        #[cfg(feature = "objc2-core-foundation")]
        #[unsafe(method(showFromRect:inView:animated:))]
        #[unsafe(method_family = none)]
        pub fn showFromRect_inView_animated(&self, rect: CGRect, view: &UIView, animated: bool);

        #[deprecated = "UIActionSheet is deprecated. Use UIAlertController with a preferredStyle of UIAlertControllerStyleActionSheet instead"]
        #[unsafe(method(showInView:))]
        #[unsafe(method_family = none)]
        pub fn showInView(&self, view: &UIView);

        #[deprecated = "UIActionSheet is deprecated. Use UIAlertController with a preferredStyle of UIAlertControllerStyleActionSheet instead"]
        #[unsafe(method(dismissWithClickedButtonIndex:animated:))]
        #[unsafe(method_family = none)]
        pub fn dismissWithClickedButtonIndex_animated(
            &self,
            button_index: NSInteger,
            animated: bool,
        );
    );
}

/// Methods declared on superclass `UIView`.
#[cfg(all(feature = "UIResponder", feature = "UIView"))]
impl UIActionSheet {
    extern_methods!(
        #[cfg(feature = "objc2-core-foundation")]
        #[unsafe(method(initWithFrame:))]
        #[unsafe(method_family = init)]
        pub fn initWithFrame(this: Allocated<Self>, frame: CGRect) -> Retained<Self>;

        /// # Safety
        ///
        /// `coder` possibly has further requirements.
        #[unsafe(method(initWithCoder:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithCoder(
            this: Allocated<Self>,
            coder: &NSCoder,
        ) -> Option<Retained<Self>>;

        #[unsafe(method(init))]
        #[unsafe(method_family = init)]
        pub fn init(this: Allocated<Self>) -> Retained<Self>;
    );
}

/// Methods declared on superclass `NSObject`.
#[cfg(all(feature = "UIResponder", feature = "UIView"))]
impl UIActionSheet {
    extern_methods!(
        #[unsafe(method(new))]
        #[unsafe(method_family = new)]
        pub fn new(mtm: MainThreadMarker) -> Retained<Self>;
    );
}

extern_protocol!(
    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uiactionsheetdelegate?language=objc)
    pub unsafe trait UIActionSheetDelegate: NSObjectProtocol + MainThreadOnly {
        #[cfg(all(feature = "UIResponder", feature = "UIView"))]
        #[deprecated = "Use UIAlertController instead."]
        #[optional]
        #[unsafe(method(actionSheet:clickedButtonAtIndex:))]
        #[unsafe(method_family = none)]
        fn actionSheet_clickedButtonAtIndex(
            &self,
            action_sheet: &UIActionSheet,
            button_index: NSInteger,
        );

        #[cfg(all(feature = "UIResponder", feature = "UIView"))]
        #[deprecated = "Use UIAlertController instead."]
        #[optional]
        #[unsafe(method(actionSheetCancel:))]
        #[unsafe(method_family = none)]
        fn actionSheetCancel(&self, action_sheet: &UIActionSheet);

        #[cfg(all(feature = "UIResponder", feature = "UIView"))]
        #[deprecated = "Use UIAlertController instead."]
        #[optional]
        #[unsafe(method(willPresentActionSheet:))]
        #[unsafe(method_family = none)]
        fn willPresentActionSheet(&self, action_sheet: &UIActionSheet);

        #[cfg(all(feature = "UIResponder", feature = "UIView"))]
        #[deprecated = "Use UIAlertController instead."]
        #[optional]
        #[unsafe(method(didPresentActionSheet:))]
        #[unsafe(method_family = none)]
        fn didPresentActionSheet(&self, action_sheet: &UIActionSheet);

        #[cfg(all(feature = "UIResponder", feature = "UIView"))]
        #[deprecated = "Use UIAlertController instead."]
        #[optional]
        #[unsafe(method(actionSheet:willDismissWithButtonIndex:))]
        #[unsafe(method_family = none)]
        fn actionSheet_willDismissWithButtonIndex(
            &self,
            action_sheet: &UIActionSheet,
            button_index: NSInteger,
        );

        #[cfg(all(feature = "UIResponder", feature = "UIView"))]
        #[deprecated = "Use UIAlertController instead."]
        #[optional]
        #[unsafe(method(actionSheet:didDismissWithButtonIndex:))]
        #[unsafe(method_family = none)]
        fn actionSheet_didDismissWithButtonIndex(
            &self,
            action_sheet: &UIActionSheet,
            button_index: NSInteger,
        );
    }
);