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_LIST_LIST_ITEM_GROUP_MODEL_NG_H 17 #define FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_PATTERN_LIST_LIST_ITEM_GROUP_MODEL_NG_H 18 19 #include <functional> 20 #include <memory> 21 22 #include "base/geometry/axis.h" 23 #include "base/geometry/dimension.h" 24 #include "core/components/common/layout/constants.h" 25 #include "core/components_ng/pattern/list/list_item_group_model.h" 26 #include "core/components_v2/list/list_properties.h" 27 28 namespace OHOS::Ace::NG { 29 30 class ACE_EXPORT ListItemGroupModelNG : public ListItemGroupModel { 31 public: 32 void Create(V2::ListItemGroupStyle listItemGroupStyle) override; 33 void SetSpace(const Dimension& space) override; 34 void SetDivider(const V2::ItemDivider& divider) override; 35 void SetHeader(std::function<void()>&& header) override; 36 void SetFooter(std::function<void()>&& footer) override; 37 RefPtr<ListChildrenMainSize> GetOrCreateListChildrenMainSize() override; 38 void SetHeaderComponent(const RefPtr<NG::UINode>& headerComponent) override; 39 void SetFooterComponent(const RefPtr<NG::UINode>& footerComponent) override; 40 void RemoveHeader() override; 41 void RemoveFooter() override; 42 43 static void SetDivider(FrameNode* frameNode, const V2::ItemDivider& divider); 44 static RefPtr<FrameNode> CreateFrameNode(int32_t nodeId); 45 static void SetHeader(FrameNode* frameNode, FrameNode* headerNode); 46 static void SetFooter(FrameNode* frameNode, FrameNode* footerNode); 47 static void SetListChildrenMainSize( 48 FrameNode* frameNode, float defaultSize, const std::vector<float>& mainSize); 49 static void ResetListChildrenMainSize(FrameNode* frameNode); 50 static V2::ItemDivider GetDivider(FrameNode* frameNode); 51 static void SetSpace(FrameNode* frameNode, const Dimension& space); 52 static void SetStyle(FrameNode* frameNode, V2::ListItemGroupStyle style); 53 }; 54 55 } // namespace OHOS::Ace::NG 56 #endif // FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_PATTERN_LIST_LIST_ITEM_MODEL_H 57