1 /* 2 * Copyright (c) 2024 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_COMPONENTS_NG_EVENT_EVENT_CONSTANTS_H 17 #define FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_EVENT_EVENT_CONSTANTS_H 18 19 #include <cstddef> 20 #include <cstdint> 21 22 #include "base/geometry/dimension.h" 23 enum class MenuPreviewMode { 24 NONE, 25 IMAGE, 26 CUSTOM, 27 }; 28 29 enum class MenuBindingType { 30 LONG_PRESS, 31 RIGHT_CLICK, 32 }; 33 34 namespace OHOS::Ace::NG { 35 36 enum class HitTestMode { 37 /** 38 * Both self and children respond to the hit test for touch events, 39 * but block hit test of the other nodes which is masked by this node. 40 */ 41 HTMDEFAULT = 0, 42 43 /** 44 * Self respond to the hit test for touch events, 45 * but block hit test of children and other nodes which is masked by this node. 46 */ 47 HTMBLOCK, 48 49 /** 50 * Self and child respond to the hit test for touch events, 51 * and allow hit test of other nodes which is masked by this node. 52 */ 53 HTMTRANSPARENT, 54 55 /** 56 * Self not respond to the hit test for touch events, 57 * but children respond to the hit test for touch events. 58 */ 59 HTMNONE, 60 61 /** 62 * Blocks all lower priority siblings and parents node from receiving the event. 63 */ 64 HTMBLOCK_HIERARCHY, 65 66 /** 67 * Self not respond to the hit test for touch events, 68 * and all descebdants (children, grandchildren, etc.) not respond to the hit test for touch events too. 69 */ 70 HTMBLOCK_DESCENDANTS, 71 72 /** 73 * Self and child respond to the hit test for touch events, 74 * when self consumed allow hit test of other nodes which is masked by this node, 75 * when child consumed block hit test of other nodes. 76 */ 77 HTMTRANSPARENT_SELF, 78 }; 79 80 enum class TouchTestStrategy { DEFAULT = 0, FORWARD_COMPETITION, FORWARD }; 81 82 enum class HitTestResult { 83 // The touch point is located outside the current component area; 84 OUT_OF_REGION, 85 // node consumption events and prevent bubbling; 86 STOP_BUBBLING, 87 // node process events and bubble; 88 BUBBLING, 89 // node process events and bubble; 90 SELF_TRANSPARENT, 91 // Blocks all lower priority siblings and parents node. 92 BLOCK_HIERARCHY, 93 }; 94 95 enum class DragFuncType { 96 DRAG_ENTER, 97 DRAG_LEAVE, 98 DRAG_MOVE, 99 DRAG_DROP, 100 DRAG_END, 101 }; 102 103 enum class EventTreeType { 104 TOUCH = 0, 105 POST_EVENT, 106 }; 107 108 enum class AxisModel { 109 ABS_X = 0, 110 ABS_Y, 111 ABS_Z, 112 ABS_RZ, 113 ABS_GAS, 114 ABS_BRAKE, 115 ABS_HAT0X, 116 ABS_HAT0Y, 117 }; 118 119 enum class GestureCallbackType { 120 START = 0, 121 UPDATE, 122 END, 123 CANCEL, 124 ACTION, 125 }; 126 127 } // namespace OHOS::Ace::NG 128 129 namespace OHOS::Ace { 130 131 static const int32_t TOUCH_TOOL_BASE_ID = 100; 132 133 enum class TouchType : size_t { 134 DOWN = 0, 135 UP, 136 MOVE, 137 CANCEL, 138 PULL_DOWN, 139 PULL_UP, 140 PULL_MOVE, 141 PULL_IN_WINDOW, 142 PULL_OUT_WINDOW, 143 HOVER_ENTER, 144 HOVER_MOVE, 145 HOVER_EXIT, 146 HOVER_CANCEL, 147 PROXIMITY_IN, 148 PROXIMITY_OUT, 149 UNKNOWN, 150 }; 151 152 enum class UIInputEventType { 153 NONE = 0, 154 TOUCH, 155 AXIS, 156 KEY, 157 FOCUS_AXIS, 158 CROWN, 159 }; 160 161 enum class KeyIntention : int32_t { 162 INTENTION_UNKNOWN = -1, 163 INTENTION_UP = 1, 164 INTENTION_DOWN = 2, 165 INTENTION_LEFT = 3, 166 INTENTION_RIGHT = 4, 167 INTENTION_SELECT = 5, 168 INTENTION_ESCAPE = 6, 169 INTENTION_BACK = 7, 170 INTENTION_FORWARD = 8, 171 INTENTION_MENU = 9, 172 INTENTION_HOME = 10, 173 INTENTION_PAGE_UP = 11, 174 INTENTION_PAGE_DOWN = 12, 175 INTENTION_ZOOM_OUT = 13, 176 INTENTION_ZOOM_IN = 14, 177 178 INTENTION_MEDIA_PLAY_PAUSE = 100, 179 INTENTION_MEDIA_FAST_FORWARD = 101, 180 INTENTION_MEDIA_FAST_REWIND = 102, 181 INTENTION_MEDIA_FAST_PLAYBACK = 103, 182 INTENTION_MEDIA_NEXT = 104, 183 INTENTION_MEDIA_PREVIOUS = 105, 184 INTENTION_MEDIA_MUTE = 106, 185 INTENTION_VOLUTE_UP = 107, 186 INTENTION_VOLUTE_DOWN = 108, 187 188 INTENTION_CALL = 200, 189 INTENTION_ENDCALL = 201, 190 INTENTION_REJECTCALL = 202, 191 192 INTENTION_CAMERA = 300, 193 }; 194 195 constexpr double MOUSE_WHEEL_DEGREES = 15.0; 196 constexpr double DP_PER_LINE_DESKTOP = 40.0; 197 constexpr Dimension LINE_HEIGHT_DESKTOP = 21.0_vp; 198 constexpr int32_t LINE_NUMBER_DESKTOP = 3; 199 constexpr int32_t DP_PER_LINE_PHONE = 64; 200 constexpr int32_t LINE_NUMBER_PHONE = 1; 201 202 enum class AxisDirection : int32_t { 203 NONE = 0, 204 UP = 1, 205 DOWN = 2, 206 LEFT = 4, 207 RIGHT = 8, 208 UP_LEFT = 5, 209 UP_RIGHT = 9, 210 DOWN_LEFT = 6, 211 DOWN_RIGHT = 10, 212 }; 213 214 enum class AxisAction : int32_t { 215 NONE = 0, 216 BEGIN, 217 UPDATE, 218 END, 219 CANCEL, 220 }; 221 } // namespace OHOS::Ace 222 223 #endif // FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_EVENT_EVENT_CONSTANTS_H 224