1 /*
2  * Copyright (c) 2023 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 #ifndef FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_PATTERN_FOLDER_STACK_GROUP_NODE_H
16 #define FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_PATTERN_FOLDER_STACK_GROUP_NODE_H
17 
18 #include <cstdint>
19 #include <list>
20 #include <variant>
21 #include <vector>
22 
23 #include "base/memory/referenced.h"
24 #include "base/utils/macros.h"
25 #include "core/animation/page_transition_common.h"
26 #include "core/components_ng/base/frame_node.h"
27 #include "core/components_ng/base/group_node.h"
28 #include "core/components_ng/pattern/linear_layout/linear_layout_pattern.h"
29 #include "core/components_ng/property/property.h"
30 
31 namespace OHOS::Ace::NG {
32 class ACE_EXPORT FolderStackGroupNode : public GroupNode {
DECLARE_ACE_TYPE(FolderStackGroupNode,GroupNode)33     DECLARE_ACE_TYPE(FolderStackGroupNode, GroupNode)
34 public:
35     FolderStackGroupNode(const std::string& tag, int32_t nodeId, const RefPtr<Pattern>& pattern)
36         : GroupNode(tag, nodeId, pattern)
37     {}
38     ~FolderStackGroupNode() override = default;
39     static RefPtr<FolderStackGroupNode> GetOrCreateGroupNode(
40         const std::string& tag, int32_t nodeId, const std::function<RefPtr<Pattern>(void)>& patternCreator);
41     void AddChildToGroup(const RefPtr<UINode>& child, int32_t slot = DEFAULT_NODE_SLOT) override;
GetHoverNode()42     const RefPtr<UINode>& GetHoverNode() const
43     {
44         return hoverNode_;
45     }
46 
SetHoverNode(const RefPtr<UINode> & hoverNode)47     void SetHoverNode(const RefPtr<UINode>& hoverNode)
48     {
49         hoverNode_ = hoverNode;
50     }
GetControlPartsStackNode()51     const RefPtr<UINode>& GetControlPartsStackNode() const
52     {
53         return desktopNode_;
54     }
SetControlPartsStackNode(const RefPtr<UINode> & desktopNode)55     void SetControlPartsStackNode(const RefPtr<UINode>& desktopNode)
56     {
57         desktopNode_ = desktopNode;
58     }
GetItemId()59     const std::vector<std::string>& GetItemId() const
60     {
61         return itemId_;
62     }
SetItemId(const std::vector<std::string> & itemId)63     void SetItemId(const std::vector<std::string>& itemId)
64     {
65         itemId_ = itemId;
66         isChangeItemId_ = true;
67     }
68 
GetIsChangeItemId()69     bool GetIsChangeItemId()
70     {
71         return isChangeItemId_;
72     }
73 
SetIsChangeItemId(bool isChangeItemId)74     void SetIsChangeItemId(bool isChangeItemId)
75     {
76         isChangeItemId_ = isChangeItemId;
77     }
78 
GetChildNode()79     const std::vector<RefPtr<UINode>>& GetChildNode() const
80     {
81         return childNode_;
82     }
83 
84 private:
85     RefPtr<UINode> hoverNode_;
86     RefPtr<UINode> desktopNode_;
87     std::vector<std::string> itemId_;
88     std::vector<RefPtr<UINode>> childNode_;
89     bool isChangeItemId_ = false;
90 };
91 } // namespace OHOS::Ace::NG
92 #endif