• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 
16 #ifndef FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_PATTERN_GRID_GRID_SCROLL_GRID_SCROLL_WITH_OPTIONS_LAYOUT_ALGORITHM_H
17 #define FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_PATTERN_GRID_GRID_SCROLL_GRID_SCROLL_WITH_OPTIONS_LAYOUT_ALGORITHM_H
18 
19 #include "core/components_ng/pattern/grid/grid_scroll/grid_scroll_layout_algorithm.h"
20 
21 namespace OHOS::Ace::NG {
22 class ACE_EXPORT GridScrollWithOptionsLayoutAlgorithm : public GridScrollLayoutAlgorithm {
23     DECLARE_ACE_TYPE(GridScrollWithOptionsLayoutAlgorithm, GridScrollLayoutAlgorithm);
24 
25 public:
GridScrollWithOptionsLayoutAlgorithm(GridLayoutInfo gridLayoutInfo,uint32_t crossCount,uint32_t mainCount)26     GridScrollWithOptionsLayoutAlgorithm(GridLayoutInfo gridLayoutInfo, uint32_t crossCount, uint32_t mainCount)
27         : GridScrollLayoutAlgorithm(gridLayoutInfo, crossCount, mainCount) {};
28     ~GridScrollWithOptionsLayoutAlgorithm() override = default;
29 
30 private:
31     void SkipLargeOffset(float mainSize, LayoutWrapper* layoutWrapper) override;
32 
33     void LargeItemLineHeight(const RefPtr<LayoutWrapper>& itemWrapper, bool& hasNormalItem) override;
34 
35     void GetTargetIndexInfoWithBenchMark(
36         LayoutWrapper* layoutWrapper, bool isTargetBackward, int32_t targetIndex) override;
37 
38     void AdjustRowColSpan(
39         const RefPtr<LayoutWrapper>& itemLayoutWrapper, LayoutWrapper* layoutWrapper, int32_t itemIndex) override;
40 
41     std::pair<int32_t, int32_t> GetCrossStartAndSpan(LayoutWrapper* layoutWrapper, int32_t itemIndex);
42 
43     std::pair<int32_t, int32_t> GetCrossStartAndSpanWithUserFunction(
44         int32_t itemIndex, const GridLayoutOptions& options, int32_t firstIrregularIndex);
45 
46     ACE_DISALLOW_COPY_AND_MOVE(GridScrollWithOptionsLayoutAlgorithm);
47 };
48 } // namespace OHOS::Ace::NG
49 #endif // FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_PATTERN_GRID_GRID_SCROLL_GRID_SCROLL_WITH_OPTIONS_LAYOUT_ALGORITHM_H
50