1 /* 2 * Copyright (c) 2023 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_MODELS_NAVIGATION_MODEL_IMPL_H 17 #define FRAMEWORKS_BRIDGE_DECLARATIVE_FRONTEND_JS_VIEW_MODELS_NAVIGATION_MODEL_IMPL_H 18 19 #include "frameworks/core/components_ng/pattern/navigation/navigation_model.h" 20 21 namespace OHOS::Ace::Framework { 22 class NavigationModelImpl : public NavigationModel { 23 public: 24 void Create() override; 25 void SetNavigationStack() override; 26 void SetNavigationStack(const RefPtr<NG::NavigationStack>& navigationStack) override; 27 void SetNavigationStackProvided(bool provided) override; 28 void SetTitle(const std::string& title, bool hasSubTitle = false) override; 29 void SetCustomTitle(const RefPtr<AceType>& customTitle) override; 30 void SetTitleHeight(const Dimension& height, bool isValid = true) override; 31 void SetTitleMode(NG::NavigationTitleMode mode) override; 32 void SetSubtitle(const std::string& subtitle) override; 33 void SetHideTitleBar(bool hideTitleBar, bool animated = false) override; 34 void SetHideNavBar(bool hideNavBar) override; 35 void SetBackButtonIcon(const std::function<void(WeakPtr<NG::FrameNode>)>& symbolApply, const std::string& src, 36 const NG::ImageOption& imageOption, RefPtr<PixelMap>& pixMap, 37 const std::vector<std::string>& nameList) override; 38 void SetHideBackButton(bool hideBackButton) override; 39 void SetHideToolBar(bool hideToolBar, bool animated = false) override; 40 void SetCustomToolBar(const RefPtr<AceType>& customToolBar) override; 41 bool NeedSetItems() override; 42 void SetToolBarItems(std::vector<NG::BarItem>&& toolBarItems) override; 43 void SetToolbarConfiguration(std::vector<NG::BarItem>&& toolBarItems) override; 44 void GetToolBarItems(std::list<RefPtr<AceType>>& items) override; 45 void SetMenuItems(std::vector<NG::BarItem>&& menuItems) override; 46 void GetMenuItems(std::list<RefPtr<AceType>>& items) override; 47 void SetCustomMenu(const RefPtr<AceType>& customMenu) override; 48 void SetOnTitleModeChange(std::function<void(NG::NavigationTitleMode)>&& onTitleModeChange, 49 std::function<void(const BaseEventInfo* baseInfo)>&& eventInfo) override; 50 void SetUsrNavigationMode(NG::NavigationMode mode) override; 51 void SetNavBarPosition(NG::NavBarPosition mode) override; 52 void SetNavBarWidth(const Dimension& value) override; SetMinNavBarWidth(const Dimension & value)53 void SetMinNavBarWidth(const Dimension& value) override {} SetMaxNavBarWidth(const Dimension & value)54 void SetMaxNavBarWidth(const Dimension& value) override {} SetMinContentWidth(const Dimension & value)55 void SetMinContentWidth(const Dimension& value) override {} 56 void SetOnNavBarStateChange(std::function<void(bool)>&& onNavBarStateChange) override; 57 void SetNavigationMode(NG::NavigationMode mode) override; 58 void SetNavDestination(std::function<void(std::string)>&& builder) override; 59 RefPtr<NG::NavigationStack> GetNavigationStack() override; 60 void SetMenuCount(int32_t menuCount) override; 61 void SetOnNavigationModeChange(std::function<void(NG::NavigationMode)>&& modeChange) override; 62 void SetIsCustomAnimation(bool isCustom) override; 63 void SetCustomTransition(NavigationTransitionEvent&& animationTransition) override; 64 void SetIgnoreLayoutSafeArea(const NG::SafeAreaExpandOpts& opts) override; 65 }; 66 } // namespace OHOS::Ace::Framework 67 #endif // FRAMEWORKS_BRIDGE_DECLARATIVE_FRONTEND_JS_VIEW_MODELS_NAVIGATION_MODEL_IMPL_H 68