• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2* Copyright (c) 2022 Huawei Device Co., Ltd.
3* Licensed under the Apache License, Version 2.0 (the "License");
4* you may not use this file except in compliance with the License.
5* You may obtain a copy of the License at
6*
7* http://www.apache.org/licenses/LICENSE-2.0
8*
9* Unless required by applicable law or agreed to in writing, software
10* distributed under the License is distributed on an "AS IS" BASIS,
11* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12* See the License for the specific language governing permissions and
13* limitations under the License.
14*/
15import { InputEvent } from "./@ohos.multimodalInput.inputEvent"
16import { KeyCode } from "./@ohos.multimodalInput.keyCode"
17/**
18* Action
19*
20* @since 9
21* @syscap SystemCapability.MultimodalInput.Input.Core
22*/
23export declare enum Action {
24  /**
25   * Cancel key
26   */
27  CANCEL = 0,
28
29  /**
30   * Down key
31   */
32  DOWN = 1,
33
34  /**
35   * Up key
36   */
37  UP = 2,
38}
39
40/**
41* Key
42*
43* @since 9
44* @syscap SystemCapability.MultimodalInput.Input.Core
45*/
46export declare interface Key {
47  /**
48   * Key code
49   */
50  code: KeyCode;
51
52  /**
53   * Time when the key is pressed
54   */
55  pressedTime: number;
56
57  /**
58   * Device to which the key belongs
59   */
60  deviceId: number;
61}
62
63/**
64* KeyEvent
65*
66* @since 9
67* @syscap SystemCapability.MultimodalInput.Input.Core
68*/
69export declare interface KeyEvent extends InputEvent {
70  /**
71   * Key action
72   */
73  action: Action;
74
75  /**
76   * Key that has changed
77   */
78  key: Key;
79
80  /**
81   * Unicode character corresponding to the key
82   */
83  unicodeChar: number;
84
85  /**
86   * List of pressed keys
87   */
88  keys: Key[];
89
90  /**
91   * Whether ctrlKey is being pressed
92   */
93  ctrlKey: boolean;
94
95  /**
96   * Whether altKey is being pressed
97   */
98  altKey: boolean;
99
100  /**
101   * Whether shiftKey is being pressed
102   */
103  shiftKey: boolean;
104
105  /**
106   * Whether logoKey is being pressed
107   */
108  logoKey: boolean;
109
110  /**
111   * Whether fnKey is being pressed
112   */
113  fnKey: boolean;
114
115  /**
116   * Whether capsLock is active
117   */
118  capsLock: boolean;
119
120  /**
121   * Whether numLock is active
122   */
123  numLock: boolean;
124
125  /**
126   * Whether scrollLock is active
127   */
128  scrollLock: boolean;
129}