#[repr(C)]pub struct ArkUI_NativeGestureAPI_1 {Show 18 fields
pub version: i32,
pub createTapGesture: Option<unsafe extern "C" fn(countNum: i32, fingersNum: i32) -> *mut ArkUI_GestureRecognizer>,
pub createLongPressGesture: Option<unsafe extern "C" fn(fingersNum: i32, repeatResult: bool, durationNum: i32) -> *mut ArkUI_GestureRecognizer>,
pub createPanGesture: Option<unsafe extern "C" fn(fingersNum: i32, directions: ArkUI_GestureDirectionMask, distanceNum: f64) -> *mut ArkUI_GestureRecognizer>,
pub createPinchGesture: Option<unsafe extern "C" fn(fingersNum: i32, distanceNum: f64) -> *mut ArkUI_GestureRecognizer>,
pub createRotationGesture: Option<unsafe extern "C" fn(fingersNum: i32, angleNum: f64) -> *mut ArkUI_GestureRecognizer>,
pub createSwipeGesture: Option<unsafe extern "C" fn(fingersNum: i32, directions: ArkUI_GestureDirectionMask, speedNum: f64) -> *mut ArkUI_GestureRecognizer>,
pub createGroupGesture: Option<unsafe extern "C" fn(gestureMode: ArkUI_GroupGestureMode) -> *mut ArkUI_GestureRecognizer>,
pub dispose: Option<unsafe extern "C" fn(recognizer: *mut ArkUI_GestureRecognizer)>,
pub addChildGesture: Option<unsafe extern "C" fn(group: *mut ArkUI_GestureRecognizer, child: *mut ArkUI_GestureRecognizer) -> i32>,
pub removeChildGesture: Option<unsafe extern "C" fn(group: *mut ArkUI_GestureRecognizer, child: *mut ArkUI_GestureRecognizer) -> i32>,
pub setGestureEventTarget: Option<unsafe extern "C" fn(recognizer: *mut ArkUI_GestureRecognizer, actionTypeMask: ArkUI_GestureEventActionTypeMask, extraParams: *mut c_void, targetReceiver: Option<unsafe extern "C" fn(event: *mut ArkUI_GestureEvent, extraParams: *mut c_void)>) -> i32>,
pub addGestureToNode: Option<unsafe extern "C" fn(node: ArkUI_NodeHandle, recognizer: *mut ArkUI_GestureRecognizer, mode: ArkUI_GesturePriority, mask: ArkUI_GestureMask) -> i32>,
pub removeGestureFromNode: Option<unsafe extern "C" fn(node: ArkUI_NodeHandle, recognizer: *mut ArkUI_GestureRecognizer) -> i32>,
pub setGestureInterrupterToNode: Option<unsafe extern "C" fn(node: ArkUI_NodeHandle, interrupter: Option<unsafe extern "C" fn(info: *mut ArkUI_GestureInterruptInfo) -> ArkUI_GestureInterruptResult>) -> i32>,
pub getGestureType: Option<unsafe extern "C" fn(recognizer: *mut ArkUI_GestureRecognizer) -> ArkUI_GestureRecognizerType>,
pub setInnerGestureParallelTo: Option<unsafe extern "C" fn(node: ArkUI_NodeHandle, userData: *mut c_void, parallelInnerGesture: Option<unsafe extern "C" fn(event: *mut ArkUI_ParallelInnerGestureEvent) -> *mut ArkUI_GestureRecognizer>) -> i32>,
pub createTapGestureWithDistanceThreshold: Option<unsafe extern "C" fn(countNum: i32, fingersNum: i32, distanceThreshold: f64) -> *mut ArkUI_GestureRecognizer>,
}api-12 only.Expand description
@brief Defines the gesture APIs.
@since 12
Fields§
§version: i32The struct version is 1.
createTapGesture: Option<unsafe extern "C" fn(countNum: i32, fingersNum: i32) -> *mut ArkUI_GestureRecognizer>@brief Creates a tap gesture.
1. This API is used to trigger a tap gesture with one, two, or more taps. \n
2. If multi-tap is configured, the timeout interval between a lift and the next tap is 300 ms. \n
3. If the distance between the last tapped position and the current tapped position exceeds 60 vp,
gesture recognition fails. \n
4. If the value is greater than 1, the tap gesture will fail to be recognized when the number of fingers
touching the screen within 300 ms of the first finger touch is less than the required number, \n
or when the number of fingers lifted from the screen within 300 ms of the first finger's being lifted
is less than the required number. \n
5. When the number of fingers touching the screen exceeds the set value, the gesture can be recognized. \n@param countNum Indicates the number of consecutive taps. If the value is less than 1 or is not set, the default value 1 is used. @param fingersNum Indicates the number of fingers required to trigger a tap. The value ranges from 1 to 10. If the value is less than 1 or is not set, the default value 1 is used. @return Returns the pointer to the created gesture.
createLongPressGesture: Option<unsafe extern "C" fn(fingersNum: i32, repeatResult: bool, durationNum: i32) -> *mut ArkUI_GestureRecognizer>@brief Creates a long press gesture.
1. This API is used to trigger a long press gesture, which requires one or more fingers with a minimum
The value ranges 500 ms hold-down time. \n
2. In components that support drag actions by default, such as <b><Text></b>, <b><TextInput></b>,
<b><TextArea></b>, <b><Hyperlink></b>, <b><Image></b>, and <b>RichEditor></b>, the long press gesture \n
may conflict with the drag action. If this occurs, they are handled as follows: \n
If the minimum duration of the long press gesture is less than 500 ms, the long press gesture receives
a higher response priority than the drag action. \n
If the minimum duration of the long press gesture is greater than or equal to 500 ms,
the drag action receives a higher response priority than the long press gesture. \n
3. If a finger moves more than 15 px after being pressed, the gesture recognition fails. \n@param fingersNum Indicates the minimum number of fingers to trigger a long press gesture. The value ranges from 1 to 10. @param repeatResult Indicates whether to continuously trigger the event callback. @param durationNum Indicates the minimum hold-down time, in ms. If the value is less than or equal to 0, the default value 500 is used. @return Returns the pointer to the created gesture.
createPanGesture: Option<unsafe extern "C" fn(fingersNum: i32, directions: ArkUI_GestureDirectionMask, distanceNum: f64) -> *mut ArkUI_GestureRecognizer>@brief Creates a pan gesture.
1. This API is used to trigger a pan gesture when the movement distance of a finger on the screen exceeds
the minimum value. \n
2. If a pan gesture and a tab swipe occur at the same time, set <b>distanceNum</b> to <b>1</b>
so that the gesture can be more easily recognized. \n@param fingersNum Indicates the minimum number of fingers to trigger a pan gesture. The value ranges from 1 to 10. If the value is less than 1 or is not set, the default value 1 is used. @param directions Indicates the pan direction. The value supports the AND (&) and OR (|) operations. @param distanceNum Indicates the minimum pan distance to trigger the gesture, in vp. If this parameter is set to a value less than or equal to 0, the default value 5 is used. @return Returns the pointer to the created gesture.
createPinchGesture: Option<unsafe extern "C" fn(fingersNum: i32, distanceNum: f64) -> *mut ArkUI_GestureRecognizer>@brief Creates a pinch gesture.
1. This API is used to trigger a pinch gesture, which requires two to five fingers with a minimum 5 vp
distance between the fingers. \n
2. While more fingers than the minimum number can be pressed to trigger the gesture, only the first
fingers of the minimum number participate in gesture calculation. \n@param fingersNum Indicates the minimum number of fingers to trigger a pinch. The value ranges from 2 to 5. Default value: 2 @param distanceNum Indicates the minimum recognition distance, in px. If this parameter is set to a value less than or equal to 0, the default value 5 is used. @return Returns the pointer to the created gesture.
createRotationGesture: Option<unsafe extern "C" fn(fingersNum: i32, angleNum: f64) -> *mut ArkUI_GestureRecognizer>@brief Creates a rotation gesture.
1. This API is used to trigger a rotation gesture, which requires two to five fingers with a
minimum 1-degree rotation angle. \n
2. While more fingers than the minimum number can be pressed to trigger the gesture, only the first
two fingers participate in gesture calculation. \n@param fingersNum Indicates the minimum number of fingers to trigger a rotation. The value ranges from 2 to 5. Default value: 2 @param angleNum Indicates the minimum degree that can trigger the rotation gesture. Default value: 1 If this parameter is set to a value less than or equal to 0 or greater than 360, the default value 1 is used. @return Returns the pointer to the created gesture.
createSwipeGesture: Option<unsafe extern "C" fn(fingersNum: i32, directions: ArkUI_GestureDirectionMask, speedNum: f64) -> *mut ArkUI_GestureRecognizer>@brief Creates a swipe gesture.
This API is used to implement a swipe gesture, which can be recognized when the swipe speed is 100
vp/s or higher. \n@param fingersNum Indicates the minimum number of fingers to trigger a swipe gesture. The value ranges from 1 to 10. @param directions Indicates the swipe direction. @param speedNum Indicates the minimum speed of the swipe gesture, in px/s. If this parameter is set to a value less than or equal to 0, the default value 100 is used. @return Returns the pointer to the created gesture.
createGroupGesture: Option<unsafe extern "C" fn(gestureMode: ArkUI_GroupGestureMode) -> *mut ArkUI_GestureRecognizer>@brief Creates a gesture group.
@param gestureMode Indicates the gesture group mode. @return Returns the pointer to the created gesture group.
dispose: Option<unsafe extern "C" fn(recognizer: *mut ArkUI_GestureRecognizer)>@brief Disposes a gesture to release resources.
@param recognizer Indicates the pointer to the gesture to dispose.
addChildGesture: Option<unsafe extern "C" fn(group: *mut ArkUI_GestureRecognizer, child: *mut ArkUI_GestureRecognizer) -> i32>@brief Adds a gesture to a gesture group.
@param group Indicates the pointer to the gesture group. @param child Indicates the gesture to be added to the gesture group. @return Returns 0 if success. Returns 401 if a parameter exception occurs. Returns 401 if a parameter exception occurs.
removeChildGesture: Option<unsafe extern "C" fn(group: *mut ArkUI_GestureRecognizer, child: *mut ArkUI_GestureRecognizer) -> i32>@brief Removes a gesture to a gesture group.
@param group Indicates the pointer to the gesture group. @param child Indicates the gesture to be removed to the gesture group. @return Returns 0 if success. Returns 401 if a parameter exception occurs.
setGestureEventTarget: Option<unsafe extern "C" fn(recognizer: *mut ArkUI_GestureRecognizer, actionTypeMask: ArkUI_GestureEventActionTypeMask, extraParams: *mut c_void, targetReceiver: Option<unsafe extern "C" fn(event: *mut ArkUI_GestureEvent, extraParams: *mut c_void)>) -> i32>@brief Registers a callback for gestures.
@param recognizer Indicates the pointer to the gesture recognizer. @param actionTypeMask Indicates the set of gesture event types. Multiple callbacks can be registered at once, with the callback event types distinguished in the callbacks. Example: actionTypeMask = GESTURE_EVENT_ACTION_ACCEPT | GESTURE_EVENT_ACTION_UPDATE; @param extraParams Indicates the context passed in the targetReceiver callback. @param targetReceiver Indicates the callback to register for processing the gesture event types. event indicates the gesture callback data. @return Returns 0 if success. Returns 401 if a parameter exception occurs.
addGestureToNode: Option<unsafe extern "C" fn(node: ArkUI_NodeHandle, recognizer: *mut ArkUI_GestureRecognizer, mode: ArkUI_GesturePriority, mask: ArkUI_GestureMask) -> i32>@brief Adds a gesture to a UI component.
@param node Indicates the UI component to which you want to add the gesture. @param recognizer Indicates the gesture to be added to the UI component. @param mode Indicates the gesture event mode. Available options are NORMAL_GESTURE, PARALLEL_GESTURE, and PRIORITY_GESTURE. @param mask Indicates the gesture masking mode. @return Returns 0 if success. Returns 401 if a parameter exception occurs.
removeGestureFromNode: Option<unsafe extern "C" fn(node: ArkUI_NodeHandle, recognizer: *mut ArkUI_GestureRecognizer) -> i32>@brief Removes a gesture from a node.
@param node Indicates the node from which you want to remove the gesture. @param recognizer Indicates the gesture to be removed. @return Returns 0 if success. Returns 401 if a parameter exception occurs.
setGestureInterrupterToNode: Option<unsafe extern "C" fn(node: ArkUI_NodeHandle, interrupter: Option<unsafe extern "C" fn(info: *mut ArkUI_GestureInterruptInfo) -> ArkUI_GestureInterruptResult>) -> i32>@brief Sets a gesture interruption callback for a node.
@param node Indicates the node for which you want to set a gesture interruption callback. @param interrupter Indicates the gesture interruption callback to set. info indicates the gesture interruption data. If interrupter returns GESTURE_INTERRUPT_RESULT_CONTINUE, the gesture recognition process continues. If it returns GESTURE_INTERRUPT_RESULT_REJECT, the gesture recognition process is paused. @return Returns 0 if success. Returns 401 if a parameter exception occurs.
getGestureType: Option<unsafe extern "C" fn(recognizer: *mut ArkUI_GestureRecognizer) -> ArkUI_GestureRecognizerType>@brief Obtains the type of a gesture.
@param recognizer Indicates the pointer to the gesture. @return Returns the gesture type.
setInnerGestureParallelTo: Option<unsafe extern "C" fn(node: ArkUI_NodeHandle, userData: *mut c_void, parallelInnerGesture: Option<unsafe extern "C" fn(event: *mut ArkUI_ParallelInnerGestureEvent) -> *mut ArkUI_GestureRecognizer>) -> i32>@brief Sets the callback function for a parallel internal gesture event.
@param node Indicates the ArkUI node for which the callback of a parallel internal gesture event is to be set. @param userData Indicates the custom data. @param parallelInnerGesture Indicates the parallel internal gesture event. event returns the data of the parallel internal gesture event; parallelInnerGesture returns the pointer to the gesture recognizer that requires parallel recognition. @return Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if success. Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter exception occurs.
createTapGestureWithDistanceThreshold: Option<unsafe extern "C" fn(countNum: i32, fingersNum: i32, distanceThreshold: f64) -> *mut ArkUI_GestureRecognizer>@brief Creates a tap gesture that is subject to distance restrictions.
1. This API is used to trigger a tap gesture with one, two, or more taps. \n
2. If multi-tap is configured, the timeout interval between a lift and the next tap is 300 ms. \n
3. If the distance between the last tapped position and the current tapped position exceeds 60 vp,
gesture recognition fails. \n
4. If the value is greater than 1, the tap gesture will fail to be recognized when the number of fingers
touching the screen within 300 ms of the first finger touch is less than the required number,
or when the number of fingers lifted from the screen within 300 ms of the first finger's being lifted
is less than the required number. \n
5. When the number of fingers touching the screen exceeds the set value, the gesture can be recognized. \n
6. If the finger moves beyond the preset distance limit, gesture recognition fails. \n@param countNum Indicates the number of consecutive taps. If the value is less than 1 or is not set, the default value 1 is used. @param fingersNum Indicates the number of fingers required to trigger a tap. The value ranges from 1 to 10. If the value is less than 1 or is not set, the default value 1 is used. @param distanceThreshold Indicates the allowed moving distance of a finger. If the value is less than 0 or is not set, it will be converted to the default value of infinity. @return Returns the pointer to the created gesture.