• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2 * Copyright (c) 2022-2025 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/**
25 * Action
26 *
27 * @enum { number }
28 * @syscap SystemCapability.MultimodalInput.Input.Core
29 * @since 9
30 */
31export declare enum Action {
32  /**
33   * Cancel
34   *
35   * @syscap SystemCapability.MultimodalInput.Input.Core
36   * @since 9
37   */
38  CANCEL = 0,
39
40  /**
41   * Moving of the mouse pointer
42   *
43   * @syscap SystemCapability.MultimodalInput.Input.Core
44   * @since 9
45   */
46  MOVE = 1,
47
48  /**
49   * Pressing down of the mouse
50   *
51   * @syscap SystemCapability.MultimodalInput.Input.Core
52   * @since 9
53   */
54  BUTTON_DOWN = 2,
55
56  /**
57   * Lifting of the mouse button
58   *
59   * @syscap SystemCapability.MultimodalInput.Input.Core
60   * @since 9
61   */
62  BUTTON_UP = 3,
63
64  /**
65   * Beginning of the axis event associated with the mouse
66   *
67   * @syscap SystemCapability.MultimodalInput.Input.Core
68   * @since 9
69   */
70  AXIS_BEGIN = 4,
71
72  /**
73   * Updating of the axis event associated with the mouse
74   *
75   * @syscap SystemCapability.MultimodalInput.Input.Core
76   * @since 9
77   */
78  AXIS_UPDATE = 5,
79
80  /**
81   * Ending of the axis event associated with the mouse
82   *
83   * @syscap SystemCapability.MultimodalInput.Input.Core
84   * @since 9
85   */
86  AXIS_END = 6,
87
88  /**
89   * Indicates a pointer action representing that a finger is pressed on touchpad.
90   *
91   * @syscap SystemCapability.MultimodalInput.Input.Core
92   * @since 11
93   */
94  ACTION_DOWN = 7,
95
96  /**
97   * Indicates a pointer action representing that a finger leaves touchpad.
98   *
99   * @syscap SystemCapability.MultimodalInput.Input.Core
100   * @since 11
101   */
102  ACTION_UP = 8,
103}
104
105/**
106 * Mouse button
107 *
108 * @enum { number }
109 * @syscap SystemCapability.MultimodalInput.Input.Core
110 * @since 9
111 */
112export declare enum Button {
113  /**
114   * Left button on the mouse
115   *
116   * @syscap SystemCapability.MultimodalInput.Input.Core
117   * @since 9
118   */
119  LEFT = 0,
120
121  /**
122   * Middle button on the mouse
123   *
124   * @syscap SystemCapability.MultimodalInput.Input.Core
125   * @since 9
126   */
127  MIDDLE = 1,
128
129  /**
130   * Right button on the mouse
131   *
132   * @syscap SystemCapability.MultimodalInput.Input.Core
133   * @since 9
134   */
135  RIGHT = 2,
136
137  /**
138   * Side button on the mouse
139   *
140   * @syscap SystemCapability.MultimodalInput.Input.Core
141   * @since 9
142   */
143  SIDE = 3,
144
145  /**
146   * Extended button on the mouse
147   *
148   * @syscap SystemCapability.MultimodalInput.Input.Core
149   * @since 9
150   */
151  EXTRA = 4,
152
153  /**
154   * Forward button on the mouse
155   *
156   * @syscap SystemCapability.MultimodalInput.Input.Core
157   * @since 9
158   */
159  FORWARD = 5,
160
161  /**
162   * Back button on the mouse
163   *
164   * @syscap SystemCapability.MultimodalInput.Input.Core
165   * @since 9
166   */
167  BACK = 6,
168
169  /**
170   * Task key on the mouse
171   *
172   * @syscap SystemCapability.MultimodalInput.Input.Core
173   * @since 9
174   */
175  TASK = 7
176}
177
178/**
179 * Axis
180 *
181 * @enum { number }
182 * @syscap SystemCapability.MultimodalInput.Input.Core
183 * @since 9
184 */
185export declare enum Axis {
186  /**
187   * Vertical scroll axis
188   *
189   * @syscap SystemCapability.MultimodalInput.Input.Core
190   * @since 9
191   */
192  SCROLL_VERTICAL = 0,
193
194  /**
195   * Horizontal scroll axis
196   *
197   * @syscap SystemCapability.MultimodalInput.Input.Core
198   * @since 9
199   */
200  SCROLL_HORIZONTAL = 1,
201
202  /**
203   * Pinch axis
204   *
205   * @syscap SystemCapability.MultimodalInput.Input.Core
206   * @since 9
207   */
208  PINCH = 2
209}
210
211/**
212 * AxisValue
213 *
214 * @interface AxisValue
215 * @syscap SystemCapability.MultimodalInput.Input.Core
216 * @since 9
217 */
218export declare interface AxisValue {
219  /**
220   * Axis type
221   * @type { Axis }
222   * @syscap SystemCapability.MultimodalInput.Input.Core
223   * @since 9
224   */
225  axis: Axis;
226
227  /**
228   * Axis value
229   * @type { number }
230   * @syscap SystemCapability.MultimodalInput.Input.Core
231   * @since 9
232   */
233  value: number;
234}
235
236/**
237 * ToolType
238 *
239 * @enum { number }
240 * @syscap SystemCapability.MultimodalInput.Input.Core
241 * @since 11
242 */
243export declare enum ToolType {
244  /**
245   * Unknown type
246   *
247   * @syscap SystemCapability.MultimodalInput.Input.Core
248   * @since 11
249   */
250  UNKNOWN = 0,
251
252  /**
253   * Mouse
254   *
255   * @syscap SystemCapability.MultimodalInput.Input.Core
256   * @since 11
257   */
258  MOUSE = 1,
259
260  /**
261   * Joystick
262   *
263   * @syscap SystemCapability.MultimodalInput.Input.Core
264   * @since 11
265   */
266  JOYSTICK = 2,
267
268  /**
269   * Touch pad
270   *
271   * @syscap SystemCapability.MultimodalInput.Input.Core
272   * @since 11
273   */
274  TOUCHPAD = 3,
275}
276
277/**
278 * MouseEvent
279 *
280 * @extends InputEvent
281 * @interface MouseEvent
282 * @syscap SystemCapability.MultimodalInput.Input.Core
283 * @since 9
284 */
285export declare interface MouseEvent extends InputEvent {
286  /**
287   * Mouse event action
288   * @type { Action }
289   * @syscap SystemCapability.MultimodalInput.Input.Core
290   * @since 9
291   */
292  action: Action;
293
294  /**
295   * X coordinate of the mouse pointer on the screen
296   * @type { number }
297   * @syscap SystemCapability.MultimodalInput.Input.Core
298   * @since 9
299   */
300  screenX: number;
301
302  /**
303   * Y coordinate of the mouse pointer on the screen
304   * @type { number }
305   * @syscap SystemCapability.MultimodalInput.Input.Core
306   * @since 9
307   */
308  screenY: number;
309
310  /**
311   * X coordinate of the mouse pointer in the window
312   * @type { number }
313   * @syscap SystemCapability.MultimodalInput.Input.Core
314   * @since 9
315   */
316  windowX: number;
317
318  /**
319   * Y coordinate of the mouse pointer in the window
320   * @type { number }
321   * @syscap SystemCapability.MultimodalInput.Input.Core
322   * @since 9
323   */
324  windowY: number;
325
326  /**
327   * X axis offset relative to the previous reported mouse pointer position. When the mouse pointer is at
328   * the edge of the screen, the value may be less than the difference of the X coordinate reported twice.
329   * @type { number }
330   * @syscap SystemCapability.MultimodalInput.Input.Core
331   * @since 9
332   */
333  rawDeltaX: number;
334
335  /**
336   * Y axis offset relative to the previous reported mouse pointer position
337   * @type { number }
338   * @syscap SystemCapability.MultimodalInput.Input.Core
339   * @since 9
340   */
341  rawDeltaY: number;
342
343  /**
344   * Button that is currently pressed or released
345   * @type { Button }
346   * @syscap SystemCapability.MultimodalInput.Input.Core
347   * @since 9
348   */
349  button: Button;
350
351  /**
352   * Button that is being pressed
353   * @type { Button[] }
354   * @syscap SystemCapability.MultimodalInput.Input.Core
355   * @since 9
356   */
357  pressedButtons: Button[];
358
359  /**
360   * All axis data contained in the event
361   * @type { AxisValue[] }
362   * @syscap SystemCapability.MultimodalInput.Input.Core
363   * @since 9
364   */
365  axes: AxisValue[];
366
367  /**
368   * List of pressed keys
369   * @type { KeyCode[] }
370   * @syscap SystemCapability.MultimodalInput.Input.Core
371   * @since 9
372   */
373  pressedKeys: KeyCode[];
374
375  /**
376   * Whether ctrlKey is being pressed
377   * @type { boolean }
378   * @syscap SystemCapability.MultimodalInput.Input.Core
379   * @since 9
380   */
381  ctrlKey: boolean;
382
383  /**
384   * Whether altKey is being pressed
385   * @type { boolean }
386   * @syscap SystemCapability.MultimodalInput.Input.Core
387   * @since 9
388   */
389  altKey: boolean;
390
391  /**
392   * Whether shiftKey is being pressed
393   * @type { boolean }
394   * @syscap SystemCapability.MultimodalInput.Input.Core
395   * @since 9
396   */
397  shiftKey: boolean;
398
399  /**
400   * Whether logoKey is being pressed
401   * @type { boolean }
402   * @syscap SystemCapability.MultimodalInput.Input.Core
403   * @since 9
404   */
405  logoKey: boolean;
406
407  /**
408   * Whether fnKey is being pressed
409   * @type { boolean }
410   * @syscap SystemCapability.MultimodalInput.Input.Core
411   * @since 9
412   */
413  fnKey: boolean;
414
415  /**
416   * Whether capsLock is active
417   * @type { boolean }
418   * @syscap SystemCapability.MultimodalInput.Input.Core
419   * @since 9
420   */
421  capsLock: boolean;
422
423  /**
424   * Whether numLock is active
425   * @type { boolean }
426   * @syscap SystemCapability.MultimodalInput.Input.Core
427   * @since 9
428   */
429  numLock: boolean;
430
431  /**
432   * Whether scrollLock is active
433   * @type { boolean }
434   * @syscap SystemCapability.MultimodalInput.Input.Core
435   * @since 9
436   */
437  scrollLock: boolean;
438
439  /**
440   * Tool type
441   *
442   * @type { ToolType }
443   * @syscap SystemCapability.MultimodalInput.Input.Core
444   * @since 11
445   */
446  toolType: ToolType;
447
448  /**
449   * globalX - Global X coordinate.
450   * @type { ?number }
451   * @syscap SystemCapability.MultimodalInput.Input.Core
452   * @since 20
453   * @arkts 1.1&1.2
454   */
455  globalX?: number;
456
457  /**
458   * globalY - Global Y coordinate.
459   * @type { ?number }
460   * @syscap SystemCapability.MultimodalInput.Input.Core
461   * @since 20
462   * @arkts 1.1&1.2
463   */
464  globalY?: number;
465}