• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 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 FRAMEWORKS_INTERFACE_INNER_API_NATIVE_NODE_CUSTOM_DIALOG_MODEL_H
17 #define FRAMEWORKS_INTERFACE_INNER_API_NATIVE_NODE_CUSTOM_DIALOG_MODEL_H
18 
19 #include "core/interfaces/arkoala/arkoala_api.h"
20 #include "base/geometry/dimension.h"
21 #include "frameworks/core/components/common/properties/shadow.h"
22 #include "frameworks/core/components/dialog/dialog_properties.h"
23 
24 struct _ArkUIDialog {
25     void* dialogHandle;
26     void* contentHandle;
27     ArkUI_Int32 alignment;
28     ArkUI_Float32 offsetX;
29     ArkUI_Float32 offsetY;
30     ArkUI_Int32 isModal;
31     ArkUI_Int32 autoCancel;
32     ArkUI_Uint32 maskColor;
33     ArkUIRect* maskRect;
34     ArkUI_Uint32 backgroundColor;
35     ArkUICornerRadius* cornerRadiusRect;
36     ArkUI_Int32 gridCount;
37     ArkUI_Int32 enableCustomStyle;
38     ArkUI_Int32 showInSubWindow;
39     ArkUI_Bool enableCustomAnimation;
40     bool (*onWillDismissCall)(ArkUI_Int32);
41     void (*onWillDismissCallByNDK)(ArkUI_DialogDismissEvent*);
42     void* userData;
43     std::optional<ArkUI_Float32> keyboardAvoidDistanceValue;
44     OHOS::Ace::DimensionUnit keyboardAvoidDistanceUnit;
45     ArkUI_Int32 levelMode;
46     ArkUI_Int32 levelUniqueId;
47     ArkUI_Int32 immersiveMode;
48     ArkUI_Float64 levelOrder;
49     void* onWillAppearData;
50     void* onDidAppearData;
51     void* onWillDisappearData;
52     void* onDidDisappearData;
53     void (*onWillAppear)(void*);
54     void (*onDidAppear)(void*);
55     void (*onWillDisappear)(void*);
56     void (*onDidDisappear)(void*);
57     ArkUIBorderWidth* borderWidthEdgeWidths;
58     OHOS::Ace::DimensionUnit borderWidthUnit;
59     ArkUIBorderColor* borderColors;
60     ArkUIBorderStyle* borderStyles;
61     std::optional<ArkUI_Float32> widthValue;
62     OHOS::Ace::DimensionUnit widthUnit;
63     std::optional<ArkUI_Float32> heightValue;
64     OHOS::Ace::DimensionUnit heightUnit;
65     OHOS::Ace::ShadowStyle shadowStyle;
66     OHOS::Ace::Shadow customShadow;
67     ArkUI_Int32 blurStyle;
68     OHOS::Ace::KeyboardAvoidMode keyboardAvoidMode;
69     ArkUI_Bool enableHoverMode;
70     OHOS::Ace::HoverModeAreaType hoverModeAreaType;
71     ArkUI_Int32 focusable;
72 };
73 
74 namespace OHOS::Ace::NG::CustomDialog {
75 ArkUIDialogHandle CreateDialog();
76 void DisposeDialog(ArkUIDialogHandle handle);
77 ArkUI_Int32 SetDialogContent(ArkUIDialogHandle handle, ArkUINodeHandle contentNode);
78 ArkUI_Int32 RemoveDialogContent(ArkUIDialogHandle handle);
79 ArkUI_Int32 SetDialogContentAlignment(ArkUIDialogHandle handle,
80     ArkUI_Int32 alignment, ArkUI_Float32 offsetX, ArkUI_Float32 offsetY);
81 ArkUI_Int32 ResetDialogContentAlignment(ArkUIDialogHandle handle);
82 ArkUI_Int32 SetDialogModalMode(ArkUIDialogHandle handle, bool isModal);
83 ArkUI_Int32 SetDialogAutoCancel(ArkUIDialogHandle handle, bool autoCancel);
84 ArkUI_Int32 SetDialogMask(ArkUIDialogHandle handle, ArkUI_Uint32 maskColor, ArkUIRect* rect);
85 ArkUI_Int32 SetDialogBackgroundColor(ArkUIDialogHandle handle, ArkUI_Uint32 backgroundColor);
86 ArkUI_Int32 SetDialogCornerRadius(ArkUIDialogHandle handle, ArkUI_Float32 topLeft, ArkUI_Float32 topRight,
87     ArkUI_Float32 bottomLeft, ArkUI_Float32 bottomRight);
88 ArkUI_Int32 SetDialogGridColumnCount(ArkUIDialogHandle handle, ArkUI_Int32 gridCount);
89 ArkUI_Int32 EnableDialogCustomStyle(ArkUIDialogHandle handle, bool enableCustomStyle);
90 ArkUI_Int32 EnableDialogCustomAnimation(ArkUIDialogHandle handle, bool enableCustomAnimation);
91 ArkUI_Int32 ShowDialog(ArkUIDialogHandle handle, bool showInSubWindow);
92 ArkUI_Int32 CloseDialog(ArkUIDialogHandle handle);
93 ArkUI_Int32 RegisterOnWillDialogDismiss(ArkUIDialogHandle handler, bool (*eventHandler)(ArkUI_Int32));
94 ArkUI_Int32 RegisterOnWillDialogDismissWithUserData(
95     ArkUIDialogHandle handler, void* userData, void (*callback)(ArkUI_DialogDismissEvent* event));
96 ArkUI_Int32 SetKeyboardAvoidDistance(ArkUIDialogHandle handle, float distance, ArkUI_Int32 unit);
97 ArkUI_Int32 SetLevelMode(ArkUIDialogHandle handle, ArkUI_Int32 mode);
98 ArkUI_Int32 SetLevelUniqueId(ArkUIDialogHandle handle, ArkUI_Int32 uniqueId);
99 ArkUI_Int32 SetImmersiveMode(ArkUIDialogHandle handle, ArkUI_Int32 mode);
100 ArkUI_Int32 SetLevelOrder(ArkUIDialogHandle handle, ArkUI_Float64 levelOrder);
101 ArkUI_Int32 RegisterOnWillAppearDialog(ArkUIDialogHandle handle, void* userData, void (*callback)(void* userData));
102 ArkUI_Int32 RegisterOnDidAppearDialog(ArkUIDialogHandle handle, void* userData, void (*callback)(void* userData));
103 ArkUI_Int32 RegisterOnWillDisappearDialog(ArkUIDialogHandle handle, void* userData, void (*callback)(void* userData));
104 ArkUI_Int32 RegisterOnDidDisappearDialog(ArkUIDialogHandle handle, void* userData, void (*callback)(void* userData));
105 ArkUI_Int32 OpenCustomDialog(ArkUIDialogHandle handle, void (*callback)(ArkUI_Int32 dialogId));
106 ArkUI_Int32 CloseCustomDialog(ArkUI_Int32 dialogId);
107 ArkUI_Int32 UpdateCustomDialog(ArkUIDialogHandle handle, void (*callback)(ArkUI_Int32 dialogId));
108 ArkUI_Int32 SetDialogSubwindowMode(ArkUIDialogHandle handle, bool showInSubWindow);
109 ArkUI_Int32 SetDialogBorderWidth(ArkUIDialogHandle handle, ArkUI_Float32 top, ArkUI_Float32 right, ArkUI_Float32 bottom,
110     ArkUI_Float32 left, ArkUI_Int32 unit);
111 ArkUI_Int32 SetDialogBorderColor(
112     ArkUIDialogHandle handle, ArkUI_Uint32 top, ArkUI_Uint32 right, ArkUI_Uint32 bottom, ArkUI_Uint32 left);
113 ArkUI_Int32 SetDialogBorderStyle(
114     ArkUIDialogHandle controllerHandler, ArkUI_Int32 top, ArkUI_Int32 right, ArkUI_Int32 bottom, ArkUI_Int32 left);
115 ArkUI_Int32 SetWidth(ArkUIDialogHandle handle, float width, ArkUI_Int32 unit);
116 ArkUI_Int32 SetHeight(ArkUIDialogHandle handle, float height, ArkUI_Int32 unit);
117 ArkUI_Int32 SetShadow(ArkUIDialogHandle controllerHandler, ArkUI_Int32 shadow);
118 ArkUI_Int32 SetDialogCustomShadow(
119     ArkUIDialogHandle controllerHandler, const ArkUIInt32orFloat32* shadows, ArkUI_Int32 length);
120 ArkUI_Int32 SetBackgroundBlurStyle(ArkUIDialogHandle controllerHandler, ArkUI_Int32 blurStyle);
121 ArkUI_Int32 SetKeyboardAvoidMode(ArkUIDialogHandle controllerHandler, ArkUI_Int32 keyboardAvoidMode);
122 ArkUI_Int32 EnableHoverMode(ArkUIDialogHandle controllerHandler, bool enableHoverMode);
123 ArkUI_Int32 SetHoverModeArea(ArkUIDialogHandle controllerHandler, ArkUI_Int32 hoverModeAreaType);
124 ArkUI_Int32 SetFocusable(ArkUIDialogHandle handle, bool focusable);
125 } // namespace OHOS::Ace::NG::CustomDialog
126 
127 #endif
128