• 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 
22 struct _ArkUIDialog {
23     void* dialogHandle;
24     void* contentHandle;
25     ArkUI_Int32 alignment;
26     ArkUI_Float32 offsetX;
27     ArkUI_Float32 offsetY;
28     ArkUI_Int32 isModal;
29     ArkUI_Int32 autoCancel;
30     ArkUI_Uint32 maskColor;
31     ArkUIRect* maskRect;
32     ArkUI_Uint32 backgroundColor;
33     ArkUICornerRadius* cornerRadiusRect;
34     ArkUI_Int32 gridCount;
35     ArkUI_Int32 enableCustomStyle;
36     ArkUI_Int32 showInSubWindow;
37     ArkUI_Bool enableCustomAnimation;
38     bool (*onWillDismissCall)(ArkUI_Int32);
39     void (*onWillDismissCallByNDK)(ArkUI_DialogDismissEvent*);
40     void* userData;
41     std::optional<ArkUI_Float32> keyboardAvoidDistanceValue;
42     OHOS::Ace::DimensionUnit keyboardAvoidDistanceUnit;
43     ArkUI_Int32 levelMode;
44     ArkUI_Int32 levelUniqueId;
45     ArkUI_Int32 immersiveMode;
46 };
47 
48 namespace OHOS::Ace::NG::CustomDialog {
49 ArkUIDialogHandle CreateDialog();
50 void DisposeDialog(ArkUIDialogHandle handle);
51 ArkUI_Int32 SetDialogContent(ArkUIDialogHandle handle, ArkUINodeHandle contentNode);
52 ArkUI_Int32 RemoveDialogContent(ArkUIDialogHandle handle);
53 ArkUI_Int32 SetDialogContentAlignment(ArkUIDialogHandle handle,
54     ArkUI_Int32 alignment, ArkUI_Float32 offsetX, ArkUI_Float32 offsetY);
55 ArkUI_Int32 ResetDialogContentAlignment(ArkUIDialogHandle handle);
56 ArkUI_Int32 SetDialogModalMode(ArkUIDialogHandle handle, bool isModal);
57 ArkUI_Int32 SetDialogAutoCancel(ArkUIDialogHandle handle, bool autoCancel);
58 ArkUI_Int32 SetDialogMask(ArkUIDialogHandle handle, ArkUI_Uint32 maskColor, ArkUIRect* rect);
59 ArkUI_Int32 SetDialogBackgroundColor(ArkUIDialogHandle handle, ArkUI_Uint32 backgroundColor);
60 ArkUI_Int32 SetDialogCornerRadius(ArkUIDialogHandle handle, ArkUI_Float32 topLeft, ArkUI_Float32 topRight,
61     ArkUI_Float32 bottomLeft, ArkUI_Float32 bottomRight);
62 ArkUI_Int32 SetDialogGridColumnCount(ArkUIDialogHandle handle, ArkUI_Int32 gridCount);
63 ArkUI_Int32 EnableDialogCustomStyle(ArkUIDialogHandle handle, bool enableCustomStyle);
64 ArkUI_Int32 EnableDialogCustomAnimation(ArkUIDialogHandle handle, bool enableCustomAnimation);
65 ArkUI_Int32 ShowDialog(ArkUIDialogHandle handle, bool showInSubWindow);
66 ArkUI_Int32 CloseDialog(ArkUIDialogHandle handle);
67 ArkUI_Int32 RegisterOnWillDialogDismiss(ArkUIDialogHandle handler, bool (*eventHandler)(ArkUI_Int32));
68 ArkUI_Int32 RegisterOnWillDialogDismissWithUserData(
69     ArkUIDialogHandle handler, void* userData, void (*callback)(ArkUI_DialogDismissEvent* event));
70 ArkUI_Int32 SetKeyboardAvoidDistance(ArkUIDialogHandle handle, float distance, ArkUI_Int32 unit);
71 ArkUI_Int32 SetLevelMode(ArkUIDialogHandle handle, ArkUI_Int32 mode);
72 ArkUI_Int32 SetLevelUniqueId(ArkUIDialogHandle handle, ArkUI_Int32 uniqueId);
73 ArkUI_Int32 SetImmersiveMode(ArkUIDialogHandle handle, ArkUI_Int32 mode);
74 } // namespace OHOS::Ace::NG::CustomDialog
75 
76 #endif
77