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_PATTERN_FORM_FORM_NODE_H 17 #define FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_PATTERN_FORM_FORM_NODE_H 18 19 #include <optional> 20 21 #include "interfaces/inner_api/ace/serialized_gesture.h" 22 23 #include "core/accessibility/accessibility_manager.h" 24 #include "core/components_ng/base/frame_node.h" 25 26 namespace OHOS::Ace::NG { 27 28 class ACE_EXPORT FormNode : public FrameNode { 29 DECLARE_ACE_TYPE(FormNode, FrameNode); 30 31 public: 32 FormNode(const std::string& tag, int32_t nodeId, const RefPtr<Pattern>& pattern, bool isRoot = false) FrameNode(tag,nodeId,pattern,isRoot)33 : FrameNode(tag, nodeId, pattern, isRoot) 34 {} 35 ~FormNode() override; 36 37 HitTestResult TouchTest(const PointF& globalPoint, const PointF& parentLocalPoint, const PointF& parentRevertPoint, 38 TouchRestrict& touchRestrict, TouchTestResult& result, int32_t touchId, ResponseLinkResult& responseLinkResult, 39 bool isDispatch = false) override; 40 41 HitTestResult AxisTest(const PointF& globalPoint, const PointF& parentLocalPoint, const PointF& parentRevertPoint, 42 TouchRestrict& touchRestrict, AxisTestResult& axisResult) override; 43 44 static RefPtr<FormNode> GetOrCreateFormNode( 45 const std::string& tag, int32_t nodeId, const std::function<RefPtr<Pattern>(void)>& patternCreator); 46 47 void DispatchPointerEvent(const TouchEvent& touchEvent, 48 SerializedGesture& serializedGesture); 49 50 void DispatchPointerEvent(const AxisEvent& axisEvent, SerializedGesture& serializedGesture); 51 52 void OnDetachFromMainTree(bool, PipelineContext* = nullptr) override; 53 54 OffsetF GetFormOffset() const; 55 56 void InitializeFormAccessibility(); 57 58 void OnAccessibilityChildTreeRegister(uint32_t windowId, int32_t treeId); 59 60 void OnAccessibilityChildTreeDeregister(); 61 62 void OnSetAccessibilityChildTree(int32_t childWindowId, int32_t childTreeId); 63 64 void OnAccessibilityDumpChildInfo(const std::vector<std::string>& params, std::vector<std::string>& info); 65 66 void NotifyAccessibilityChildTreeRegister(); 67 68 int32_t GetImageId(); 69 70 void ClearAccessibilityChildTreeRegisterFlag(); 71 private: 72 std::optional<int32_t> imageId_; 73 std::shared_ptr<AccessibilityChildTreeCallback> accessibilityChildTreeCallback_; 74 }; 75 76 } // namespace OHOS::Ace::NG 77 #endif // FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_PATTERN_FORM_FORM_NODE_H 78