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_CONTAINER_MODAL_CONTAINER_MODAL_VIEW_ENHANCE_H 17 #define FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_PATTERNS_CONTAINER_MODAL_CONTAINER_MODAL_VIEW_ENHANCE_H 18 19 #include "base/geometry/ng/offset_t.h" 20 #include "base/utils/macros.h" 21 #include "core/components_ng/base/frame_node.h" 22 #include "core/components_ng/pattern/container_modal/container_modal_view.h" 23 namespace OHOS::Ace::NG { 24 class ACE_EXPORT ContainerModalViewEnhance : public ContainerModalView { 25 public: 26 static RefPtr<FrameNode> Create(RefPtr<FrameNode>& content); SetEnableSplit(bool enableSplit)27 static void SetEnableSplit(bool enableSplit) 28 { 29 enableSplit_ = enableSplit; 30 } 31 32 protected: 33 static RefPtr<FrameNode> BuildTitle(RefPtr<FrameNode>& containerNode, bool isFloatingTitle = false); 34 static void SetTapGestureEvent(RefPtr<FrameNode>& containerNode, RefPtr<FrameNode>& containerTitleRow); 35 static RefPtr<FrameNode> AddControlButtons(RefPtr<FrameNode>& containerNode, RefPtr<FrameNode>& containerTitleRow); 36 static void BondingMaxBtnGestureEvent(RefPtr<FrameNode>& maximizeBtn, RefPtr<FrameNode>& containerNode); 37 static void BondingMaxBtnInputEvent(RefPtr<FrameNode>& maximizeBtn, RefPtr<FrameNode>& containerNode); 38 static RefPtr<FrameNode> ShowMaxMenu(const RefPtr<FrameNode>& targetNode, OffsetF menuPosition); 39 static void BondingMenuItemEvent(RefPtr<FrameNode> item); 40 static RefPtr<FrameNode> BuildMenuItem( 41 std::string title, InternalResource::ResourceId resourceId, RefPtr<ClickEvent> event, bool chooseCurrent); 42 static RefPtr<FrameNode> BuildLeftSplitMenuItem(); 43 static RefPtr<FrameNode> BuildRightSplitMenuItem(); 44 static RefPtr<FrameNode> BuildMenuItemIcon(InternalResource::ResourceId resourceId); 45 static RefPtr<FrameNode> BuildMenuItemPadding(PaddingProperty padding, RefPtr<FrameNode> node); 46 static RefPtr<FrameNode> BuildGestureRow(RefPtr<FrameNode>& containerNode); 47 static void ResetHoverTimer(); 48 static bool sIsMenuPending_; 49 static bool sIsForbidMenuEvent_; 50 static bool enableSplit_; 51 static OffsetF menuOffset_; 52 static CancelableCallback<void()> sContextTimer_; 53 54 private: 55 static void CalculateMenuOffset(OffsetF menuPosition); 56 }; 57 } // namespace OHOS::Ace::NG 58 #endif // FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_PATTERNS_CONTAINER_MODAL_CONTAINER_MODAL_VIEW_ENHANCE_H 59