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 OHOS_ACE_FRAMEWORK_CJ_ALERT_DIALOG_FFI_H 17 #define OHOS_ACE_FRAMEWORK_CJ_ALERT_DIALOG_FFI_H 18 19 #include <cstdint> 20 21 #include "bridge/cj_frontend/interfaces/cj_ffi/cj_common_ffi.h" 22 #include "bridge/cj_frontend/interfaces/cj_ffi/cj_macro.h" 23 24 extern "C" { 25 struct NativeRectangle { 26 double x; 27 int32_t xUnit; 28 double y; 29 int32_t yUnit; 30 double width; 31 int32_t widthUnit; 32 double height; 33 int32_t heightUnit; 34 }; 35 36 struct NativeAlertDialogButtonOptions { 37 bool enabled; 38 bool defaultFocus; 39 int32_t* style; 40 char* value; 41 uint32_t* fontColor; 42 uint32_t* backgroundColor; 43 void (*action)(); 44 }; 45 46 struct NativeAlertDialogParam { 47 char* title; 48 char* subtitle; 49 char* message; 50 bool autoCancel; 51 void (*cancel)(); 52 int32_t alignment; 53 NativeOffset offset; 54 int32_t gridCount; 55 NativeRectangle maskRect; 56 bool showInSubWindow; 57 bool isModal; 58 uint32_t backgroundColor; 59 int32_t backgroundBlurStyle; 60 }; 61 62 struct CArrNativeAlertDialogButtonOptions { 63 NativeAlertDialogButtonOptions* head; 64 int32_t size; 65 }; 66 67 CJ_EXPORT void FfiOHOSShowAlertDialogParamWithConfirm( 68 NativeAlertDialogParam alertDialog, 69 NativeAlertDialogButtonOptions confirm); 70 71 CJ_EXPORT void FfiOHOSShowAlertDialogParamWithButtons( 72 NativeAlertDialogParam alertDialog, 73 NativeAlertDialogButtonOptions primaryButton, 74 NativeAlertDialogButtonOptions secondaryButton); 75 76 CJ_EXPORT void FfiOHOSShowAlertDialogParamWithOptions( 77 NativeAlertDialogParam alertDialog, 78 CArrNativeAlertDialogButtonOptions buttons, 79 int32_t buttonDirection); 80 } 81 82 #endif // OHOS_ACE_FRAMEWORK_CJ_ALERT_DIALOG_FFI_H 83