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_APP_BAR_VIEW_H 17 #define FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_PATTERNS_APP_BAR_VIEW_H 18 19 #include <cstddef> 20 #include <optional> 21 22 #include "base/utils/macros.h" 23 #include "core/components_ng/base/frame_node.h" 24 25 namespace OHOS::Ace::NG { 26 /** 27 * The structure of Atomic Service (install free): 28 * |--AtomicService(Column) 29 * |--Stage 30 * |--ModalPage(normal) 31 * |--MenuBarRow 32 * |--MenuBar 33 * |--menuButton 34 * |--divider 35 * |--closeButton 36 * |--ModalPage(UEC) 37 */ 38 39 class ACE_FORCE_EXPORT AppBarView : public Referenced { 40 public: 41 AppBarView() = default; 42 RefPtr<FrameNode> Create(const RefPtr<FrameNode>& stage); SetVisible(bool visible)43 void SetVisible(bool visible) {} SetRowColor(const std::optional<Color> & color)44 void SetRowColor(const std::optional<Color>& color) {} SetContent(const std::string & content)45 void SetContent(const std::string& content) {} SetFontStyle(Ace::FontStyle fontStyle)46 void SetFontStyle(Ace::FontStyle fontStyle) {} SetIconColor(const std::optional<Color> & color)47 void SetIconColor(const std::optional<Color>& color) {} 48 void SetStatusBarItemColor(bool isLight); 49 std::optional<RectF> GetAppBarRect(); 50 51 private: 52 RefPtr<FrameNode> BuildMenuBarRow(); 53 RefPtr<FrameNode> BuildMenuBar(); 54 RefPtr<FrameNode> BuildButton(bool isMenuButton); 55 RefPtr<FrameNode> BuildIcon(bool isMenuIcon); 56 RefPtr<FrameNode> BuildDivider(); 57 void BindMenuCallback(const RefPtr<FrameNode>& menuButton); 58 void BindCloseCallback(const RefPtr<FrameNode>& closeButton); 59 void CreateServicePanel(bool firstTry); 60 void DestroyServicePanel(); 61 static void InitUIExtensionNode(const RefPtr<FrameNode>& uiExtNode); 62 int32_t sessionId_ = 0; 63 64 WeakPtr<FrameNode> atomicService_; 65 }; 66 } // namespace OHOS::Ace::NG 67 #endif // FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_PATTERNS_APP_BAR_VIEW_H 68