• 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/**
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   *
222   * @syscap SystemCapability.MultimodalInput.Input.Core
223   * @since 9
224   */
225  axis: Axis;
226
227  /**
228   * Axis value
229   *
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 * @interface MouseEvent
281 * @syscap SystemCapability.MultimodalInput.Input.Core
282 * @since 9
283 */
284export declare interface MouseEvent extends InputEvent {
285  /**
286   * Mouse event action
287   *
288   * @syscap SystemCapability.MultimodalInput.Input.Core
289   * @since 9
290   */
291  action: Action;
292
293  /**
294   * X coordinate of the mouse pointer on the screen
295   *
296   * @syscap SystemCapability.MultimodalInput.Input.Core
297   * @since 9
298   */
299  screenX: number;
300
301  /**
302   * Y coordinate of the mouse pointer on the screen
303   *
304   * @syscap SystemCapability.MultimodalInput.Input.Core
305   * @since 9
306   */
307  screenY: number;
308
309  /**
310   * X coordinate of the mouse pointer in the window
311   *
312   * @syscap SystemCapability.MultimodalInput.Input.Core
313   * @since 9
314   */
315  windowX: number;
316
317  /**
318   * Y coordinate of the mouse pointer in the window
319   *
320   * @syscap SystemCapability.MultimodalInput.Input.Core
321   * @since 9
322   */
323  windowY: number;
324
325  /**
326   * X axis offset relative to the previous reported mouse pointer position. When the mouse pointer is at
327   * the edge of the screen, the value may be less than the difference of the X coordinate reported twice.
328   *
329   * @syscap SystemCapability.MultimodalInput.Input.Core
330   * @since 9
331   */
332  rawDeltaX: number;
333
334  /**
335   * Y axis offset relative to the previous reported mouse pointer position
336   *
337   * @syscap SystemCapability.MultimodalInput.Input.Core
338   * @since 9
339   */
340  rawDeltaY: number;
341
342  /**
343   * Button that is currently pressed or released
344   *
345   * @syscap SystemCapability.MultimodalInput.Input.Core
346   * @since 9
347   */
348  button: Button;
349
350  /**
351   * Button that is being pressed
352   *
353   * @syscap SystemCapability.MultimodalInput.Input.Core
354   * @since 9
355   */
356  pressedButtons: Button[];
357
358  /**
359   * All axis data contained in the event
360   *
361   * @syscap SystemCapability.MultimodalInput.Input.Core
362   * @since 9
363   */
364  axes: AxisValue[];
365
366  /**
367   * List of pressed keys
368   *
369   * @syscap SystemCapability.MultimodalInput.Input.Core
370   * @since 9
371   */
372  pressedKeys: KeyCode[];
373
374  /**
375   * Whether ctrlKey is being pressed
376   *
377   * @syscap SystemCapability.MultimodalInput.Input.Core
378   * @since 9
379   */
380  ctrlKey: boolean;
381
382  /**
383   * Whether altKey is being pressed
384   *
385   * @syscap SystemCapability.MultimodalInput.Input.Core
386   * @since 9
387   */
388  altKey: boolean;
389
390  /**
391   * Whether shiftKey is being pressed
392   *
393   * @syscap SystemCapability.MultimodalInput.Input.Core
394   * @since 9
395   */
396  shiftKey: boolean;
397
398  /**
399   * Whether logoKey is being pressed
400   *
401   * @syscap SystemCapability.MultimodalInput.Input.Core
402   * @since 9
403   */
404  logoKey: boolean;
405
406  /**
407   * Whether fnKey is being pressed
408   *
409   * @syscap SystemCapability.MultimodalInput.Input.Core
410   * @since 9
411   */
412  fnKey: boolean;
413
414  /**
415   * Whether capsLock is active
416   *
417   * @syscap SystemCapability.MultimodalInput.Input.Core
418   * @since 9
419   */
420  capsLock: boolean;
421
422  /**
423   * Whether numLock is active
424   *
425   * @syscap SystemCapability.MultimodalInput.Input.Core
426   * @since 9
427   */
428  numLock: boolean;
429
430  /**
431   * Whether scrollLock is active
432   *
433   * @syscap SystemCapability.MultimodalInput.Input.Core
434   * @since 9
435   */
436  scrollLock: boolean;
437
438  /**
439   * Tool type
440   *
441   * @type { ToolType }
442   * @syscap SystemCapability.MultimodalInput.Input.Core
443   * @since 11
444   */
445  toolType: ToolType;
446}