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_INTERFACE_INNERKITS_ACE_POPUP_CONFIG_H
17 #define FOUNDATION_ACE_INTERFACE_INNERKITS_ACE_POPUP_CONFIG_H
18 
19 #include <optional>
20 #include <string>
21 
22 namespace OHOS::Ace {
23 enum class PopupPlacement {
24     LEFT,
25     RIGHT,
26     TOP,
27     BOTTOM,
28     TOP_LEFT,
29     TOP_RIGHT,
30     BOTTOM_LEFT,
31     BOTTOM_RIGHT,
32     LEFT_TOP,
33     LEFT_BOTTOM,
34     RIGHT_TOP,
35     RIGHT_BOTTOM,
36     NONE,
37 };
38 
39 enum class PopupDimensionUnit {
40     PX = 0,
41     VP,
42     FP,
43     PERCENT,
44     LPX,
45     AUTO,
46     CALC,
47 };
48 
49 struct PopupOffset {
50     PopupDimensionUnit unit = PopupDimensionUnit::PX;
51     double deltaX = 0.0;
52     double deltaY = 0.0;
53 };
54 
55 struct PopupSize {
56     PopupDimensionUnit unit = PopupDimensionUnit::PX;
57     double width = 0.0;
58     double height = 0.0;
59 };
60 
61 struct PopupLength {
62     PopupDimensionUnit unit = PopupDimensionUnit::PX;
63     double length = 0.0;
64 };
65 
66 struct CustomPopupUIExtensionConfig {
67     bool isShowInSubWindow = true;
68     bool isFocusable = true;
69     std::int32_t nodeId = -1;
70     std::string inspectorId;
71     std::optional<bool> isAutoCancel;
72     std::optional<bool> isEnableArrow;
73     std::optional<PopupSize> targetSize;
74     std::optional<PopupOffset> targetOffset;
75     std::optional<PopupLength> targetSpace;
76     std::optional<PopupLength> arrowOffset;
77     std::optional<PopupPlacement> placement;
78     std::optional<int32_t> backgroundColor;
79     std::optional<int32_t> maskColor;
80     std::function<void(const std::string&)> onStateChange;
81 };
82 } // namespace OHOS::Ace
83 #endif // FOUNDATION_ACE_INTERFACE_INNERKITS_ACE_POPUP_CONFIG_H