1 /* 2 * Copyright (c) 2025 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_OVERLAY_DIALOG_MANAGER_H 17 #define FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_PATTERNS_OVERLAY_DIALOG_MANAGER_H 18 19 #include "base/utils/singleton.h" 20 #include "core/components_ng/pattern/overlay/overlay_manager.h" 21 22 namespace OHOS::Ace::NG { 23 class ACE_FORCE_EXPORT DialogManager : public Singleton<DialogManager> { 24 DECLARE_SINGLETON(DialogManager); 25 public: 26 static void ShowInEmbeddedOverlay(std::function<void(RefPtr<NG::OverlayManager>)>&& task, 27 const std::string& name, int32_t uniqueId); 28 static RefPtr<OverlayManager> GetEmbeddedOverlay(int32_t uniqueId, const RefPtr<PipelineContext>& context); 29 30 static RefPtr<OverlayManager> FindPageNodeOverlay(const RefPtr<FrameNode>& currentNode); 31 32 RefPtr<OverlayManager> GetEmbeddedOverlayWithNode(const RefPtr<UINode>& dialogNode); 33 34 RefPtr<UINode> GetDialogNodeByContentNode(const RefPtr<UINode>& currentNode); 35 SetDismissDialogInfo(int32_t id,const std::string & name)36 void SetDismissDialogInfo(int32_t id, const std::string& name) 37 { 38 dismissDialogId_ = id; 39 dialogTag_ = name; 40 } 41 GetDismissDialogId()42 int32_t GetDismissDialogId() const 43 { 44 return dismissDialogId_; 45 } 46 GetDialogTag()47 std::string& GetDialogTag() 48 { 49 return dialogTag_; 50 } 51 52 private: 53 int32_t dismissDialogId_ = 0; 54 std::string dialogTag_; 55 }; 56 } // namespace OHOS::Ace::NG 57 #endif // FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_PATTERNS_OVERLAY_DIALOG_MANAGER_H 58