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_V2_LIST_LIST_ITEM_GROUP_COMPONENT_H 17 #define FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_V2_LIST_LIST_ITEM_GROUP_COMPONENT_H 18 19 #include <string> 20 21 #include "base/utils/macros.h" 22 #include "base/utils/noncopyable.h" 23 #include "core/components_v2/common/common_def.h" 24 #include "core/components_v2/list/list_properties.h" 25 #include "core/pipeline/base/component_group.h" 26 27 namespace OHOS::Ace::V2 { 28 29 class ACE_EXPORT ListItemGroupComponent : public ComponentGroup { 30 DECLARE_ACE_TYPE(V2::ListItemGroupComponent, ComponentGroup); 31 32 public: 33 ListItemGroupComponent() = default; 34 ~ListItemGroupComponent() override = default; 35 36 RefPtr<Element> CreateElement() override; 37 RefPtr<RenderNode> CreateRenderNode() override; 38 uint32_t Compare(const RefPtr<Component>& component) const override; 39 40 ACE_DEFINE_COMPONENT_PROP(Space, Dimension, 0.0_vp); 41 GetItemDivider()42 const std::unique_ptr<ItemDivider>& GetItemDivider() const 43 { 44 return itemDivider_; 45 } SetItemDivider(std::unique_ptr<ItemDivider> && divider)46 void SetItemDivider(std::unique_ptr<ItemDivider>&& divider) 47 { 48 itemDivider_ = std::move(divider); 49 } 50 SetHeaderComponent(RefPtr<Component> component)51 void SetHeaderComponent(RefPtr<Component> component) 52 { 53 headerComponent_ = component; 54 } SetFooterComponent(RefPtr<Component> component)55 void SetFooterComponent(RefPtr<Component> component) 56 { 57 footerComponent_ = component; 58 } GetHeaderComponent()59 RefPtr<Component> GetHeaderComponent() const 60 { 61 return headerComponent_; 62 } GetFooterComponent()63 RefPtr<Component> GetFooterComponent() const 64 { 65 return footerComponent_; 66 } 67 68 private: 69 std::unique_ptr<ItemDivider> itemDivider_; 70 RefPtr<Component> headerComponent_; 71 RefPtr<Component> footerComponent_; 72 ACE_DISALLOW_COPY_AND_MOVE(ListItemGroupComponent); 73 }; 74 } // namespace OHOS::Ace::V2 75 76 #endif // FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_V2_LIST_LIST_ITEM_GROUP_COMPONENT_H 77