objc2-ui-kit 0.2.2

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

use crate::*;

// 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 {
    #[deprecated = "UIActionSheet is deprecated. Use UIAlertController with a preferredStyle of UIAlertControllerStyleActionSheet instead."]
    #[doc(alias = "UIActionSheetStyleAutomatic")]
    pub const Automatic: Self = Self(-1);
    #[cfg(feature = "UIInterface")]
    #[deprecated = "UIActionSheet is deprecated. Use UIAlertController with a preferredStyle of UIAlertControllerStyleActionSheet instead."]
    #[doc(alias = "UIActionSheetStyleDefault")]
    pub const Default: Self = Self(UIBarStyle::Default.0);
    #[cfg(feature = "UIInterface")]
    #[deprecated = "UIActionSheet is deprecated. Use UIAlertController with a preferredStyle of UIAlertControllerStyleActionSheet instead."]
    #[doc(alias = "UIActionSheetStyleBlackTranslucent")]
    pub const BlackTranslucent: Self = Self(UIBarStyle::BlackTranslucent.0);
    #[cfg(feature = "UIInterface")]
    #[deprecated = "UIActionSheet is deprecated. Use UIAlertController with a preferredStyle of UIAlertControllerStyleActionSheet instead."]
    #[doc(alias = "UIActionSheetStyleBlackOpaque")]
    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!(
    #[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"))]
    unsafe impl ClassType for UIActionSheet {
        #[inherits(UIResponder, NSObject)]
        type Super = UIView;
        type Mutability = MainThreadOnly;
    }
);

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

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

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

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

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

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

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

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

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

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

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

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

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

        #[deprecated = "UIActionSheet is deprecated. Use UIAlertController with a preferredStyle of UIAlertControllerStyleActionSheet instead"]
        #[method(setDelegate:)]
        pub unsafe fn setDelegate(
            &self,
            delegate: Option<&ProtocolObject<dyn UIActionSheetDelegate>>,
        );

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

        #[deprecated = "UIActionSheet is deprecated. Use UIAlertController with a preferredStyle of UIAlertControllerStyleActionSheet instead"]
        #[method(setTitle:)]
        pub unsafe fn setTitle(&self, title: &NSString);

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

        #[deprecated = "UIActionSheet is deprecated. Use UIAlertController with a preferredStyle of UIAlertControllerStyleActionSheet instead"]
        #[method(setActionSheetStyle:)]
        pub unsafe fn setActionSheetStyle(&self, action_sheet_style: UIActionSheetStyle);

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

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

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

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

        #[deprecated = "UIActionSheet is deprecated. Use UIAlertController with a preferredStyle of UIAlertControllerStyleActionSheet instead"]
        #[method(setCancelButtonIndex:)]
        pub unsafe fn setCancelButtonIndex(&self, cancel_button_index: NSInteger);

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

        #[deprecated = "UIActionSheet is deprecated. Use UIAlertController with a preferredStyle of UIAlertControllerStyleActionSheet instead"]
        #[method(setDestructiveButtonIndex:)]
        pub unsafe fn setDestructiveButtonIndex(&self, destructive_button_index: NSInteger);

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

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

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

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

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

        #[method(showFromRect:inView:animated:)]
        pub unsafe fn showFromRect_inView_animated(
            &self,
            rect: CGRect,
            view: &UIView,
            animated: bool,
        );

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

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

extern_methods!(
    /// Methods declared on superclass `UIView`
    #[cfg(all(feature = "UIResponder", feature = "UIView"))]
    unsafe impl UIActionSheet {
        #[method_id(@__retain_semantics Init initWithFrame:)]
        pub unsafe fn initWithFrame(this: Allocated<Self>, frame: CGRect) -> Retained<Self>;

        #[method_id(@__retain_semantics Init initWithCoder:)]
        pub unsafe fn initWithCoder(
            this: Allocated<Self>,
            coder: &NSCoder,
        ) -> Option<Retained<Self>>;
    }
);

extern_methods!(
    /// Methods declared on superclass `NSObject`
    #[cfg(all(feature = "UIResponder", feature = "UIView"))]
    unsafe impl UIActionSheet {
        #[method_id(@__retain_semantics Init init)]
        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;

        #[method_id(@__retain_semantics New new)]
        pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
    }
);

extern_protocol!(
    pub unsafe trait UIActionSheetDelegate: NSObjectProtocol + IsMainThreadOnly {
        #[cfg(all(feature = "UIResponder", feature = "UIView"))]
        #[deprecated = "Use UIAlertController instead."]
        #[optional]
        #[method(actionSheet:clickedButtonAtIndex:)]
        unsafe fn actionSheet_clickedButtonAtIndex(
            &self,
            action_sheet: &UIActionSheet,
            button_index: NSInteger,
        );

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

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

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

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

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

    unsafe impl ProtocolType for dyn UIActionSheetDelegate {}
);