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 ARKUI_NATIVE_NODE_DIALOG_MODEL_H
17 #define ARKUI_NATIVE_NODE_DIALOG_MODEL_H
18 
19 #include "native_dialog.h"
20 #include "native_type.h"
21 #include "frameworks/core/interfaces/arkoala/arkoala_api.h"
22 
23 #ifdef __cplusplus
24 extern "C" {
25 #endif
26 
27 struct ArkUI_NativeDialog {
28     ArkUIDialogHandle controller = nullptr;
29 };
30 
31 struct ArkUI_DialogDismissEvent {
32     void* userData;
33     int32_t reason = -1;
34     bool BlockDismiss = false;
35 };
36 
37 #ifdef __cplusplus
38 };
39 #endif
40 
41 namespace OHOS::Ace::DialogModel {
42 ArkUI_NativeDialogHandle Create();
43 void Dispose(ArkUI_NativeDialogHandle handle);
44 int32_t SetContent(ArkUI_NativeDialogHandle handle, ArkUI_NodeHandle content);
45 int32_t RemoveContent(ArkUI_NativeDialogHandle handle);
46 int32_t SetContentAlignment(ArkUI_NativeDialogHandle handle, int32_t alignment, float offsetX, float offsetY);
47 int32_t ResetContentAlignment(ArkUI_NativeDialogHandle handle);
48 int32_t SetModalMode(ArkUI_NativeDialogHandle handle, bool isModal);
49 int32_t SetAutoCancel(ArkUI_NativeDialogHandle handle, bool autoCancel);
50 int32_t SetMask(ArkUI_NativeDialogHandle handle, uint32_t maskColor, const ArkUI_Rect* rect);
51 int32_t SetBackgroundColor(ArkUI_NativeDialogHandle handle, uint32_t backgroundColor);
52 int32_t SetCornerRadius(ArkUI_NativeDialogHandle handle, float topLeft, float topRight,
53     float bottomLeft, float bottomRight);
54 int32_t SetGridColumnCount(ArkUI_NativeDialogHandle handle, int32_t gridCount);
55 int32_t EnableCustomStyle(ArkUI_NativeDialogHandle handle, bool enableCustomStyle);
56 int32_t EnableCustomAnimation(ArkUI_NativeDialogHandle handle, bool enableCustomAnimation);
57 int32_t RegisterOnWillDismiss(ArkUI_NativeDialogHandle handle, ArkUI_OnWillDismissEvent eventHandler);
58 int32_t Show(ArkUI_NativeDialogHandle handle, bool showInSubWindow);
59 int32_t Close(ArkUI_NativeDialogHandle handle);
60 int32_t RegisterOnWillDismissWithUserData(
61     ArkUI_NativeDialogHandle handle, void* userData, void (*callback)(ArkUI_DialogDismissEvent* event));
62 } // namespace OHOS::Ace::NG::DialogModel
63 
64 #endif // ARKUI_NATIVE_NODE_DIALOG_MODEL_H