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 16import type { InputEvent } from './@ohos.multimodalInput.inputEvent'; 17import type { KeyCode } from './@ohos.multimodalInput.keyCode'; 18 19/** 20 * Action 21 * 22 * @enum { number } 23 * @syscap SystemCapability.MultimodalInput.Input.Core 24 * @since 9 25 */ 26export declare enum Action { 27 /** 28 * Cancel 29 * 30 * @syscap SystemCapability.MultimodalInput.Input.Core 31 * @since 9 32 */ 33 CANCEL = 0, 34 35 /** 36 * Moving of the mouse pointer 37 * 38 * @syscap SystemCapability.MultimodalInput.Input.Core 39 * @since 9 40 */ 41 MOVE = 1, 42 43 /** 44 * Pressing down of the mouse 45 * 46 * @syscap SystemCapability.MultimodalInput.Input.Core 47 * @since 9 48 */ 49 BUTTON_DOWN = 2, 50 51 /** 52 * Lifting of the mouse button 53 * 54 * @syscap SystemCapability.MultimodalInput.Input.Core 55 * @since 9 56 */ 57 BUTTON_UP = 3, 58 59 /** 60 * Beginning of the axis event associated with the mouse 61 * 62 * @syscap SystemCapability.MultimodalInput.Input.Core 63 * @since 9 64 */ 65 AXIS_BEGIN = 4, 66 67 /** 68 * Updating of the axis event associated with the mouse 69 * 70 * @syscap SystemCapability.MultimodalInput.Input.Core 71 * @since 9 72 */ 73 AXIS_UPDATE = 5, 74 75 /** 76 * Ending of the axis event associated with the mouse 77 * 78 * @syscap SystemCapability.MultimodalInput.Input.Core 79 * @since 9 80 */ 81 AXIS_END = 6 82} 83 84/** 85 * Mouse button 86 * 87 * @enum { number } 88 * @syscap SystemCapability.MultimodalInput.Input.Core 89 * @since 9 90 */ 91export declare enum Button { 92 /** 93 * Left button on the mouse 94 * 95 * @syscap SystemCapability.MultimodalInput.Input.Core 96 * @since 9 97 */ 98 LEFT = 0, 99 100 /** 101 * Middle button on the mouse 102 * 103 * @syscap SystemCapability.MultimodalInput.Input.Core 104 * @since 9 105 */ 106 MIDDLE = 1, 107 108 /** 109 * Right button on the mouse 110 * 111 * @syscap SystemCapability.MultimodalInput.Input.Core 112 * @since 9 113 */ 114 RIGHT = 2, 115 116 /** 117 * Side button on the mouse 118 * 119 * @syscap SystemCapability.MultimodalInput.Input.Core 120 * @since 9 121 */ 122 SIDE = 3, 123 124 /** 125 * Extended button on the mouse 126 * 127 * @syscap SystemCapability.MultimodalInput.Input.Core 128 * @since 9 129 */ 130 EXTRA = 4, 131 132 /** 133 * Forward button on the mouse 134 * 135 * @syscap SystemCapability.MultimodalInput.Input.Core 136 * @since 9 137 */ 138 FORWARD = 5, 139 140 /** 141 * Back button on the mouse 142 * 143 * @syscap SystemCapability.MultimodalInput.Input.Core 144 * @since 9 145 */ 146 BACK = 6, 147 148 /** 149 * Task key on the mouse 150 * 151 * @syscap SystemCapability.MultimodalInput.Input.Core 152 * @since 9 153 */ 154 TASK = 7 155} 156 157/** 158 * Axis 159 * 160 * @enum { number } 161 * @syscap SystemCapability.MultimodalInput.Input.Core 162 * @since 9 163 */ 164export declare enum Axis { 165 /** 166 * Vertical scroll axis 167 * 168 * @syscap SystemCapability.MultimodalInput.Input.Core 169 * @since 9 170 */ 171 SCROLL_VERTICAL = 0, 172 173 /** 174 * Horizontal scroll axis 175 * 176 * @syscap SystemCapability.MultimodalInput.Input.Core 177 * @since 9 178 */ 179 SCROLL_HORIZONTAL = 1, 180 181 /** 182 * Pinch axis 183 * 184 * @syscap SystemCapability.MultimodalInput.Input.Core 185 * @since 9 186 */ 187 PINCH = 2 188} 189 190/** 191 * AxisValue 192 * 193 * @interface AxisValue 194 * @syscap SystemCapability.MultimodalInput.Input.Core 195 * @since 9 196 */ 197export declare interface AxisValue { 198 /** 199 * Axis type 200 * 201 * @syscap SystemCapability.MultimodalInput.Input.Core 202 * @since 9 203 */ 204 axis: Axis; 205 206 /** 207 * Axis value 208 * 209 * @syscap SystemCapability.MultimodalInput.Input.Core 210 * @since 9 211 */ 212 value: number; 213} 214 215/** 216 * MouseEvent 217 * 218 * @interface MouseEvent 219 * @syscap SystemCapability.MultimodalInput.Input.Core 220 * @since 9 221 */ 222export declare interface MouseEvent extends InputEvent { 223 /** 224 * Mouse event action 225 * 226 * @syscap SystemCapability.MultimodalInput.Input.Core 227 * @since 9 228 */ 229 action: Action; 230 231 /** 232 * X coordinate of the mouse pointer on the screen 233 * 234 * @syscap SystemCapability.MultimodalInput.Input.Core 235 * @since 9 236 */ 237 screenX: number; 238 239 /** 240 * Y coordinate of the mouse pointer on the screen 241 * 242 * @syscap SystemCapability.MultimodalInput.Input.Core 243 * @since 9 244 */ 245 screenY: number; 246 247 /** 248 * X coordinate of the mouse pointer in the window 249 * 250 * @syscap SystemCapability.MultimodalInput.Input.Core 251 * @since 9 252 */ 253 windowX: number; 254 255 /** 256 * Y coordinate of the mouse pointer in the window 257 * 258 * @syscap SystemCapability.MultimodalInput.Input.Core 259 * @since 9 260 */ 261 windowY: number; 262 263 /** 264 * X axis offset relative to the previous reported mouse pointer position. When the mouse pointer is at 265 * the edge of the screen, the value may be less than the difference of the X coordinate reported twice. 266 * 267 * @syscap SystemCapability.MultimodalInput.Input.Core 268 * @since 9 269 */ 270 rawDeltaX: number; 271 272 /** 273 * Y axis offset relative to the previous reported mouse pointer position 274 * 275 * @syscap SystemCapability.MultimodalInput.Input.Core 276 * @since 9 277 */ 278 rawDeltaY: number; 279 280 /** 281 * Button that is currently pressed or released 282 * 283 * @syscap SystemCapability.MultimodalInput.Input.Core 284 * @since 9 285 */ 286 button: Button; 287 288 /** 289 * Button that is being pressed 290 * 291 * @syscap SystemCapability.MultimodalInput.Input.Core 292 * @since 9 293 */ 294 pressedButtons: Button[]; 295 296 /** 297 * All axis data contained in the event 298 * 299 * @syscap SystemCapability.MultimodalInput.Input.Core 300 * @since 9 301 */ 302 axes: AxisValue[]; 303 304 /** 305 * List of pressed keys 306 * 307 * @syscap SystemCapability.MultimodalInput.Input.Core 308 * @since 9 309 */ 310 pressedKeys: KeyCode[]; 311 312 /** 313 * Whether ctrlKey is being pressed 314 * 315 * @syscap SystemCapability.MultimodalInput.Input.Core 316 * @since 9 317 */ 318 ctrlKey: boolean; 319 320 /** 321 * Whether altKey is being pressed 322 * 323 * @syscap SystemCapability.MultimodalInput.Input.Core 324 * @since 9 325 */ 326 altKey: boolean; 327 328 /** 329 * Whether shiftKey is being pressed 330 * 331 * @syscap SystemCapability.MultimodalInput.Input.Core 332 * @since 9 333 */ 334 shiftKey: boolean; 335 336 /** 337 * Whether logoKey is being pressed 338 * 339 * @syscap SystemCapability.MultimodalInput.Input.Core 340 * @since 9 341 */ 342 logoKey: boolean; 343 344 /** 345 * Whether fnKey is being pressed 346 * 347 * @syscap SystemCapability.MultimodalInput.Input.Core 348 * @since 9 349 */ 350 fnKey: boolean; 351 352 /** 353 * Whether capsLock is active 354 * 355 * @syscap SystemCapability.MultimodalInput.Input.Core 356 * @since 9 357 */ 358 capsLock: boolean; 359 360 /** 361 * Whether numLock is active 362 * 363 * @syscap SystemCapability.MultimodalInput.Input.Core 364 * @since 9 365 */ 366 numLock: boolean; 367 368 /** 369 * Whether scrollLock is active 370 * 371 * @syscap SystemCapability.MultimodalInput.Input.Core 372 * @since 9 373 */ 374 scrollLock: boolean; 375}