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 FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NAVIGATION_BAR_RENDER_NAVIGATION_CONTAINER_H
17 #define FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NAVIGATION_BAR_RENDER_NAVIGATION_CONTAINER_H
18 
19 #include "core/animation/animation.h"
20 #include "core/animation/animator.h"
21 #include "core/components/navigation_bar/navigation_container_component.h"
22 #include "core/components/navigation_bar/render_collapsing_navigation_bar.h"
23 #include "core/gestures/raw_recognizer.h"
24 #include "core/pipeline/base/related_node.h"
25 #include "core/pipeline/base/render_node.h"
26 
27 namespace OHOS::Ace {
28 
29 class RenderNavigationContainer : public RenderNode, public RelatedContainer {
30     DECLARE_ACE_TYPE(RenderNavigationContainer, RenderNode, RelatedContainer);
31 
32 public:
33     static RefPtr<RenderNode> Create();
34     void Update(const RefPtr<Component>& component) override;
35     void PerformLayout() override;
36     void OnRelatedStart() override;
37     void OnRelatedPreScroll(const Offset& delta, Offset& consumed) override;
38     void OnRelatedScroll(const Offset& delta, Offset& consumed) override;
39     void OnRelatedEnd() override;
SetCollapsingNavigationBar(const RefPtr<RenderCollapsingNavigationBar> & collapsingNavigationBar)40     void SetCollapsingNavigationBar(const RefPtr<RenderCollapsingNavigationBar>& collapsingNavigationBar)
41     {
42         collapsingNavigationBar_ = collapsingNavigationBar;
43     }
GetTitle()44     const std::string& GetTitle() const
45     {
46         return title_;
47     }
GetSubTitle()48     const std::string& GetSubTitle() const
49     {
50         return subTitle_;
51     }
GetHideBackButton()52     bool GetHideBackButton() const
53     {
54         return hideBackButton_;
55     }
GetHideNavigationBar()56     bool GetHideNavigationBar() const
57     {
58         return hideNavigationBar_;
59     }
60 
GetHideNavigationToolBar()61     bool GetHideNavigationToolBar() const
62     {
63         return hideNavigationToolBar_;
64     }
65 
GetTitleMode()66     NavigationTitleMode GetTitleMode() const
67     {
68         return titleMode_;
69     }
70 
GetToolBarItems()71     const std::list<RefPtr<ToolBarItem>>& GetToolBarItems()
72     {
73         return toolBarItems_;
74     }
75 
GetMenuItems()76     const std::list<RefPtr<ToolBarItem>>& GetMenuItems()
77     {
78         return menuItems_;
79     }
80 
81 private:
82     RefPtr<RenderCollapsingNavigationBar> collapsingNavigationBar_;
83     std::string title_;
84     std::string subTitle_;
85     bool hideBackButton_ = false;
86     bool hideNavigationBar_ = false;
87     bool hideNavigationToolBar_ = false;
88     NavigationTitleMode titleMode_ = NavigationTitleMode::MINI;
89     std::list<RefPtr<ToolBarItem>> toolBarItems_;
90     std::list<RefPtr<ToolBarItem>> menuItems_;
91 };
92 
93 } // namespace OHOS::Ace
94 
95 #endif // FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NAVIGATION_BAR_RENDER_NAVIGATION_CONTAINER_H
96