• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2021-2022 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 FRAMEWORKS_BRIDGE_DECLARATIVE_FRONTEND_JS_VIEW_JS_NAVIGATION_VIEW_H
17 #define FRAMEWORKS_BRIDGE_DECLARATIVE_FRONTEND_JS_VIEW_JS_NAVIGATION_VIEW_H
18 
19 #include "frameworks/bridge/declarative_frontend/jsview/js_container_base.h"
20 #include "frameworks/core/components/navigation_bar/navigation_container_component.h"
21 #include "frameworks/core/components_ng/pattern/navigation/navigation_declaration.h"
22 #include "frameworks/core/components_ng/pattern/navigation/navigation_options.h"
23 
24 namespace OHOS::Ace::Framework {
25 
26 class JSNavigation : public JSContainerBase {
27 public:
28     static void Create();
29     static void Create(const JSCallbackInfo& info);
30     static void JSBind(BindingTarget globalObj);
31     static void SetTitleMode(int32_t value);
32     static void SetTitle(const JSCallbackInfo& info);
33     static void SetSubTitle(const std::string& subTitle);
34     static void SetEnableModeChangeAnimation(const JSCallbackInfo& info);
35     static void SetSplitPlaceholder(const JSCallbackInfo& info);
36     static void SetHideTitleBar(const JSCallbackInfo& info);
37     static void SetHideBackButton(bool hide);
38     static void SetHideToolBar(const JSCallbackInfo& info);
39     static void SetToolBar(const JSCallbackInfo& info);
40     static void SetEnableToolBarAdaptation(const JSCallbackInfo& info);
41     static void SetToolbarConfiguration(const JSCallbackInfo& info);
42     static void SetMenus(const JSCallbackInfo& info);
43     static void SetMenuCount(int32_t menuCount);
44     static void SetOnTitleModeChanged(const JSCallbackInfo& info);
45     static void SetUsrNavigationMode(const JSCallbackInfo& info);
46     static void SetOnNavigationModeChange(const JSCallbackInfo& info);
47     static void SetNavBarWidth(const JSCallbackInfo& info);
48     static void SetNavBarWidthRange(const JSCallbackInfo& info);
49     static void SetMinContentWidth(const JSCallbackInfo& info);
50     static void SetNavBarPosition(int32_t value);
51     static void SetHideNavBar(bool hide);
52     static void SetBackButtonIcon(const JSCallbackInfo& info);
53     static void SetOnNavBarStateChange(const JSCallbackInfo& info);
54     static void SetNavDestination(const JSCallbackInfo& info);
55 
56     static void ParseToolBarItems(const JSCallbackInfo& info, std::list<RefPtr<AceType>>& items);
57     static bool ParseCommonTitle(const JSRef<JSObject>& jsObj);
58     static void ParseCommonAndCustomTitle(const JSRef<JSObject>& jsObj);
59     static void ParseBackButtonText(const JSCallbackInfo& info, RefPtr<PixelMap>& pixMap,
60         const NG::ImageOption& imageOption, const std::function<void(WeakPtr<NG::FrameNode>)>& iconSymbol,
61         std::string src, const std::vector<std::string>& nameList, RefPtr<ResourceObject>& backButtonIconResObj);
62 
63     static void SetCustomNavContentTransition(const JSCallbackInfo& info);
64 
65     static void SetIgnoreLayoutSafeArea(const JSCallbackInfo& info);
66     static void SetSystemBarStyle(const JSCallbackInfo& info);
67     static void SetRecoverable(const JSCallbackInfo& info);
68     static void SetEnableDragBar(const JSCallbackInfo& info);
69 };
70 } // namespace OHOS::Ace::Framework
71 
72 #endif // FRAMEWORKS_BRIDGE_DECLARATIVE_FRONTEND_JS_VIEW_JS_NAVIGATION_VIEW_H
73