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::ptr::NonNull;
use objc2::__framework_prelude::*;
use objc2_foundation::*;
use objc2_ui_kit::*;

use crate::*;

/// [Apple's documentation](https://developer.apple.com/documentation/browserenginekit/bekeypressstate?language=objc)
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct BEKeyPressState(pub NSInteger);
impl BEKeyPressState {
    #[doc(alias = "BEKeyPressStateDown")]
    pub const Down: Self = Self(1);
    #[doc(alias = "BEKeyPressStateUp")]
    pub const Up: Self = Self(2);
}

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

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

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

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

impl BEKeyEntry {
    extern_methods!(
        /// Data about the key that was pressed
        #[unsafe(method(key))]
        #[unsafe(method_family = none)]
        pub unsafe fn key(&self, mtm: MainThreadMarker) -> Retained<UIKey>;

        /// Type of the event, indicating whether it represents when the key is pressed or released.
        #[unsafe(method(state))]
        #[unsafe(method_family = none)]
        pub unsafe fn state(&self) -> BEKeyPressState;

        /// Represents whether the event is repeating.
        ///
        /// For example, a continued press and hold on a key may result in its repeated insertion.
        #[unsafe(method(isKeyRepeating))]
        #[unsafe(method_family = none)]
        pub unsafe fn isKeyRepeating(&self) -> bool;

        /// Time at which the key event occurred.
        #[unsafe(method(timestamp))]
        #[unsafe(method_family = none)]
        pub unsafe fn timestamp(&self) -> NSTimeInterval;

        #[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() -> Retained<Self>;
    );
}