• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2021-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 
16 #ifndef FOUNDATION_ACE_FRAMEWORK_JAVASCRIPT_BRIDGE_JS_VIEW_JS_TAB_CONTENT_H
17 #define FOUNDATION_ACE_FRAMEWORK_JAVASCRIPT_BRIDGE_JS_VIEW_JS_TAB_CONTENT_H
18 
19 #include "bridge/declarative_frontend/engine/bindings_defines.h"
20 #include "bridge/declarative_frontend/engine/js_types.h"
21 #include "frameworks/bridge/declarative_frontend/engine/functions/js_function.h"
22 #include "frameworks/bridge/declarative_frontend/jsview/js_container_base.h"
23 #include "frameworks/core/components/tab_bar/tab_content_component.h"
24 #include "frameworks/core/components_v2/tabs/tab_content_item_component.h"
25 #include "frameworks/core/components_v2/tabs/tabs_component.h"
26 #include "frameworks/core/components_ng/pattern/tabs/tab_content_model.h"
27 #include "frameworks/core/components_ng/pattern/tabs/tabs_model_ng.h"
28 
29 namespace OHOS::Ace::Framework {
30 
31 class JSTabContent : public JSContainerBase {
32 public:
33     static void JSBind(BindingTarget globalObj);
34     static void Create(const JSCallbackInfo& info);
35     static void Pop();
36 
37 protected:
38     static void SetTabBar(const JSCallbackInfo& info);
39 
40     // The width and height of tabcontent depend on the size constraints of tabs and tabbar.
SetTabContentWidth(const JSCallbackInfo & info)41     static void SetTabContentWidth(const JSCallbackInfo& info)
42     {
43         LOGW("TabContent does not support width and height settings");
44     }
45 
SetTabContentHeight(const JSCallbackInfo & info)46     static void SetTabContentHeight(const JSCallbackInfo& info)
47     {
48         LOGW("TabContent does not support width and height settings");
49     }
50 
SetTabContentSize(const JSCallbackInfo & info)51     static void SetTabContentSize(const JSCallbackInfo& info)
52     {
53         LOGW("TabContent does not support width and height settings");
54     }
55 
56 private:
57     static void CreateForPartialUpdate(const JSCallbackInfo& info);
58     static void CreateForNG(const JSCallbackInfo& info);
59     static void SetTabBarForNG(const JSCallbackInfo& info);
60     static void SetIndicator(const JSRef<JSVal>& info);
61     static void SetBoard(const JSRef<JSVal>& info);
62     static void SetSelectedMode(const JSRef<JSVal>& info);
63     static void SetSubTabBarStyle(const JSRef<JSObject>& paramObject);
64     static void SetLabelStyle(const JSRef<JSVal>& info, bool isSubTabStyle);
65     static void SetPadding(const JSRef<JSVal>& info, bool isSubTabStyle);
66     static void GetFontContent(JSRef<JSVal> font, LabelStyle& labelStyle, bool isSubTabStyle);
67     static void CompleteParameters(LabelStyle& buttonParameters, bool isSubTabStyle);
68     static void SetLayoutMode(const JSRef<JSVal>& info);
69     static void SetVerticalAlign(const JSRef<JSVal>& info);
70     static void SetSymmetricExtensible(const JSRef<JSVal>& info);
71     static void SetId(const JSRef<JSVal>& info);
72     static void SetBottomTabBarStyle(const JSRef<JSObject>& paramObject);
73 };
74 
75 } // namespace OHOS::Ace::Framework
76 
77 #endif // FOUNDATION_ACE_FRAMEWORK_JAVASCRIPT_BRIDGE_JS_VIEW_JS_TAB_CONTENT_H
78