objc2_ui_kit/generated/
UIKey.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::*;
6
7use crate::*;
8
9extern_class!(
10    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uikey?language=objc)
11    #[unsafe(super(NSObject))]
12    #[thread_kind = MainThreadOnly]
13    #[derive(Debug, PartialEq, Eq, Hash)]
14    pub struct UIKey;
15);
16
17extern_conformance!(
18    unsafe impl NSCoding for UIKey {}
19);
20
21extern_conformance!(
22    unsafe impl NSCopying for UIKey {}
23);
24
25unsafe impl CopyingHelper for UIKey {
26    type Result = Self;
27}
28
29extern_conformance!(
30    unsafe impl NSObjectProtocol for UIKey {}
31);
32
33impl UIKey {
34    extern_methods!(
35        /// Returns: a string representing what would be inserted into a text field when this key is pressed.
36        ///
37        /// if a modifier key is held, this property will contain the modified characters according
38        /// the rules for that particular modifier key (i.e., if shift is held on a Latin keyboard, this will
39        /// contain capital letters).
40        #[unsafe(method(characters))]
41        #[unsafe(method_family = none)]
42        pub unsafe fn characters(&self) -> Retained<NSString>;
43
44        /// Returns: a string representing which characters would be inserted into a text field when this key is
45        /// pressed, not taking any held modifiers into account.
46        ///
47        /// for Latin based languages, expect this to be always in lowercase (unmodified meaning not
48        /// taking shift key into account). If only a modifier key was pressed, this property will contain an empty string.
49        #[unsafe(method(charactersIgnoringModifiers))]
50        #[unsafe(method_family = none)]
51        pub unsafe fn charactersIgnoringModifiers(&self) -> Retained<NSString>;
52
53        #[cfg(feature = "UICommand")]
54        /// Returns: a bitfield representing which modifier keys are currently being held in addition to this key.
55        #[unsafe(method(modifierFlags))]
56        #[unsafe(method_family = none)]
57        pub unsafe fn modifierFlags(&self) -> UIKeyModifierFlags;
58
59        #[cfg(all(feature = "UIKeyConstants", feature = "objc2-core-foundation"))]
60        /// Returns: the raw HID usage code for the pressed key. See UIKeyConstants.h.
61        #[unsafe(method(keyCode))]
62        #[unsafe(method_family = none)]
63        pub unsafe fn keyCode(&self) -> UIKeyboardHIDUsage;
64    );
65}
66
67/// Methods declared on superclass `NSObject`.
68impl UIKey {
69    extern_methods!(
70        #[unsafe(method(init))]
71        #[unsafe(method_family = init)]
72        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
73
74        #[unsafe(method(new))]
75        #[unsafe(method_family = new)]
76        pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
77    );
78}