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 FRAMEWORKS_BRIDGE_DECLARATIVE_FRONTEND_JS_VIEW_JS_INTERACTABLE_VIEW_H 17 #define FRAMEWORKS_BRIDGE_DECLARATIVE_FRONTEND_JS_VIEW_JS_INTERACTABLE_VIEW_H 18 19 #include "frameworks/bridge/declarative_frontend/jsview/js_pan_handler.h" 20 #include "frameworks/bridge/declarative_frontend/jsview/js_touch_handler.h" 21 #include "frameworks/bridge/declarative_frontend/jsview/js_view_abstract.h" 22 #include "frameworks/core/components_ng/gestures/tap_gesture.h" 23 #include "frameworks/core/gestures/tap_gesture.h" 24 #include "frameworks/core/pipeline/base/component.h" 25 26 namespace OHOS::Ace::Framework { 27 28 using RemoteCallback = std::function<void(const BaseEventInfo* info)>; 29 30 class JSInteractableView { 31 public: 32 static void JsOnTouch(const JSCallbackInfo& args); 33 static void JsOnPan(const JSCallbackInfo& args); 34 static void JsOnClick(const JSCallbackInfo& info); 35 static void JsTouchable(const JSCallbackInfo& info); 36 static void JsOnHover(const JSCallbackInfo& info); 37 static void JsOnKey(const JSCallbackInfo& args); 38 static void SetFocusable(bool focusable); 39 static void SetFocusNode(bool isFocusNode); 40 41 static void JsOnAppear(const JSCallbackInfo& info); 42 static void JsOnDisAppear(const JSCallbackInfo& info); 43 44 static void JsOnDelete(const JSCallbackInfo& info); 45 static void JsOnAccessibility(const JSCallbackInfo& info); 46 static void JsCommonRemoteMessage(const JSCallbackInfo& info); 47 48 static std::function<void()> GetRemoteMessageEventCallback(const JSCallbackInfo& info); 49 50 protected: 51 static void JsRemoteMessage(const JSCallbackInfo& info, RemoteCallback& remoteCallback); 52 53 private: 54 static void SplitString(const std::string& str, char tag, std::vector<std::string>& strList); 55 }; // class JSInteractableView 56 57 } // namespace OHOS::Ace::Framework 58 #endif // FRAMEWORKS_BRIDGE_DECLARATIVE_FRONTEND_JS_VIEW_JS_INTERACTABLE_VIEW_H 59