1 /* 2 * Copyright (c) 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_NG_PATTERNS_NAVIGATION_BAR_ITEM_NODE_H 17 #define FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_PATTERNS_NAVIGATION_BAR_ITEM_NODE_H 18 19 #include <cstdint> 20 #include <optional> 21 22 #include "core/components_ng/base/frame_node.h" 23 24 namespace OHOS::Ace::NG { 25 26 class ACE_EXPORT BarItemNode : public FrameNode { 27 DECLARE_ACE_TYPE(BarItemNode, FrameNode) 28 public: 29 BarItemNode(const std::string& tag, int32_t nodeId); 30 ~BarItemNode() override = default; 31 IsAtomicNode()32 bool IsAtomicNode() const override 33 { 34 return false; 35 } 36 SetTextNode(const RefPtr<UINode> & text)37 void SetTextNode(const RefPtr<UINode>& text) 38 { 39 text_ = text; 40 } 41 GetTextNode()42 const RefPtr<UINode>& GetTextNode() const 43 { 44 return text_; 45 } 46 SetIconNode(const RefPtr<UINode> & icon)47 void SetIconNode(const RefPtr<UINode>& icon) 48 { 49 icon_ = icon; 50 } 51 GetIconNode()52 const RefPtr<UINode>& GetIconNode() const 53 { 54 return icon_; 55 } 56 57 ACE_DEFINE_PROPERTY_ITEM_FUNC_WITHOUT_GROUP(IconSrc, std::string); OnIconSrcUpdate(const std::string & value)58 void OnIconSrcUpdate(const std::string& value) {} 59 ACE_DEFINE_PROPERTY_ITEM_FUNC_WITHOUT_GROUP(Text, std::string); OnTextUpdate(const std::string & value)60 void OnTextUpdate(const std::string& value) {} 61 62 private: 63 RefPtr<UINode> text_; 64 RefPtr<UINode> icon_; 65 }; 66 67 } // namespace OHOS::Ace::NG 68 #endif // FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_PATTERNS_NAVIGATION_BAR_ITEM_NODE_H