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_NG_PATTERN_FLEX_FLEX_MODEL_NG_H 17 #define FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_PATTERN_FLEX_FLEX_MODEL_NG_H 18 19 #include "core/components_ng/pattern/flex/flex_model.h" 20 #include "core/components_ng/base/frame_node.h" 21 22 namespace OHOS::Ace::NG { 23 24 class ACE_EXPORT FlexModelNG : public FlexModel { 25 public: 26 void CreateFlexRow() override; 27 28 void CreateWrap() override; 29 30 void SetDirection(FlexDirection direction) override; 31 void SetWrapDirection(WrapDirection direction) override; 32 33 void SetMainAxisAlign(FlexAlign align) override; 34 void SetWrapMainAlignment(WrapAlignment value) override; 35 36 void SetCrossAxisAlign(FlexAlign align) override; 37 void SetWrapCrossAlignment(WrapAlignment value) override; 38 39 void SetAlignItems(int32_t value) override; 40 void SetWrapAlignment(WrapAlignment value) override; 41 void SetMainSpace(const std::optional<Dimension>& space) override; 42 void SetCrossSpace(const std::optional<Dimension>& space) override; 43 SetHasHeight()44 void SetHasHeight() override {}; SetHasWidth()45 void SetHasWidth() override {}; SetFlexWidth()46 void SetFlexWidth() override {}; SetFlexHeight()47 void SetFlexHeight() override {}; 48 49 void SetJustifyContent(int32_t value) override; 50 51 void SetAlignContent(int32_t value) override; 52 53 static RefPtr<FrameNode> CreateFrameNode(int32_t nodeId); 54 static void SetFlexRow(FrameNode* frameNode); 55 static void SetFlexWrap(FrameNode* frameNode); 56 static void SetFlexDirection(FrameNode* frameNode, FlexDirection value); 57 static void SetFlexWrapDirection(FrameNode* frameNode, WrapDirection value); 58 static void SetFlexJustifyContent(FrameNode* frameNode, int32_t value); 59 static void SetFlexAlignItems(FrameNode* frameNode, int32_t value); 60 static void SetFlexAlignContent(FrameNode* frameNode, int32_t value); 61 62 static int GetFlexWrap(FrameNode* frameNode); 63 static int GetFlexDirection(FrameNode* frameNode); 64 static int GetFlexJustifyContent(FrameNode* frameNode); 65 static int GetFlexAlignItems(FrameNode* frameNode); 66 static int GetFlexAlignContent(FrameNode* frameNode); 67 static void SetMainSpace(FrameNode* frameNode, const std::optional<Dimension>& space); 68 static void SetCrossSpace(FrameNode* frameNode, const std::optional<Dimension>& space); 69 }; 70 71 } // namespace OHOS::Ace::NG 72 #endif // FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_PATTERN_FLEX_FLEX_MODEL_NG_H 73