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 FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_PATTERNS_NAVIGATION_TOOL_BAR_NODE_H 17 #define FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_PATTERNS_NAVIGATION_TOOL_BAR_NODE_H 18 19 #include "core/components_ng/base/frame_node.h" 20 #include "core/components_ng/property/property.h" 21 22 namespace OHOS::Ace::NG { 23 class ACE_EXPORT NavToolbarNode : public FrameNode { 24 DECLARE_ACE_TYPE(NavToolbarNode, FrameNode) 25 public: 26 NavToolbarNode(const std::string& tag, int32_t nodeId); NavToolbarNode(const std::string & tag,int32_t nodeId,const RefPtr<Pattern> & pattern)27 NavToolbarNode(const std::string& tag, int32_t nodeId, const RefPtr<Pattern>& pattern) 28 : FrameNode(tag, nodeId, pattern) 29 {} 30 ~NavToolbarNode() override; 31 static RefPtr<NavToolbarNode> GetOrCreateToolbarNode( 32 const std::string& tag, int32_t nodeId, const std::function<RefPtr<Pattern>(void)>& patternCreator); 33 IsAtomicNode()34 bool IsAtomicNode() const override 35 { 36 return false; 37 } 38 SetToolbarContainerNode(const RefPtr<UINode> & toolbarContainerNode)39 void SetToolbarContainerNode(const RefPtr<UINode>& toolbarContainerNode) 40 { 41 toolbarContainerNode_ = toolbarContainerNode; 42 } 43 GetToolbarContainerNode()44 const RefPtr<UINode>& GetToolbarContainerNode() const 45 { 46 return toolbarContainerNode_; 47 } 48 SetIsUseNewToolbar(bool isNewToolbar)49 void SetIsUseNewToolbar(bool isNewToolbar) 50 { 51 isNewToolbar_ = isNewToolbar; 52 } 53 IsUsedNewToolbar()54 bool IsUsedNewToolbar() const 55 { 56 return isNewToolbar_; 57 } 58 SetHasValidContent(bool has)59 void SetHasValidContent(bool has) 60 { 61 hasValidContent_ = has; 62 } 63 HasValidContent()64 bool HasValidContent() const 65 { 66 return hasValidContent_; 67 } 68 69 private: 70 RefPtr<UINode> toolbarContainerNode_; 71 bool isNewToolbar_ = false; 72 bool hasValidContent_ = false; 73 }; 74 } // namespace OHOS::Ace::NG 75 76 #endif // FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_PATTERNS_NAVIGATION_TOOL_BAR_NODE_H 77