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 #include "core/interfaces/native/node/api.h"
17
18 namespace OHOS::Ace::NG {
SetResizeable(ArkUIRuntimeCallInfo * runtimeCallInfo)19 ArkUINativeModuleValue RowSplitBridge::SetResizeable(ArkUIRuntimeCallInfo *runtimeCallInfo)
20 {
21 EcmaVM *vm = runtimeCallInfo->GetVM();
22 CHECK_NULL_RETURN(vm, panda::NativePointerRef::New(vm, nullptr));
23 Local<JSValueRef> nativeNodeArg = runtimeCallInfo->GetCallArgRef(0);
24 Local<JSValueRef> resizeableArg = runtimeCallInfo->GetCallArgRef(1);
25 void *nativeNode = nativeNodeArg->ToNativePointer(vm)->Value();
26 bool resizeable = false;
27 if (resizeableArg->IsBoolean()) {
28 resizeable = resizeableArg->ToBoolean(vm)->BooleaValue();
29 }
30 GetArkUIInternalNodeAPI()->GetRowSplitModifier().SetRowSplitResizeable(nativeNode, resizeable);
31 return panda::JSValueRef::Undefined(vm);
32 }
33
ResetResizeable(ArkUIRuntimeCallInfo * runtimeCallInfo)34 ArkUINativeModuleValue RowSplitBridge::ResetResizeable(ArkUIRuntimeCallInfo *runtimeCallInfo)
35 {
36 EcmaVM *vm = runtimeCallInfo->GetVM();
37 CHECK_NULL_RETURN(vm, panda::NativePointerRef::New(vm, nullptr));
38 Local<JSValueRef> nativeNodeArg = runtimeCallInfo->GetCallArgRef(0);
39 void *nativeNode = nativeNodeArg->ToNativePointer(vm)->Value();
40 GetArkUIInternalNodeAPI()->GetRowSplitModifier().ResetRowSplitResizeable(nativeNode);
41 return panda::JSValueRef::Undefined(vm);
42 }
43 }
44