arkui_sys/native_dialog/native_dialog_ffi.rs
1// automatically generated by rust-bindgen 0.71.1
2
3#![allow(non_upper_case_globals)]
4#![allow(non_camel_case_types)]
5#![allow(non_snake_case)]
6use crate::native_type::*;
7
8#[cfg(feature = "api-12")]
9#[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
10impl ArkUI_DismissReason {
11 /// Touching the system-defined Back button or pressing the Esc key.
12 pub const DIALOG_DISMISS_BACK_PRESS: ArkUI_DismissReason = ArkUI_DismissReason(0);
13}
14#[cfg(feature = "api-12")]
15#[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
16impl ArkUI_DismissReason {
17 /// Touching the mask.
18 pub const DIALOG_DISMISS_TOUCH_OUTSIDE: ArkUI_DismissReason = ArkUI_DismissReason(1);
19}
20#[cfg(feature = "api-12")]
21#[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
22impl ArkUI_DismissReason {
23 /// Touching the Close button.
24 pub const DIALOG_DISMISS_CLOSE_BUTTON: ArkUI_DismissReason = ArkUI_DismissReason(2);
25}
26#[cfg(feature = "api-12")]
27#[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
28impl ArkUI_DismissReason {
29 /// Sliding down.
30 pub const DIALOG_DISMISS_SLIDE_DOWN: ArkUI_DismissReason = ArkUI_DismissReason(3);
31}
32#[repr(transparent)]
33/// Enumerates the actions for triggering closure of the dialog box.
34///
35///
36/// Available since API-level: 12
37#[cfg(feature = "api-12")]
38#[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
39#[derive(Clone, Hash, PartialEq, Eq)]
40pub struct ArkUI_DismissReason(pub ::core::ffi::c_uint);
41/// Invoked when the dialog box is closed.
42///
43///
44/// Available since API-level: 12
45#[cfg(feature = "api-12")]
46#[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
47pub type ArkUI_OnWillDismissEvent =
48 ::core::option::Option<unsafe extern "C" fn(reason: i32) -> bool>;
49#[repr(C)]
50pub struct ArkUI_DialogDismissEvent {
51 _unused: [u8; 0],
52}
53/// Provides the custom dialog box APIs for the native side.
54///
55///
56/// Version: 1
57///
58/// Available since API-level: 12
59#[cfg(feature = "api-12")]
60#[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
61#[repr(C)]
62pub struct ArkUI_NativeDialogAPI_1 {
63 /// Creates a custom dialog box and returns the pointer to the created dialog box.
64 ///
65 ///
66 /// **Note:** This method must be called before the <b>show</b> method.
67 ///
68 /// # Returns
69 ///
70 /// * Returns the pointer to the created custom dialog box; returns a null pointer if the creation fails.
71 pub create: ::core::option::Option<unsafe extern "C" fn() -> ArkUI_NativeDialogHandle>,
72 /// Destroys a custom dialog box.
73 ///
74 /// # Arguments
75 ///
76 /// * `handle` - Indicates the pointer to the custom dialog box controller.
77 pub dispose: ::core::option::Option<unsafe extern "C" fn(handle: ArkUI_NativeDialogHandle)>,
78 /// Attaches the content of a custom dialog box.
79 ///
80 ///
81 /// **Note:** This method must be called before the <b>show</b> method.
82 /// # Arguments
83 ///
84 /// * `handle` - Indicates the pointer to the custom dialog box controller.
85 ///
86 /// * `content` - Indicates the pointer to the root node of the custom dialog box content.
87 ///
88 /// # Returns
89 ///
90 /// * Returns the error code.
91 /// Returns [`ARKUI_ERROR_CODE_NO_ERROR`] if the operation is successful.
92 /// Returns [`ARKUI_ERROR_CODE_PARAM_INVALID`] if a parameter error occurs.
93 pub setContent: ::core::option::Option<
94 unsafe extern "C" fn(handle: ArkUI_NativeDialogHandle, content: ArkUI_NodeHandle) -> i32,
95 >,
96 /// Detaches the content of a custom dialog box.
97 ///
98 ///
99 /// **Note:** This method must be called before the <b>show</b> method.
100 /// # Arguments
101 ///
102 /// * `handle` - Indicates the pointer to the custom dialog box controller.
103 ///
104 /// # Returns
105 ///
106 /// * Returns the error code.
107 /// Returns [`ARKUI_ERROR_CODE_NO_ERROR`] if the operation is successful.
108 /// Returns [`ARKUI_ERROR_CODE_PARAM_INVALID`] if a parameter error occurs.
109 pub removeContent:
110 ::core::option::Option<unsafe extern "C" fn(handle: ArkUI_NativeDialogHandle) -> i32>,
111 /// Sets the alignment mode for a custom dialog box.
112 ///
113 ///
114 /// **Note:** This method must be called before the <b>show</b> method.
115 /// # Arguments
116 ///
117 /// * `handle` - Indicates the pointer to the custom dialog box controller.
118 ///
119 /// * `alignment` - Indicates the alignment mode. The parameter type is [`ArkUI_Alignment`].
120 ///
121 /// * `offsetX` - Indicates the horizontal offset of the custom dialog box. The value is a floating point number.
122 ///
123 /// * `offsetY` - Indicates the vertical offset of the custom dialog box. The value is a floating point number.
124 ///
125 /// # Returns
126 ///
127 /// * Returns the error code.
128 /// Returns [`ARKUI_ERROR_CODE_NO_ERROR`] if the operation is successful.
129 /// Returns [`ARKUI_ERROR_CODE_PARAM_INVALID`] if a parameter error occurs.
130 pub setContentAlignment: ::core::option::Option<
131 unsafe extern "C" fn(
132 handle: ArkUI_NativeDialogHandle,
133 alignment: i32,
134 offsetX: f32,
135 offsetY: f32,
136 ) -> i32,
137 >,
138 /// Resets the alignment mode of a custom dialog box to its default settings.
139 ///
140 ///
141 /// **Note:** This method must be called before the <b>show</b> method.
142 /// # Arguments
143 ///
144 /// * `handle` - Indicates the pointer to the custom dialog box controller.
145 ///
146 /// # Returns
147 ///
148 /// * Returns the error code.
149 /// Returns [`ARKUI_ERROR_CODE_NO_ERROR`] if the operation is successful.
150 /// Returns [`ARKUI_ERROR_CODE_PARAM_INVALID`] if a parameter error occurs.
151 pub resetContentAlignment:
152 ::core::option::Option<unsafe extern "C" fn(handle: ArkUI_NativeDialogHandle) -> i32>,
153 /// Sets the modal mode for a custom dialog box.
154 ///
155 ///
156 /// **Note:** This method must be called before the <b>show</b> method.
157 /// # Arguments
158 ///
159 /// * `handle` - Indicates the pointer to the custom dialog box controller.
160 ///
161 /// * `isModal` - Specifies whether the custom dialog box is a modal, which has a mask applied. The value
162 /// <b>true</b> means that the custom dialog box is a modal, and <b>false</b> means the opposite.
163 ///
164 /// # Returns
165 ///
166 /// * Returns the error code.
167 /// Returns [`ARKUI_ERROR_CODE_NO_ERROR`] if the operation is successful.
168 /// Returns [`ARKUI_ERROR_CODE_PARAM_INVALID`] if a parameter error occurs.
169 pub setModalMode: ::core::option::Option<
170 unsafe extern "C" fn(handle: ArkUI_NativeDialogHandle, isModal: bool) -> i32,
171 >,
172 /// Specifies whether to allow users to touch the mask to dismiss the custom dialog box.
173 ///
174 ///
175 /// **Note:** This method must be called before the <b>show</b> method.
176 /// # Arguments
177 ///
178 /// * `handle` - Indicates the pointer to the custom dialog box controller.
179 ///
180 /// * `autoCancel` - Specifies whether to allow users to touch the mask to dismiss the dialog box.
181 /// The value <b>true</b> means to allow users to do so, and <b>false</b> means the opposite.
182 ///
183 /// # Returns
184 ///
185 /// * Returns the error code.
186 /// Returns [`ARKUI_ERROR_CODE_NO_ERROR`] if the operation is successful.
187 /// Returns [`ARKUI_ERROR_CODE_PARAM_INVALID`] if a parameter error occurs.
188 pub setAutoCancel: ::core::option::Option<
189 unsafe extern "C" fn(handle: ArkUI_NativeDialogHandle, autoCancel: bool) -> i32,
190 >,
191 /// Sets the mask for a custom dialog box.
192 ///
193 ///
194 /// **Note:** This method must be called before the <b>show</b> method.
195 /// # Arguments
196 ///
197 /// * `handle` - Indicates the pointer to the custom dialog box controller.
198 ///
199 /// * `maskColor` - Indicates the mask color, in 0xARGB format.
200 ///
201 /// * `maskRect` - Indicates the pointer to the mask area. Events outside the mask area are transparently
202 /// transmitted, and events within the mask area are not. The parameter type is [`ArkUI_Rect`].
203 ///
204 /// # Returns
205 ///
206 /// * Returns the error code.
207 /// Returns [`ARKUI_ERROR_CODE_NO_ERROR`] if the operation is successful.
208 /// Returns [`ARKUI_ERROR_CODE_PARAM_INVALID`] if a parameter error occurs.
209 pub setMask: ::core::option::Option<
210 unsafe extern "C" fn(
211 handle: ArkUI_NativeDialogHandle,
212 maskColor: u32,
213 maskRect: *const ArkUI_Rect,
214 ) -> i32,
215 >,
216 /// Sets the background color for a custom dialog box.
217 ///
218 ///
219 /// **Note:** This method must be called before the <b>show</b> method.
220 /// # Arguments
221 ///
222 /// * `handle` - Indicates the pointer to the custom dialog box controller.
223 ///
224 /// * `backgroundColor` - Indicates the background color of the custom dialog box, in 0xARGB format.
225 ///
226 /// # Returns
227 ///
228 /// * Returns the error code.
229 /// Returns [`ARKUI_ERROR_CODE_NO_ERROR`] if the operation is successful.
230 /// Returns [`ARKUI_ERROR_CODE_PARAM_INVALID`] if a parameter error occurs.
231 pub setBackgroundColor: ::core::option::Option<
232 unsafe extern "C" fn(handle: ArkUI_NativeDialogHandle, backgroundColor: u32) -> i32,
233 >,
234 /// Sets the background corner radius for a custom dialog box.
235 ///
236 ///
237 /// **Note:** This method must be called before the <b>show</b> method.
238 /// # Arguments
239 ///
240 /// * `handle` - Indicates the pointer to the custom dialog box controller.
241 ///
242 /// * `topLeft` - Indicates the radius of the upper left corner of the custom dialog box background.
243 ///
244 /// * `topRight` - Indicates the radius of the upper right corner of the custom dialog box background.
245 ///
246 /// * `bottomLeft` - Indicates the radius of the lower left corner of the custom dialog box background.
247 ///
248 /// * `bottomRight` - Indicates the radius of the lower right corner of the custom dialog box background.
249 ///
250 /// # Returns
251 ///
252 /// * Returns the error code.
253 /// Returns [`ARKUI_ERROR_CODE_NO_ERROR`] if the operation is successful.
254 /// Returns [`ARKUI_ERROR_CODE_PARAM_INVALID`] if a parameter error occurs.
255 pub setCornerRadius: ::core::option::Option<
256 unsafe extern "C" fn(
257 handle: ArkUI_NativeDialogHandle,
258 topLeft: f32,
259 topRight: f32,
260 bottomLeft: f32,
261 bottomRight: f32,
262 ) -> i32,
263 >,
264 /// Sets the number of grid columns occupied by a custom dialog box.
265 ///
266 ///
267 /// **Note:** This method must be called before the <b>show</b> method.
268 /// # Arguments
269 ///
270 /// * `handle` - Indicates the pointer to the custom dialog box controller.
271 ///
272 /// * `gridCount` - Indicates the number of grid columns occupied by the dialog box. The default value is subject to
273 /// the window size, and the maximum value is the maximum number of columns supported by the system.
274 ///
275 /// # Returns
276 ///
277 /// * Returns the error code.
278 /// Returns [`ARKUI_ERROR_CODE_NO_ERROR`] if the operation is successful.
279 /// Returns [`ARKUI_ERROR_CODE_PARAM_INVALID`] if a parameter error occurs.
280 pub setGridColumnCount: ::core::option::Option<
281 unsafe extern "C" fn(handle: ArkUI_NativeDialogHandle, gridCount: i32) -> i32,
282 >,
283 /// Specifies whether to use a custom style for the custom dialog box.
284 ///
285 ///
286 /// **Note:** This method must be called before the <b>show</b> method.
287 /// # Arguments
288 ///
289 /// * `handle` - Indicates the pointer to the custom dialog box controller.
290 ///
291 /// * `enableCustomStyle` - Specifies whether to use a custom style for the dialog box.
292 /// <b>true</b>: The dialog box automatically adapts its width to the child components; the rounded corner is 0;
293 /// the background color is transparent.
294 /// <b>false</b>: The dialog box automatically adapts its width to the grid system and its height to the child
295 /// components; the rounded corner is 24 vp.
296 ///
297 /// # Returns
298 ///
299 /// * Returns the error code.
300 /// Returns [`ARKUI_ERROR_CODE_NO_ERROR`] if the operation is successful.
301 /// Returns [`ARKUI_ERROR_CODE_PARAM_INVALID`] if a parameter error occurs.
302 pub enableCustomStyle: ::core::option::Option<
303 unsafe extern "C" fn(handle: ArkUI_NativeDialogHandle, enableCustomStyle: bool) -> i32,
304 >,
305 /// Specifies whether to use a custom animation for a custom dialog box.
306 ///
307 ///
308 /// **Note:** This method must be called before the <b>show</b> method.
309 /// # Arguments
310 ///
311 /// * `handle` - Indicates the pointer to the custom dialog box controller.
312 ///
313 /// * `enableCustomAnimation` - Specifies whether to use a custom animation. The value <b>true</b> means to use a
314 /// custom animation, and <b>false</b> means to use the default animation.
315 ///
316 /// # Returns
317 ///
318 /// * Returns the error code.
319 /// Returns [`ARKUI_ERROR_CODE_NO_ERROR`] if the operation is successful.
320 /// Returns [`ARKUI_ERROR_CODE_PARAM_INVALID`] if a parameter error occurs.
321 pub enableCustomAnimation: ::core::option::Option<
322 unsafe extern "C" fn(handle: ArkUI_NativeDialogHandle, enableCustomAnimation: bool) -> i32,
323 >,
324 /// Registers a callback for a custom dialog box so that the user can decide whether to close the dialog box
325 /// after they touch the Back button or press the Esc key.
326 ///
327 ///
328 /// **Note:** This method must be called before the <b>show</b> method.
329 /// # Arguments
330 ///
331 /// * `handle` - Indicates the pointer to the custom dialog box controller.
332 ///
333 /// * `eventHandler` - Indicates the callback to register. The parameter type is [`ArkUI_OnWillDismissEvent`].
334 ///
335 /// # Returns
336 ///
337 /// * Returns the error code.
338 /// Returns [`ARKUI_ERROR_CODE_NO_ERROR`] if the operation is successful.
339 /// Returns [`ARKUI_ERROR_CODE_PARAM_INVALID`] if a parameter error occurs.
340 pub registerOnWillDismiss: ::core::option::Option<
341 unsafe extern "C" fn(
342 handle: ArkUI_NativeDialogHandle,
343 eventHandler: ArkUI_OnWillDismissEvent,
344 ) -> i32,
345 >,
346 /// Shows a custom dialog box.
347 ///
348 /// # Arguments
349 ///
350 /// * `handle` - Indicates the pointer to the custom dialog box controller.
351 ///
352 /// * `showInSubWindow` - Specifies whether to show the dialog box in a sub-window.
353 ///
354 /// # Returns
355 ///
356 /// * Returns the error code.
357 /// Returns [`ARKUI_ERROR_CODE_NO_ERROR`] if the operation is successful.
358 /// Returns [`ARKUI_ERROR_CODE_PARAM_INVALID`] if a parameter error occurs.
359 pub show: ::core::option::Option<
360 unsafe extern "C" fn(handle: ArkUI_NativeDialogHandle, showInSubWindow: bool) -> i32,
361 >,
362 /// Closes a custom dialog box. If the dialog box has been closed, this API does not take effect.
363 ///
364 /// # Arguments
365 ///
366 /// * `handle` - Indicates the pointer to the custom dialog box controller.
367 ///
368 /// # Returns
369 ///
370 /// * Returns the error code.
371 /// Returns [`ARKUI_ERROR_CODE_NO_ERROR`] if the operation is successful.
372 /// Returns [`ARKUI_ERROR_CODE_PARAM_INVALID`] if a parameter error occurs.
373 pub close:
374 ::core::option::Option<unsafe extern "C" fn(handle: ArkUI_NativeDialogHandle) -> i32>,
375 /// Registers a listener for the dismiss event of the custom dialog box.
376 ///
377 /// # Arguments
378 ///
379 /// * `handle` - Indicates the pointer to the custom dialog box controller.
380 ///
381 /// * `userData` - Indicates the pointer to the custom data.
382 ///
383 /// * `callback` - Indicates the callback for the dismiss event of the custom dialog box.
384 ///
385 /// # Returns
386 ///
387 /// * Returns the result code.
388 /// Returns [`ARKUI_ERROR_CODE_NO_ERROR`] if the operation is successful.
389 /// Returns [`ARKUI_ERROR_CODE_PARAM_INVALID`] if a parameter error occurs.
390 pub registerOnWillDismissWithUserData: ::core::option::Option<
391 unsafe extern "C" fn(
392 handle: ArkUI_NativeDialogHandle,
393 userData: *mut ::core::ffi::c_void,
394 callback: ::core::option::Option<
395 unsafe extern "C" fn(event: *mut ArkUI_DialogDismissEvent),
396 >,
397 ) -> i32,
398 >,
399}
400extern "C" {
401 /// Sets whether to block the system behavior of dismissing a dialog box.
402 ///
403 /// # Arguments
404 ///
405 /// * `event` - Indicates the pointer to a dialog box dismiss event object.
406 ///
407 /// * `shouldBlockDismiss` - Indicates whether to block the system behavior of dismissing the dialog box. The value
408 /// <b>true</b> means to block the system behavior, and <b>false</b> means the opposite.
409 ///
410 /// Available since API-level: 12
411 #[cfg(feature = "api-12")]
412 #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
413 pub fn OH_ArkUI_DialogDismissEvent_SetShouldBlockDismiss(
414 event: *mut ArkUI_DialogDismissEvent,
415 shouldBlockDismiss: bool,
416 );
417 /// Obtains the pointer to user data in a dialog box dismiss event object.
418 ///
419 /// # Arguments
420 ///
421 /// * `event` - Indicates the pointer to a dialog box dismiss event object.
422 ///
423 ///
424 /// # Returns
425 ///
426 /// * Returns the pointer to user data.
427 ///
428 /// Available since API-level: 12
429 #[cfg(feature = "api-12")]
430 #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
431 pub fn OH_ArkUI_DialogDismissEvent_GetUserData(
432 event: *mut ArkUI_DialogDismissEvent,
433 ) -> *mut ::core::ffi::c_void;
434 /// Obtains the c from a dialog box dismiss event object.
435 ///
436 /// # Arguments
437 ///
438 /// * `event` - Indicates the pointer to a dialog box dismiss event object.
439 ///
440 ///
441 /// # Returns
442 ///
443 /// * Returns the dismissal reason. Returns <b>-1</b> if an exception occurs.
444 /// [`DIALOG_DISMISS_BACK_PRESS`]: touching the Back button, swiping left or right on the screen, or
445 /// pressing the Esc key.
446 /// [`DIALOG_DISMISS_TOUCH_OUTSIDE`]: touching the mask.
447 /// [`DIALOG_DISMISS_CLOSE_BUTTON`]: touching the Close button.
448 /// [`DIALOG_DISMISS_SLIDE_DOWN`]: sliding down.
449 ///
450 /// Available since API-level: 12
451 #[cfg(feature = "api-12")]
452 #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
453 pub fn OH_ArkUI_DialogDismissEvent_GetDismissReason(
454 event: *mut ArkUI_DialogDismissEvent,
455 ) -> i32;
456}