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_tabcontent_bridge.h"
16 #include "frameworks/bridge/declarative_frontend/jsview/js_tab_content.h"
17 
18 namespace OHOS::Ace::NG {
SetTabBar(ArkUIRuntimeCallInfo * runtimeCallInfo)19 ArkUINativeModuleValue TabContentBridge::SetTabBar(ArkUIRuntimeCallInfo* runtimeCallInfo)
20 {
21     Framework::JSTabContent::SetTabBar(Framework::JsiCallbackInfo(runtimeCallInfo));
22     return panda::JSValueRef::Undefined(runtimeCallInfo->GetVM());
23 }
24 
ResetTabBar(ArkUIRuntimeCallInfo * runtimeCallInfo)25 ArkUINativeModuleValue TabContentBridge::ResetTabBar(ArkUIRuntimeCallInfo* runtimeCallInfo)
26 {
27     EcmaVM* vm = runtimeCallInfo->GetVM();
28     CHECK_NULL_RETURN(vm, panda::NativePointerRef::New(vm, nullptr));
29     Local<JSValueRef> firstArg = runtimeCallInfo->GetCallArgRef(0);
30     auto nativeNode = nodePtr(firstArg->ToNativePointer(vm)->Value());
31     GetArkUINodeModifiers()->getTabContentModifier()->setTabContentLabel(nativeNode, "");
32     return panda::JSValueRef::Undefined(vm);
33 }
34 
SetTabContentWidth(ArkUIRuntimeCallInfo * runtimeCallInfo)35 ArkUINativeModuleValue TabContentBridge::SetTabContentWidth(ArkUIRuntimeCallInfo* runtimeCallInfo)
36 {
37     LOGW("TabContent does not support width and height settings");
38     EcmaVM* vm = runtimeCallInfo->GetVM();
39     return panda::JSValueRef::Undefined(vm);
40 }
41 
SetTabContentHeight(ArkUIRuntimeCallInfo * runtimeCallInfo)42 ArkUINativeModuleValue TabContentBridge::SetTabContentHeight(ArkUIRuntimeCallInfo* runtimeCallInfo)
43 {
44     LOGW("TabContent does not support width and height settings");
45     EcmaVM* vm = runtimeCallInfo->GetVM();
46     return panda::JSValueRef::Undefined(vm);
47 }
48 
SetTabContentSize(ArkUIRuntimeCallInfo * runtimeCallInfo)49 ArkUINativeModuleValue TabContentBridge::SetTabContentSize(ArkUIRuntimeCallInfo* runtimeCallInfo)
50 {
51     LOGW("TabContent does not support width and height settings");
52     EcmaVM* vm = runtimeCallInfo->GetVM();
53     return panda::JSValueRef::Undefined(vm);
54 }
ResetTabContentWidth(ArkUIRuntimeCallInfo * runtimeCallInfo)55 ArkUINativeModuleValue TabContentBridge::ResetTabContentWidth(ArkUIRuntimeCallInfo* runtimeCallInfo)
56 {
57     LOGW("TabContent does not support width and height settings");
58     EcmaVM* vm = runtimeCallInfo->GetVM();
59     return panda::JSValueRef::Undefined(vm);
60 }
61 
ResetTabContentHeight(ArkUIRuntimeCallInfo * runtimeCallInfo)62 ArkUINativeModuleValue TabContentBridge::ResetTabContentHeight(ArkUIRuntimeCallInfo* runtimeCallInfo)
63 {
64     LOGW("TabContent does not support width and height settings");
65     EcmaVM* vm = runtimeCallInfo->GetVM();
66     return panda::JSValueRef::Undefined(vm);
67 }
68 
ResetTabContentSize(ArkUIRuntimeCallInfo * runtimeCallInfo)69 ArkUINativeModuleValue TabContentBridge::ResetTabContentSize(ArkUIRuntimeCallInfo* runtimeCallInfo)
70 {
71     LOGW("TabContent does not support width and height settings");
72     EcmaVM* vm = runtimeCallInfo->GetVM();
73     return panda::JSValueRef::Undefined(vm);
74 }
75 } // namespace OHOS::Ace::NG
76