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