• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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_INTERFACES_INNER_API_ACE_KIT_SRC_VIEW_FRAME_NODE_IMPL_H
17 #define FOUNDATION_ACE_INTERFACES_INNER_API_ACE_KIT_SRC_VIEW_FRAME_NODE_IMPL_H
18 
19 #include "interfaces/inner_api/ace_kit/include/ui/view/frame_node.h"
20 
21 #include "core/components_ng/base/frame_node.h"
22 #include "core/components_ng/layout/layout_wrapper.h"
23 
24 namespace OHOS::Ace::Kit {
25 using AceNode = NG::FrameNode;
26 
27 class FrameNodeImpl : public FrameNode {
28     DECLARE_ACE_TYPE(FrameNodeImpl, FrameNode);
29 
30 public:
31     FrameNodeImpl(const RefPtr<AceNode>& node, const RefPtr<Pattern>& pattern);
32     explicit FrameNodeImpl(const RefPtr<AceNode>& node);
33     ~FrameNodeImpl();
34 
35     void Reset() override;
36 
37     void Measure(const Kit::LayoutConstraintInfo& parentContraint) override;
38     void Layout() override;
39 
40     void InitializePatternAndContext() override;
41 
42     RefPtr<NG::LayoutProperty> GetLayoutProperty() override;
43     RefPtr<Pattern> GetPattern() override;
44     void PushAceNode(const RefPtr<AceNode>& node);
45     RefPtr<AceNode> PopAceNode();
46     RefPtr<AceNode> GetAceNode() const;
47     NG::LayoutWrapper* GetLayoutWrapper();
48     RefPtr<UIContext> GetUIContext() const override;
49     AceNode* GetAceNodePtr();
50     RefPtr<Property> GetProperty() override;
51 
52     void AddChild(const RefPtr<FrameNode>& child) override;
53     std::list<RefPtr<FrameNode>> GetChildren() override;
54     void MarkDirtyNode(NG::PropertyChangeFlag flag) override;
55     void RemoveChild(const RefPtr<FrameNode>& child) override;
56 
57     std::string GetTag() const override;
58     int32_t GetId() const override;
59 
60     void MeasureChildren() override;
61     void LayoutChildren() override;
62     NodeHandle GetHandle() override;
63 
64 private:
65     AceNode* frameNode_;
66     RefPtr<AceNode> nodeRef_;
67     RefPtr<Pattern> pattern_;
68     RefPtr<Property> property_;
69 };
70 } // namespace OHOS::Ace::Kit
71 
72 #endif // FOUNDATION_ACE_INTERFACES_INNER_API_ACE_KIT_SRC_VIEW_FRAME_NODE_IMPL_H
73