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 "bridge/declarative_frontend/engine/jsi/nativeModule/arkts_native_row_split_bridge.h"
16
17 namespace OHOS::Ace::NG {
SetResizable(ArkUIRuntimeCallInfo * runtimeCallInfo)18 ArkUINativeModuleValue RowSplitBridge::SetResizable(ArkUIRuntimeCallInfo *runtimeCallInfo)
19 {
20 EcmaVM *vm = runtimeCallInfo->GetVM();
21 CHECK_NULL_RETURN(vm, panda::NativePointerRef::New(vm, nullptr));
22 Local<JSValueRef> nativeNodeArg = runtimeCallInfo->GetCallArgRef(0);
23 Local<JSValueRef> resizableArg = runtimeCallInfo->GetCallArgRef(1);
24 auto nativeNode = nodePtr(nativeNodeArg->ToNativePointer(vm)->Value());
25 bool resizable = false;
26 if (resizableArg->IsBoolean()) {
27 resizable = resizableArg->ToBoolean(vm)->BooleaValue(vm);
28 }
29 GetArkUINodeModifiers()->getRowSplitModifier()->setRowSplitResizable(nativeNode, resizable);
30 return panda::JSValueRef::Undefined(vm);
31 }
32
ResetResizable(ArkUIRuntimeCallInfo * runtimeCallInfo)33 ArkUINativeModuleValue RowSplitBridge::ResetResizable(ArkUIRuntimeCallInfo *runtimeCallInfo)
34 {
35 EcmaVM *vm = runtimeCallInfo->GetVM();
36 CHECK_NULL_RETURN(vm, panda::NativePointerRef::New(vm, nullptr));
37 Local<JSValueRef> nativeNodeArg = runtimeCallInfo->GetCallArgRef(0);
38 auto nativeNode = nodePtr(nativeNodeArg->ToNativePointer(vm)->Value());
39 GetArkUINodeModifiers()->getRowSplitModifier()->resetRowSplitResizable(nativeNode);
40 return panda::JSValueRef::Undefined(vm);
41 }
42 }
43