1 /*
2  * Copyright (c) 2023-2024 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_PATTERN_ENHANCE_H
17 #define FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_PATTERNS_CONTAINER_MODAL_CONTAINER_MODAL_PATTERN_ENHANCE_H
18 
19 #include "core/components_ng/pattern/container_modal/container_modal_pattern.h"
20 namespace OHOS::Ace::NG {
21 class ACE_EXPORT ContainerModalPatternEnhance : public ContainerModalPattern {
22     DECLARE_ACE_TYPE(ContainerModalPatternEnhance, ContainerModalPattern);
23 
24 public:
25     ContainerModalPatternEnhance() = default;
26     ~ContainerModalPatternEnhance() override = default;
27     void OnWindowFocused() override;
28     void OnWindowUnfocused() override;
29     void OnWindowForceUnfocused() override;
30     void UpdateTitleInTargetPos(bool isShow, int32_t height);
31     void SetContainerButtonHide(bool hideSplit, bool hideMaximize, bool hideMinimize, bool hideClose) override;
32     void ShowTitle(bool isShow, bool hasDeco = true, bool needUpdate = false) override;
GetControlButtonVisibleBeforeAnim()33     VisibleType GetControlButtonVisibleBeforeAnim()
34     {
35         return controlButtonVisibleBeforeAnim_;
36     }
37 
SetControlButtonVisibleBeforeAnim(VisibleType visibleType)38     void SetControlButtonVisibleBeforeAnim(VisibleType visibleType)
39     {
40         controlButtonVisibleBeforeAnim_ = visibleType;
41     }
42 
43     void EnableContainerModalGesture(bool isEnable) override;
44     void ClearTapGestureEvent(RefPtr<FrameNode>& node);
45     void SetTapGestureEvent(RefPtr<FrameNode>& node);
46     void EnablePanEventOnNode(
47         RefPtr<FrameNode>& node, bool isEnable, const std::string& rowName);
48     void EnableTapGestureOnNode(
49         RefPtr<FrameNode>& node, bool isEnable, const std::string& rowName);
50     bool GetFloatingTitleVisible() override;
51     bool GetCustomTitleVisible() override;
52     bool GetControlButtonVisible() override;
53 protected:
54     RefPtr<UINode> GetTitleItemByIndex(const RefPtr<FrameNode>& controlButtonsNode, int32_t originIndex) override;
55     void ChangeFloatingTitle(bool isFocus) override;
56 
57     void ChangeCustomTitle(bool isFocus) override;
58 
59     void ChangeControlButtons(bool isFocus) override;
60 
61     void ChangeTitleButtonIcon(
62         const RefPtr<FrameNode>& buttonNode, InternalResource::ResourceId icon, bool isFocus, bool isCloseBtn) override;
63 
64 private:
65     VisibleType controlButtonVisibleBeforeAnim_;
66     bool enableContainerModalGesture_ = true;
67 };
68 } // namespace OHOS::Ace::NG
69 #endif // FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_PATTERNS_CONTAINER_MODAL_CONTAINER_MODAL_PATTERN_ENHANCE_H
70