arkui_sys/native_interface_focus/native_interface_focus_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#[cfg(feature = "api-15")]
8use ohos_sys_opaque_types::ArkUI_ContextHandle;
9
10#[cfg(feature = "api-15")]
11#[cfg_attr(docsrs, doc(cfg(feature = "api-15")))]
12impl ArkUI_KeyProcessingMode {
13 /// Key events are used to move focus.
14 pub const ARKUI_KEY_PROCESSING_MODE_FOCUS_NAVIGATION: ArkUI_KeyProcessingMode =
15 ArkUI_KeyProcessingMode(0);
16 /// Key events bubble up to ancestors.
17 pub const ARKUI_KEY_PROCESSING_MODE_FOCUS_ANCESTOR_EVENT: ArkUI_KeyProcessingMode =
18 ArkUI_KeyProcessingMode(1);
19}
20#[repr(transparent)]
21/// Determines the priority of key event processing when component cannot handle the key event.
22///
23///
24/// Available since API-level: 15
25#[cfg(feature = "api-15")]
26#[cfg_attr(docsrs, doc(cfg(feature = "api-15")))]
27#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
28pub struct ArkUI_KeyProcessingMode(pub ::core::ffi::c_uint);
29extern "C" {
30 /// Apply focus for a specific node.
31 ///
32 /// # Arguments
33 ///
34 /// * `node` - The node.
35 ///
36 /// # Returns
37 ///
38 /// * The error code.
39 /// [`ARKUI_ERROR_CODE_NO_ERROR`] if the operation is successful.
40 /// [`ARKUI_ERROR_CODE_FOCUS_NON_FOCUSABLE`] if the node is not focusable.
41 /// [`ARKUI_ERROR_CODE_FOCUS_NON_FOCUSABLE_ANCESTOR`] if the node has unfocusable ancestor.
42 /// [`ARKUI_ERROR_CODE_FOCUS_NON_EXISTENT`] if the node is not exists.
43 ///
44 /// Available since API-level: 15
45 #[cfg(feature = "api-15")]
46 #[cfg_attr(docsrs, doc(cfg(feature = "api-15")))]
47 pub fn OH_ArkUI_FocusRequest(node: ArkUI_NodeHandle) -> ArkUiResult;
48 /// Clear current focus to root scope.
49 ///
50 /// # Arguments
51 ///
52 /// * `uiContext` - Indicates the pointer to a UI instance.
53 ///
54 /// Available since API-level: 15
55 #[cfg(feature = "api-15")]
56 #[cfg_attr(docsrs, doc(cfg(feature = "api-15")))]
57 pub fn OH_ArkUI_FocusClear(uiContext: ArkUI_ContextHandle);
58 /// Set the focus active state in current window, the focus node would show its focus box.
59 ///
60 /// # Arguments
61 ///
62 /// * `uiContext` - Indicates the pointer to a UI instance.
63 ///
64 /// * `isActive` - Set the state to be active or inactive.
65 ///
66 /// * `isAutoInactive` - When touch event or mouse-pressed event triggerd,
67 /// "true" indicates to set state to inactive,
68 /// "false" indicates to maintain the state until relative API is called.
69 ///
70 /// Available since API-level: 15
71 #[cfg(feature = "api-15")]
72 #[cfg_attr(docsrs, doc(cfg(feature = "api-15")))]
73 pub fn OH_ArkUI_FocusActivate(
74 uiContext: ArkUI_ContextHandle,
75 isActive: bool,
76 isAutoInactive: bool,
77 );
78 /// Set the focus transfer behaviour when current focus view changes.
79 ///
80 /// # Arguments
81 ///
82 /// * `uiContext` - Indicates the pointer to a UI instance.
83 ///
84 /// * `autoTransfer` - Indicates whether to transfer focus when focus view show.
85 ///
86 /// Available since API-level: 15
87 #[cfg(feature = "api-15")]
88 #[cfg_attr(docsrs, doc(cfg(feature = "api-15")))]
89 pub fn OH_ArkUI_FocusSetAutoTransfer(uiContext: ArkUI_ContextHandle, autoTransfer: bool);
90 /// Set the priority of key event processing when component cannot handle the key event.
91 ///
92 /// # Arguments
93 ///
94 /// * `uiContext` - Indicates the pointer to a UI instance.
95 ///
96 /// * `mode` - Indicates the key processing mode.
97 ///
98 /// Available since API-level: 15
99 #[cfg(feature = "api-15")]
100 #[cfg_attr(docsrs, doc(cfg(feature = "api-15")))]
101 pub fn OH_ArkUI_FocusSetKeyProcessingMode(
102 uiContext: ArkUI_ContextHandle,
103 mode: ArkUI_KeyProcessingMode,
104 );
105}