1 /* 2 * Copyright (c) 2021 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 FOUNDATION_ACE_FRAMEWORKS_CORE_ACCESSIBILITY_ACCESSIBILITY_UTILS_H 17 #define FOUNDATION_ACE_FRAMEWORKS_CORE_ACCESSIBILITY_ACCESSIBILITY_UTILS_H 18 19 #include <cstddef> 20 #include <cstdint> 21 22 namespace OHOS::Ace { 23 24 // define accessibility node tags 25 extern const char ACCESSIBILITY_TAG_DIV[]; 26 extern const char ACCESSIBILITY_TAG_CALENDAR[]; 27 extern const char ACCESSIBILITY_TAG_TEXT[]; 28 extern const char ACCESSIBILITY_TAG_PICKER[]; 29 extern const char ACCESSIBILITY_TAG_OPTION[]; 30 extern const char ACCESSIBILITY_TAG_POPUP[]; 31 extern const char ACCESSIBILITY_TAG_PROGRESS[]; 32 extern const char ACCESSIBILITY_TAG_SELECT[]; 33 extern const char ACCESSIBILITY_TAG_MENU[]; 34 extern const char ACCESSIBILITY_TAG_SLIDER[]; 35 extern const char ACCESSIBILITY_TAG_SPAN[]; 36 extern const char ACCESSIBILITY_TAG_STACK[]; 37 extern const char ACCESSIBILITY_TAG_SWIPER[]; 38 extern const char ACCESSIBILITY_TAG_SWITCH[]; 39 extern const char ACCESSIBILITY_TAG_TABS[]; 40 extern const char ACCESSIBILITY_TAG_TAB_BAR[]; 41 extern const char ACCESSIBILITY_TAG_TAB_CONTENT[]; 42 extern const char ACCESSIBILITY_TAG_REFRESH[]; 43 extern const char ACCESSIBILITY_TAG_IMAGE[]; 44 extern const char ACCESSIBILITY_TAG_LIST[]; 45 extern const char ACCESSIBILITY_TAG_LIST_ITEM[]; 46 extern const char ACCESSIBILITY_TAG_LIST_ITEM_GROUP[]; 47 extern const char ACCESSIBILITY_TAG_VIDEO[]; 48 extern const char ACCESSIBILITY_TAG_RATING[]; 49 extern const char ACCESSIBILITY_TAG_MARQUEE[]; 50 extern const char ACCESSIBILITY_TAG_NAVIGATION_BAR[]; 51 extern const char ACCESSIBILITY_TAG_NAVIGATION_MENU[]; 52 extern const char ACCESSIBILITY_TAG_TEXTAREA[]; 53 extern const char ACCESSIBILITY_TAG_INPUT[]; 54 extern const char ACCESSIBILITY_TAG_LABEL[]; 55 extern const char ACCESSIBILITY_TAG_DIVIDER[]; 56 extern const char ACCESSIBILITY_TAG_CANVAS[]; 57 extern const char ACCESSIBILITY_TAG_BUTTON[]; 58 extern const char ACCESSIBILITY_TAG_CHART[]; 59 extern const char ACCESSIBILITY_TAG_CLOCK[]; 60 extern const char ACCESSIBILITY_TAG_DIALOG[]; 61 extern const char ACCESSIBILITY_TAG_SEARCH[]; 62 63 enum class AccessibilityEventType: size_t { 64 CLICK = 0x00000001, 65 LONG_PRESS = 0x00000002, 66 SELECTED = 0x00000004, 67 BLUR = 0x00000007, 68 FOCUS = 0x00000008, 69 TEXT_CHANGE = 0x00000010, 70 EJECT_DISMISS = 0x00000020, 71 MOUSE = 149, 72 KEYBOARD_BACK = 150, 73 KEYBOARD_UP = 151, 74 KEYBOARD_DOWN = 152, 75 KEYBOARD_LEFT = 153, 76 KEYBOARD_RIGHT = 154, 77 KEYBOARD_CENTER = 155, 78 HANDLE_A = 156, 79 HANDLE_SELECT = 157, 80 KEYBOARD_TAB = 158, 81 KEYBOARD_SPACE = 159, 82 KEYBOARD_ENTER = 160, 83 KEYBOARD_ESCAPE = 161, 84 KEYBOARD_NUMBER_ENTER = 162, 85 TV_CONTROL_MEDIA_PLAY = 163, 86 PAGE_CHANGE = 200, 87 TOUCH_START = 0x00000200, 88 TOUCH_MOVE = 0x00000201, 89 TOUCH_CANCEL = 0x00000202, 90 TOUCH_END = 0x00000400, 91 CHANGE = 0x00000800, 92 SCROLL_END = 0x00001000, 93 SCROLL_START = 0x01000000, 94 UNKNOWN, 95 }; 96 97 struct OperableInfo { 98 bool checkable = false; 99 bool clickable = false; 100 bool scrollable = false; 101 bool longClickable = false; 102 bool focusable = false; 103 }; 104 105 enum class AceAction : uint32_t { 106 ACTION_NONE = 0, 107 GLOBAL_ACTION_BACK, 108 CUSTOM_ACTION, 109 ACTION_CLICK = 10, 110 ACTION_LONG_CLICK, 111 ACTION_SCROLL_FORWARD, 112 ACTION_SCROLL_BACKWARD, 113 ACTION_FOCUS, 114 ACTION_ACCESSIBILITY_FOCUS, 115 ACTION_CLEAR_ACCESSIBILITY_FOCUS, 116 ACTION_NEXT_AT_MOVEMENT_GRANULARITY, 117 ACTION_PREVIOUS_AT_MOVEMENT_GRANULARITY 118 }; 119 120 struct AccessibilityValue { 121 double min = 0.0; 122 double max = 0.0; 123 double current = 0.0; 124 }; 125 126 enum class AceTextCategory { 127 INPUT_TYPE_DEFAULT = 0, 128 INPUT_TYPE_TEXT, 129 INPUT_TYPE_EMAIL, 130 INPUT_TYPE_DATE, 131 INPUT_TYPE_TIME, 132 INPUT_TYPE_NUMBER, 133 INPUT_TYPE_PASSWORD 134 }; 135 136 struct AceCollectionInfo { 137 int32_t rows = 0; 138 int32_t columns = 0; 139 }; 140 141 struct AceCollectionItemInfo { 142 int32_t row = 0; 143 int32_t column = 0; 144 }; 145 146 } // namespace OHOS::Ace 147 148 #endif // FOUNDATION_ACE_FRAMEWORKS_CORE_ACCESSIBILITY_ACCESSIBILITY_UTILS_H 149