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 int32_t SetKeyboardAvoidDistance(ArkUI_NativeDialogHandle handle, float distance, ArkUI_LengthMetricUnit unit); 63 int32_t SetLevelMode(ArkUI_NativeDialogHandle handle, ArkUI_LevelMode levelMode); 64 int32_t SetLevelUniqueId(ArkUI_NativeDialogHandle handle, int32_t uniqueId); 65 int32_t SetImmersiveMode(ArkUI_NativeDialogHandle handle, ArkUI_ImmersiveMode immersiveMode); 66 int32_t SetLevelOrder(ArkUI_NativeDialogHandle handle, double levelOrder); 67 int32_t RegisterOnWillAppear(ArkUI_NativeDialogHandle handle, void* userData, void (*callback)(void* userData)); 68 int32_t RegisterOnDidAppear(ArkUI_NativeDialogHandle handle, void* userData, void (*callback)(void* userData)); 69 int32_t RegisterOnWillDisappear(ArkUI_NativeDialogHandle handle, void* userData, void (*callback)(void* userData)); 70 int32_t RegisterOnDidDisappear(ArkUI_NativeDialogHandle handle, void* userData, void (*callback)(void* userData)); 71 int32_t SetBorderWidth( 72 ArkUI_NativeDialogHandle handle, float top, float right, float bottom, float left, ArkUI_LengthMetricUnit unit); 73 int32_t SetBorderColor(ArkUI_NativeDialogHandle handle, uint32_t top, uint32_t right, uint32_t bottom, uint32_t left); 74 int32_t SetBorderStyle(ArkUI_NativeDialogHandle handle, int32_t top, int32_t right, int32_t bottom, int32_t left); 75 int32_t SetWidth(ArkUI_NativeDialogHandle handle, float width, ArkUI_LengthMetricUnit unit); 76 int32_t SetHeight(ArkUI_NativeDialogHandle handle, float height, ArkUI_LengthMetricUnit unit); 77 int32_t SetShadow(ArkUI_NativeDialogHandle handle, ArkUI_ShadowStyle shadow); 78 int32_t SetCustomShadow(ArkUI_NativeDialogHandle handle, const ArkUI_AttributeItem* customShadow); 79 int32_t SetBackgroundBlurStyle(ArkUI_NativeDialogHandle handle, ArkUI_BlurStyle blurStyle); 80 int32_t SetKeyboardAvoidMode(ArkUI_NativeDialogHandle handle, ArkUI_KeyboardAvoidMode keyboardAvoidMode); 81 int32_t EnableHoverMode(ArkUI_NativeDialogHandle handle, bool enableHoverMode); 82 int32_t SetHoverModeArea(ArkUI_NativeDialogHandle handle, ArkUI_HoverModeAreaType hoverModeAreaType); 83 int32_t SetFocusable(ArkUI_NativeDialogHandle handle, bool focusable); 84 int32_t SetBackgroundBlurStyleOptions(ArkUI_NativeDialogHandle handle, const ArkUI_AttributeItem* customShadow); 85 int32_t SetBackgroundEffect(ArkUI_NativeDialogHandle handle, const ArkUI_AttributeItem* customShadow); 86 } // namespace OHOS::Ace::NG::DialogModel 87 88 #endif // ARKUI_NATIVE_NODE_DIALOG_MODEL_H