• 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 */
15
16/**
17 * @file
18 * @kit InputKit
19 */
20
21import type { InputEvent } from './@ohos.multimodalInput.inputEvent';
22import type { KeyCode } from './@ohos.multimodalInput.keyCode';
23/**
24 * Action
25 *
26 * @enum { number }
27 * @syscap SystemCapability.MultimodalInput.Input.Core
28 * @since 9
29 */
30/**
31 * Action
32 *
33 * @enum { number }
34 * @syscap SystemCapability.MultimodalInput.Input.Core
35 * @atomicservice
36 * @since 12
37 */
38export declare enum Action {
39  /**
40   * Cancel key
41   *
42   * @syscap SystemCapability.MultimodalInput.Input.Core
43   * @since 9
44   */
45  /**
46   * Cancel key
47   *
48   * @syscap SystemCapability.MultimodalInput.Input.Core
49   * @atomicservice
50   * @since 12
51   */
52  CANCEL = 0,
53
54  /**
55   * Down key
56   *
57   * @syscap SystemCapability.MultimodalInput.Input.Core
58   * @since 9
59   */
60  /**
61   * Down key
62   *
63   * @syscap SystemCapability.MultimodalInput.Input.Core
64   * @atomicservice
65   * @since 12
66   */
67  DOWN = 1,
68
69  /**
70   * Up key
71   *
72   * @syscap SystemCapability.MultimodalInput.Input.Core
73   * @since 9
74   */
75  /**
76   * Up key
77   *
78   * @syscap SystemCapability.MultimodalInput.Input.Core
79   * @atomicservice
80   * @since 12
81   */
82  UP = 2
83}
84
85/**
86 * Key
87 *
88 * @interface Key
89 * @syscap SystemCapability.MultimodalInput.Input.Core
90 * @since 9
91 */
92/**
93 * Key
94 *
95 * @typedef Key
96 * @syscap SystemCapability.MultimodalInput.Input.Core
97 * @atomicservice
98 * @since 12
99 */
100export declare interface Key {
101  /**
102   * Key code
103   * @type { KeyCode }
104   * @syscap SystemCapability.MultimodalInput.Input.Core
105   * @since 9
106   */
107  /**
108   * Key code
109   * @type { KeyCode }
110   * @syscap SystemCapability.MultimodalInput.Input.Core
111   * @atomicservice
112   * @since 12
113   */
114  code: KeyCode;
115
116  /**
117   * Time when the key is pressed
118   * @type { number }
119   * @syscap SystemCapability.MultimodalInput.Input.Core
120   * @since 9
121   */
122  /**
123   * Time when the key is pressed
124   * @type { number }
125   * @syscap SystemCapability.MultimodalInput.Input.Core
126   * @atomicservice
127   * @since 12
128   */
129  pressedTime: number;
130
131  /**
132   * Device to which the key belongs
133   * @type { number }
134   * @syscap SystemCapability.MultimodalInput.Input.Core
135   * @since 9
136   */
137  /**
138   * Device to which the key belongs
139   * @type { number }
140   * @syscap SystemCapability.MultimodalInput.Input.Core
141   * @atomicservice
142   * @since 12
143   */
144  deviceId: number;
145}
146
147/**
148 * KeyEvent
149 *
150 * @interface KeyEvent
151 * @syscap SystemCapability.MultimodalInput.Input.Core
152 * @since 9
153 */
154/**
155 * KeyEvent
156 *
157 * @typedef KeyEvent
158 * @extends InputEvent
159 * @syscap SystemCapability.MultimodalInput.Input.Core
160 * @atomicservice
161 * @since 12
162 */
163export declare interface KeyEvent extends InputEvent {
164  /**
165   * Key action
166   * @type { Action }
167   * @syscap SystemCapability.MultimodalInput.Input.Core
168   * @since 9
169   */
170  /**
171   * Key action
172   * @type { Action }
173   * @syscap SystemCapability.MultimodalInput.Input.Core
174   * @atomicservice
175   * @since 12
176   */
177  action: Action;
178
179  /**
180   * Key that has changed
181   * @type { Key }
182   * @syscap SystemCapability.MultimodalInput.Input.Core
183   * @since 9
184   */
185  /**
186   * Key that has changed
187   * @type { Key }
188   * @syscap SystemCapability.MultimodalInput.Input.Core
189   * @atomicservice
190   * @since 12
191   */
192  key: Key;
193
194  /**
195   * Unicode character corresponding to the key
196   * @type { number }
197   * @syscap SystemCapability.MultimodalInput.Input.Core
198   * @since 9
199   */
200  /**
201   * Unicode character corresponding to the key
202   * @type { number }
203   * @syscap SystemCapability.MultimodalInput.Input.Core
204   * @atomicservice
205   * @since 12
206   */
207  unicodeChar: number;
208
209  /**
210   * List of pressed keys
211   * @type { Key[] }
212   * @syscap SystemCapability.MultimodalInput.Input.Core
213   * @since 9
214   */
215  /**
216   * List of pressed keys
217   * @type { Key[] }
218   * @syscap SystemCapability.MultimodalInput.Input.Core
219   * @atomicservice
220   * @since 12
221   */
222  keys: Key[];
223
224  /**
225   * Whether ctrlKey is being pressed
226   * @type { boolean }
227   * @syscap SystemCapability.MultimodalInput.Input.Core
228   * @since 9
229   */
230  /**
231   * Whether ctrlKey is being pressed
232   * @type { boolean }
233   * @syscap SystemCapability.MultimodalInput.Input.Core
234   * @atomicservice
235   * @since 12
236   */
237  ctrlKey: boolean;
238
239  /**
240   * Whether altKey is being pressed
241   * @type { boolean }
242   * @syscap SystemCapability.MultimodalInput.Input.Core
243   * @since 9
244   */
245  /**
246   * Whether altKey is being pressed
247   * @type { boolean }
248   * @syscap SystemCapability.MultimodalInput.Input.Core
249   * @atomicservice
250   * @since 12
251   */
252  altKey: boolean;
253
254  /**
255   * Whether shiftKey is being pressed
256   * @type { boolean }
257   * @syscap SystemCapability.MultimodalInput.Input.Core
258   * @since 9
259   */
260  /**
261   * Whether shiftKey is being pressed
262   * @type { boolean }
263   * @syscap SystemCapability.MultimodalInput.Input.Core
264   * @atomicservice
265   * @since 12
266   */
267  shiftKey: boolean;
268
269  /**
270   * Whether logoKey is being pressed
271   * @type { boolean }
272   * @syscap SystemCapability.MultimodalInput.Input.Core
273   * @since 9
274   */
275  /**
276   * Whether logoKey is being pressed
277   * @type { boolean }
278   * @syscap SystemCapability.MultimodalInput.Input.Core
279   * @atomicservice
280   * @since 12
281   */
282  logoKey: boolean;
283
284  /**
285   * Whether fnKey is being pressed
286   * @type { boolean }
287   * @syscap SystemCapability.MultimodalInput.Input.Core
288   * @since 9
289   */
290  /**
291   * Whether fnKey is being pressed
292   * @type { boolean }
293   * @syscap SystemCapability.MultimodalInput.Input.Core
294   * @atomicservice
295   * @since 12
296   */
297  fnKey: boolean;
298
299  /**
300   * Whether capsLock is active
301   * @type { boolean }
302   * @syscap SystemCapability.MultimodalInput.Input.Core
303   * @since 9
304   */
305  /**
306   * Whether capsLock is active
307   * @type { boolean }
308   * @syscap SystemCapability.MultimodalInput.Input.Core
309   * @atomicservice
310   * @since 12
311   */
312  capsLock: boolean;
313
314  /**
315   * Whether numLock is active
316   * @type { boolean }
317   * @syscap SystemCapability.MultimodalInput.Input.Core
318   * @since 9
319   */
320  /**
321   * Whether numLock is active
322   * @type { boolean }
323   * @syscap SystemCapability.MultimodalInput.Input.Core
324   * @atomicservice
325   * @since 12
326   */
327  numLock: boolean;
328
329  /**
330   * Whether scrollLock is active
331   * @type { boolean }
332   * @syscap SystemCapability.MultimodalInput.Input.Core
333   * @since 9
334   */
335  /**
336   * Whether scrollLock is active
337   * @type { boolean }
338   * @syscap SystemCapability.MultimodalInput.Input.Core
339   * @atomicservice
340   * @since 12
341   */
342  scrollLock: boolean;
343}