objc2_browser_engine_kit/generated/
BEKeyEntry.rs

1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::ptr::NonNull;
4use objc2::__framework_prelude::*;
5use objc2_foundation::*;
6use objc2_ui_kit::*;
7
8use crate::*;
9
10/// [Apple's documentation](https://developer.apple.com/documentation/browserenginekit/bekeypressstate?language=objc)
11// NS_ENUM
12#[repr(transparent)]
13#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
14pub struct BEKeyPressState(pub NSInteger);
15impl BEKeyPressState {
16    #[doc(alias = "BEKeyPressStateDown")]
17    pub const Down: Self = Self(1);
18    #[doc(alias = "BEKeyPressStateUp")]
19    pub const Up: Self = Self(2);
20}
21
22unsafe impl Encode for BEKeyPressState {
23    const ENCODING: Encoding = NSInteger::ENCODING;
24}
25
26unsafe impl RefEncode for BEKeyPressState {
27    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
28}
29
30extern_class!(
31    /// [Apple's documentation](https://developer.apple.com/documentation/browserenginekit/bekeyentry?language=objc)
32    #[unsafe(super(NSObject))]
33    #[derive(Debug, PartialEq, Eq, Hash)]
34    pub struct BEKeyEntry;
35);
36
37extern_conformance!(
38    unsafe impl NSObjectProtocol for BEKeyEntry {}
39);
40
41impl BEKeyEntry {
42    extern_methods!(
43        /// Data about the key that was pressed
44        #[unsafe(method(key))]
45        #[unsafe(method_family = none)]
46        pub unsafe fn key(&self, mtm: MainThreadMarker) -> Retained<UIKey>;
47
48        /// Type of the event, indicating whether it represents when the key is pressed or released.
49        #[unsafe(method(state))]
50        #[unsafe(method_family = none)]
51        pub unsafe fn state(&self) -> BEKeyPressState;
52
53        /// Represents whether the event is repeating.
54        ///
55        /// For example, a continued press and hold on a key may result in its repeated insertion.
56        #[unsafe(method(isKeyRepeating))]
57        #[unsafe(method_family = none)]
58        pub unsafe fn isKeyRepeating(&self) -> bool;
59
60        /// Time at which the key event occurred.
61        #[unsafe(method(timestamp))]
62        #[unsafe(method_family = none)]
63        pub unsafe fn timestamp(&self) -> NSTimeInterval;
64
65        #[unsafe(method(init))]
66        #[unsafe(method_family = init)]
67        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
68
69        #[unsafe(method(new))]
70        #[unsafe(method_family = new)]
71        pub unsafe fn new() -> Retained<Self>;
72    );
73}