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 * Self and child respond to the hit test for touch events, 63 * when self consumed allow hit test of other nodes which is masked by this node, 64 * when child consumed block hit test of other nodes. 65 */ 66 HTMTRANSPARENT_SELF, 67 }; 68 69 enum class TouchTestStrategy { DEFAULT = 0, FORWARD_COMPETITION, FORWARD }; 70 71 enum class HitTestResult { 72 // The touch point is located outside the current component area; 73 OUT_OF_REGION, 74 // node consumption events and prevent bubbling; 75 STOP_BUBBLING, 76 // node process events and bubble; 77 BUBBLING, 78 // node process events and bubble; 79 SELF_TRANSPARENT, 80 }; 81 82 enum class DragFuncType { 83 DRAG_ENTER, 84 DRAG_LEAVE, 85 DRAG_MOVE, 86 DRAG_DROP, 87 DRAG_END, 88 }; 89 90 enum class EventTreeType { 91 TOUCH = 0, 92 POST_EVENT, 93 }; 94 95 enum class AxisModel { 96 ABS_X = 0, 97 ABS_Y, 98 ABS_Z, 99 ABS_RZ, 100 ABS_GAS, 101 ABS_BRAKE, 102 ABS_HAT0X, 103 ABS_HAT0Y, 104 }; 105 106 enum class GestureCallbackType { 107 START = 0, 108 UPDATE, 109 END, 110 CANCEL, 111 }; 112 113 } // namespace OHOS::Ace::NG 114 115 namespace OHOS::Ace { 116 117 static const int32_t TOUCH_TOOL_BASE_ID = 100; 118 119 enum class TouchType : size_t { 120 DOWN = 0, 121 UP, 122 MOVE, 123 CANCEL, 124 PULL_DOWN, 125 PULL_UP, 126 PULL_MOVE, 127 PULL_IN_WINDOW, 128 PULL_OUT_WINDOW, 129 HOVER_ENTER, 130 HOVER_MOVE, 131 HOVER_EXIT, 132 HOVER_CANCEL, 133 PROXIMITY_IN, 134 PROXIMITY_OUT, 135 UNKNOWN, 136 }; 137 138 enum class UIInputEventType { 139 NONE = 0, 140 TOUCH, 141 AXIS, 142 KEY, 143 FOCUS_AXIS, 144 CROWN, 145 }; 146 147 enum class KeyIntention : int32_t { 148 INTENTION_UNKNOWN = -1, 149 INTENTION_UP = 1, 150 INTENTION_DOWN = 2, 151 INTENTION_LEFT = 3, 152 INTENTION_RIGHT = 4, 153 INTENTION_SELECT = 5, 154 INTENTION_ESCAPE = 6, 155 INTENTION_BACK = 7, 156 INTENTION_FORWARD = 8, 157 INTENTION_MENU = 9, 158 INTENTION_HOME = 10, 159 INTENTION_PAGE_UP = 11, 160 INTENTION_PAGE_DOWN = 12, 161 INTENTION_ZOOM_OUT = 13, 162 INTENTION_ZOOM_IN = 14, 163 164 INTENTION_MEDIA_PLAY_PAUSE = 100, 165 INTENTION_MEDIA_FAST_FORWARD = 101, 166 INTENTION_MEDIA_FAST_REWIND = 102, 167 INTENTION_MEDIA_FAST_PLAYBACK = 103, 168 INTENTION_MEDIA_NEXT = 104, 169 INTENTION_MEDIA_PREVIOUS = 105, 170 INTENTION_MEDIA_MUTE = 106, 171 INTENTION_VOLUTE_UP = 107, 172 INTENTION_VOLUTE_DOWN = 108, 173 174 INTENTION_CALL = 200, 175 INTENTION_ENDCALL = 201, 176 INTENTION_REJECTCALL = 202, 177 178 INTENTION_CAMERA = 300, 179 }; 180 181 constexpr double MOUSE_WHEEL_DEGREES = 15.0; 182 constexpr double DP_PER_LINE_DESKTOP = 40.0; 183 constexpr Dimension LINE_HEIGHT_DESKTOP = 21.0_vp; 184 constexpr int32_t LINE_NUMBER_DESKTOP = 3; 185 constexpr int32_t DP_PER_LINE_PHONE = 64; 186 constexpr int32_t LINE_NUMBER_PHONE = 1; 187 188 enum class AxisDirection : int32_t { 189 NONE = 0, 190 UP = 1, 191 DOWN = 2, 192 LEFT = 4, 193 RIGHT = 8, 194 UP_LEFT = 5, 195 UP_RIGHT = 9, 196 DOWN_LEFT = 6, 197 DOWN_RIGHT = 10, 198 }; 199 200 enum class AxisAction : int32_t { 201 NONE = 0, 202 BEGIN, 203 UPDATE, 204 END, 205 CANCEL, 206 }; 207 } // namespace OHOS::Ace 208 209 #endif // FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_EVENT_EVENT_CONSTANTS_H 210