arkui_sys/native_node_napi/
native_node_napi_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::drawable_descriptor::ArkUI_DrawableDescriptor;
7use crate::native_type::*;
8use ohos_sys_opaque_types::{napi_env, napi_value};
9
10extern "C" {
11    /// Obtains a <b>FrameNode</b> object on the ArkTS side and maps it to an <b>ArkUI_NodeHandle</b> object on the
12    /// native side.
13    ///
14    /// # Arguments
15    ///
16    /// * `env` - Indicates the NAPI environment pointer.
17    ///
18    /// * `frameNode` - Indicates the <b>FrameNode</b> object created on the ArkTS side.
19    ///
20    /// * `handle` - Indicates the pointer to the <b>ArkUI_NodeHandle</b> object.
21    ///
22    /// # Returns
23    ///
24    /// * Returns the error code.
25    /// Returns [`ARKUI_ERROR_CODE_NO_ERROR`] if the operation is successful.
26    /// Returns [`ARKUI_ERROR_CODE_PARAM_INVALID`] if a parameter error occurs.
27    ///
28    /// Available since API-level: 12
29    #[cfg(feature = "api-12")]
30    #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
31    pub fn OH_ArkUI_GetNodeHandleFromNapiValue(
32        env: napi_env,
33        frameNode: napi_value,
34        handle: *mut ArkUI_NodeHandle,
35    ) -> i32;
36    /// Obtains a <b>UIContext</b> object on the ArkTS side and maps it to an <b>ArkUI_ContextHandle</b> object on the
37    /// native side.
38    ///
39    /// # Arguments
40    ///
41    /// * `env` - ndicates the NAPI environment pointer.
42    ///
43    /// * `value` - Indicates the <b>UIContext</b> object created on the ArkTS side.
44    ///
45    /// * `context` - Indicates the pointer to the <b>ArkUI_ContextHandle</b> object.
46    ///
47    /// # Returns
48    ///
49    /// * Returns the error code.
50    /// Returns [`ARKUI_ERROR_CODE_NO_ERROR`] if the operation is successful.
51    /// Returns [`ARKUI_ERROR_CODE_PARAM_INVALID`] if a parameter error occurs.
52    ///
53    /// Available since API-level: 12
54    #[cfg(feature = "api-12")]
55    #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
56    pub fn OH_ArkUI_GetContextFromNapiValue(
57        env: napi_env,
58        value: napi_value,
59        context: *mut ArkUI_ContextHandle,
60    ) -> i32;
61    /// Obtains a <b>NodeContent</b> object on the ArkTS side and maps it to an <b>ArkUI_NodeContentHandle</b>
62    /// object on the native side.
63    ///
64    /// # Arguments
65    ///
66    /// * `env` - ndicates the NAPI environment pointer.
67    ///
68    /// * `value` - Indicates the <b>NodeContent</b> object created on the ArkTS side.
69    ///
70    /// * `content` - Indicates the pointer to the <b>ArkUI_NodeContentHandle</b> object.
71    ///
72    /// # Returns
73    ///
74    /// * Returns the error code.
75    /// Returns [`ARKUI_ERROR_CODE_NO_ERROR`] if the operation is successful.
76    /// Returns [`ARKUI_ERROR_CODE_PARAM_INVALID`] if a parameter error occurs.
77    ///
78    /// Available since API-level: 12
79    #[cfg(feature = "api-12")]
80    #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
81    pub fn OH_ArkUI_GetNodeContentFromNapiValue(
82        env: napi_env,
83        value: napi_value,
84        content: *mut ArkUI_NodeContentHandle,
85    ) -> i32;
86    /// Obtains a <b>DrawableDescriptor</b> object on the ArkTS side and maps it to an
87    /// <b>ArkUI_DrawableDescriptro</b> object on the native side.
88    ///
89    /// # Arguments
90    ///
91    /// * `env` - Indicates the NAPI environment pointer.
92    ///
93    /// * `value` - Indicates the <b>DrawableDescriptor</b> object created on the ArkTS side.
94    ///
95    /// * `drawableDescriptor` - Indicates the pointer to the <b>ArkUI_DrawableDescriptro</b> object.
96    ///
97    /// # Returns
98    ///
99    /// * Returns the error code.
100    /// Returns [`ARKUI_ERROR_CODE_NO_ERROR`] if the operation is successful.
101    /// Returns [`ARKUI_ERROR_CODE_PARAM_INVALID`] if a parameter error occurs.
102    ///
103    /// Available since API-level: 12
104    #[cfg(feature = "api-12")]
105    #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
106    pub fn OH_ArkUI_GetDrawableDescriptorFromNapiValue(
107        env: napi_env,
108        value: napi_value,
109        drawableDescriptor: *mut *mut ArkUI_DrawableDescriptor,
110    ) -> i32;
111    /// Obtains a <b>Resource</b> object on the ArkTS side and maps it to an
112    /// <b>ArkUI_DrawableDescriptro</b> object on the native side.
113    ///
114    /// # Arguments
115    ///
116    /// * `env` - Indicates the NAPI environment pointer.
117    ///
118    /// * `value` - Indicates the <b>Resource</b> object created on the ArkTS side.
119    ///
120    /// * `drawableDescriptor` - Indicates the pointer to the <b>ArkUI_DrawableDescriptro</b> object.
121    ///
122    /// # Returns
123    ///
124    /// * Returns the error code.
125    /// Returns [`ARKUI_ERROR_CODE_NO_ERROR`] if the operation is successful.
126    /// Returns [`ARKUI_ERROR_CODE_PARAM_INVALID`] if a parameter error occurs.
127    ///
128    /// Available since API-level: 12
129    #[cfg(feature = "api-12")]
130    #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
131    pub fn OH_ArkUI_GetDrawableDescriptorFromResourceNapiValue(
132        env: napi_env,
133        value: napi_value,
134        drawableDescriptor: *mut *mut ArkUI_DrawableDescriptor,
135    ) -> i32;
136    /// Obtain the ID of the Navigation component where the node is located.
137    ///
138    /// # Arguments
139    ///
140    /// * `node` - The node.
141    ///
142    /// * `buffer` - The buffer to which NavigationID writes to the memory,
143    /// memory space needs to be allocated by the developer.
144    ///
145    /// * `bufferSize` - The buffer size
146    ///
147    /// * `writeLength` - Indicates the string length actually written to the buffer
148    /// when returning [`ARKUI_ERROR_CODE_NO_ERROR`].
149    /// Indicates the minimum buffer size that can accommodate the target
150    /// when [`ARKUI_ERROR_CODE_BUFFER_SIZE_ERROR`] is returned.
151    ///
152    /// # Returns
153    ///
154    /// * The error code.
155    /// [`ARKUI_ERROR_CODE_NO_ERROR`] if the operation is successful.
156    /// [`ARKUI_ERROR_CODE_PARAM_INVALID`] if the node, buffer or writeLength is null.
157    /// [`ARKUI_ERROR_CODE_GET_INFO_FAILED`] if query information failed,
158    /// this may be because the node is not in Navigation.
159    /// [`ARKUI_ERROR_CODE_BUFFER_SIZE_ERROR`] If the buffer size is less than the minimum buffer size.
160    ///
161    /// Available since API-level: 12
162    #[cfg(feature = "api-12")]
163    #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
164    pub fn OH_ArkUI_GetNavigationId(
165        node: ArkUI_NodeHandle,
166        buffer: *mut ::core::ffi::c_char,
167        bufferSize: i32,
168        writeLength: *mut i32,
169    ) -> ArkUI_ErrorCode;
170    /// Obtain the name of the NavDestination component where the node is located.
171    ///
172    /// # Arguments
173    ///
174    /// * `node` - The node.
175    ///
176    /// * `buffer` - The buffer to which NavDestination name writes to the memory,
177    /// memory space needs to be allocated by the developer.
178    ///
179    /// * `bufferSize` - The buffer size
180    ///
181    /// * `writeLength` - Indicates the string length actually written to the buffer
182    /// when returning [`ARKUI_ERROR_CODE_NO_ERROR`].
183    /// Indicates the minimum buffer size that can accommodate the target
184    /// when [`ARKUI_ERROR_CODE_BUFFER_SIZE_ERROR`] is returned.
185    ///
186    /// # Returns
187    ///
188    /// * The error code.
189    /// [`ARKUI_ERROR_CODE_NO_ERROR`] if the operation is successful.
190    /// [`ARKUI_ERROR_CODE_PARAM_INVALID`] if the node, buffer or writeLength is null.
191    /// [`ARKUI_ERROR_CODE_GET_INFO_FAILED`] if query information failed,
192    /// this may be because the node is not in Navigation.
193    /// [`ARKUI_ERROR_CODE_BUFFER_SIZE_ERROR`] If the buffer size is less than the minimum buffer size.
194    ///
195    /// Available since API-level: 12
196    #[cfg(feature = "api-12")]
197    #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
198    pub fn OH_ArkUI_GetNavDestinationName(
199        node: ArkUI_NodeHandle,
200        buffer: *mut ::core::ffi::c_char,
201        bufferSize: i32,
202        writeLength: *mut i32,
203    ) -> ArkUI_ErrorCode;
204    /// Based on the given index value, obtain the length of the Navigation stack where the node is located.
205    ///
206    /// # Arguments
207    ///
208    /// * `node` - The node.
209    ///
210    /// * `length` - The length of the stack. After the operation succeeds, the result is written back to this parameter.
211    ///
212    /// # Returns
213    ///
214    /// * The error code.
215    /// [`ARKUI_ERROR_CODE_NO_ERROR`] if the operation is successful.
216    /// [`ARKUI_ERROR_CODE_PARAM_INVALID`] if the node or length is null.
217    /// [`ARKUI_ERROR_CODE_GET_INFO_FAILED`] if query information failed,
218    /// this may be because the node is not in Navigation.
219    ///
220    /// Available since API-level: 12
221    #[cfg(feature = "api-12")]
222    #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
223    pub fn OH_ArkUI_GetNavStackLength(node: ArkUI_NodeHandle, length: *mut i32) -> ArkUI_ErrorCode;
224    /// Based on the given index value, obtain the page name of the corresponding position
225    /// in the navigation stack where the node is located.
226    /// Index values are counted from 0, with 0 being the bottom of the stack.
227    ///
228    /// # Arguments
229    ///
230    /// * `node` - The node.
231    ///
232    /// * `index` - The index of the NavDestination in the stack is queried.
233    ///
234    /// * `buffer` - The buffer to which NavDestination index writes to the memory,
235    /// memory space needs to be allocated by the developer.
236    ///
237    /// * `bufferSize` - The buffer size
238    ///
239    /// * `writeLength` - Indicates the string length actually written to the buffer
240    /// when returning [`ARKUI_ERROR_CODE_NO_ERROR`].
241    /// Indicates the minimum buffer size that can accommodate the target
242    /// when [`ARKUI_ERROR_CODE_BUFFER_SIZE_ERROR`] is returned.
243    ///
244    /// # Returns
245    ///
246    /// * The error code.
247    /// [`ARKUI_ERROR_CODE_NO_ERROR`] if the operation is successful.
248    /// [`ARKUI_ERROR_CODE_PARAM_INVALID`] if the node, buffer or writeLength is null.
249    /// [`ARKUI_ERROR_CODE_NODE_INDEX_INVALID`] if index is an invalid value.
250    /// [`ARKUI_ERROR_CODE_GET_INFO_FAILED`] if query information failed,
251    /// this may be because the node is not in Navigation.
252    /// [`ARKUI_ERROR_CODE_BUFFER_SIZE_ERROR`] If the buffer size is less than the minimum buffer size.
253    ///
254    /// Available since API-level: 12
255    #[cfg(feature = "api-12")]
256    #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
257    pub fn OH_ArkUI_GetNavDestinationNameByIndex(
258        node: ArkUI_NodeHandle,
259        index: i32,
260        buffer: *mut ::core::ffi::c_char,
261        bufferSize: i32,
262        writeLength: *mut i32,
263    ) -> ArkUI_ErrorCode;
264    /// Obtain the ID of the NavDestination component where the node is located.
265    ///
266    /// # Arguments
267    ///
268    /// * `node` - The node.
269    ///
270    /// * `buffer` - The buffer to which NavDestination ID writes to the memory,
271    /// memory space needs to be allocated by the developer.
272    ///
273    /// * `bufferSize` - The buffer size
274    ///
275    /// * `writeLength` - Indicates the string length actually written to the buffer
276    /// when returning [`ARKUI_ERROR_CODE_NO_ERROR`].
277    /// Indicates the minimum buffer size that can accommodate the target
278    /// when [`ARKUI_ERROR_CODE_BUFFER_SIZE_ERROR`] is returned.
279    ///
280    /// # Returns
281    ///
282    /// * The error code.
283    /// [`ARKUI_ERROR_CODE_NO_ERROR`] if the operation is successful.
284    /// [`ARKUI_ERROR_CODE_PARAM_INVALID`] if the node, buffer or writeLength is null.
285    /// [`ARKUI_ERROR_CODE_GET_INFO_FAILED`] if query information failed,
286    /// this may be because the node is not in Navigation.
287    /// [`ARKUI_ERROR_CODE_BUFFER_SIZE_ERROR`] If the buffer size is less than the minimum buffer size.
288    ///
289    /// Available since API-level: 12
290    #[cfg(feature = "api-12")]
291    #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
292    pub fn OH_ArkUI_GetNavDestinationId(
293        node: ArkUI_NodeHandle,
294        buffer: *mut ::core::ffi::c_char,
295        bufferSize: i32,
296        writeLength: *mut i32,
297    ) -> ArkUI_ErrorCode;
298    /// Obtain the state of the NavDestination component where the node is located.
299    ///
300    /// # Arguments
301    ///
302    /// * `node` - The node.
303    ///
304    /// * `state` - The state value of NavDestination is written back into this parameter.
305    ///
306    /// # Returns
307    ///
308    /// * The error code.
309    /// [`ARKUI_ERROR_CODE_NO_ERROR`] if the operation is successful.
310    /// [`ARKUI_ERROR_CODE_PARAM_INVALID`] if the node or state is null.
311    /// [`ARKUI_ERROR_CODE_GET_INFO_FAILED`] if query information failed,
312    /// this may be because the node is not in Navigation.
313    ///
314    /// Available since API-level: 12
315    #[cfg(feature = "api-12")]
316    #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
317    pub fn OH_ArkUI_GetNavDestinationState(
318        node: ArkUI_NodeHandle,
319        state: *mut ArkUI_NavDestinationState,
320    ) -> ArkUI_ErrorCode;
321    /// Obtain the index of the NavDestination component on the Navigation stack where the node is located.
322    ///
323    /// # Arguments
324    ///
325    /// * `node` - The node.
326    ///
327    /// * `index` - Index value, counted from 0.
328    ///
329    /// # Returns
330    ///
331    /// * The error code.
332    /// [`ARKUI_ERROR_CODE_NO_ERROR`] if the operation is successful.
333    /// [`ARKUI_ERROR_CODE_PARAM_INVALID`] if the node or index is null.
334    /// [`ARKUI_ERROR_CODE_GET_INFO_FAILED`] if query information failed,
335    /// this may be because the node is not in Navigation.
336    ///
337    /// Available since API-level: 12
338    #[cfg(feature = "api-12")]
339    #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
340    pub fn OH_ArkUI_GetNavDestinationIndex(
341        node: ArkUI_NodeHandle,
342        index: *mut i32,
343    ) -> ArkUI_ErrorCode;
344    /// Obtain the parameters of the NavDestination component where the node is located.
345    ///
346    /// # Arguments
347    ///
348    /// * `node` - The node.
349    ///
350    /// # Returns
351    ///
352    /// * The parameters.
353    /// If a null pointer is returned, it may be because the node is empty or the parameters does not exist.
354    ///
355    /// Available since API-level: 12
356    #[cfg(feature = "api-12")]
357    #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
358    pub fn OH_ArkUI_GetNavDestinationParam(node: ArkUI_NodeHandle) -> napi_value;
359    /// Obtain the index of the page where the node resides in the Router page stack.
360    ///
361    /// # Arguments
362    ///
363    /// * `node` - The node.
364    ///
365    /// * `index` - Index value, counted from 1.
366    ///
367    /// # Returns
368    ///
369    /// * The error code.
370    /// [`ARKUI_ERROR_CODE_NO_ERROR`] if the operation is successful.
371    /// [`ARKUI_ERROR_CODE_PARAM_INVALID`] if the node or index is null.
372    /// [`ARKUI_ERROR_CODE_GET_INFO_FAILED`] if query information failed,
373    /// this may be because the node is not in RouterPage.
374    ///
375    /// Available since API-level: 12
376    #[cfg(feature = "api-12")]
377    #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
378    pub fn OH_ArkUI_GetRouterPageIndex(node: ArkUI_NodeHandle, index: *mut i32) -> ArkUI_ErrorCode;
379    /// Obtain the name of the page where the node is located.
380    ///
381    /// # Arguments
382    ///
383    /// * `node` - The node.
384    ///
385    /// * `buffer` - The buffer to which page name writes to the memory,
386    /// memory space needs to be allocated by the developer.
387    ///
388    /// * `bufferSize` - The buffer size
389    ///
390    /// * `writeLength` - Indicates the string length actually written to the buffer
391    /// when returning [`ARKUI_ERROR_CODE_NO_ERROR`].
392    /// Indicates the minimum buffer size that can accommodate the target
393    /// when [`ARKUI_ERROR_CODE_BUFFER_SIZE_ERROR`] is returned.
394    ///
395    /// # Returns
396    ///
397    /// * The error code.
398    /// [`ARKUI_ERROR_CODE_NO_ERROR`] if the operation is successful.
399    /// [`ARKUI_ERROR_CODE_PARAM_INVALID`] if the node, buffer or writeLength is null.
400    /// [`ARKUI_ERROR_CODE_GET_INFO_FAILED`] if query information failed,
401    /// this may be because the node is not in RouterPage.
402    /// [`ARKUI_ERROR_CODE_BUFFER_SIZE_ERROR`] If the buffer size is less than the minimum buffer size.
403    ///
404    /// Available since API-level: 12
405    #[cfg(feature = "api-12")]
406    #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
407    pub fn OH_ArkUI_GetRouterPageName(
408        node: ArkUI_NodeHandle,
409        buffer: *mut ::core::ffi::c_char,
410        bufferSize: i32,
411        writeLength: *mut i32,
412    ) -> ArkUI_ErrorCode;
413    /// Obtain the path of the page where the node is located.
414    ///
415    /// # Arguments
416    ///
417    /// * `node` - The node.
418    ///
419    /// * `buffer` - The buffer to which page path writes to the memory,
420    /// memory space needs to be allocated by the developer.
421    ///
422    /// * `bufferSize` - The buffer size
423    ///
424    /// * `writeLength` - Indicates the string length actually written to the buffer
425    /// when returning [`ARKUI_ERROR_CODE_NO_ERROR`].
426    /// Indicates the minimum buffer size that can accommodate the target
427    /// when [`ARKUI_ERROR_CODE_BUFFER_SIZE_ERROR`] is returned.
428    ///
429    /// # Returns
430    ///
431    /// * The error code.
432    /// [`ARKUI_ERROR_CODE_NO_ERROR`] if the operation is successful.
433    /// [`ARKUI_ERROR_CODE_PARAM_INVALID`] if the node, buffer or writeLength is null.
434    /// [`ARKUI_ERROR_CODE_GET_INFO_FAILED`] if query information failed,
435    /// this may be because the node is not in RouterPage.
436    /// [`ARKUI_ERROR_CODE_BUFFER_SIZE_ERROR`] If the buffer size is less than the minimum buffer size.
437    ///
438    /// Available since API-level: 12
439    #[cfg(feature = "api-12")]
440    #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
441    pub fn OH_ArkUI_GetRouterPagePath(
442        node: ArkUI_NodeHandle,
443        buffer: *mut ::core::ffi::c_char,
444        bufferSize: i32,
445        writeLength: *mut i32,
446    ) -> ArkUI_ErrorCode;
447    /// Obtain the state of the page where the node is located.
448    ///
449    /// # Arguments
450    ///
451    /// * `node` - The node.
452    ///
453    /// * `state` - The state value of the page is written back to this parameter.
454    ///
455    /// # Returns
456    ///
457    /// * The error code.
458    /// [`ARKUI_ERROR_CODE_NO_ERROR`] if the operation is successful.
459    /// [`ARKUI_ERROR_CODE_PARAM_INVALID`] if the node or state is null.
460    /// [`ARKUI_ERROR_CODE_GET_INFO_FAILED`] if query information failed,
461    /// this may be because the node is not in RouterPage.
462    ///
463    /// Available since API-level: 12
464    #[cfg(feature = "api-12")]
465    #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
466    pub fn OH_ArkUI_GetRouterPageState(
467        node: ArkUI_NodeHandle,
468        state: *mut ArkUI_RouterPageState,
469    ) -> ArkUI_ErrorCode;
470    /// Obtain the ID of the page where the node is located.
471    ///
472    /// # Arguments
473    ///
474    /// * `node` - The node.
475    ///
476    /// * `buffer` - The buffer to which page ID writes to the memory,
477    /// memory space needs to be allocated by the developer.
478    ///
479    /// * `bufferSize` - The buffer size
480    ///
481    /// * `writeLength` - Indicates the string length actually written to the buffer
482    /// when returning [`ARKUI_ERROR_CODE_NO_ERROR`].
483    /// Indicates the minimum buffer size that can accommodate the target
484    /// when [`ARKUI_ERROR_CODE_BUFFER_SIZE_ERROR`] is returned.
485    ///
486    /// # Returns
487    ///
488    /// * The error code.
489    /// [`ARKUI_ERROR_CODE_NO_ERROR`] if the operation is successful.
490    /// [`ARKUI_ERROR_CODE_PARAM_INVALID`] if the node, buffer or writeLength is null.
491    /// [`ARKUI_ERROR_CODE_GET_INFO_FAILED`] if query information failed,
492    /// this may be because the node is not in RouterPage.
493    /// [`ARKUI_ERROR_CODE_BUFFER_SIZE_ERROR`] If the buffer size is less than the minimum buffer size.
494    ///
495    /// Available since API-level: 12
496    #[cfg(feature = "api-12")]
497    #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
498    pub fn OH_ArkUI_GetRouterPageId(
499        node: ArkUI_NodeHandle,
500        buffer: *mut ::core::ffi::c_char,
501        bufferSize: i32,
502        writeLength: *mut i32,
503    ) -> ArkUI_ErrorCode;
504}