1 /* 2 * Copyright (c) 2021-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 #ifndef KEY_EVENT_H 17 #define KEY_EVENT_H 18 19 #include <memory> 20 #include <vector> 21 #include <set> 22 23 #include "nocopyable.h" 24 #include "parcel.h" 25 26 #include "input_event.h" 27 28 namespace OHOS { 29 namespace MMI { 30 class KeyEvent : public InputEvent { 31 public: 32 /** 33 * Unknown function key 34 * 35 * @since 9 36 */ 37 static const int32_t UNKNOWN_FUNCTION_KEY; 38 39 /** 40 * Num Lock key 41 * 42 * @since 9 43 */ 44 static const int32_t NUM_LOCK_FUNCTION_KEY; 45 46 /** 47 * Caps Lock key 48 * 49 * @since 9 50 */ 51 static const int32_t CAPS_LOCK_FUNCTION_KEY; 52 53 /** 54 * Scroll Lock key 55 * 56 * @since 9 57 */ 58 static const int32_t SCROLL_LOCK_FUNCTION_KEY; 59 60 /** 61 * Function (Fn) key 62 * 63 * @since 9 64 */ 65 static const int32_t KEYCODE_FN; 66 67 /** 68 * Unknown keycode 69 * 70 * 71 * @since 9 72 */ 73 static const int32_t KEYCODE_UNKNOWN; 74 75 /** 76 * Home key 77 * <p>This key is processed by the framework and will never be sent to the application. 78 * 79 * @since 9 80 */ 81 static const int32_t KEYCODE_HOME; 82 83 /** 84 * Back key 85 * 86 * @since 9 87 */ 88 static const int32_t KEYCODE_BACK; 89 90 /** 91 * Call key 92 * 93 * @since 9 94 */ 95 static const int32_t KEYCODE_CALL; 96 97 /** 98 * End Call key 99 * 100 * @since 9 101 */ 102 static const int32_t KEYCODE_ENDCALL; 103 104 /** 105 * Clear key 106 * 107 * @since 9 108 */ 109 static const int32_t KEYCODE_CLEAR; 110 111 /** 112 * Headset Hook key 113 * <p>This key is used to end a call and stop media. 114 * 115 * @since 9 116 */ 117 static const int32_t KEYCODE_HEADSETHOOK; 118 119 /** 120 * Focus key 121 * <p>This key is used to enable focus for the camera. 122 * 123 * @since 9 124 */ 125 static const int32_t KEYCODE_FOCUS; 126 127 /** 128 * Notification key 129 * 130 * @since 9 131 */ 132 static const int32_t KEYCODE_NOTIFICATION; 133 134 /** 135 * Search key 136 * 137 * @since 9 138 */ 139 static const int32_t KEYCODE_SEARCH; 140 141 /** 142 * Play/Pause media key 143 * 144 * @since 9 145 */ 146 static const int32_t KEYCODE_MEDIA_PLAY_PAUSE; 147 148 /** 149 * Stop media key 150 * 151 * @since 9 152 */ 153 static const int32_t KEYCODE_MEDIA_STOP; 154 155 /** 156 * Play Next media key 157 * 158 * @since 9 159 */ 160 static const int32_t KEYCODE_MEDIA_NEXT; 161 162 /** 163 * Play Previous media key 164 * 165 * @since 9 166 */ 167 static const int32_t KEYCODE_MEDIA_PREVIOUS; 168 169 /** 170 * Rewind media key 171 * 172 * @since 9 173 */ 174 static const int32_t KEYCODE_MEDIA_REWIND; 175 176 /** 177 * Fast Forward media key 178 * 179 * @since 9 180 */ 181 static const int32_t KEYCODE_MEDIA_FAST_FORWARD; 182 183 /** 184 * Volume Up key 185 * 186 * @since 9 187 */ 188 static const int32_t KEYCODE_VOLUME_UP; 189 190 /** 191 * Volume Down key 192 * 193 * @since 9 194 */ 195 static const int32_t KEYCODE_VOLUME_DOWN; 196 197 /** 198 * Power key 199 * 200 * @since 9 201 */ 202 static const int32_t KEYCODE_POWER; 203 204 /** 205 * Camera key 206 * <p>This key is used to start the camera or take photos. 207 * 208 * @since 9 209 */ 210 static const int32_t KEYCODE_CAMERA; 211 212 /** 213 * Voice Assistant key 214 * <p>This key is used to wake up the voice assistant. 215 * 216 * @since 9 217 */ 218 static const int32_t KEYCODE_VOICE_ASSISTANT; 219 220 /** 221 * Custom key 1 222 * <p>The actions mapping to the custom keys are user-defined. 223 * Key values 521-529 are reserved for custom keys. 224 * 225 * @since 9 226 */ 227 static const int32_t KEYCODE_CUSTOM1; 228 229 /** 230 * Volume Mute key 231 * 232 * @since 9 233 */ 234 static const int32_t KEYCODE_VOLUME_MUTE; 235 236 /** 237 * Mute key 238 * 239 * @since 9 240 */ 241 static const int32_t KEYCODE_MUTE; 242 243 /** 244 * Brightness Up key 245 * 246 * @since 9 247 */ 248 static const int32_t KEYCODE_BRIGHTNESS_UP; 249 250 /** 251 * Brightness Down key 252 * 253 * @since 9 254 */ 255 static const int32_t KEYCODE_BRIGHTNESS_DOWN; 256 257 /** 258 * General-purpose key 1 on wearables 259 * 260 * @since 3 261 */ 262 static const int32_t KEYCODE_WEAR_1; 263 264 /** 265 * Number 0 key 266 * 267 * @since 9 268 */ 269 static const int32_t KEYCODE_0; 270 271 /** 272 * Number 1 key 273 * 274 * @since 9 275 */ 276 static const int32_t KEYCODE_1; 277 278 /** 279 * Number 2 key 280 * 281 * @since 9 282 */ 283 static const int32_t KEYCODE_2; 284 285 /** 286 * Number 3 key 287 * 288 * @since 9 289 */ 290 static const int32_t KEYCODE_3; 291 292 /** 293 * Number 4 key 294 * 295 * @since 9 296 */ 297 static const int32_t KEYCODE_4; 298 299 /** 300 * Number 5 key 301 * 302 * @since 9 303 */ 304 static const int32_t KEYCODE_5; 305 306 /** 307 * Number 6 key 308 * 309 * @since 9 310 */ 311 static const int32_t KEYCODE_6; 312 313 /** 314 * Number 7 key 315 * 316 * @since 9 317 */ 318 static const int32_t KEYCODE_7; 319 320 /** 321 * Number 8 key 322 * 323 * @since 9 324 */ 325 static const int32_t KEYCODE_8; 326 327 /** 328 * Number 9 key 329 * 330 * @since 9 331 */ 332 static const int32_t KEYCODE_9; 333 334 /** 335 * Star (*) key 336 * 337 * @since 9 338 */ 339 static const int32_t KEYCODE_STAR; 340 341 /** 342 * Pound (#) key 343 * 344 * @since 9 345 */ 346 static const int32_t KEYCODE_POUND; 347 348 /** 349 * Directional Pad Up key 350 * <p>This key may be synthesized from trackball motions. 351 * 352 * @since 9 353 */ 354 static const int32_t KEYCODE_DPAD_UP; 355 356 /** 357 * Directional Pad Down key 358 * <p>This key may be synthesized from trackball motions. 359 * 360 * @since 9 361 */ 362 static const int32_t KEYCODE_DPAD_DOWN; 363 364 /** 365 * Directional Pad Left key 366 * <p>This key may be synthesized from trackball motions. 367 * 368 * @since 9 369 */ 370 static const int32_t KEYCODE_DPAD_LEFT; 371 372 /** 373 * Directional Pad Right key 374 * <p>This key may be synthesized from trackball motions. 375 * 376 * @since 9 377 */ 378 static const int32_t KEYCODE_DPAD_RIGHT; 379 380 /** 381 * Directional Pad Center key 382 * <p>This key may be synthesized from trackball motions. 383 * 384 * @since 9 385 */ 386 static const int32_t KEYCODE_DPAD_CENTER; 387 388 /** 389 * Letter A key 390 * 391 * @since 9 392 */ 393 static const int32_t KEYCODE_A; 394 395 /** 396 * Letter B key 397 * 398 * @since 9 399 */ 400 static const int32_t KEYCODE_B; 401 402 /** 403 * Letter C key 404 * 405 * @since 9 406 */ 407 static const int32_t KEYCODE_C; 408 409 /** 410 * Letter D key 411 * 412 * @since 9 413 */ 414 static const int32_t KEYCODE_D; 415 416 /** 417 * Letter E key 418 * 419 * @since 9 420 */ 421 static const int32_t KEYCODE_E; 422 423 /** 424 * Letter F key 425 * 426 * @since 9 427 */ 428 static const int32_t KEYCODE_F; 429 430 /** 431 * Letter G key 432 * 433 * @since 9 434 */ 435 static const int32_t KEYCODE_G; 436 437 /** 438 * Letter H key 439 * 440 * @since 9 441 */ 442 static const int32_t KEYCODE_H; 443 444 /** 445 * Letter I key 446 * 447 * @since 9 448 */ 449 static const int32_t KEYCODE_I; 450 451 /** 452 * Letter J key 453 * 454 * @since 9 455 */ 456 static const int32_t KEYCODE_J; 457 458 /** 459 * Letter K key 460 * 461 * @since 9 462 */ 463 static const int32_t KEYCODE_K; 464 465 /** 466 * Letter L key 467 * 468 * @since 9 469 */ 470 static const int32_t KEYCODE_L; 471 472 /** 473 * Letter M key 474 * 475 * @since 9 476 */ 477 static const int32_t KEYCODE_M; 478 479 /** 480 * Letter N key 481 * 482 * @since 9 483 */ 484 static const int32_t KEYCODE_N; 485 486 /** 487 * Letter O key 488 * 489 * @since 9 490 */ 491 static const int32_t KEYCODE_O; 492 493 /** 494 * Letter P key 495 * 496 * @since 9 497 */ 498 static const int32_t KEYCODE_P; 499 500 /** 501 * Letter Q key 502 * 503 * @since 9 504 */ 505 static const int32_t KEYCODE_Q; 506 507 /** 508 * Letter R key 509 * 510 * @since 9 511 */ 512 static const int32_t KEYCODE_R; 513 514 /** 515 * Letter S key 516 * 517 * @since 9 518 */ 519 static const int32_t KEYCODE_S; 520 521 /** 522 * Letter T key 523 * 524 * @since 9 525 */ 526 static const int32_t KEYCODE_T; 527 528 /** 529 * Letter U key 530 * 531 * @since 9 532 */ 533 static const int32_t KEYCODE_U; 534 535 /** 536 * Letter V key 537 * 538 * @since 9 539 */ 540 static const int32_t KEYCODE_V; 541 542 /** 543 * Letter W key 544 * 545 * @since 9 546 */ 547 static const int32_t KEYCODE_W; 548 549 /** 550 * Letter X key 551 * 552 * @since 9 553 */ 554 static const int32_t KEYCODE_X; 555 556 /** 557 * Letter Y key 558 * 559 * @since 9 560 */ 561 static const int32_t KEYCODE_Y; 562 563 /** 564 * Letter Z key 565 * 566 * @since 9 567 */ 568 static const int32_t KEYCODE_Z; 569 570 /** 571 * Semicolon (;) key 572 * 573 * @since 9 574 */ 575 static const int32_t KEYCODE_COMMA; 576 577 /** 578 * Period (.) key 579 * 580 * @since 9 581 */ 582 static const int32_t KEYCODE_PERIOD; 583 584 /** 585 * Left Alt modifier key 586 * 587 * @since 9 588 */ 589 static const int32_t KEYCODE_ALT_LEFT; 590 591 /** 592 * Right Alt modifier key 593 * 594 * @since 9 595 */ 596 static const int32_t KEYCODE_ALT_RIGHT; 597 598 /** 599 * Left Shift modifier key 600 * 601 * @since 9 602 */ 603 static const int32_t KEYCODE_SHIFT_LEFT; 604 605 /** 606 * Right Shift modifier key 607 * 608 * @since 9 609 */ 610 static const int32_t KEYCODE_SHIFT_RIGHT; 611 612 /** 613 * Tab key 614 * 615 * @since 9 616 */ 617 static const int32_t KEYCODE_TAB; 618 619 /** 620 * Space key 621 * 622 * @since 9 623 */ 624 static const int32_t KEYCODE_SPACE; 625 626 /** 627 * Symbol modifier key 628 * <p>This key is used to input alternate symbols. 629 * 630 * @since 9 631 */ 632 static const int32_t KEYCODE_SYM; 633 634 /** 635 * Explorer function key 636 * <p>This key is used to launch a browser application. 637 * 638 * @since 9 639 */ 640 static const int32_t KEYCODE_EXPLORER; 641 642 /** 643 * Email function key 644 * <p>This key is used to launch an email application. 645 * 646 * @since 9 647 */ 648 static const int32_t KEYCODE_ENVELOPE; 649 650 /** 651 * Enter key 652 * 653 * @since 9 654 */ 655 static const int32_t KEYCODE_ENTER; 656 657 /** 658 * Backspace key 659 * <p>Unlike {@link #static const int32_t KEYCODE_FORWARD_DEL}, 660 * this key is used to delete characters before the insertion point. 661 * 662 * @since 9 663 */ 664 static const int32_t KEYCODE_DEL; 665 666 /** 667 * Backtick (') key 668 * 669 * @since 9 670 */ 671 static const int32_t KEYCODE_GRAVE; 672 673 /** 674 * Minus (-) key 675 * 676 * @since 9 677 */ 678 static const int32_t KEYCODE_MINUS; 679 680 /** 681 * Equals (=) key 682 * 683 * @since 9 684 */ 685 static const int32_t KEYCODE_EQUALS; 686 687 /** 688 * Left bracket ([) key 689 * 690 * @since 9 691 */ 692 static const int32_t KEYCODE_LEFT_BRACKET; 693 694 /** 695 * Right bracket (]) key 696 * 697 * @since 9 698 */ 699 static const int32_t KEYCODE_RIGHT_BRACKET; 700 701 /** 702 * Backslash (\) key 703 * 704 * @since 9 705 */ 706 static const int32_t KEYCODE_BACKSLASH; 707 708 /** 709 * Semicolon (;) key 710 * 711 * @since 9 712 */ 713 static const int32_t KEYCODE_SEMICOLON; 714 715 /** 716 * Apostrophe (') key 717 * 718 * @since 9 719 */ 720 static const int32_t KEYCODE_APOSTROPHE; 721 722 /** 723 * Slash (/) key 724 * 725 * @since 9 726 */ 727 static const int32_t KEYCODE_SLASH; 728 729 /** 730 * At (@) key 731 * 732 * @since 9 733 */ 734 static const int32_t KEYCODE_AT; 735 736 /** 737 * Plus (+) key 738 * 739 * @since 9 740 */ 741 static const int32_t KEYCODE_PLUS; 742 743 /** 744 * Menu key 745 * 746 * @since 9 747 */ 748 static const int32_t KEYCODE_MENU; 749 750 /** 751 * Page Up key 752 * 753 * @since 9 754 */ 755 static const int32_t KEYCODE_PAGE_UP; 756 757 /** 758 * Page Down key 759 * 760 * @since 9 761 */ 762 static const int32_t KEYCODE_PAGE_DOWN; 763 764 /** 765 * Escape key 766 * 767 * @since 9 768 */ 769 static const int32_t KEYCODE_ESCAPE; 770 771 /** 772 * Forward Delete key 773 * <p>Unlike {@link #static const int32_t KEYCODE_DEL}, 774 * this key is used to delete characters ahead of the insertion point. 775 * 776 * @since 9 777 */ 778 static const int32_t KEYCODE_FORWARD_DEL; 779 780 /** 781 * Left Control modifier key 782 * 783 * @since 9 784 */ 785 static const int32_t KEYCODE_CTRL_LEFT; 786 787 /** 788 * Right Control modifier key 789 * 790 * @since 9 791 */ 792 static const int32_t KEYCODE_CTRL_RIGHT; 793 794 /** 795 * Caps Lock key 796 * 797 * @since 9 798 */ 799 static const int32_t KEYCODE_CAPS_LOCK; 800 801 /** 802 * Scroll Lock key 803 * 804 * @since 9 805 */ 806 static const int32_t KEYCODE_SCROLL_LOCK; 807 808 /** 809 * Left Meta modifier key 810 * 811 * @since 9 812 */ 813 static const int32_t KEYCODE_META_LEFT; 814 815 /** 816 * Right Meta modifier key 817 * 818 * @since 9 819 */ 820 static const int32_t KEYCODE_META_RIGHT; 821 822 /** 823 * Function modifier key 824 * 825 * @since 9 826 */ 827 static const int32_t KEYCODE_FUNCTION; 828 829 /** 830 * System Request/Print Screen key 831 * 832 * @since 9 833 */ 834 static const int32_t KEYCODE_SYSRQ; 835 836 /** 837 * Break/Pause key 838 * 839 * @since 9 840 */ 841 static const int32_t KEYCODE_BREAK; 842 843 /** 844 * Home Movement key 845 * <p>This key is used to scroll or move the cursor around to the start of a line or to the 846 * top of a list. 847 * 848 * @since 9 849 */ 850 static const int32_t KEYCODE_MOVE_HOME; 851 852 /** 853 * End Movement key 854 * <p>This key is used to scroll or move the cursor around to the end of a line or to the 855 * bottom of a list. 856 * 857 * @since 9 858 */ 859 static const int32_t KEYCODE_MOVE_END; 860 861 /** 862 * Insert key 863 * <p>This key is used to toggle the insert or overwrite edit mode. 864 * 865 * @since 9 866 */ 867 static const int32_t KEYCODE_INSERT; 868 869 /** 870 * Forward key 871 * <p>This key is used to navigate forward in the history stack. 872 * It is a complement of {@link #static const int32_t KEYCODE_BACK}. 873 * 874 * @since 9 875 */ 876 static const int32_t KEYCODE_FORWARD; 877 878 /** 879 * Play media key 880 * 881 * @since 9 882 */ 883 static const int32_t KEYCODE_MEDIA_PLAY; 884 885 /** 886 * Pause media key 887 * 888 * @since 9 889 */ 890 static const int32_t KEYCODE_MEDIA_PAUSE; 891 892 /** 893 * Close media key 894 * <p>This key can be used to close a CD tray, for example. 895 * 896 * @since 9 897 */ 898 static const int32_t KEYCODE_MEDIA_CLOSE; 899 900 /** 901 * Eject media key 902 * <p>This key can be used to eject a CD tray, for example. 903 * 904 * @since 9 905 */ 906 static const int32_t KEYCODE_MEDIA_EJECT; 907 908 /** 909 * Record media key 910 * 911 * @since 9 912 */ 913 static const int32_t KEYCODE_MEDIA_RECORD; 914 915 /** 916 * F1 key 917 * 918 * @since 9 919 */ 920 static const int32_t KEYCODE_F1; 921 922 /** 923 * F2 key 924 * 925 * @since 9 926 */ 927 static const int32_t KEYCODE_F2; 928 929 /** 930 * F3 key 931 * 932 * @since 9 933 */ 934 static const int32_t KEYCODE_F3; 935 936 /** 937 * F4 key 938 * 939 * @since 9 940 */ 941 static const int32_t KEYCODE_F4; 942 943 /** 944 * F5 key 945 * 946 * @since 9 947 */ 948 static const int32_t KEYCODE_F5; 949 950 /** 951 * F6 key 952 * 953 * @since 9 954 */ 955 static const int32_t KEYCODE_F6; 956 957 /** 958 * F7 key 959 * 960 * @since 9 961 */ 962 static const int32_t KEYCODE_F7; 963 964 /** 965 * F8 key 966 * 967 * @since 9 968 */ 969 static const int32_t KEYCODE_F8; 970 971 /** 972 * F9 key 973 * 974 * @since 9 975 */ 976 static const int32_t KEYCODE_F9; 977 978 /** 979 * F10 key 980 * 981 * @since 9 982 */ 983 static const int32_t KEYCODE_F10; 984 985 /** 986 * F11 key 987 * 988 * @since 9 989 */ 990 static const int32_t KEYCODE_F11; 991 992 /** 993 * F12 key 994 * 995 * @since 9 996 */ 997 static const int32_t KEYCODE_F12; 998 999 /** 1000 * Number Lock key 1001 * <p>This key is used to alter the behavior of other keys on the numeric keypad. 1002 * 1003 * @since 9 1004 */ 1005 static const int32_t KEYCODE_NUM_LOCK; 1006 1007 /** 1008 * Number 0 key on the numeric keypad 1009 * 1010 * @since 9 1011 */ 1012 static const int32_t KEYCODE_NUMPAD_0; 1013 1014 /** 1015 * Number 1 key on the numeric keypad 1016 * 1017 * @since 9 1018 */ 1019 static const int32_t KEYCODE_NUMPAD_1; 1020 1021 /** 1022 * Number 2 key on the numeric keypad 1023 * 1024 * @since 9 1025 */ 1026 static const int32_t KEYCODE_NUMPAD_2; 1027 1028 /** 1029 * Number 3 key on the numeric keypad 1030 * 1031 * @since 9 1032 */ 1033 static const int32_t KEYCODE_NUMPAD_3; 1034 1035 /** 1036 * Number 4 key on the numeric keypad 1037 * 1038 * @since 9 1039 */ 1040 static const int32_t KEYCODE_NUMPAD_4; 1041 1042 /** 1043 * Number 5 key on the numeric keypad 1044 * 1045 * @since 9 1046 */ 1047 static const int32_t KEYCODE_NUMPAD_5; 1048 1049 /** 1050 * Number 6 key on the numeric keypad 1051 * 1052 * @since 9 1053 */ 1054 static const int32_t KEYCODE_NUMPAD_6; 1055 1056 /** 1057 * Number 7 key on the numeric keypad 1058 * 1059 * @since 9 1060 */ 1061 static const int32_t KEYCODE_NUMPAD_7; 1062 1063 /** 1064 * Number 8 key on the numeric keypad 1065 * 1066 * @since 9 1067 */ 1068 static const int32_t KEYCODE_NUMPAD_8; 1069 1070 /** 1071 * Number 9 key on the numeric keypad 1072 * 1073 * @since 9 1074 */ 1075 static const int32_t KEYCODE_NUMPAD_9; 1076 1077 /** 1078 * Slash (/) key (for division) on the numeric keypad 1079 * 1080 * @since 9 1081 */ 1082 static const int32_t KEYCODE_NUMPAD_DIVIDE; 1083 1084 /** 1085 * Star (*) key (for multiplication) on the numeric keypad 1086 * 1087 * @since 9 1088 */ 1089 static const int32_t KEYCODE_NUMPAD_MULTIPLY; 1090 1091 /** 1092 * Minus (-) key (for subtraction) on the numeric keypad 1093 * 1094 * @since 9 1095 */ 1096 static const int32_t KEYCODE_NUMPAD_SUBTRACT; 1097 1098 /** 1099 * Plus (+) key (for addition) on the numeric keypad 1100 * 1101 * @since 9 1102 */ 1103 static const int32_t KEYCODE_NUMPAD_ADD; 1104 1105 /** 1106 * Dot (.) key (for decimals or digit grouping) on the 1107 * numeric keypad 1108 * 1109 * @since 9 1110 */ 1111 static const int32_t KEYCODE_NUMPAD_DOT; 1112 1113 /** 1114 * Comma (,) key (for decimals or digit grouping) on the 1115 * numeric keypad 1116 * 1117 * @since 9 1118 */ 1119 static const int32_t KEYCODE_NUMPAD_COMMA; 1120 1121 /** 1122 * Enter key on the numeric keypad 1123 * 1124 * @since 9 1125 */ 1126 static const int32_t KEYCODE_NUMPAD_ENTER; 1127 1128 /** 1129 * Equals (=) key on the numeric keypad 1130 * 1131 * @since 9 1132 */ 1133 static const int32_t KEYCODE_NUMPAD_EQUALS; 1134 1135 /** 1136 * Left parentheses (() key on the numeric keypad 1137 * 1138 * @since 9 1139 */ 1140 static const int32_t KEYCODE_NUMPAD_LEFT_PAREN; 1141 1142 /** 1143 * Right parentheses ()) key on the numeric keypad 1144 * 1145 * @since 9 1146 */ 1147 static const int32_t KEYCODE_NUMPAD_RIGHT_PAREN; 1148 1149 /** 1150 * Virtual multitask key 1151 * 1152 * @since 9 1153 */ 1154 static const int32_t KEYCODE_VIRTUAL_MULTITASK; 1155 1156 /** 1157 * Button A on the gamepad 1158 * 1159 * @since 9 1160 */ 1161 static const int32_t KEYCODE_BUTTON_A; 1162 1163 /** 1164 * Button B on the gamepad 1165 * 1166 * @since 9 1167 */ 1168 static const int32_t KEYCODE_BUTTON_B; 1169 1170 /** 1171 * Button C on the gamepad 1172 * 1173 * @since 9 1174 */ 1175 static const int32_t KEYCODE_BUTTON_C; 1176 1177 /** 1178 * Button X on the gamepad 1179 * 1180 * @since 9 1181 */ 1182 static const int32_t KEYCODE_BUTTON_X; 1183 1184 /** 1185 * Button Y on the gamepad 1186 * 1187 * @since 9 1188 */ 1189 static const int32_t KEYCODE_BUTTON_Y; 1190 1191 /** 1192 * Button Z on the gamepad 1193 * 1194 * @since 9 1195 */ 1196 static const int32_t KEYCODE_BUTTON_Z; 1197 1198 /** 1199 * Button L1 on the gamepad 1200 * 1201 * @since 9 1202 */ 1203 static const int32_t KEYCODE_BUTTON_L1; 1204 1205 /** 1206 * Button R1 on the gamepad 1207 * 1208 * @since 9 1209 */ 1210 static const int32_t KEYCODE_BUTTON_R1; 1211 1212 /** 1213 * Button L2 on the gamepad 1214 * 1215 * @since 9 1216 */ 1217 static const int32_t KEYCODE_BUTTON_L2; 1218 1219 /** 1220 * Button R2 on the gamepad 1221 * 1222 * @since 9 1223 */ 1224 static const int32_t KEYCODE_BUTTON_R2; 1225 1226 /** 1227 * Select button on the gamepad 1228 * 1229 * @since 9 1230 */ 1231 static const int32_t KEYCODE_BUTTON_SELECT; 1232 1233 /** 1234 * Start button on the gamepad 1235 * 1236 * @since 9 1237 */ 1238 static const int32_t KEYCODE_BUTTON_START; 1239 1240 /** 1241 * Mode button on the gamepad 1242 * 1243 * @since 9 1244 */ 1245 static const int32_t KEYCODE_BUTTON_MODE; 1246 1247 /** 1248 * Left Thumb button on the gamepad 1249 * 1250 * @since 9 1251 */ 1252 static const int32_t KEYCODE_BUTTON_THUMBL; 1253 1254 /** 1255 * Right Thumb button on the gamepad 1256 * 1257 * @since 9 1258 */ 1259 static const int32_t KEYCODE_BUTTON_THUMBR; 1260 1261 /** 1262 * Trigger button on the joystick 1263 * 1264 * @since 9 1265 */ 1266 static const int32_t KEYCODE_BUTTON_TRIGGER; 1267 1268 /** 1269 * Thumb button on the joystick 1270 * 1271 * @since 9 1272 */ 1273 static const int32_t KEYCODE_BUTTON_THUMB; 1274 1275 /** 1276 * Thumb button 2 on the joystick 1277 * 1278 * @since 9 1279 */ 1280 static const int32_t KEYCODE_BUTTON_THUMB2; 1281 1282 /** 1283 * Top button on the joystick 1284 * 1285 * @since 9 1286 */ 1287 static const int32_t KEYCODE_BUTTON_TOP; 1288 1289 /** 1290 * Top button 2 on the joystick 1291 * 1292 * @since 9 1293 */ 1294 static const int32_t KEYCODE_BUTTON_TOP2; 1295 1296 /** 1297 * Pinkie button on the joystick 1298 * 1299 * @since 9 1300 */ 1301 static const int32_t KEYCODE_BUTTON_PINKIE; 1302 1303 /** 1304 * Base button 1 on the joystick 1305 * 1306 * @since 9 1307 */ 1308 static const int32_t KEYCODE_BUTTON_BASE1; 1309 1310 /** 1311 * Base button 2 on the joystick 1312 * 1313 * @since 9 1314 */ 1315 static const int32_t KEYCODE_BUTTON_BASE2; 1316 1317 /** 1318 * Base button 3 on the joystick 1319 * 1320 * @since 9 1321 */ 1322 static const int32_t KEYCODE_BUTTON_BASE3; 1323 1324 /** 1325 * Base button 4 on the joystick 1326 * 1327 * @since 9 1328 */ 1329 static const int32_t KEYCODE_BUTTON_BASE4; 1330 1331 /** 1332 * Base button 5 on the joystick 1333 * 1334 * @since 9 1335 */ 1336 static const int32_t KEYCODE_BUTTON_BASE5; 1337 1338 /** 1339 * Base button 6 on the joystick 1340 * 1341 * @since 9 1342 */ 1343 static const int32_t KEYCODE_BUTTON_BASE6; 1344 1345 /** 1346 * Base button 7 on the joystick 1347 * 1348 * @since 9 1349 */ 1350 static const int32_t KEYCODE_BUTTON_BASE7; 1351 1352 /** 1353 * Base button 8 on the joystick 1354 * 1355 * @since 9 1356 */ 1357 static const int32_t KEYCODE_BUTTON_BASE8; 1358 1359 /** 1360 * Base button 9 on the joystick 1361 * 1362 * @since 9 1363 */ 1364 static const int32_t KEYCODE_BUTTON_BASE9; 1365 1366 /** 1367 * Dead button on the joystick 1368 * 1369 * @since 9 1370 */ 1371 static const int32_t KEYCODE_BUTTON_DEAD; 1372 1373 /** 1374 * List Menu key on keyboard 1375 * 1376 * @since 9 1377 */ 1378 static const int32_t KEYCODE_COMPOSE; 1379 1380 /** 1381 * Sleep key 1382 * 1383 * @since 9 1384 */ 1385 static const int32_t KEYCODE_SLEEP; 1386 1387 /** 1388 * Zenkaku_Hankaku, a Japanese modifier key that toggles between 1389 * Hankaku (half-width) and Zenkaku (full-width) characters 1390 * 1391 * @since 9 1392 */ 1393 static const int32_t KEYCODE_ZENKAKU_HANKAKU; 1394 1395 /** 1396 * 102nd key 1397 * 1398 * @since 9 1399 */ 1400 static const int32_t KEYCODE_102ND; 1401 1402 /** 1403 * Japanese Ro key 1404 * 1405 * @since 9 1406 */ 1407 static const int32_t KEYCODE_RO; 1408 1409 /** 1410 * Japanese katakana key 1411 * 1412 * @since 9 1413 */ 1414 static const int32_t KEYCODE_KATAKANA; 1415 1416 /** 1417 * Japanese hiragana key 1418 * 1419 * @since 9 1420 */ 1421 static const int32_t KEYCODE_HIRAGANA; 1422 1423 /** 1424 * Japanese conversion key 1425 * 1426 * @since 9 1427 */ 1428 static const int32_t KEYCODE_HENKAN; 1429 1430 /** 1431 * Japanese katakana/hiragana key 1432 * 1433 * @since 9 1434 */ 1435 static const int32_t KEYCODE_KATAKANA_HIRAGANA; 1436 1437 /** 1438 * Japanese non-conversion key 1439 * 1440 * @since 9 1441 */ 1442 static const int32_t KEYCODE_MUHENKAN; 1443 1444 /** 1445 * Line Feed key 1446 * 1447 * @since 9 1448 */ 1449 static const int32_t KEYCODE_LINEFEED; 1450 1451 /** 1452 * Macro key 1453 * 1454 * @since 9 1455 */ 1456 static const int32_t KEYCODE_MACRO; 1457 1458 /** 1459 * Plus/Minus key on the numeric keypad 1460 * 1461 * @since 9 1462 */ 1463 static const int32_t KEYCODE_NUMPAD_PLUSMINUS; 1464 1465 /** 1466 * Extension 1467 * 1468 * @since 9 1469 */ 1470 static const int32_t KEYCODE_SCALE; 1471 1472 /** 1473 * Japanese Hanguel key 1474 * 1475 * @since 9 1476 */ 1477 static const int32_t KEYCODE_HANGUEL; 1478 1479 /** 1480 * Japanese hanja key 1481 * 1482 * @since 9 1483 */ 1484 static const int32_t KEYCODE_HANJA; 1485 1486 /** 1487 * Japanese YEN key 1488 * 1489 * @since 9 1490 */ 1491 static const int32_t KEYCODE_YEN; 1492 1493 /** 1494 * Stop key 1495 * 1496 * @since 9 1497 */ 1498 static const int32_t KEYCODE_STOP; 1499 1500 /** 1501 * Again key 1502 * 1503 * @since 9 1504 */ 1505 static const int32_t KEYCODE_AGAIN; 1506 1507 /** 1508 * Props key 1509 * 1510 * @since 9 1511 */ 1512 static const int32_t KEYCODE_PROPS; 1513 1514 /** 1515 * Undo key 1516 * 1517 * @since 9 1518 */ 1519 static const int32_t KEYCODE_UNDO; 1520 1521 /** 1522 * Copy key 1523 * 1524 * @since 9 1525 */ 1526 static const int32_t KEYCODE_COPY; 1527 1528 /** 1529 * Open key 1530 * 1531 * @since 9 1532 */ 1533 static const int32_t KEYCODE_OPEN; 1534 1535 /** 1536 * Paste key 1537 * 1538 * @since 9 1539 */ 1540 static const int32_t KEYCODE_PASTE; 1541 1542 /** 1543 * Find key 1544 * 1545 * @since 9 1546 */ 1547 static const int32_t KEYCODE_FIND; 1548 1549 /** 1550 * Cut key 1551 * 1552 * @since 9 1553 */ 1554 static const int32_t KEYCODE_CUT; 1555 1556 /** 1557 * Help key 1558 * 1559 * @since 9 1560 */ 1561 static const int32_t KEYCODE_HELP; 1562 1563 /** 1564 * Calculate key 1565 * 1566 * @since 9 1567 */ 1568 static const int32_t KEYCODE_CALC; 1569 1570 /** 1571 * File key 1572 * 1573 * @since 9 1574 */ 1575 static const int32_t KEYCODE_FILE; 1576 1577 /** 1578 * Bookmarks key 1579 * 1580 * @since 9 1581 */ 1582 static const int32_t KEYCODE_BOOKMARKS; 1583 1584 /** 1585 * Next key 1586 * 1587 * @since 9 1588 */ 1589 static const int32_t KEYCODE_NEXT; 1590 1591 /** 1592 * Play/Pause key 1593 * 1594 * @since 9 1595 */ 1596 static const int32_t KEYCODE_PLAYPAUSE; 1597 1598 /** 1599 * Previous key 1600 * 1601 * @since 9 1602 */ 1603 static const int32_t KEYCODE_PREVIOUS; 1604 1605 /** 1606 * CD Stop key 1607 * 1608 * @since 9 1609 */ 1610 static const int32_t KEYCODE_STOPCD; 1611 1612 /** 1613 * Configuration key 1614 * 1615 * @since 9 1616 */ 1617 static const int32_t KEYCODE_CONFIG; 1618 1619 /** 1620 * Refresh key 1621 * 1622 * @since 9 1623 */ 1624 static const int32_t KEYCODE_REFRESH; 1625 1626 /** 1627 * Exit key 1628 * 1629 * @since 9 1630 */ 1631 static const int32_t KEYCODE_EXIT; 1632 1633 /** 1634 * Edit key 1635 * 1636 * @since 9 1637 */ 1638 static const int32_t KEYCODE_EDIT; 1639 1640 /** 1641 * Scroll Up key 1642 * 1643 * @since 9 1644 */ 1645 static const int32_t KEYCODE_SCROLLUP; 1646 1647 /** 1648 * Scroll Down key 1649 * 1650 * @since 9 1651 */ 1652 static const int32_t KEYCODE_SCROLLDOWN; 1653 1654 /** 1655 * New key 1656 * 1657 * @since 9 1658 */ 1659 static const int32_t KEYCODE_NEW; 1660 1661 /** 1662 * Redo key 1663 * 1664 * @since 9 1665 */ 1666 static const int32_t KEYCODE_REDO; 1667 1668 /** 1669 * Close key 1670 * 1671 * @since 9 1672 */ 1673 static const int32_t KEYCODE_CLOSE; 1674 1675 /** 1676 * Play key 1677 * 1678 * @since 9 1679 */ 1680 static const int32_t KEYCODE_PLAY; 1681 1682 /** 1683 * Bass boost key 1684 * 1685 * @since 9 1686 */ 1687 static const int32_t KEYCODE_BASSBOOST; 1688 1689 /** 1690 * Print key 1691 * 1692 * @since 9 1693 */ 1694 static const int32_t KEYCODE_PRINT; 1695 1696 /** 1697 * Chat key 1698 * 1699 * @since 9 1700 */ 1701 static const int32_t KEYCODE_CHAT; 1702 1703 /** 1704 * Finance key 1705 * 1706 * @since 9 1707 */ 1708 static const int32_t KEYCODE_FINANCE; 1709 1710 /** 1711 * Cancel key 1712 * 1713 * @since 9 1714 */ 1715 static const int32_t KEYCODE_CANCEL; 1716 1717 /** 1718 * Keyboard Illumination Toggle key 1719 * 1720 * @since 9 1721 */ 1722 static const int32_t KEYCODE_KBDILLUM_TOGGLE; 1723 1724 /** 1725 * Keyboard Illumination Down key 1726 * 1727 * @since 9 1728 */ 1729 static const int32_t KEYCODE_KBDILLUM_DOWN; 1730 1731 /** 1732 * Keyboard Illumination Up key 1733 * 1734 * @since 9 1735 */ 1736 static const int32_t KEYCODE_KBDILLUM_UP; 1737 1738 /** 1739 * Send key 1740 * 1741 * @since 9 1742 */ 1743 static const int32_t KEYCODE_SEND; 1744 1745 /** 1746 * Reply key 1747 * 1748 * @since 9 1749 */ 1750 static const int32_t KEYCODE_REPLY; 1751 1752 /** 1753 * Mail Forward key 1754 * 1755 * @since 9 1756 */ 1757 static const int32_t KEYCODE_FORWARDMAIL; 1758 1759 /** 1760 * Save key 1761 * 1762 * @since 9 1763 */ 1764 static const int32_t KEYCODE_SAVE; 1765 1766 /** 1767 * Documents key 1768 * 1769 * @since 9 1770 */ 1771 static const int32_t KEYCODE_DOCUMENTS; 1772 1773 /** 1774 * Next Video key 1775 * 1776 * @since 9 1777 */ 1778 static const int32_t KEYCODE_VIDEO_NEXT; 1779 1780 /** 1781 * Previous Video key 1782 * 1783 * @since 9 1784 */ 1785 static const int32_t KEYCODE_VIDEO_PREV; 1786 1787 /** 1788 * Brightness Cycle key 1789 * 1790 * @since 9 1791 */ 1792 static const int32_t KEYCODE_BRIGHTNESS_CYCLE; 1793 1794 /** 1795 * Brightness 0 key 1796 * 1797 * @since 9 1798 */ 1799 static const int32_t KEYCODE_BRIGHTNESS_ZERO; 1800 1801 /** 1802 * Display Off key 1803 * 1804 * @since 9 1805 */ 1806 static const int32_t KEYCODE_DISPLAY_OFF; 1807 1808 /** 1809 * Miscellaneous buttons on the gamepad 1810 * 1811 * @since 9 1812 */ 1813 static const int32_t KEYCODE_BTN_MISC; 1814 1815 /** 1816 * Go To key 1817 * 1818 * @since 9 1819 */ 1820 static const int32_t KEYCODE_GOTO; 1821 1822 /** 1823 * Info key 1824 * 1825 * @since 9 1826 */ 1827 static const int32_t KEYCODE_INFO; 1828 1829 /** 1830 * Program key 1831 * 1832 * @since 9 1833 */ 1834 static const int32_t KEYCODE_PROGRAM; 1835 1836 /** 1837 * Personal Video Recorder (PVR) key 1838 * 1839 * @since 9 1840 */ 1841 static const int32_t KEYCODE_PVR; 1842 1843 /** 1844 * Subtitle key 1845 * 1846 * @since 9 1847 */ 1848 static const int32_t KEYCODE_SUBTITLE; 1849 1850 /** 1851 * Full Screen key 1852 * 1853 * @since 9 1854 */ 1855 static const int32_t KEYCODE_FULL_SCREEN; 1856 1857 /** 1858 * Keyboard 1859 * 1860 * @since 9 1861 */ 1862 static const int32_t KEYCODE_KEYBOARD; 1863 1864 /** 1865 * Aspect Ratio key 1866 * 1867 * @since 9 1868 */ 1869 static const int32_t KEYCODE_ASPECT_RATIO; 1870 1871 /** 1872 * Port Control key 1873 * 1874 * @since 9 1875 */ 1876 static const int32_t KEYCODE_PC; 1877 1878 /** 1879 * TV key 1880 * 1881 * @since 9 1882 */ 1883 static const int32_t KEYCODE_TV; 1884 1885 /** 1886 * TV key 2 1887 * 1888 * @since 9 1889 */ 1890 static const int32_t KEYCODE_TV2; 1891 1892 /** 1893 * VCR key 1894 * 1895 * @since 9 1896 */ 1897 static const int32_t KEYCODE_VCR; 1898 1899 /** 1900 * VCR key 2 1901 * 1902 * @since 9 1903 */ 1904 static const int32_t KEYCODE_VCR2; 1905 1906 /** 1907 * SIM Application Toolkit (SAT) key 1908 * 1909 * @since 9 1910 */ 1911 static const int32_t KEYCODE_SAT; 1912 1913 /** 1914 * CD key 1915 * 1916 * @since 9 1917 */ 1918 static const int32_t KEYCODE_CD; 1919 1920 /** 1921 * Tape key 1922 * 1923 * @since 9 1924 */ 1925 static const int32_t KEYCODE_TAPE; 1926 1927 /** 1928 * Tuner key 1929 * 1930 * @since 9 1931 */ 1932 static const int32_t KEYCODE_TUNER; 1933 1934 /** 1935 * Player key 1936 * 1937 * @since 9 1938 */ 1939 static const int32_t KEYCODE_PLAYER; 1940 1941 /** 1942 * DVD key 1943 * 1944 * @since 9 1945 */ 1946 static const int32_t KEYCODE_DVD; 1947 1948 /** 1949 * Audio key 1950 * 1951 * @since 9 1952 */ 1953 static const int32_t KEYCODE_AUDIO; 1954 1955 /** 1956 * Video key 1957 * 1958 * @since 9 1959 */ 1960 static const int32_t KEYCODE_VIDEO; 1961 1962 /** 1963 * Memo key 1964 * 1965 * @since 9 1966 */ 1967 static const int32_t KEYCODE_MEMO; 1968 1969 /** 1970 * Calendar key 1971 * 1972 * @since 9 1973 */ 1974 static const int32_t KEYCODE_CALENDAR; 1975 1976 /** 1977 * Red indicator 1978 * 1979 * @since 9 1980 */ 1981 static const int32_t KEYCODE_RED; 1982 1983 /** 1984 * Green indicator 1985 * 1986 * @since 9 1987 */ 1988 static const int32_t KEYCODE_GREEN; 1989 1990 /** 1991 * Yellow indicator 1992 * 1993 * @since 9 1994 */ 1995 static const int32_t KEYCODE_YELLOW; 1996 1997 /** 1998 * Blue indicator 1999 * 2000 * @since 9 2001 */ 2002 static const int32_t KEYCODE_BLUE; 2003 2004 /** 2005 * Channel Up key 2006 * 2007 * @since 9 2008 */ 2009 static const int32_t KEYCODE_CHANNELUP; 2010 2011 /** 2012 * Channel Down key 2013 * 2014 * @since 9 2015 */ 2016 static const int32_t KEYCODE_CHANNELDOWN; 2017 2018 /** 2019 * Last key 2020 * 2021 * @since 9 2022 */ 2023 static const int32_t KEYCODE_LAST; 2024 2025 /** 2026 * Restart key 2027 * 2028 * @since 9 2029 */ 2030 static const int32_t KEYCODE_RESTART; 2031 2032 /** 2033 * Slow key 2034 * 2035 * @since 9 2036 */ 2037 static const int32_t KEYCODE_SLOW; 2038 2039 /** 2040 * Shuffle key 2041 * 2042 * @since 9 2043 */ 2044 static const int32_t KEYCODE_SHUFFLE; 2045 2046 /** 2047 * Videophone key 2048 * 2049 * @since 9 2050 */ 2051 static const int32_t KEYCODE_VIDEOPHONE; 2052 2053 /** 2054 * Games key 2055 * 2056 * @since 9 2057 */ 2058 static const int32_t KEYCODE_GAMES; 2059 2060 /** 2061 * Zoom In key 2062 * 2063 * @since 9 2064 */ 2065 static const int32_t KEYCODE_ZOOMIN; 2066 2067 /** 2068 * Zoom Out key 2069 * 2070 * @since 9 2071 */ 2072 static const int32_t KEYCODE_ZOOMOUT; 2073 2074 /** 2075 * Zoom Reset key 2076 * 2077 * @since 9 2078 */ 2079 static const int32_t KEYCODE_ZOOMRESET; 2080 2081 /** 2082 * Word Processor key 2083 * 2084 * @since 9 2085 */ 2086 static const int32_t KEYCODE_WORDPROCESSOR; 2087 2088 /** 2089 * Editor key 2090 * 2091 * @since 9 2092 */ 2093 static const int32_t KEYCODE_EDITOR; 2094 2095 /** 2096 * Spreadsheet key 2097 * 2098 * @since 9 2099 */ 2100 static const int32_t KEYCODE_SPREADSHEET; 2101 2102 /** 2103 * Graphics Editor key 2104 * 2105 * @since 9 2106 */ 2107 static const int32_t KEYCODE_GRAPHICSEDITOR; 2108 2109 /** 2110 * Presentation key 2111 * 2112 * @since 9 2113 */ 2114 static const int32_t KEYCODE_PRESENTATION; 2115 2116 /** 2117 * Database key 2118 * 2119 * @since 9 2120 */ 2121 static const int32_t KEYCODE_DATABASE; 2122 2123 /** 2124 * News key 2125 * 2126 * @since 9 2127 */ 2128 static const int32_t KEYCODE_NEWS; 2129 2130 /** 2131 * Voice mailbox 2132 * 2133 * @since 9 2134 */ 2135 static const int32_t KEYCODE_VOICEMAIL; 2136 2137 /** 2138 * Address Book key 2139 * 2140 * @since 9 2141 */ 2142 static const int32_t KEYCODE_ADDRESSBOOK; 2143 2144 /** 2145 * Messenger key 2146 * 2147 * @since 9 2148 */ 2149 static const int32_t KEYCODE_MESSENGER; 2150 2151 /** 2152 * Brightness Toggle key 2153 * 2154 * @since 9 2155 */ 2156 static const int32_t KEYCODE_BRIGHTNESS_TOGGLE; 2157 2158 /** 2159 * Spell Check key 2160 * 2161 * @since 9 2162 */ 2163 static const int32_t KEYCODE_SPELLCHECK; 2164 2165 /** 2166 * Coffee key 2167 * 2168 * @since 9 2169 */ 2170 static const int32_t KEYCODE_COFFEE; 2171 2172 /** 2173 * Media Repeat key 2174 * 2175 * @since 9 2176 */ 2177 static const int32_t KEYCODE_MEDIA_REPEAT; 2178 2179 /** 2180 * Images key 2181 * 2182 * @since 9 2183 */ 2184 static const int32_t KEYCODE_IMAGES; 2185 2186 /** 2187 * Button Configuration key 2188 * 2189 * @since 9 2190 */ 2191 static const int32_t KEYCODE_BUTTONCONFIG; 2192 2193 /** 2194 * Task Manager key 2195 * 2196 * @since 9 2197 */ 2198 static const int32_t KEYCODE_TASKMANAGER; 2199 2200 /** 2201 * Journal key 2202 * 2203 * @since 9 2204 */ 2205 static const int32_t KEYCODE_JOURNAL; 2206 2207 /** 2208 * Control Panel key 2209 * 2210 * @since 9 2211 */ 2212 static const int32_t KEYCODE_CONTROLPANEL; 2213 2214 /** 2215 * Application Select key 2216 * 2217 * @since 9 2218 */ 2219 static const int32_t KEYCODE_APPSELECT; 2220 2221 /** 2222 * Screen Saver key 2223 * 2224 * @since 9 2225 */ 2226 static const int32_t KEYCODE_SCREENSAVER; 2227 2228 /** 2229 * Assistant key 2230 * 2231 * @since 9 2232 */ 2233 static const int32_t KEYCODE_ASSISTANT; 2234 2235 /** 2236 * Next Keyboard Layout key 2237 * 2238 * @since 9 2239 */ 2240 static const int32_t KEYCODE_KBD_LAYOUT_NEXT; 2241 2242 /** 2243 * Minimum Brightness key 2244 * 2245 * @since 9 2246 */ 2247 static const int32_t KEYCODE_BRIGHTNESS_MIN; 2248 2249 /** 2250 * Maximum Brightness key 2251 * 2252 * @since 9 2253 */ 2254 static const int32_t KEYCODE_BRIGHTNESS_MAX; 2255 2256 /** 2257 * Keyboard Input Assist_Previous 2258 * 2259 * @since 9 2260 */ 2261 static const int32_t KEYCODE_KBDINPUTASSIST_PREV; 2262 2263 /** 2264 * Keyboard Input Assist_Next 2265 * 2266 * @since 9 2267 */ 2268 static const int32_t KEYCODE_KBDINPUTASSIST_NEXT; 2269 2270 /** 2271 * Keyboard Input Assist_Previous Group 2272 * 2273 * @since 9 2274 */ 2275 static const int32_t KEYCODE_KBDINPUTASSIST_PREVGROUP; 2276 2277 /** 2278 * Keyboard Input Assist_Next Group 2279 * 2280 * @since 9 2281 */ 2282 static const int32_t KEYCODE_KBDINPUTASSIST_NEXTGROUP; 2283 2284 /** 2285 * Keyboard Input Assist_Accept 2286 * 2287 * @since 9 2288 */ 2289 static const int32_t KEYCODE_KBDINPUTASSIST_ACCEPT; 2290 2291 /** 2292 * Keyboard Input Assist_Cancel 2293 * 2294 * @since 9 2295 */ 2296 static const int32_t KEYCODE_KBDINPUTASSIST_CANCEL; 2297 2298 /** 2299 * Front key 2300 * 2301 * @since 9 2302 */ 2303 static const int32_t KEYCODE_FRONT; 2304 2305 /** 2306 * Setup key 2307 * 2308 * @since 9 2309 */ 2310 static const int32_t KEYCODE_SETUP; 2311 2312 /** 2313 * Wakeup key 2314 * 2315 * @since 9 2316 */ 2317 static const int32_t KEYCODE_WAKEUP; 2318 2319 /** 2320 * Send File key 2321 * 2322 * @since 9 2323 */ 2324 static const int32_t KEYCODE_SENDFILE; 2325 2326 /** 2327 * Delete File key 2328 * 2329 * @since 9 2330 */ 2331 static const int32_t KEYCODE_DELETEFILE; 2332 2333 /** 2334 * File Transfer (XFER) key 2335 * 2336 * @since 9 2337 */ 2338 static const int32_t KEYCODE_XFER; 2339 2340 /** 2341 * Program key 1 2342 * 2343 * @since 9 2344 */ 2345 static const int32_t KEYCODE_PROG1; 2346 2347 /** 2348 * Program key 2 2349 * 2350 * @since 9 2351 */ 2352 static const int32_t KEYCODE_PROG2; 2353 2354 /** 2355 * MS-DOS key 2356 * 2357 * @since 9 2358 */ 2359 static const int32_t KEYCODE_MSDOS; 2360 2361 /** 2362 * Screen Lock key 2363 * 2364 * @since 9 2365 */ 2366 static const int32_t KEYCODE_SCREENLOCK; 2367 2368 /** 2369 * Direction Rotation Display key 2370 * 2371 * @since 9 2372 */ 2373 static const int32_t KEYCODE_DIRECTION_ROTATE_DISPLAY; 2374 2375 /** 2376 * Cycle Windows key 2377 * 2378 * @since 9 2379 */ 2380 static const int32_t KEYCODE_CYCLEWINDOWS; 2381 2382 /** 2383 * Computer key 2384 * 2385 * @since 9 2386 */ 2387 static const int32_t KEYCODE_COMPUTER; 2388 2389 /** 2390 * Eject Close CD key 2391 * 2392 * @since 9 2393 */ 2394 static const int32_t KEYCODE_EJECTCLOSECD; 2395 2396 /** 2397 * ISO key 2398 * 2399 * @since 9 2400 */ 2401 static const int32_t KEYCODE_ISO; 2402 2403 /** 2404 * Move key 2405 * 2406 * @since 9 2407 */ 2408 static const int32_t KEYCODE_MOVE; 2409 2410 /** 2411 * F13 key 2412 * 2413 * @since 9 2414 */ 2415 static const int32_t KEYCODE_F13; 2416 2417 /** 2418 * F14 key 2419 * 2420 * @since 9 2421 */ 2422 static const int32_t KEYCODE_F14; 2423 2424 /** 2425 * F15 key 2426 * 2427 * @since 9 2428 */ 2429 static const int32_t KEYCODE_F15; 2430 2431 /** 2432 * F16 key 2433 * 2434 * @since 9 2435 */ 2436 static const int32_t KEYCODE_F16; 2437 2438 /** 2439 * F17 key 2440 * 2441 * @since 9 2442 */ 2443 static const int32_t KEYCODE_F17; 2444 2445 /** 2446 * F18 key 2447 * 2448 * @since 9 2449 */ 2450 static const int32_t KEYCODE_F18; 2451 2452 /** 2453 * F19 key 2454 * 2455 * @since 9 2456 */ 2457 static const int32_t KEYCODE_F19; 2458 2459 /** 2460 * F20 key 2461 * 2462 * @since 9 2463 */ 2464 static const int32_t KEYCODE_F20; 2465 2466 /** 2467 * F21 key 2468 * 2469 * @since 9 2470 */ 2471 static const int32_t KEYCODE_F21; 2472 2473 /** 2474 * F22 key 2475 * 2476 * @since 9 2477 */ 2478 static const int32_t KEYCODE_F22; 2479 2480 /** 2481 * F23 key 2482 * 2483 * @since 9 2484 */ 2485 static const int32_t KEYCODE_F23; 2486 2487 /** 2488 * F24 key 2489 * 2490 * @since 9 2491 */ 2492 static const int32_t KEYCODE_F24; 2493 2494 /** 2495 * Program key 3 2496 * 2497 * @since 9 2498 */ 2499 static const int32_t KEYCODE_PROG3; 2500 2501 /** 2502 * Program key 4 2503 * 2504 * @since 9 2505 */ 2506 static const int32_t KEYCODE_PROG4; 2507 2508 /** 2509 * Dashboard key 2510 * 2511 * @since 9 2512 */ 2513 static const int32_t KEYCODE_DASHBOARD; 2514 2515 /** 2516 * Suspend key 2517 * 2518 * @since 9 2519 */ 2520 static const int32_t KEYCODE_SUSPEND; 2521 2522 /** 2523 * Higher Order Path key 2524 * 2525 * @since 9 2526 */ 2527 static const int32_t KEYCODE_HP; 2528 2529 /** 2530 * Sound key 2531 * 2532 * @since 9 2533 */ 2534 static const int32_t KEYCODE_SOUND; 2535 2536 /** 2537 * Question key 2538 * 2539 * @since 9 2540 */ 2541 static const int32_t KEYCODE_QUESTION; 2542 2543 /** 2544 * Connect key 2545 * 2546 * @since 9 2547 */ 2548 static const int32_t KEYCODE_CONNECT; 2549 2550 /** 2551 * Sport key 2552 * 2553 * @since 9 2554 */ 2555 static const int32_t KEYCODE_SPORT; 2556 2557 /** 2558 * Shop key 2559 * 2560 * @since 9 2561 */ 2562 static const int32_t KEYCODE_SHOP; 2563 2564 /** 2565 * Alterase key 2566 * 2567 * @since 9 2568 */ 2569 static const int32_t KEYCODE_ALTERASE; 2570 2571 /** 2572 * Enable/Disable Video Mode key 2573 * 2574 * @since 9 2575 */ 2576 static const int32_t KEYCODE_SWITCHVIDEOMODE; 2577 2578 /** 2579 * Battery key 2580 * 2581 * @since 9 2582 */ 2583 static const int32_t KEYCODE_BATTERY; 2584 2585 /** 2586 * Bluetooth key 2587 * 2588 * @since 9 2589 */ 2590 static const int32_t KEYCODE_BLUETOOTH; 2591 2592 /** 2593 * WLAN key 2594 * 2595 * @since 9 2596 */ 2597 static const int32_t KEYCODE_WLAN; 2598 2599 /** 2600 * Ultra-wideband (UWB) key 2601 * 2602 * @since 9 2603 */ 2604 static const int32_t KEYCODE_UWB; 2605 2606 /** 2607 * WWAN WiMAX key 2608 * 2609 * @since 9 2610 */ 2611 static const int32_t KEYCODE_WWAN_WIMAX; 2612 2613 /** 2614 * RF Kill key 2615 * 2616 * @since 9 2617 */ 2618 static const int32_t KEYCODE_RFKILL; 2619 2620 /** 2621 * Channel key 2622 * 2623 * @since 9 2624 */ 2625 static const int32_t KEYCODE_CHANNEL; 2626 2627 /** 2628 * Button 0 2629 * 2630 * @since 9 2631 */ 2632 static const int32_t KEYCODE_BTN_0; 2633 2634 /** 2635 * Button 1 2636 * 2637 * @since 9 2638 */ 2639 static const int32_t KEYCODE_BTN_1; 2640 2641 /** 2642 * Button 2 2643 * 2644 * @since 9 2645 */ 2646 static const int32_t KEYCODE_BTN_2; 2647 2648 /** 2649 * Button 3 2650 * 2651 * @since 9 2652 */ 2653 static const int32_t KEYCODE_BTN_3; 2654 2655 /** 2656 * Button 4 2657 * 2658 * @since 9 2659 */ 2660 static const int32_t KEYCODE_BTN_4; 2661 2662 /** 2663 * Button 5 2664 * 2665 * @since 9 2666 */ 2667 static const int32_t KEYCODE_BTN_5; 2668 2669 /** 2670 * Button 6 2671 * 2672 * @since 9 2673 */ 2674 static const int32_t KEYCODE_BTN_6; 2675 2676 /** 2677 * Button 7 2678 * 2679 * @since 9 2680 */ 2681 static const int32_t KEYCODE_BTN_7; 2682 2683 /** 2684 * Button 8 2685 * 2686 * @since 9 2687 */ 2688 static const int32_t KEYCODE_BTN_8; 2689 2690 /** 2691 * Button 9 2692 * 2693 * @since 9 2694 */ 2695 static const int32_t KEYCODE_BTN_9; 2696 2697 /** 2698 * Virtual keyboard 1 2699 * 2700 * @since 9 2701 */ 2702 static const int32_t KEYCODE_BRL_DOT1; 2703 2704 /** 2705 * Virtual keyboard 2 2706 * 2707 * @since 9 2708 */ 2709 static const int32_t KEYCODE_BRL_DOT2; 2710 2711 /** 2712 * Virtual keyboard 3 2713 * 2714 * @since 9 2715 */ 2716 static const int32_t KEYCODE_BRL_DOT3; 2717 2718 /** 2719 * Virtual keyboard 4 2720 * 2721 * @since 9 2722 */ 2723 static const int32_t KEYCODE_BRL_DOT4; 2724 2725 /** 2726 * Virtual keyboard 5 2727 * 2728 * @since 9 2729 */ 2730 static const int32_t KEYCODE_BRL_DOT5; 2731 2732 /** 2733 * Virtual keyboard 6 2734 * 2735 * @since 9 2736 */ 2737 static const int32_t KEYCODE_BRL_DOT6; 2738 2739 /** 2740 * Virtual keyboard 7 2741 * 2742 * @since 9 2743 */ 2744 static const int32_t KEYCODE_BRL_DOT7; 2745 2746 /** 2747 * Virtual keyboard 8 2748 * 2749 * @since 9 2750 */ 2751 static const int32_t KEYCODE_BRL_DOT8; 2752 2753 /** 2754 * Virtual keyboard 9 2755 * 2756 * @since 9 2757 */ 2758 static const int32_t KEYCODE_BRL_DOT9; 2759 2760 /** 2761 * Virtual keyboard 10 2762 * 2763 * @since 9 2764 */ 2765 static const int32_t KEYCODE_BRL_DOT10; 2766 2767 /** 2768 * Left Knob roll-up 2769 * <p>In contrast to {@link #static const int32_t KEYCODE_LEFT_KNOB_ROLL_DOWN}, 2770 * this key is used to roll the left knob upwards. The knob function is scenario-specific, 2771 * for example, increasing the volume or air conditioner temperature. 2772 * 2773 * @since 9 2774 */ 2775 static const int32_t KEYCODE_LEFT_KNOB_ROLL_UP; 2776 2777 /** 2778 * Left Knob roll-down 2779 * <p>In contrast to {@link #static const int32_t KEYCODE_LEFT_KNOB_ROLL_UP}, 2780 * this key is used to roll the left knob downwards. The knob function is 2781 * scenario-specific, for example, reducing the volume or air 2782 * conditioner temperature. 2783 * @since 9 2784 */ 2785 static const int32_t KEYCODE_LEFT_KNOB_ROLL_DOWN; 2786 2787 /** 2788 * Left Knob 2789 * <p>Pressing the knob will activate its adjustment function. 2790 * 2791 * @since 9 2792 */ 2793 static const int32_t KEYCODE_LEFT_KNOB; 2794 2795 /** 2796 * Right Knob roll-up 2797 * <p>In contrast to {@link #static const int32_t KEYCODE_RIGHT_KNOB_ROLL_DOWN}, 2798 * this key is used to roll the right knob upwards. The knobfunction is scenario-specific, 2799 * for example, increasing the volume or air conditioner temperature. 2800 * 2801 * @since 9 2802 */ 2803 static const int32_t KEYCODE_RIGHT_KNOB_ROLL_UP; 2804 2805 /** 2806 * Right Knob roll-down 2807 * <p>In contrast to {@link #static const int32_t KEYCODE_RIGHT_KNOB_ROLL_UP}, 2808 * this key is used to roll the right knob downwards. The knobfunction is scenario-specific, 2809 * for example, reducing the volume or air conditioner temperature. 2810 * 2811 * @since 9 2812 */ 2813 static const int32_t KEYCODE_RIGHT_KNOB_ROLL_DOWN; 2814 2815 /** 2816 * Right Knob 2817 * <p>Pressing the knob will activate its adjustment function. 2818 * 2819 * @since 9 2820 */ 2821 static const int32_t KEYCODE_RIGHT_KNOB; 2822 2823 /** 2824 * Audio Source Switch button 2825 * <p>Pressing this button will enable the audio source. Depending on the 2826 * actual scenario, it may also indicate that the Bluetooth call control 2827 * button is pressed. 2828 * @since 9 2829 */ 2830 static const int32_t KEYCODE_VOICE_SOURCE_SWITCH; 2831 2832 /** 2833 * Menu key 2834 * <p>Pressing this key will display the launcher page. 2835 * 2836 * @since 9 2837 */ 2838 static const int32_t KEYCODE_LAUNCHER_MENU; 2839 2840 /** 2841 * Stylus key 2842 * 2843 * @since 12 2844 */ 2845 static const int32_t KEYCODE_STYLUS_SCREEN; 2846 2847 /** 2848 * Unknown key operation, which is usually used to indicate the initial invalid value. 2849 * 2850 * @since 9 2851 */ 2852 static const int32_t KEY_ACTION_UNKNOWN; 2853 2854 /** 2855 * Action Cancel 2856 * Pressing this key will cause the failure in reporting the Action Up event. 2857 * Instead, the action of pressing the Action Cancel key is reported. 2858 * 2859 * @since 9 2860 */ 2861 static const int32_t KEY_ACTION_CANCEL; 2862 2863 /** 2864 * Action Down 2865 * 2866 * @since 9 2867 */ 2868 static const int32_t KEY_ACTION_DOWN; 2869 2870 /** 2871 * Action Up 2872 * 2873 * @since 9 2874 */ 2875 static const int32_t KEY_ACTION_UP; 2876 2877 /** 2878 * Unknown intention 2879 * 2880 * @since 9 2881 */ 2882 static const int32_t INTENTION_UNKNOWN; 2883 2884 /** 2885 * Up intention 2886 * 2887 * @since 9 2888 */ 2889 static const int32_t INTENTION_UP; 2890 2891 /** 2892 * Down intention 2893 * 2894 * @since 9 2895 */ 2896 static const int32_t INTENTION_DOWN; 2897 2898 /** 2899 * Left intention 2900 * 2901 * @since 9 2902 */ 2903 static const int32_t INTENTION_LEFT; 2904 2905 /** 2906 * Right intention 2907 * 2908 * @since 9 2909 */ 2910 static const int32_t INTENTION_RIGHT; 2911 2912 /** 2913 * Select intention 2914 * 2915 * @since 9 2916 */ 2917 static const int32_t INTENTION_SELECT; 2918 2919 /** 2920 * Escape intention 2921 * 2922 * @since 9 2923 */ 2924 static const int32_t INTENTION_ESCAPE; 2925 2926 /** 2927 * Back intention 2928 * 2929 * @since 9 2930 */ 2931 static const int32_t INTENTION_BACK; 2932 2933 /** 2934 * Forward intention 2935 * 2936 * @since 9 2937 */ 2938 static const int32_t INTENTION_FORWARD; 2939 2940 /** 2941 * Menu intention 2942 * 2943 * @since 9 2944 */ 2945 static const int32_t INTENTION_MENU; 2946 2947 /** 2948 * Home intention 2949 * 2950 * @since 9 2951 */ 2952 static const int32_t INTENTION_HOME; 2953 2954 /** 2955 * Page Up intention 2956 * 2957 * @since 9 2958 */ 2959 static const int32_t INTENTION_PAGE_UP; 2960 2961 /** 2962 * Page down intention 2963 * 2964 * @since 9 2965 */ 2966 static const int32_t INTENTION_PAGE_DOWN; 2967 2968 /** 2969 * Zoom out intention 2970 * 2971 * @since 9 2972 */ 2973 static const int32_t INTENTION_ZOOM_OUT; 2974 2975 /** 2976 * Zoom in intention 2977 * 2978 * @since 9 2979 */ 2980 static const int32_t INTENTION_ZOOM_IN; 2981 2982 /** 2983 * Media play/pause intention 2984 * 2985 * @since 9 2986 */ 2987 static const int32_t INTENTION_MEDIA_PLAY_PAUSE; 2988 2989 /** 2990 * Media fast forward intention 2991 * 2992 * @since 9 2993 */ 2994 static const int32_t INTENTION_MEDIA_FAST_FORWARD; 2995 2996 /** 2997 * Media fast rewind intention 2998 * 2999 * @since 9 3000 */ 3001 static const int32_t INTENTION_MEDIA_FAST_REWIND; 3002 3003 /** 3004 * Media fast playback intention 3005 * 3006 * @since 9 3007 */ 3008 static const int32_t INTENTION_MEDIA_FAST_PLAYBACK; 3009 3010 /** 3011 * Media next intention 3012 * 3013 * @since 9 3014 */ 3015 static const int32_t INTENTION_MEDIA_NEXT; 3016 3017 /** 3018 * Media previous intention 3019 * 3020 * @since 9 3021 */ 3022 static const int32_t INTENTION_MEDIA_PREVIOUS; 3023 3024 /** 3025 * Media mute intention 3026 * 3027 * @since 9 3028 */ 3029 static const int32_t INTENTION_MEDIA_MUTE; 3030 3031 /** 3032 * Volume up intention 3033 * 3034 * @since 9 3035 */ 3036 static const int32_t INTENTION_VOLUTE_UP; 3037 3038 /** 3039 * Volume down intention 3040 * 3041 * @since 9 3042 */ 3043 static const int32_t INTENTION_VOLUTE_DOWN; 3044 3045 /** 3046 * Call intention 3047 * 3048 * @since 9 3049 */ 3050 static const int32_t INTENTION_CALL; 3051 3052 /** 3053 * End call intention 3054 * 3055 * @since 9 3056 */ 3057 static const int32_t INTENTION_ENDCALL; 3058 3059 /** 3060 * Reject call intention 3061 * 3062 * @since 9 3063 */ 3064 static const int32_t INTENTION_REJECTCALL; 3065 3066 /** 3067 * Camera intention 3068 * 3069 * @since 9 3070 */ 3071 static const int32_t INTENTION_CAMERA; 3072 3073 /** 3074 * Outbound Notification Center 3075 * 3076 * @since 11 3077 */ 3078 static const int32_t KEYCODE_CALL_NOTIFICATION_CENTER; 3079 3080 /** 3081 * Outbound Control Center 3082 * 3083 * @since 11 3084 */ 3085 static const int32_t KEYCODE_CALL_CONTROL_CENTER; 3086 public: 3087 class KeyItem { 3088 public: 3089 KeyItem(); 3090 ~KeyItem(); 3091 3092 /** 3093 * @brief Obtains the key code of the key. 3094 * @return Returns the key code. 3095 * @since 9 3096 */ 3097 int32_t GetKeyCode() const; 3098 3099 /** 3100 * @brief Sets a key code for the key. 3101 * @param keyCode Indicates the key code to set. 3102 * @return void 3103 * @since 9 3104 */ 3105 void SetKeyCode(int32_t keyCode); 3106 3107 /** 3108 * @brief Obtains the time when the key is pressed. 3109 * @return Returns the time. 3110 * @since 9 3111 */ 3112 int64_t GetDownTime() const; 3113 3114 /** 3115 * @brief Sets the time when the key is pressed. 3116 * @param downTime Indicates the time to set. 3117 * @return void 3118 * @since 9 3119 */ 3120 void SetDownTime(int64_t downTime); 3121 3122 /** 3123 * @brief Obtains the unique identifier of the device that reports this event. 3124 * @return Returns the device ID. 3125 * @since 9 3126 */ 3127 int32_t GetDeviceId() const; 3128 3129 /** 3130 * @brief Sets a unique identifier for the device that reports this event. 3131 * @param deviceId Indicates the device ID to set. 3132 * @return void 3133 * @since 9 3134 */ 3135 void SetDeviceId(int32_t deviceId); 3136 3137 /** 3138 * @brief Checks whether the key is pressed. 3139 * @return Returns <b>true</b> if the key is pressed; returns <b>false</b> otherwise. 3140 * @since 9 3141 */ 3142 bool IsPressed() const; 3143 3144 /** 3145 * @brief Sets whether to enable the pressed state for the key. 3146 * @param pressed Specifies whether to set the pressed state for the key. 3147 * The value <b>true</b> means to set the pressed state for the key, 3148 * and the <b>false</b> means the opposite. 3149 * @return void 3150 * @since 9 3151 */ 3152 void SetPressed(bool pressed); 3153 3154 /** 3155 * @brief Sets the Unicode value corresponding to the current key. 3156 * @param unicode Unicode value. 3157 * @return Null 3158 * @since 9 3159 */ 3160 void SetUnicode(uint32_t unicode); 3161 3162 /** 3163 * @brief Obtains the Unicode value of the current key. 3164 * @return Returns the Unicode value. 3165 * @since 9 3166 */ 3167 uint32_t GetUnicode() const; 3168 3169 public: 3170 /** 3171 * @brief Writes data to a <b>Parcel</b> object. 3172 * @param out Indicates the object into which data will be written. 3173 * @return Returns <b>true</b> if the data is successfully written; returns <b>false</b> otherwise. 3174 * @since 9 3175 */ 3176 bool WriteToParcel(Parcel &out) const; 3177 3178 /** 3179 * @brief Reads data from a <b>Parcel</b> object. 3180 * @param in Indicates the object from which data will be read. 3181 * @return Returns <b>true</b> if the data is successfully read; returns <b>false</b> otherwise. 3182 * @since 9 3183 */ 3184 bool ReadFromParcel(Parcel &in); 3185 3186 private: 3187 bool pressed_ = false; 3188 int32_t deviceId_ = -1; 3189 int32_t keyCode_ = -1; 3190 int64_t downTime_ = 0; 3191 uint32_t unicode_ { 0 }; 3192 }; 3193 3194 public: 3195 static std::shared_ptr<KeyEvent> from(std::shared_ptr<InputEvent> inputEvent); 3196 3197 /** 3198 * @brief Converts the action of this key event as a string. 3199 * @param action Indicates the action represented by pressing a key. 3200 * @return Returns the pointer to the action string. 3201 * @since 9 3202 */ 3203 static const char* ActionToString(int32_t action); 3204 3205 /** 3206 * @brief Converts the key code of this key event as a string. 3207 * @param keyCode Indicates the code that identifies the key. 3208 * @return Returns the pointer to the key code string. 3209 * @since 9 3210 */ 3211 static const char* KeyCodeToString(int32_t keyCode); 3212 3213 static std::shared_ptr<KeyEvent> Clone(std::shared_ptr<KeyEvent> keyEvent); 3214 3215 public: 3216 /** 3217 * @brief Constructor of KeyEvent. 3218 * @since 9 3219 */ 3220 KeyEvent(const KeyEvent& other); 3221 3222 /** 3223 * @brief Virtual destructor of KeyEvent. 3224 * @since 9 3225 */ 3226 virtual ~KeyEvent(); 3227 3228 KeyEvent& operator=(const KeyEvent& other) = delete; 3229 DISALLOW_MOVE(KeyEvent); 3230 3231 /** 3232 * @brief Creates a key event. 3233 * @since 9 3234 */ 3235 static std::shared_ptr<KeyEvent> Create(); 3236 3237 virtual void Reset() override; 3238 3239 /** 3240 * @brief Obtains the key code of this key event. 3241 * @return Returns the key code. 3242 * @since 9 3243 */ 3244 int32_t GetKeyCode() const; 3245 3246 /** 3247 * @brief Sets a key code for this key event. 3248 * @param keyCode Indicates the key code to set. 3249 * @return void 3250 * @since 9 3251 */ 3252 void SetKeyCode(int32_t keyCode); 3253 3254 /** 3255 * @brief Obtains the key action of this key event. 3256 * @return Returns the key action. 3257 * @since 9 3258 */ 3259 int32_t GetKeyAction() const; 3260 3261 /** 3262 * @brief Sets a key action for this key event. 3263 * @param keyAction Indicates the key action to set. 3264 * @return void 3265 * @since 9 3266 */ 3267 void SetKeyAction(int32_t keyAction); 3268 3269 /** 3270 * @brief Obtains the list of pressed keys in this key event. 3271 * @return Returns the list of pressed keys. 3272 * @since 9 3273 */ 3274 std::vector<int32_t> GetPressedKeys() const; 3275 3276 /** 3277 * @brief Adds a key item. 3278 * @param keyItem Indicates the key item to add. 3279 * @return void 3280 * @since 9 3281 */ 3282 void AddKeyItem(const KeyItem& keyItem); 3283 3284 /** 3285 * @brief Obtains the key item. 3286 * @return Returns the key item. 3287 * @since 9 3288 */ 3289 std::vector<KeyEvent::KeyItem> GetKeyItems() const; 3290 3291 /** 3292 * @brief Adds the pressed key items. 3293 * @param keyItem Indicates the key item to add. 3294 * @return void 3295 * @since 9 3296 */ 3297 void AddPressedKeyItems(const KeyItem& keyItem); 3298 3299 /** 3300 * @brief Removes the released key Items. 3301 * @param keyItem Indicates the key item to remove. 3302 * @return void 3303 * @since 9 3304 */ 3305 void RemoveReleasedKeyItems(const KeyItem& keyItem); 3306 3307 /** 3308 * @brief Obtains the key item of this key event. 3309 * @return Returns the key item. 3310 * @since 9 3311 */ 3312 std::optional<KeyEvent::KeyItem> GetKeyItem() const; 3313 3314 /** 3315 * @brief Obtains the key item based on a key code. 3316 * @param keyCode Indicates the key code. 3317 * @return Returns the key item. 3318 * @since 9 3319 */ 3320 std::optional<KeyEvent::KeyItem> GetKeyItem(int32_t keyCode) const; 3321 3322 /** 3323 * @brief Checks whether this key event is valid. 3324 * @return Returns <b>true</b> if the key event is valid; returns <b>false</b> otherwise. 3325 * @since 9 3326 */ 3327 bool IsValid() const; 3328 3329 /** 3330 * @brief Converts a specific key to a function key. 3331 * @param keyCode Indicates the keycode of the key to convert. 3332 * @return Returns the converted function key. 3333 * @since 9 3334 */ 3335 int32_t TransitionFunctionKey(int32_t keyCode); 3336 3337 /** 3338 * @brief Sets the enable status of the specified function key. 3339 * @param funcKey Indicates the function key. 3340 * @param value Indicates the enable status of the function key. 3341 * @return Returns the result indicating whether the setting is successful. 3342 * @since 9 3343 */ 3344 int32_t SetFunctionKey(int32_t funcKey, int32_t value); 3345 3346 /** 3347 * @brief Obtains the enable status of the specified function key. 3348 * @param funcKey Indicates the function key. 3349 * @return Returns the enable status of the function key. 3350 * @since 9 3351 */ 3352 bool GetFunctionKey(int32_t funcKey) const; 3353 3354 /** 3355 * @brief Obtains the key intention of the current event. 3356 * @param void 3357 * @return Returns the key intention of the current event. 3358 * @since 9 3359 */ 3360 int32_t GetKeyIntention() const; 3361 3362 /** 3363 * @brief Sets the key intention for the current key event. 3364 * @param keyIntention Specified key intention. 3365 * @return void 3366 * @since 9 3367 */ 3368 void SetKeyIntention(int32_t keyIntention); 3369 3370 /** 3371 * @brief Gets the automatic keystroke repeat status. 3372 * @return bool 3373 * @since 10 3374 */ 3375 bool IsRepeat() const; 3376 3377 /** 3378 * @brief Sets the injection key to repeat automatically. 3379 * @param repeat Key injection automatic repeat identification. 3380 * @return void 3381 * @since 10 3382 */ 3383 void SetRepeat(bool repeat); 3384 3385 #ifdef OHOS_BUILD_ENABLE_SECURITY_COMPONENT 3386 /** 3387 * @brief Set the enhance data. 3388 * @return void. 3389 * @since 11 3390 */ 3391 void SetEnhanceData(std::vector<uint8_t> enhanceData); 3392 /** 3393 * @brief Obtains the enhance data. 3394 * @return Returns the enhance data. 3395 * @since 11 3396 */ 3397 std::vector<uint8_t> GetEnhanceData() const; 3398 #endif // OHOS_BUILD_ENABLE_SECURITY_COMPONENT 3399 public: 3400 /** 3401 * @brief Writes data to a <b>Parcel</b> object. 3402 * @param out Indicates the object into which data will be written. 3403 * @return Returns <b>true</b> if the data is successfully written; returns <b>false</b> otherwise. 3404 * @since 9 3405 */ 3406 bool WriteToParcel(Parcel &out) const; 3407 3408 /** 3409 * @brief Reads data from a <b>Parcel</b> object. 3410 * @param in Indicates the object from which data will be read. 3411 * @return Returns <b>true</b> if the data is successfully read; returns <b>false</b> otherwise. 3412 * @since 9 3413 */ 3414 bool ReadFromParcel(Parcel &in); 3415 3416 /** 3417 * @brief Converts a key event action into a short string. 3418 * @param Indicates the key event action. 3419 * @return Returns the string converted from the key action. 3420 * @since 12 3421 */ 3422 static std::string_view ActionToShortStr(int32_t action); 3423 protected: 3424 /** 3425 * @brief Constructs an input event object by using the specified input event type. Generally, this method 3426 * is used to construct a base class object when constructing a derived class object. 3427 * @since 9 3428 */ 3429 explicit KeyEvent(int32_t eventType); 3430 3431 public: 3432 void SetFourceMonitorFlag(bool fourceMonitorFlag); 3433 bool GetFourceMonitorFlag(); 3434 3435 private: 3436 #ifdef OHOS_BUILD_ENABLE_SECURITY_COMPONENT 3437 bool ReadEnhanceDataFromParcel(Parcel &in); 3438 #endif // OHOS_BUILD_ENABLE_SECURITY_COMPONENT 3439 bool IsValidKeyItem() const; 3440 3441 private: 3442 int32_t keyCode_ { -1 }; 3443 std::vector<KeyItem> keys_; 3444 int32_t keyAction_ { 0 }; 3445 int32_t keyIntention_ { -1 }; 3446 bool numLock_ { false }; 3447 bool capsLock_ { false }; 3448 bool scrollLock_ { false }; 3449 bool repeat_ { false }; 3450 #ifdef OHOS_BUILD_ENABLE_SECURITY_COMPONENT 3451 std::vector<uint8_t> enhanceData_; 3452 #endif // OHOS_BUILD_ENABLE_SECURITY_COMPONENT 3453 bool fourceMonitorFlag_ { false }; 3454 }; 3455 } // namespace MMI 3456 } // namespace OHOS 3457 #endif // KEY_EVENT_H 3458