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_BUBBLE_BUBBLE_VIEW_H 17 #define FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_PATTERNS_BUBBLE_BUBBLE_VIEW_H 18 19 #include <string> 20 21 #include "base/geometry/dimension.h" 22 #include "base/memory/referenced.h" 23 #include "base/utils/device_config.h" 24 #include "base/utils/macros.h" 25 #include "core/components/common/properties/color.h" 26 #include "core/components/common/properties/popup_param.h" 27 #include "core/components_ng/base/frame_node.h" 28 #include "core/components_ng/pattern/text/text_layout_property.h" 29 #include "core/components_ng/pattern/text/text_styles.h" 30 #include "core/pipeline_ng/ui_task_scheduler.h" 31 32 namespace OHOS::Ace::NG { 33 34 class ACE_EXPORT BubbleView { 35 public: 36 static RefPtr<FrameNode> CreateBubbleNode( 37 const std::string& tag, int32_t targetId, const RefPtr<PopupParam>& param); 38 static RefPtr<FrameNode> CreateCustomBubbleNode(const std::string& targetTag, int32_t targetId, 39 const RefPtr<UINode>& customNode, const RefPtr<PopupParam>& param); 40 static RefPtr<FrameNode> CreateMessage(const std::string& message, bool isUseCustom); 41 static RefPtr<FrameNode> CreateCombinedChild( 42 const RefPtr<PopupParam>& param, int32_t popupId, int32_t targetId, const RefPtr<FrameNode>& bobbleNode); 43 static RefPtr<FrameNode> CreateButtons(const RefPtr<PopupParam>& param, int32_t popupId, int32_t targetId); 44 static RefPtr<FrameNode> CreateButton( 45 ButtonProperties& buttonParam, int32_t popupId, int32_t targetId, const RefPtr<PopupParam>& param); 46 static void UpdatePopupParam(int32_t popupId, const RefPtr<PopupParam>& param, const RefPtr<FrameNode>& targetNode); 47 static void UpdateCustomPopupParam(int32_t popupId, const RefPtr<PopupParam>& param); 48 static void UpdateCommonParam(int32_t popupId, const RefPtr<PopupParam>& param, bool custom = true); 49 static void GetPopupMaxWidthAndHeight(const RefPtr<PopupParam>& param, float& popupMaxWidth, float& popupMaxHeight); 50 static void UpdateBubbleContent(int32_t popupId, const RefPtr<PopupParam>& param); 51 static void UpdateBubbleButtons(std::list<RefPtr<UINode>>& buttons, const RefPtr<PopupParam>& param); 52 }; 53 } // namespace OHOS::Ace::NG 54 55 #endif // FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_PATTERNS_BUBBLE_BUBBLE_VIEW_H 56