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(bool useHomeDestination = false) 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 SetEnableModeChangeAnimation(bool isEnable) override; 34 void SetHideTitleBar(bool hideTitleBar, bool animated = false) override; 35 void SetHideNavBar(bool hideNavBar) override; 36 void SetBackButtonIcon(const std::function<void(WeakPtr<NG::FrameNode>)>& symbolApply, const std::string& src, 37 const NG::ImageOption& imageOption, RefPtr<PixelMap>& pixMap, 38 const std::vector<std::string>& nameList, bool userDefinedAccessibilityText = false, 39 const std::string& backButtonAccessibilityText = "") override; 40 void SetBackButtonIcon(const std::function<void(WeakPtr<NG::FrameNode>)>& symbolApply, 41 const RefPtr<ResourceObject>& resObj, const NG::ImageOption& imageOption, RefPtr<PixelMap>& pixMap, 42 const std::vector<std::string>& nameList, bool userDefinedAccessibilityText = false, 43 const std::string& backButtonAccessibilityText = "") override; 44 void SetBackButtonIconTextRes(const std::function<void(WeakPtr<NG::FrameNode>)>& symbolApply, 45 const std::string& src, const NG::ImageOption& imageOption, RefPtr<PixelMap>& pixMap, 46 const std::vector<std::string>& nameList, bool userDefinedAccessibilityText, 47 const RefPtr<ResourceObject>& resObj) override; 48 void SetBackButtonIconSrcAndTextRes(const std::function<void(WeakPtr<NG::FrameNode>)>& symbolApply, 49 const RefPtr<ResourceObject>& backButtonResObj, const NG::ImageOption& imageOption, RefPtr<PixelMap>& pixMap, 50 const std::vector<std::string>& nameList, bool userDefinedAccessibilityText, 51 const RefPtr<ResourceObject>& backButtonTextResObj) override; 52 void UpdateBackButtonIcon(const std::vector<std::string>& nameList, 53 NG::FrameNode* frameNode, const RefPtr<ResourceObject>& backButtonIconResObj) override; 54 void UpdateBackButtonIconText(bool userDefinedAccessibilityText, 55 const RefPtr<NG::TitleBarNode>& titleBarNode, const RefPtr<ResourceObject>& backButtonTextResObj) override; 56 void SetHideBackButton(bool hideBackButton) override; 57 void SetHideToolBar(bool hideToolBar, bool animated = false) override; 58 void SetCustomToolBar(const RefPtr<AceType>& customToolBar) override; 59 bool NeedSetItems() override; 60 void SetToolBarItems(std::vector<NG::BarItem>&& toolBarItems) override; 61 void SetToolbarConfiguration(std::vector<NG::BarItem>&& toolBarItems) override; 62 void GetToolBarItems(std::list<RefPtr<AceType>>& items) override; 63 void SetMenuItems(std::vector<NG::BarItem>&& menuItems) override; 64 void GetMenuItems(std::list<RefPtr<AceType>>& items) override; 65 void SetCustomMenu(const RefPtr<AceType>& customMenu) override; 66 void SetOnTitleModeChange(std::function<void(NG::NavigationTitleMode)>&& onTitleModeChange, 67 std::function<void(const BaseEventInfo* baseInfo)>&& eventInfo) override; 68 void SetUsrNavigationMode(NG::NavigationMode mode) override; 69 void SetNavBarPosition(NG::NavBarPosition mode) override; 70 void SetNavBarWidth(const Dimension& value, bool isDoubleBind = false) override; SetMinNavBarWidth(const Dimension & value)71 void SetMinNavBarWidth(const Dimension& value) override {} SetMaxNavBarWidth(const Dimension & value)72 void SetMaxNavBarWidth(const Dimension& value) override {} SetMinContentWidth(const Dimension & value)73 void SetMinContentWidth(const Dimension& value) override {} 74 void SetOnNavBarStateChange(std::function<void(bool)>&& onNavBarStateChange) override; 75 void SetNavigationMode(NG::NavigationMode mode) override; 76 void SetNavDestination(std::function<void(std::string)>&& builder) override; 77 RefPtr<NG::NavigationStack> GetNavigationStack() override; 78 void SetMenuCount(int32_t menuCount) override; 79 void SetOnNavigationModeChange(std::function<void(NG::NavigationMode)>&& modeChange) override; 80 void SetIsCustomAnimation(bool isCustom) override; 81 void SetCustomTransition(NavigationTransitionEvent&& animationTransition) override; 82 void SetIgnoreLayoutSafeArea(const NG::IgnoreLayoutSafeAreaOpts& opts) override; 83 }; 84 } // namespace OHOS::Ace::Framework 85 #endif // FRAMEWORKS_BRIDGE_DECLARATIVE_FRONTEND_JS_VIEW_MODELS_NAVIGATION_MODEL_IMPL_H 86