1 /* 2 * Copyright (c) 2022-2025 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 "core/pipeline_ng/pipeline_context.h" 24 #include "frameworks/base/geometry/size.h" 25 #include "frameworks/core/pipeline/pipeline_context.h" 26 27 namespace OHOS::Ace::V2 { 28 29 class GridContainerUtils : public AceType { 30 DECLARE_ACE_TYPE(GridContainerUtils, AceType); 31 32 public: 33 ~GridContainerUtils() override = default; 34 35 static int CalcBreakPoint(const RefPtr<GridSizeInfo>& threshold, double windowWidth); 36 static WidthBreakpoint GetWidthBreakpoint( 37 const WidthLayoutBreakPoint &custlayoutBreakpoints, const RefPtr<PipelineBase> &pipeline, bool userDefine); 38 static GridSizeType ProcessGridSizeType(const V2::BreakPoints& breakpoints, const Size& size, 39 const WindowMode& mode, const RefPtr<PipelineBase>& pipeline = nullptr); 40 static GridSizeType ProcessGridSizeType( 41 const RefPtr<BreakPoints>& breakpoints, const Size& size, const RefPtr<PipelineContext>& pipeline); 42 static std::pair<Dimension, Dimension> ProcessGutter(GridSizeType sizeType, const RefPtr<Gutter>& gutter); 43 static std::pair<Dimension, Dimension> ProcessGutter(GridSizeType sizeType, const Gutter& gutter); 44 45 static int32_t ProcessColumn(GridSizeType sizeType, const GridContainerSize& columnNum); 46 static int32_t ProcessColumn(GridSizeType sizeType, const RefPtr<GridContainerSize>& columnNum); 47 static double ProcessColumnWidth(const std::pair<double, double>& gutter, int32_t columnNum, double size); 48 static void InheritGridRowColumns(const RefPtr<V2::GridContainerSize>& gridContainerSize, 49 int32_t *containerSizeArray, int32_t size); 50 }; 51 } // namespace OHOS::Ace::V2 52 #endif // FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_V2_GRID_LAYOUT_GRID_COL_UTILS_H