1 /* 2 * Copyright (c) 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_NG_PATTERN_SHEET_SIDE_SHEET_PRESENTATION_SIDE_LAYOUT_ALGORITHM_H 17 #define FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_PATTERN_SHEET_SIDE_SHEET_PRESENTATION_SIDE_LAYOUT_ALGORITHM_H 18 19 #include <cstdint> 20 #include <functional> 21 #include <optional> 22 #include <unordered_map> 23 24 #include "base/geometry/axis.h" 25 #include "base/geometry/dimension.h" 26 #include "base/geometry/ng/size_t.h" 27 #include "base/memory/referenced.h" 28 #include "core/components/common/properties/placement.h" 29 #include "core/components_ng/layout/layout_algorithm.h" 30 #include "core/components_ng/layout/layout_wrapper.h" 31 #include "core/components_ng/pattern/linear_layout/linear_layout_algorithm.h" 32 #include "core/components_ng/pattern/overlay/sheet_presentation_property.h" 33 #include "core/components_ng/pattern/overlay/sheet_style.h" 34 35 namespace OHOS::Ace::NG { 36 37 class SheetPresentationPattern; 38 39 class ACE_EXPORT SheetPresentationSideLayoutAlgorithm : public LinearLayoutAlgorithm { 40 DECLARE_ACE_TYPE(SheetPresentationSideLayoutAlgorithm, LayoutAlgorithm); 41 42 public: 43 SheetPresentationSideLayoutAlgorithm() = default; 44 ~SheetPresentationSideLayoutAlgorithm() override = default; 45 46 void Measure(LayoutWrapper* layoutWrapper) override; 47 void MeasureOperation(LayoutWrapper* layoutWrapper, LayoutConstraintF constraint); 48 void MeasureCloseIcon(LayoutWrapper* layoutWrapper, LayoutConstraintF constraint); 49 void MeasureScrollNode(LayoutWrapper* layoutWrapper, LayoutConstraintF constraint); 50 void Layout(LayoutWrapper* layoutWrapper) override; 51 52 void LayoutTitleBuilder(LayoutWrapper* layoutWrapper); 53 void LayoutScrollNode(LayoutWrapper* layoutWrapper); 54 void LayoutCloseIcon(LayoutWrapper* layoutWrapper); 55 float GetSheetDefaultWidth(const RefPtr<SheetPresentationPattern>& sheetPattern); 56 GetSideSheetMaxHeight()57 float GetSideSheetMaxHeight() const 58 { 59 return sheetMaxHeight_; 60 } GetSideSheetMaxWidth()61 float GetSideSheetMaxWidth() const 62 { 63 return sheetMaxWidth_; 64 } GetSideSheetWidth()65 float GetSideSheetWidth() const 66 { 67 return sheetWidth_; 68 } 69 GetSheetHeight()70 float GetSheetHeight() const 71 { 72 return sheetHeight_; 73 } 74 75 private: 76 float sheetHeight_ = 0.0f; 77 float sheetWidth_ = 0.0f; 78 float sheetMaxHeight_ = 0.0f; 79 float sheetMaxWidth_ = 0.0f; 80 }; 81 } // namespace OHOS::Ace::NG 82 #endif // FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_PATTERN_SHEET_SIDE_SHEET_PRESENTATION_SIDE_LAYOUT_ALGORITHM_H