• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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_GRID_LAYOUT_GRID_COL_UTILS_H
17 #define FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_V2_GRID_LAYOUT_GRID_COL_UTILS_H
18 
19 #include <utility>
20 
21 #include "base/memory/ace_type.h"
22 #include "core/components_v2/grid_layout/grid_container_util_class.h"
23 #include "frameworks/base/geometry/size.h"
24 #include "frameworks/core/pipeline/pipeline_context.h"
25 
26 namespace OHOS::Ace::V2 {
27 
28 class GridContainerUtils : public AceType {
29     DECLARE_ACE_TYPE(GridContainerUtils, AceType);
30 
31 public:
32     ~GridContainerUtils() override = default;
33 
34     static GridSizeType ProcessGridSizeType(const V2::BreakPoints& breakpoints, const Size& size);
35     static GridSizeType ProcessGridSizeType(
36         const RefPtr<BreakPoints>& breakpoints, const Size& size, const RefPtr<PipelineContext>& pipeline);
37     static std::pair<Dimension, Dimension> ProcessGutter(GridSizeType sizeType, const RefPtr<Gutter>& gutter);
38     static std::pair<Dimension, Dimension> ProcessGutter(GridSizeType sizeType, const Gutter& gutter);
39 
40     static int32_t ProcessColumn(GridSizeType sizeType, const GridContainerSize& columnNum);
41     static int32_t ProcessColumn(GridSizeType sizeType, const RefPtr<GridContainerSize>& columnNum);
42     static double ProcessColumnWidth(const std::pair<double, double>& gutter, int32_t columnNum, double size);
43 };
44 } // namespace OHOS::Ace::V2
45 #endif // FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_V2_GRID_LAYOUT_GRID_COL_UTILS_H