1 /*
2  * Copyright (c) 2022-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_PANEL_SLIDING_PANEL_MODEL_NG_H
17 #define FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_PATTERNS_PANEL_SLIDING_PANEL_MODEL_NG_H
18 
19 #include "core/components_ng/base/view_abstract.h"
20 #include "core/components_ng/pattern/panel/sliding_panel_model.h"
21 
22 namespace OHOS::Ace::NG {
23 class ACE_EXPORT SlidingPanelModelNG : public OHOS::Ace::SlidingPanelModel {
24 public:
25     void Create(bool isShow) override;
26     void SetPanelType(PanelType type) override;
27     void SetPanelMode(PanelMode mode) override;
28     void SetHasDragBar(bool hasDragBar) override;
29     void SetCustomHeight(const CalcDimension& customHeight) override;
30     void SetMiniHeight(const Dimension& miniHeight) override;
31     void SetHalfHeight(const Dimension& halfHeight) override;
32     void SetFullHeight(const Dimension& fullHeight) override;
33     void SetIsShow(bool isShow) override;
34     void SetShowCloseIcon(bool showCloseIcon) override;
35     void SetBackgroundMask(const Color& backgroundMask) override;
36     void SetBackgroundColor(const Color& backgroundColor) override;
37     void SetOnSizeChange(ChangeEvent&& changeEvent) override;
38     void SetOnHeightChange(HeightChangeEvent&& onHeightChange) override;
39     void Pop() override;
40     void SetBorderColor(const Color& borderColor) override;
41     void SetBorderWidth(const Dimension& borderWidth) override;
42     void SetBorderStyle(const BorderStyle& borderStyle) override;
43     void SetBorder(const BorderStyle& borderStyle, const Dimension& borderWidth) override;
44     void SetModeChangeEvent(ChangeEvent&& modeChangeEvent) override;
45 
46     static void SetPanelMode(FrameNode* frameNode, PanelMode mode);
47     static void SetPanelMiniHeight(FrameNode* frameNode, const Dimension& miniHeight);
48     static void SetPanelHalfHeight(FrameNode* frameNode, const Dimension& halfHeight);
49     static void ResetPanelHalfHeight(FrameNode* frameNode);
50     static void SetPanelFullHeight(FrameNode* frameNode, const Dimension& fullHeight);
51     static void ResetPanelFullHeight(FrameNode* frameNode);
52     static void SetPanelBackgroundMask(FrameNode* frameNode, const Color& backgroundMask);
53     static void SetPanelType(FrameNode* frameNode, PanelType type);
54     static void SetPanelCustomHeight(FrameNode* frameNode, const CalcDimension& customHeight);
55     static void SetShowCloseIcon(FrameNode* frameNode, bool showCloseIcon);
56     static void SetHasDragBar(FrameNode* frameNode, bool hasDragBar);
57     static void SetIsShow(FrameNode* frameNode, bool isShow);
58 
59 private:
60     static RefPtr<SlidingPanelNode> GetOrCreateSlidingPanelNode(
61         const std::string& tag, int32_t nodeId, const std::function<RefPtr<Pattern>(void)>& patternCreator);
62     static RefPtr<LinearLayoutProperty> GetLinearLayoutProperty();
63 };
64 } // namespace OHOS::Ace::NG
65 #endif // FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_PATTERNS_PANEL_SLIDING_PANEL_MODEL_NG_H
66