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_WATER_FLOW_WATER_FLOW_ELEMENT_H
17 #define FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_V2_WATER_FLOW_WATER_FLOW_ELEMENT_H
18 
19 #include "core/components_v2/common/element_proxy.h"
20 #include "core/components_v2/water_flow/water_flow_item_generator.h"
21 #include "core/pipeline/base/render_element.h"
22 
23 namespace OHOS::Ace::V2 {
24 
25 class WaterFlowElement : public RenderElement,
26                          public FlushEvent,
27                          private WaterFlowItemGenerator,
28                          private V2::ElementProxyHost {
29     DECLARE_ACE_TYPE(WaterFlowElement, RenderElement);
30 
31 public:
32     void Update() override;
33     void PerformBuild() override;
34 
35     size_t TotalCount();
36     bool BuildChildByIndex(size_t index);
37     void DeleteChildByIndex(size_t index);
38     void OnPostFlush() override;
39     void Dump() override;
40     RefPtr<RenderNode> RequestWaterFlowFooter() override;
41 
42 private:
43     RefPtr<RenderNode> CreateRenderNode() override;
44     void ApplyRenderChild(const RefPtr<RenderElement>& renderChild) override;
45 
46     RefPtr<Element> OnUpdateElement(const RefPtr<Element>& element, const RefPtr<Component>& component) override;
47     RefPtr<Component> OnMakeEmptyComponent() override;
48     void OnDataSourceUpdated(size_t startIndex) override;
49     RefPtr<Element> footerElement_;
50 };
51 } // namespace OHOS::Ace::V2
52 #endif // FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_V2_WATER_FLOW_WATER_FLOW_ELEMENT_H
53