1 /*
2  * Copyright (c) 2024 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_FRAMEWORKS_CORE_COMPONENTS_NG_PATTERNS_NAVIGATION_NAVIGATION_TOOLBAR_UTIL_H
17 #define FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_PATTERNS_NAVIGATION_NAVIGATION_TOOLBAR_UTIL_H
18 
19 #include "base/memory/ace_type.h"
20 #include "base/memory/referenced.h"
21 #include "core/components_ng/base/ui_node.h"
22 #include "core/components_ng/pattern/navigation/navdestination_node_base.h"
23 #include "core/components_ng/pattern/navigation/navigation_declaration.h"
24 #include "core/components_ng/pattern/navigation/navigation_options.h"
25 
26 namespace OHOS::Ace::NG {
27 struct FieldProperty {
28     std::string parentId;
29     std::string field;
30 };
31 class NavigationToolbarUtil {
32 public:
33     static void CreateToolBarDividerNodeIfNeeded(const RefPtr<NavDestinationNodeBase>& nodeBase);
34     static void SetToolbarConfiguration(const RefPtr<NavDestinationNodeBase>& nodeBase,
35         std::vector<NG::BarItem>&& toolBarItems, bool enabled, const FieldProperty& fieldProperty);
36     static void SetCustomToolBar(const RefPtr<NavDestinationNodeBase>& nodeBase, const RefPtr<AceType>& customNode);
37     static void SetToolbarOptions(const RefPtr<NavDestinationNodeBase>& nodeBase, NavigationToolbarOptions&& opt);
38     static void MountToolBar(
39         const RefPtr<NavDestinationNodeBase>& nodeBase, bool& needRunToolBarAnimation);
40 };
41 
42 } // namespace OHOS::Ace::NG
43 
44 #endif // FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_PATTERNS_NAVIGATION_NAVIGATION_TOOLBAR_UTIL_H