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