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_SIDE_BAR_CONTAINER_MODEL_NG_H
17 #define FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_PATTERNS_SIDE_BAR_CONTAINER_MODEL_NG_H
18 
19 #include "core/components_ng/pattern/side_bar/side_bar_container_model.h"
20 
21 namespace OHOS::Ace::NG {
22 class ACE_EXPORT SideBarContainerModelNG : public SideBarContainerModel {
23 public:
24     void Create() override;
25     void SetSideBarContainerType(SideBarContainerType type) override;
26     void SetShowSideBar(bool isShow) override;
27     void SetShowControlButton(bool showControlButton) override;
28     void ParseAndSetWidth(WidthType widthType, Dimension& width) override;
29     void SetSideBarWidth(const Dimension& sideBarWidth) override;
30     void SetMinSideBarWidth(const Dimension& minSideBarWidth) override;
31     void SetMaxSideBarWidth(const Dimension& maxSideBarWidth) override;
32     void SetAutoHide(bool autoHide) override;
33     void SetSideBarPosition(SideBarPosition sideBarPosition) override;
34     void SetControlButtonWidth(const Dimension& width) override;
35     void SetControlButtonHeight(const Dimension& height) override;
36     void SetControlButtonLeft(const Dimension& left) override;
37     void ResetControlButtonLeft() override;
38     void SetControlButtonTop(const Dimension& top) override;
39     void SetControlButtonShowIconInfo(
40         const std::string& showIconStr, bool isPixelMap, RefPtr<PixelMap> pixMap) override;
41     void SetControlButtonHiddenIconInfo(
42         const std::string& hiddenIconStr, bool isPixelMap, RefPtr<PixelMap> pixMap) override;
43     void SetControlButtonSwitchingIconInfo(
44         const std::string& switchingIconStr, bool isPixelMap, RefPtr<PixelMap> pixMap) override;
45     void ResetControlButtonIconInfo() override;
46     void SetOnChange(std::function<void(const bool)>&& onChange) override;
47     void SetDividerStrokeWidth(const Dimension& strokeWidth) override;
48     void SetDividerColor(const Color& color) override;
49     void SetDividerStartMargin(const Dimension& startMargin) override;
50     void SetDividerEndMargin(const Dimension& endMargin) override;
51     void SetOnChangeEvent(std::function<void(const bool)>&& onChangeEvent) override;
52     void SetMinContentWidth(const Dimension& minContentWidth) override;
53     static void SetSideBarWidth(FrameNode* frameNode, const Dimension& sideBarWidth);
54     static void SetMinSideBarWidth(FrameNode* frameNode, const Dimension& minSideBarWidth);
55     static void SetControlButtonWidth(FrameNode* frameNode, const Dimension& width);
56     static void SetControlButtonHeight(FrameNode* frameNode, const Dimension& height);
57     static void SetControlButtonLeft(FrameNode* frameNode, const Dimension& left);
58     static void SetControlButtonTop(FrameNode* frameNode, const Dimension& top);
59     static void SetControlButtonShowIconInfo(
60         FrameNode* frameNode, const std::string& showIconStr, bool isPixelMap, RefPtr<PixelMap> pixMap);
61     static void SetControlButtonHiddenIconInfo(
62         FrameNode* frameNode, const std::string& hiddenIconStr, bool isPixelMap, RefPtr<PixelMap> pixMap);
63     static void SetControlButtonSwitchingIconInfo(
64         FrameNode* frameNode, const std::string& switchingIconStr, bool isPixelMap, RefPtr<PixelMap> pixMap);
65     static void SetShowControlButton(FrameNode* frameNode, bool showControlButton);
66     static void SetAutoHide(FrameNode* frameNode, bool autoHide);
67     static void SetMaxSideBarWidth(FrameNode* frameNode, const Dimension& maxSideBarWidth);
68     static void SetMinContentWidth(FrameNode* frameNode, const Dimension& minContentWidth);
69     static void SetSideBarPosition(FrameNode* frameNode, SideBarPosition sideBarPosition);
70     static void SetShowSideBar(FrameNode* frameNode, bool isShow);
71 
72     static void SetDividerStrokeWidth(FrameNode* frameNode, const Dimension& strokeWidth);
73     static void SetDividerColor(FrameNode* frameNode, const Color& color);
74     static void SetDividerStartMargin(FrameNode* frameNode, const Dimension& startMargin);
75     static void SetDividerEndMargin(FrameNode* frameNode, const Dimension& endMargin);
76     static void ResetControlButtonLeft(FrameNode* frameNode);
77     static void ResetControlButtonIconInfo(FrameNode* frameNode);
78 private:
79     void MarkNeedInitRealSideBarWidth() override;
80     static void MarkNeedInitRealSideBarWidth(FrameNode* frameNode);
81 };
82 } // namespace OHOS::Ace::NG
83 #endif // FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_PATTERNS_SIDE_BAR_CONTAINER_MODEL_H
84