//! 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::*;

use crate::*;

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

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

#[cfg(feature = "UIInteraction")]
extern_conformance!(
    unsafe impl UIInteraction for UIToolTipInteraction {}
);

impl UIToolTipInteraction {
    extern_methods!(
        /// The interaction's delegate.
        #[unsafe(method(delegate))]
        #[unsafe(method_family = none)]
        pub fn delegate(
            &self,
        ) -> Option<Retained<ProtocolObject<dyn UIToolTipInteractionDelegate>>>;

        /// Setter for [`delegate`][Self::delegate].
        ///
        /// This is a [weak property][objc2::topics::weak_property].
        #[unsafe(method(setDelegate:))]
        #[unsafe(method_family = none)]
        pub fn setDelegate(
            &self,
            delegate: Option<&ProtocolObject<dyn UIToolTipInteractionDelegate>>,
        );

        /// Indicates whether the interaction is enabled. Defaults to YES.
        #[unsafe(method(isEnabled))]
        #[unsafe(method_family = none)]
        pub fn isEnabled(&self) -> bool;

        /// Setter for [`isEnabled`][Self::isEnabled].
        #[unsafe(method(setEnabled:))]
        #[unsafe(method_family = none)]
        pub fn setEnabled(&self, enabled: bool);

        /// The interaction's default tool tip string.
        #[unsafe(method(defaultToolTip))]
        #[unsafe(method_family = none)]
        pub fn defaultToolTip(&self) -> Option<Retained<NSString>>;

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

        /// Creates a UIToolTipInteraction.
        #[unsafe(method(init))]
        #[unsafe(method_family = init)]
        pub fn init(this: Allocated<Self>) -> Retained<Self>;

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

/// Methods declared on superclass `NSObject`.
impl UIToolTipInteraction {
    extern_methods!(
        #[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/uitooltipconfiguration?language=objc)
    #[unsafe(super(NSObject))]
    #[thread_kind = MainThreadOnly]
    #[derive(Debug, PartialEq, Eq, Hash)]
    pub struct UIToolTipConfiguration;
);

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

impl UIToolTipConfiguration {
    extern_methods!(
        /// The string to annotate the contents at a given point.
        #[unsafe(method(toolTip))]
        #[unsafe(method_family = none)]
        pub fn toolTip(&self) -> Retained<NSString>;

        #[cfg(feature = "objc2-core-foundation")]
        /// The rectangle containing the contents being annotated by the tool tip. Value is CGRectNull if the tool tip applies to the entire view.
        #[unsafe(method(sourceRect))]
        #[unsafe(method_family = none)]
        pub fn sourceRect(&self) -> CGRect;

        /// Creates a UIToolTipConfiguration with the provided string, applied to the entire view.
        #[unsafe(method(configurationWithToolTip:))]
        #[unsafe(method_family = none)]
        pub fn configurationWithToolTip(
            tool_tip: &NSString,
            mtm: MainThreadMarker,
        ) -> Retained<Self>;

        #[cfg(feature = "objc2-core-foundation")]
        /// Creates a UIToolTipConfiguration with the provided string, applied to the specified region.
        #[unsafe(method(configurationWithToolTip:inRect:))]
        #[unsafe(method_family = none)]
        pub fn configurationWithToolTip_inRect(
            tool_tip: &NSString,
            source_rect: CGRect,
            mtm: MainThreadMarker,
        ) -> Retained<Self>;

        #[unsafe(method(new))]
        #[unsafe(method_family = new)]
        pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;

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

extern_protocol!(
    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uitooltipinteractiondelegate?language=objc)
    pub unsafe trait UIToolTipInteractionDelegate:
        NSObjectProtocol + MainThreadOnly
    {
        #[cfg(feature = "objc2-core-foundation")]
        /// Called when the interaction is about to begin.
        ///
        ///
        /// Parameter `interaction`: This UIToolTipInteraction.
        ///
        ///
        /// Returns: The tool tip configuration containing the string and rectangle for this interaction. Return nil if the interaction is inactive or the hit test fails.
        #[optional]
        #[unsafe(method(toolTipInteraction:configurationAtPoint:))]
        #[unsafe(method_family = none)]
        fn toolTipInteraction_configurationAtPoint(
            &self,
            interaction: &UIToolTipInteraction,
            point: CGPoint,
        ) -> Option<Retained<UIToolTipConfiguration>>;
    }
);
