objc2-browser-engine-kit 0.3.2

Bindings to the BrowserEngineKit 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")]
use objc2_quartz_core::*;
use objc2_ui_kit::*;

use crate::*;

extern_protocol!(
    /// [Apple's documentation](https://developer.apple.com/documentation/browserenginekit/bescrollviewdelegate?language=objc)
    pub unsafe trait BEScrollViewDelegate: UIScrollViewDelegate + MainThreadOnly {
        #[cfg(feature = "block2")]
        #[optional]
        #[unsafe(method(scrollView:handleScrollUpdate:completion:))]
        #[unsafe(method_family = none)]
        unsafe fn scrollView_handleScrollUpdate_completion(
            &self,
            scroll_view: &BEScrollView,
            scroll_update: &BEScrollViewScrollUpdate,
            completion: &block2::DynBlock<dyn Fn(Bool)>,
        );

        #[optional]
        #[unsafe(method(parentScrollViewForScrollView:))]
        #[unsafe(method_family = none)]
        unsafe fn parentScrollViewForScrollView(
            &self,
            scroll_view: &BEScrollView,
        ) -> Option<Retained<BEScrollView>>;
    }
);

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

#[cfg(feature = "objc2-quartz-core")]
extern_conformance!(
    unsafe impl CALayerDelegate for BEScrollView {}
);

extern_conformance!(
    unsafe impl NSCoding for BEScrollView {}
);

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

extern_conformance!(
    unsafe impl UIAppearance for BEScrollView {}
);

extern_conformance!(
    unsafe impl UIAppearanceContainer for BEScrollView {}
);

extern_conformance!(
    unsafe impl UICoordinateSpace for BEScrollView {}
);

extern_conformance!(
    unsafe impl UIDynamicItem for BEScrollView {}
);

extern_conformance!(
    unsafe impl UIFocusEnvironment for BEScrollView {}
);

extern_conformance!(
    unsafe impl UIFocusItem for BEScrollView {}
);

extern_conformance!(
    unsafe impl UIFocusItemContainer for BEScrollView {}
);

extern_conformance!(
    unsafe impl UIFocusItemScrollableContainer for BEScrollView {}
);

extern_conformance!(
    unsafe impl UIResponderStandardEditActions for BEScrollView {}
);

extern_conformance!(
    unsafe impl UITraitEnvironment for BEScrollView {}
);

impl BEScrollView {
    extern_methods!(
        #[unsafe(method(delegate))]
        #[unsafe(method_family = none)]
        pub unsafe fn delegate(&self)
            -> Option<Retained<ProtocolObject<dyn BEScrollViewDelegate>>>;

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

/// Methods declared on superclass `UIView`.
impl BEScrollView {
    extern_methods!(
        #[cfg(feature = "objc2-core-foundation")]
        #[unsafe(method(initWithFrame:))]
        #[unsafe(method_family = init)]
        pub unsafe 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 unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
    );
}

/// Methods declared on superclass `NSObject`.
impl BEScrollView {
    extern_methods!(
        #[unsafe(method(new))]
        #[unsafe(method_family = new)]
        pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
    );
}

/// [Apple's documentation](https://developer.apple.com/documentation/browserenginekit/bescrollviewscrollupdatephase?language=objc)
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct BEScrollViewScrollUpdatePhase(pub NSInteger);
impl BEScrollViewScrollUpdatePhase {
    #[doc(alias = "BEScrollViewScrollUpdatePhaseBegan")]
    pub const Began: Self = Self(0);
    #[doc(alias = "BEScrollViewScrollUpdatePhaseChanged")]
    pub const Changed: Self = Self(1);
    #[doc(alias = "BEScrollViewScrollUpdatePhaseEnded")]
    pub const Ended: Self = Self(2);
    #[doc(alias = "BEScrollViewScrollUpdatePhaseCancelled")]
    pub const Cancelled: Self = Self(3);
}

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

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

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

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

impl BEScrollViewScrollUpdate {
    extern_methods!(
        #[unsafe(method(init))]
        #[unsafe(method_family = init)]
        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;

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

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

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

        #[cfg(feature = "objc2-core-foundation")]
        #[unsafe(method(locationInView:))]
        #[unsafe(method_family = none)]
        pub unsafe fn locationInView(&self, view: Option<&UIView>) -> CGPoint;

        #[cfg(feature = "objc2-core-foundation")]
        #[unsafe(method(translationInView:))]
        #[unsafe(method_family = none)]
        pub unsafe fn translationInView(&self, view: Option<&UIView>) -> CGPoint;
    );
}