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 FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_EVENT_GESTURE_EVENT_ACTUATOR_H 17 #define FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_EVENT_GESTURE_EVENT_ACTUATOR_H 18 19 #include "base/geometry/ng/offset_t.h" 20 #include "base/memory/ace_type.h" 21 #include "base/memory/referenced.h" 22 #include "core/accessibility/accessibility_utils.h" 23 #include "core/event/touch_event.h" 24 25 namespace OHOS::Ace::NG { 26 27 using OnAccessibilityEventFunc = std::function<void(AccessibilityEventType)>; 28 29 class GestureEventActuator : public virtual AceType { 30 DECLARE_ACE_TYPE(GestureEventActuator, AceType) 31 public: 32 GestureEventActuator() = default; 33 ~GestureEventActuator() override = default; 34 OnCollectTouchTarget(const OffsetF & coordinateOffset,const TouchRestrict & touchRestrict,const GetEventTargetImpl & getEventTargetImpl,TouchTestResult & result,ResponseLinkResult & responseLinkResult)35 virtual void OnCollectTouchTarget(const OffsetF& coordinateOffset, const TouchRestrict& touchRestrict, 36 const GetEventTargetImpl& getEventTargetImpl, TouchTestResult& result, ResponseLinkResult& responseLinkResult) 37 {} 38 SetOnAccessibility(OnAccessibilityEventFunc onAccessibilityEvent)39 void SetOnAccessibility(OnAccessibilityEventFunc onAccessibilityEvent) 40 { 41 onAccessibilityEventFunc_ = std::move(onAccessibilityEvent); 42 } 43 AddTouchListener(const TouchRestrict & touchRestrict)44 virtual void AddTouchListener(const TouchRestrict& touchRestrict) 45 {} 46 47 protected: 48 OnAccessibilityEventFunc onAccessibilityEventFunc_ = nullptr; 49 }; 50 51 } // namespace OHOS::Ace::NG 52 53 #endif // FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_EVENT_GESTURE_EVENT_ACTUATOR_H