• 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 
21 #include "frameworks/core/components/navigation_bar/navigation_container_component.h"
22 #include "frameworks/core/components_ng/pattern/navigation/navigation_declaration.h"
23 
24 namespace OHOS::Ace::Framework {
25 
26 class JSNavigation : public JSContainerBase {
27 public:
28     static void Create();
29     static void JSBind(BindingTarget globalObj);
30     static void SetTitleMode(int32_t value);
31     static void SetTitle(const JSCallbackInfo& info);
32     static void SetSubTitle(const std::string& subTitle);
33     static void SetHideTitleBar(bool hide);
34     static void SetHideBackButton(bool hide);
35     static void SetHideToolBar(bool hide);
36     static void SetToolBar(const JSCallbackInfo& info);
37     static void SetMenus(const JSCallbackInfo& info);
38     static void SetMenuCount(int32_t menuCount);
39     static void SetOnTitleModeChanged(const JSCallbackInfo& info);
40     static void SetUsrNavigationMode(int32_t value);
41     static void SetNavBarWidth(const JSCallbackInfo& info);
42     static void SetNavBarPosition(int32_t value);
43     static void SetHideNavBar(bool hide);
44     static void SetBackButtonIcon(const JSCallbackInfo& info);
45     static void SetOnNavBarStateChange(const JSCallbackInfo& info);
46 
47     static void ParseToolBarItems(const JSRef<JSArray>& jsArray, std::list<RefPtr<ToolBarItem>>& items);
48     static void ParseBarItems(
49         const JSCallbackInfo& info, const JSRef<JSArray>& jsArray, std::vector<NG::BarItem>& items);
50     static bool ParseCommonTitle(const JSRef<JSVal>& jsValue);
51 };
52 
53 } // namespace OHOS::Ace::Framework
54 
55 #endif // FRAMEWORKS_BRIDGE_DECLARATIVE_FRONTEND_JS_VIEW_JS_NAVIGATION_VIEW_H
56