diff --git a/arkui/ace_engine/native/BUILD.gn b/arkui/ace_engine/native/BUILD.gn index 122bd36893b25e385ee26bca74ffccd8fd2cc98e..dedbb67494812eed1724fbd38f850102f9966eda 100644 --- a/arkui/ace_engine/native/BUILD.gn +++ b/arkui/ace_engine/native/BUILD.gn @@ -28,7 +28,6 @@ if (!is_arkui_x) { sources = [ "native_animate.h", "native_dialog.h", - "native_event.h", "native_gesture.h", "native_interface.h", "native_node.h", diff --git a/arkui/ace_engine/native/libace.ndk.json b/arkui/ace_engine/native/libace.ndk.json index f6223576b7af045bbcf3b472cbb6291245d7d25f..8576e71fb785e10da5b1e7d988ad8f533629fcb6 100644 --- a/arkui/ace_engine/native/libace.ndk.json +++ b/arkui/ace_engine/native/libace.ndk.json @@ -674,5 +674,9 @@ { "first_introduced": "12", "name": "OH_ArkUI_GetContextFromNapiValue" + }, + { + "first_introduced": "12", + "name": "OH_ArkUI_PointerEvent_SetInterceptHitTestMode" } ] \ No newline at end of file diff --git a/arkui/ace_engine/native/native_event.h b/arkui/ace_engine/native/native_event.h deleted file mode 100644 index ab2e301cbb36a84a053ba09f950c2e7b9ebe6b0f..0000000000000000000000000000000000000000 --- a/arkui/ace_engine/native/native_event.h +++ /dev/null @@ -1,78 +0,0 @@ -/* - * Copyright (c) 2024 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * @addtogroup ArkUI_NativeModule - * @{ - * - * @brief Provides UI capabilities of ArkUI on the native side, such as UI - * component creation and destruction, tree node operations, attribute setting, - * and event listening. - * - * @since 12 - */ - -/** - * @file native_event.h - * - * @brief Provides the event type definitions of ArkUI on the native side. - * - * @library libace_ndk.z.so - * @syscap SystemCapability.ArkUI.ArkUI.Full - * @since 12 - */ - -#ifndef ARKUI_NATIVE_EVENT -#define ARKUI_NATIVE_EVENT - -#include - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * @brief Enumerates the hit test modes. - * - * @since 12 - */ -typedef enum { - /** Both the node and its child node respond to the hit test of a touch event, but its sibling node is blocked from - * the hit test. - */ - HTM_DEFAULT = 0, - - /** The node responds to the hit test of a touch event, but its child node and sibling node are blocked from the hit - * test. - */ - HTM_BLOCK, - - /** Both the node and its child node respond to the hit test of a touch event, and its sibling node is also - * considered during the hit test. - */ - HTM_TRANSPARENT, - - /** The node does not respond to the hit test of a touch event, but its child node and sibling node are considered - * during the hit test. - */ - HTM_NONE, -} HitTestMode; - -#ifdef __cplusplus -}; -#endif - -#endif // ARKUI_NATIVE_EVENT -/** @} */ diff --git a/arkui/ace_engine/native/native_interface_xcomponent.h b/arkui/ace_engine/native/native_interface_xcomponent.h index e1ae0dbeff288c32205ae801f553d2cc97994b7d..d988ff6ff04caec5947b70ca1907d720be50073a 100644 --- a/arkui/ace_engine/native/native_interface_xcomponent.h +++ b/arkui/ace_engine/native/native_interface_xcomponent.h @@ -42,7 +42,6 @@ #include #endif -#include "arkui/native_event.h" #include "arkui/native_type.h" #include "arkui/ui_input_event.h" diff --git a/arkui/ace_engine/native/native_node.h b/arkui/ace_engine/native/native_node.h index 3c5f59829530221bfe9dd988fe35703c5e4a8537..d856e862e37c60c8597a89f57df745c19790a058 100644 --- a/arkui/ace_engine/native/native_node.h +++ b/arkui/ace_engine/native/native_node.h @@ -36,7 +36,6 @@ #ifndef ARKUI_NATIVE_NODE_H #define ARKUI_NATIVE_NODE_H -#include "native_event.h" #include "native_type.h" #include "ui_input_event.h" @@ -3906,6 +3905,14 @@ typedef enum { * application screen, in vp. \n */ NODE_ON_CLICK, + /** + * @brief Defines event interception. + * + * This event is triggered when the component is touched. \n + * When the event callback occurs, the union type in the {@link ArkUI_NodeEvent} object is + * {@link ArkUI_UIInputEvent}. \n + */ + NODE_ON_TOUCH_INTERCEPT, /** * @brief Defines the image loading success event. * diff --git a/arkui/ace_engine/native/ui_input_event.h b/arkui/ace_engine/native/ui_input_event.h index 0a056482325c3299693877b2ea7d6ad50a0602cd..afb29c8f4367c341340b8c84fe79e9bd69f78360 100644 --- a/arkui/ace_engine/native/ui_input_event.h +++ b/arkui/ace_engine/native/ui_input_event.h @@ -114,6 +114,33 @@ enum { UI_INPUT_EVENT_SOURCE_TYPE_TOUCH_SCREEN = 2, }; +/** + * @brief Enumerates the hit test modes. + * + * @since 12 + */ +typedef enum { + /** Both the node and its child node respond to the hit test of a touch event, but its sibling node is blocked from + * the hit test. + */ + HTM_DEFAULT = 0, + + /** The node responds to the hit test of a touch event, but its child node and sibling node are blocked from the hit + * test. + */ + HTM_BLOCK, + + /** Both the node and its child node respond to the hit test of a touch event, and its sibling node is also + * considered during the hit test. + */ + HTM_TRANSPARENT, + + /** The node does not respond to the hit test of a touch event, but its child node and sibling node are considered + * during the hit test. + */ + HTM_NONE, +} HitTestMode; + /** * @brief Obtains the type of this UI input event. * @@ -592,6 +619,16 @@ double OH_ArkUI_AxisEvent_GetHorizontalAxisValue(const ArkUI_UIInputEvent* event */ double OH_ArkUI_AxisEvent_GetPinchAxisScaleValue(const ArkUI_UIInputEvent* event); +/** + * @brief Sets how the component behaves during hit testing. + * + * @param event Indicates the pointer to the current UI input event. + * @param mode Indicates how the component behaves during hit testing. The parameter type is {@link HitTestMode}. + * @return Returns the status code of the execution. + * @since 12 + */ +int32_t OH_ArkUI_PointerEvent_SetInterceptHitTestMode(const ArkUI_UIInputEvent* event, HitTestMode mode); + #ifdef __cplusplus }; #endif