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 #include "core/interfaces/native/node/row_split_modifier.h"
16 #include "core/components/common/layout/constants.h"
17 #include "core/pipeline/base/element_register.h"
18 #include "core/components_ng/base/frame_node.h"
19 #include "core/components_ng/pattern/linear_split/linear_split_model_ng.h"
20
21 namespace OHOS::Ace::NG {
22 constexpr bool DEFAULT_ROW_SPLIT_RESIZABLE = false;
SetRowSplitResizable(ArkUINodeHandle node,ArkUI_Bool resizable)23 void SetRowSplitResizable(ArkUINodeHandle node, ArkUI_Bool resizable)
24 {
25 auto *frameNode = reinterpret_cast<FrameNode *>(node);
26 CHECK_NULL_VOID(frameNode);
27 LinearSplitModelNG::SetResizable(frameNode, NG::SplitType::ROW_SPLIT, resizable);
28 }
29
ResetRowSplitResizable(ArkUINodeHandle node)30 void ResetRowSplitResizable(ArkUINodeHandle node)
31 {
32 auto *frameNode = reinterpret_cast<FrameNode *>(node);
33 CHECK_NULL_VOID(frameNode);
34 LinearSplitModelNG::SetResizable(frameNode, NG::SplitType::ROW_SPLIT, DEFAULT_ROW_SPLIT_RESIZABLE);
35 }
36
37 namespace NodeModifier {
GetRowSplitModifier()38 const ArkUIRowSplitModifier* GetRowSplitModifier()
39 {
40 static const ArkUIRowSplitModifier modifier = { SetRowSplitResizable, ResetRowSplitResizable };
41 return &modifier;
42 }
43
GetCJUIRowSplitModifier()44 const CJUIRowSplitModifier* GetCJUIRowSplitModifier()
45 {
46 static const CJUIRowSplitModifier modifier = { SetRowSplitResizable, ResetRowSplitResizable };
47 return &modifier;
48 }
49 }
50 }