1 /* 2 * Copyright (c) 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 JS_TOUCH_EVENT 17 #define JS_TOUCH_EVENT 18 19 #include "napi/native_node_api.h" 20 #include "nocopyable.h" 21 22 namespace OHOS { 23 namespace MMI { 24 class JsTouchEvent final { 25 public: 26 enum class Action : int32_t { 27 CANCEL = 0, 28 DOWN = 1, 29 MOVE = 2, 30 UP = 3, 31 PULL_DOWN = 4, 32 PULL_MOVE = 5, 33 PULL_UP = 6, 34 }; 35 36 enum class ToolType : int32_t { 37 FINGER = 0, 38 PEN = 1, 39 RUBBER = 2, 40 BRUSH = 3, 41 PENCIL = 4, 42 AIRBRUSH = 5, 43 MOUSE = 6, 44 LENS = 7, 45 }; 46 47 enum class SourceType : int32_t { 48 TOUCH_SCREEN = 0, 49 PEN = 1, 50 TOUCH_PAD = 2, 51 }; 52 53 enum class FixedMode : int32_t { 54 NONE = 0, 55 AUTO = 1, 56 }; 57 JsTouchEvent() = default; 58 ~JsTouchEvent() = default; 59 DISALLOW_COPY_AND_MOVE(JsTouchEvent); 60 static napi_value Export(napi_env env, napi_value exports); 61 private: 62 static napi_value GetNapiInt32(napi_env env, int32_t code); 63 static napi_value EnumClassConstructor(napi_env env, napi_callback_info info); 64 }; 65 } // namespace MMI 66 } // namespace OHOS 67 #endif // JS_TOUCH_EVENT