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