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::*;
use objc2_foundation::*;

use crate::*;

/// [Apple's documentation](https://developer.apple.com/documentation/uikit/uiaccessibilitycustomrotordirection?language=objc)
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct UIAccessibilityCustomRotorDirection(pub NSInteger);
impl UIAccessibilityCustomRotorDirection {
    #[doc(alias = "UIAccessibilityCustomRotorDirectionPrevious")]
    pub const Previous: Self = Self(0);
    #[doc(alias = "UIAccessibilityCustomRotorDirectionNext")]
    pub const Next: Self = Self(1);
}

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

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

/// [Apple's documentation](https://developer.apple.com/documentation/uikit/uiaccessibilitycustomsystemrotortype?language=objc)
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct UIAccessibilityCustomSystemRotorType(pub NSInteger);
impl UIAccessibilityCustomSystemRotorType {
    #[doc(alias = "UIAccessibilityCustomSystemRotorTypeNone")]
    pub const None: Self = Self(0);
    #[doc(alias = "UIAccessibilityCustomSystemRotorTypeLink")]
    pub const Link: Self = Self(1);
    #[doc(alias = "UIAccessibilityCustomSystemRotorTypeVisitedLink")]
    pub const VisitedLink: Self = Self(2);
    #[doc(alias = "UIAccessibilityCustomSystemRotorTypeHeading")]
    pub const Heading: Self = Self(3);
    #[doc(alias = "UIAccessibilityCustomSystemRotorTypeHeadingLevel1")]
    pub const HeadingLevel1: Self = Self(4);
    #[doc(alias = "UIAccessibilityCustomSystemRotorTypeHeadingLevel2")]
    pub const HeadingLevel2: Self = Self(5);
    #[doc(alias = "UIAccessibilityCustomSystemRotorTypeHeadingLevel3")]
    pub const HeadingLevel3: Self = Self(6);
    #[doc(alias = "UIAccessibilityCustomSystemRotorTypeHeadingLevel4")]
    pub const HeadingLevel4: Self = Self(7);
    #[doc(alias = "UIAccessibilityCustomSystemRotorTypeHeadingLevel5")]
    pub const HeadingLevel5: Self = Self(8);
    #[doc(alias = "UIAccessibilityCustomSystemRotorTypeHeadingLevel6")]
    pub const HeadingLevel6: Self = Self(9);
    #[doc(alias = "UIAccessibilityCustomSystemRotorTypeBoldText")]
    pub const BoldText: Self = Self(10);
    #[doc(alias = "UIAccessibilityCustomSystemRotorTypeItalicText")]
    pub const ItalicText: Self = Self(11);
    #[doc(alias = "UIAccessibilityCustomSystemRotorTypeUnderlineText")]
    pub const UnderlineText: Self = Self(12);
    #[doc(alias = "UIAccessibilityCustomSystemRotorTypeMisspelledWord")]
    pub const MisspelledWord: Self = Self(13);
    #[doc(alias = "UIAccessibilityCustomSystemRotorTypeImage")]
    pub const Image: Self = Self(14);
    #[doc(alias = "UIAccessibilityCustomSystemRotorTypeTextField")]
    pub const TextField: Self = Self(15);
    #[doc(alias = "UIAccessibilityCustomSystemRotorTypeTable")]
    pub const Table: Self = Self(16);
    #[doc(alias = "UIAccessibilityCustomSystemRotorTypeList")]
    pub const List: Self = Self(17);
    #[doc(alias = "UIAccessibilityCustomSystemRotorTypeLandmark")]
    pub const Landmark: Self = Self(18);
}

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

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

/// [Apple's documentation](https://developer.apple.com/documentation/uikit/uiaccessibilitycustomrotorsearch?language=objc)
#[cfg(feature = "block2")]
pub type UIAccessibilityCustomRotorSearch = *mut block2::DynBlock<
    dyn Fn(
        NonNull<UIAccessibilityCustomRotorSearchPredicate>,
    ) -> *mut UIAccessibilityCustomRotorItemResult,
>;

/// [Apple's documentation](https://developer.apple.com/documentation/uikit/axcustomrotorsreturnblock?language=objc)
#[cfg(feature = "block2")]
pub type AXCustomRotorsReturnBlock =
    *mut block2::DynBlock<dyn Fn() -> *mut NSArray<UIAccessibilityCustomRotor>>;

mod private_NSObjectUIAccessibilityCustomRotor {
    pub trait Sealed {}
}

/// Category "UIAccessibilityCustomRotor" on [`NSObject`].
#[doc(alias = "UIAccessibilityCustomRotor")]
pub unsafe trait NSObjectUIAccessibilityCustomRotor:
    ClassType + Sized + private_NSObjectUIAccessibilityCustomRotor::Sealed
{
    extern_methods!(
        #[unsafe(method(accessibilityCustomRotors))]
        #[unsafe(method_family = none)]
        fn accessibilityCustomRotors(
            &self,
            mtm: MainThreadMarker,
        ) -> Option<Retained<NSArray<UIAccessibilityCustomRotor>>>;

        /// Setter for [`accessibilityCustomRotors`][Self::accessibilityCustomRotors].
        #[unsafe(method(setAccessibilityCustomRotors:))]
        #[unsafe(method_family = none)]
        fn setAccessibilityCustomRotors(
            &self,
            accessibility_custom_rotors: Option<&NSArray<UIAccessibilityCustomRotor>>,
            mtm: MainThreadMarker,
        );

        #[cfg(feature = "block2")]
        #[unsafe(method(accessibilityCustomRotorsBlock))]
        #[unsafe(method_family = none)]
        fn accessibilityCustomRotorsBlock(
            &self,
            mtm: MainThreadMarker,
        ) -> AXCustomRotorsReturnBlock;

        #[cfg(feature = "block2")]
        /// Setter for [`accessibilityCustomRotorsBlock`][Self::accessibilityCustomRotorsBlock].
        ///
        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
        ///
        /// # Safety
        ///
        /// `accessibility_custom_rotors_block` must be a valid pointer or null.
        #[unsafe(method(setAccessibilityCustomRotorsBlock:))]
        #[unsafe(method_family = none)]
        unsafe fn setAccessibilityCustomRotorsBlock(
            &self,
            accessibility_custom_rotors_block: AXCustomRotorsReturnBlock,
            mtm: MainThreadMarker,
        );
    );
}

impl private_NSObjectUIAccessibilityCustomRotor::Sealed for NSObject {}
unsafe impl NSObjectUIAccessibilityCustomRotor for NSObject {}

extern_class!(
    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uiaccessibilitycustomrotorsearchpredicate?language=objc)
    #[unsafe(super(NSObject))]
    #[thread_kind = MainThreadOnly]
    #[derive(Debug, PartialEq, Eq, Hash)]
    pub struct UIAccessibilityCustomRotorSearchPredicate;
);

extern_conformance!(
    unsafe impl NSObjectProtocol for UIAccessibilityCustomRotorSearchPredicate {}
);

impl UIAccessibilityCustomRotorSearchPredicate {
    extern_methods!(
        #[unsafe(method(currentItem))]
        #[unsafe(method_family = none)]
        pub fn currentItem(&self) -> Retained<UIAccessibilityCustomRotorItemResult>;

        /// Setter for [`currentItem`][Self::currentItem].
        #[unsafe(method(setCurrentItem:))]
        #[unsafe(method_family = none)]
        pub fn setCurrentItem(&self, current_item: &UIAccessibilityCustomRotorItemResult);

        #[unsafe(method(searchDirection))]
        #[unsafe(method_family = none)]
        pub fn searchDirection(&self) -> UIAccessibilityCustomRotorDirection;

        /// Setter for [`searchDirection`][Self::searchDirection].
        #[unsafe(method(setSearchDirection:))]
        #[unsafe(method_family = none)]
        pub fn setSearchDirection(&self, search_direction: UIAccessibilityCustomRotorDirection);
    );
}

/// Methods declared on superclass `NSObject`.
impl UIAccessibilityCustomRotorSearchPredicate {
    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!(
    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uiaccessibilitycustomrotor?language=objc)
    #[unsafe(super(NSObject))]
    #[thread_kind = MainThreadOnly]
    #[derive(Debug, PartialEq, Eq, Hash)]
    pub struct UIAccessibilityCustomRotor;
);

extern_conformance!(
    unsafe impl NSObjectProtocol for UIAccessibilityCustomRotor {}
);

impl UIAccessibilityCustomRotor {
    extern_methods!(
        #[cfg(feature = "block2")]
        /// # Safety
        ///
        /// `item_search_block` must be a valid pointer.
        #[unsafe(method(initWithName:itemSearchBlock:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithName_itemSearchBlock(
            this: Allocated<Self>,
            name: &NSString,
            item_search_block: UIAccessibilityCustomRotorSearch,
        ) -> Retained<Self>;

        #[cfg(feature = "block2")]
        /// # Safety
        ///
        /// `item_search_block` must be a valid pointer.
        #[unsafe(method(initWithAttributedName:itemSearchBlock:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithAttributedName_itemSearchBlock(
            this: Allocated<Self>,
            attributed_name: &NSAttributedString,
            item_search_block: UIAccessibilityCustomRotorSearch,
        ) -> Retained<Self>;

        #[cfg(feature = "block2")]
        /// # Safety
        ///
        /// `item_search_block` must be a valid pointer.
        #[unsafe(method(initWithSystemType:itemSearchBlock:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithSystemType_itemSearchBlock(
            this: Allocated<Self>,
            r#type: UIAccessibilityCustomSystemRotorType,
            item_search_block: UIAccessibilityCustomRotorSearch,
        ) -> Retained<Self>;

        #[unsafe(method(name))]
        #[unsafe(method_family = none)]
        pub fn name(&self) -> Retained<NSString>;

        /// Setter for [`name`][Self::name].
        ///
        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
        #[unsafe(method(setName:))]
        #[unsafe(method_family = none)]
        pub fn setName(&self, name: &NSString);

        #[unsafe(method(attributedName))]
        #[unsafe(method_family = none)]
        pub fn attributedName(&self) -> Retained<NSAttributedString>;

        /// Setter for [`attributedName`][Self::attributedName].
        ///
        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
        #[unsafe(method(setAttributedName:))]
        #[unsafe(method_family = none)]
        pub fn setAttributedName(&self, attributed_name: &NSAttributedString);

        #[cfg(feature = "block2")]
        /// # Safety
        ///
        /// The returned block's argument must be a valid pointer.
        #[unsafe(method(itemSearchBlock))]
        #[unsafe(method_family = none)]
        pub unsafe fn itemSearchBlock(&self) -> UIAccessibilityCustomRotorSearch;

        #[cfg(feature = "block2")]
        /// Setter for [`itemSearchBlock`][Self::itemSearchBlock].
        ///
        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
        ///
        /// # Safety
        ///
        /// `item_search_block` must be a valid pointer.
        #[unsafe(method(setItemSearchBlock:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setItemSearchBlock(
            &self,
            item_search_block: UIAccessibilityCustomRotorSearch,
        );

        #[unsafe(method(systemRotorType))]
        #[unsafe(method_family = none)]
        pub fn systemRotorType(&self) -> UIAccessibilityCustomSystemRotorType;
    );
}

/// Methods declared on superclass `NSObject`.
impl UIAccessibilityCustomRotor {
    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!(
    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uiaccessibilitycustomrotoritemresult?language=objc)
    #[unsafe(super(NSObject))]
    #[thread_kind = MainThreadOnly]
    #[derive(Debug, PartialEq, Eq, Hash)]
    pub struct UIAccessibilityCustomRotorItemResult;
);

extern_conformance!(
    unsafe impl NSObjectProtocol for UIAccessibilityCustomRotorItemResult {}
);

impl UIAccessibilityCustomRotorItemResult {
    extern_methods!(
        #[cfg(feature = "UITextInput")]
        /// # Safety
        ///
        /// `target_element` should be of the correct type.
        #[unsafe(method(initWithTargetElement:targetRange:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithTargetElement_targetRange(
            this: Allocated<Self>,
            target_element: &ProtocolObject<dyn NSObjectProtocol>,
            target_range: Option<&UITextRange>,
        ) -> Retained<Self>;

        #[unsafe(method(targetElement))]
        #[unsafe(method_family = none)]
        pub fn targetElement(&self) -> Option<Retained<ProtocolObject<dyn NSObjectProtocol>>>;

        /// Setter for [`targetElement`][Self::targetElement].
        ///
        /// This is a [weak property][objc2::topics::weak_property].
        ///
        /// # Safety
        ///
        /// `target_element` should be of the correct type.
        #[unsafe(method(setTargetElement:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setTargetElement(
            &self,
            target_element: Option<&ProtocolObject<dyn NSObjectProtocol>>,
        );

        #[cfg(feature = "UITextInput")]
        #[unsafe(method(targetRange))]
        #[unsafe(method_family = none)]
        pub fn targetRange(&self) -> Option<Retained<UITextRange>>;

        #[cfg(feature = "UITextInput")]
        /// Setter for [`targetRange`][Self::targetRange].
        #[unsafe(method(setTargetRange:))]
        #[unsafe(method_family = none)]
        pub fn setTargetRange(&self, target_range: Option<&UITextRange>);
    );
}

/// Methods declared on superclass `NSObject`.
impl UIAccessibilityCustomRotorItemResult {
    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>;
    );
}