• 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 
23 namespace OHOS::Ace::Framework {
24 
25 class JSNavigation : public JSContainerBase {
26 public:
27     static void Create();
28     static void Create(const JSCallbackInfo& info);
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 SetToolbarConfiguration(const JSCallbackInfo& info);
38     static void SetMenus(const JSCallbackInfo& info);
39     static void SetMenuCount(int32_t menuCount);
40     static void SetOnTitleModeChanged(const JSCallbackInfo& info);
41     static void SetUsrNavigationMode(int32_t value);
42     static void SetNavBarWidth(const JSCallbackInfo& info);
43     static void SetNavBarWidthRange(const JSCallbackInfo& info);
44     static void SetMinContentWidth(const JSCallbackInfo& info);
45     static void SetNavBarPosition(int32_t value);
46     static void SetHideNavBar(bool hide);
47     static void SetBackButtonIcon(const JSCallbackInfo& info);
48     static void SetOnNavBarStateChange(const JSCallbackInfo& info);
49     static void SetNavDestination(const JSCallbackInfo& info);
50 
51     static void ParseToolBarItems(const JSRef<JSArray>& jsArray, std::list<RefPtr<AceType>>& items);
52     static void ParseBarItems(
53         const JSCallbackInfo& info, const JSRef<JSArray>& jsArray, std::vector<NG::BarItem>& items);
54     static bool ParseCommonTitle(const JSRef<JSVal>& jsValue);
55     static void ParseToolbarItemsConfiguration(
56         const JSCallbackInfo& info, const JSRef<JSArray>& jsArray, std::vector<NG::BarItem>& items);
57 };
58 } // namespace OHOS::Ace::Framework
59 
60 #endif // FRAMEWORKS_BRIDGE_DECLARATIVE_FRONTEND_JS_VIEW_JS_NAVIGATION_VIEW_H
61