• 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     std::optional<OHOS::Ace::Shadow> customShadow;
66     ArkUI_Int32 blurStyle;
67     std::optional<OHOS::Ace::BlurStyleOption> blurStyleOption;
68     std::optional<OHOS::Ace::EffectOption> effectOption;
69     OHOS::Ace::KeyboardAvoidMode keyboardAvoidMode;
70     std::optional<ArkUI_Bool> enableHoverMode;
71     OHOS::Ace::HoverModeAreaType hoverModeAreaType;
72     ArkUI_Int32 focusable;
73     ArkUI_Int32* dialogState;
74 };
75 
76 namespace OHOS::Ace::NG::CustomDialog {
77 ArkUIDialogHandle CreateDialog();
78 void DisposeDialog(ArkUIDialogHandle handle);
79 ArkUI_Int32 SetDialogContent(ArkUIDialogHandle handle, ArkUINodeHandle contentNode);
80 ArkUI_Int32 RemoveDialogContent(ArkUIDialogHandle handle);
81 ArkUI_Int32 SetDialogContentAlignment(ArkUIDialogHandle handle,
82     ArkUI_Int32 alignment, ArkUI_Float32 offsetX, ArkUI_Float32 offsetY);
83 ArkUI_Int32 ResetDialogContentAlignment(ArkUIDialogHandle handle);
84 ArkUI_Int32 SetDialogModalMode(ArkUIDialogHandle handle, bool isModal);
85 ArkUI_Int32 SetDialogAutoCancel(ArkUIDialogHandle handle, bool autoCancel);
86 ArkUI_Int32 SetDialogMask(ArkUIDialogHandle handle, ArkUI_Uint32 maskColor, ArkUIRect* rect);
87 ArkUI_Int32 SetDialogBackgroundColor(ArkUIDialogHandle handle, ArkUI_Uint32 backgroundColor);
88 ArkUI_Int32 SetDialogCornerRadius(ArkUIDialogHandle handle, ArkUI_Float32 topLeft, ArkUI_Float32 topRight,
89     ArkUI_Float32 bottomLeft, ArkUI_Float32 bottomRight);
90 ArkUI_Int32 SetDialogGridColumnCount(ArkUIDialogHandle handle, ArkUI_Int32 gridCount);
91 ArkUI_Int32 EnableDialogCustomStyle(ArkUIDialogHandle handle, bool enableCustomStyle);
92 ArkUI_Int32 EnableDialogCustomAnimation(ArkUIDialogHandle handle, bool enableCustomAnimation);
93 ArkUI_Int32 ShowDialog(ArkUIDialogHandle handle, bool showInSubWindow);
94 ArkUI_Int32 CloseDialog(ArkUIDialogHandle handle);
95 ArkUI_Int32 RegisterOnWillDialogDismiss(ArkUIDialogHandle handler, bool (*eventHandler)(ArkUI_Int32));
96 ArkUI_Int32 RegisterOnWillDialogDismissWithUserData(
97     ArkUIDialogHandle handler, void* userData, void (*callback)(ArkUI_DialogDismissEvent* event));
98 ArkUI_Int32 GetDialogState(ArkUIDialogHandle handle, ArkUI_Int32* dialogState);
99 ArkUI_Int32 SetKeyboardAvoidDistance(ArkUIDialogHandle handle, float distance, ArkUI_Int32 unit);
100 ArkUI_Int32 SetLevelMode(ArkUIDialogHandle handle, ArkUI_Int32 mode);
101 ArkUI_Int32 SetLevelUniqueId(ArkUIDialogHandle handle, ArkUI_Int32 uniqueId);
102 ArkUI_Int32 SetImmersiveMode(ArkUIDialogHandle handle, ArkUI_Int32 mode);
103 ArkUI_Int32 SetLevelOrder(ArkUIDialogHandle handle, ArkUI_Float64 levelOrder);
104 ArkUI_Int32 RegisterOnWillAppearDialog(ArkUIDialogHandle handle, void* userData, void (*callback)(void* userData));
105 ArkUI_Int32 RegisterOnDidAppearDialog(ArkUIDialogHandle handle, void* userData, void (*callback)(void* userData));
106 ArkUI_Int32 RegisterOnWillDisappearDialog(ArkUIDialogHandle handle, void* userData, void (*callback)(void* userData));
107 ArkUI_Int32 RegisterOnDidDisappearDialog(ArkUIDialogHandle handle, void* userData, void (*callback)(void* userData));
108 ArkUI_Int32 OpenCustomDialog(ArkUIDialogHandle handle, void (*callback)(ArkUI_Int32 dialogId));
109 ArkUI_Int32 CloseCustomDialog(ArkUI_Int32 dialogId);
110 ArkUI_Int32 UpdateCustomDialog(ArkUIDialogHandle handle, void (*callback)(ArkUI_Int32 dialogId));
111 ArkUI_Int32 SetDialogSubwindowMode(ArkUIDialogHandle handle, bool showInSubWindow);
112 ArkUI_Int32 SetDialogBorderWidth(ArkUIDialogHandle handle, ArkUI_Float32 top, ArkUI_Float32 right, ArkUI_Float32 bottom,
113     ArkUI_Float32 left, ArkUI_Int32 unit);
114 ArkUI_Int32 SetDialogBorderColor(
115     ArkUIDialogHandle handle, ArkUI_Uint32 top, ArkUI_Uint32 right, ArkUI_Uint32 bottom, ArkUI_Uint32 left);
116 ArkUI_Int32 SetDialogBorderStyle(
117     ArkUIDialogHandle controllerHandler, ArkUI_Int32 top, ArkUI_Int32 right, ArkUI_Int32 bottom, ArkUI_Int32 left);
118 ArkUI_Int32 SetWidth(ArkUIDialogHandle handle, float width, ArkUI_Int32 unit);
119 ArkUI_Int32 SetHeight(ArkUIDialogHandle handle, float height, ArkUI_Int32 unit);
120 ArkUI_Int32 SetShadow(ArkUIDialogHandle controllerHandler, ArkUI_Int32 shadow);
121 ArkUI_Int32 SetDialogCustomShadow(
122     ArkUIDialogHandle controllerHandler, const ArkUIInt32orFloat32* shadows, ArkUI_Int32 length);
123 ArkUI_Int32 SetBackgroundBlurStyle(ArkUIDialogHandle controllerHandler, ArkUI_Int32 blurStyle);
124 ArkUI_Int32 SetKeyboardAvoidMode(ArkUIDialogHandle controllerHandler, ArkUI_Int32 keyboardAvoidMode);
125 ArkUI_Int32 EnableHoverMode(ArkUIDialogHandle controllerHandler, bool enableHoverMode);
126 ArkUI_Int32 SetHoverModeArea(ArkUIDialogHandle controllerHandler, ArkUI_Int32 hoverModeAreaType);
127 ArkUI_Int32 SetFocusable(ArkUIDialogHandle handle, bool focusable);
128 ArkUI_Int32 SetBackgroundBlurStyleOptions(ArkUIDialogHandle controllerHandler, ArkUI_Int32 (*intArray)[3],
129     ArkUI_Float32 scale, ArkUI_Uint32 (*uintArray)[3], ArkUI_Bool isValidColor);
130 ArkUI_Int32 SetBackgroundEffect(ArkUIDialogHandle controllerHandler, ArkUI_Float32 (*floatArray)[3],
131     ArkUI_Int32 (*intArray)[2], ArkUI_Uint32 (*uintArray)[4], ArkUI_Bool isValidColor);
132 } // namespace OHOS::Ace::NG::CustomDialog
133 
134 #endif
135