mirror of
https://gitee.com/openharmony/arkui_ace_engine
synced 2025-02-17 08:52:57 +00:00
GestureInfo file split
Signed-off-by: zhouchaobo <zhouchaobo@huawei.com> Change-Id: I25c8ccc6b2edde8778acb194fca4ff03731f4626
This commit is contained in:
parent
d152479cf5
commit
dd6bb1c362
@ -145,6 +145,7 @@ template("ace_core_source_set") {
|
||||
|
||||
# gestures
|
||||
"gestures/click_recognizer.cpp",
|
||||
"gestures/drag_event.cpp",
|
||||
"gestures/drag_recognizer.cpp",
|
||||
"gestures/exclusive_recognizer.cpp",
|
||||
"gestures/gesture_recognizer.cpp",
|
||||
@ -494,10 +495,6 @@ template("ace_core_source_set") {
|
||||
}
|
||||
}
|
||||
|
||||
if (defined(config.enable_drag_framework) && config.enable_drag_framework) {
|
||||
sources += [ "gestures/gesture_info.cpp" ]
|
||||
}
|
||||
|
||||
if (defined(config.remote_window_support) && config.remote_window_support) {
|
||||
if (!use_mingw_win && !use_mac && !use_linux) {
|
||||
deps += [
|
||||
@ -659,6 +656,7 @@ template("ace_core_ng_source_set") {
|
||||
|
||||
# gestures
|
||||
"gestures/click_recognizer.cpp",
|
||||
"gestures/drag_event.cpp",
|
||||
"gestures/drag_recognizer.cpp",
|
||||
"gestures/exclusive_recognizer.cpp",
|
||||
"gestures/gesture_recognizer.cpp",
|
||||
@ -825,9 +823,6 @@ template("ace_core_ng_source_set") {
|
||||
}
|
||||
|
||||
external_deps = []
|
||||
if (defined(config.enable_drag_framework) && config.enable_drag_framework) {
|
||||
sources += [ "gestures/gesture_info.cpp" ]
|
||||
}
|
||||
|
||||
if (defined(config.remote_window_support) && config.remote_window_support) {
|
||||
if (!use_mingw_win && !use_mac && !use_linux) {
|
||||
|
@ -17,7 +17,7 @@
|
||||
#define FOUNDATION_ACE_FRAMEWORKS_CORE_COMMON_INTERACTION_DATA_H
|
||||
|
||||
#include "base/image/pixel_map.h"
|
||||
#include "core/gestures/gesture_info.h"
|
||||
#include "core/gestures/drag_event.h"
|
||||
|
||||
namespace OHOS::Ace {
|
||||
enum class DragCursorStyleCore {
|
||||
|
@ -21,7 +21,6 @@
|
||||
#include "core/components/common/properties/animatable_color.h"
|
||||
#include "core/components/common/properties/color.h"
|
||||
#include "core/components/common/properties/decoration.h"
|
||||
#include "core/gestures/gesture_info.h"
|
||||
#include "core/gestures/gesture_group.h"
|
||||
#include "core/gestures/raw_recognizer.h"
|
||||
|
||||
|
@ -16,10 +16,10 @@
|
||||
#ifndef FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_BOX_DRAG_DROP_EVENT_H
|
||||
#define FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_BOX_DRAG_DROP_EVENT_H
|
||||
|
||||
#include "core/gestures/drag_event.h"
|
||||
#include "core/pipeline/base/component.h"
|
||||
#include "frameworks/base/memory/ace_type.h"
|
||||
#include "frameworks/base/window/drag_window.h"
|
||||
#include "frameworks/core/gestures/gesture_info.h"
|
||||
#include "frameworks/core/gestures/gesture_recognizer.h"
|
||||
#include "frameworks/core/common/clipboard/clipboard_proxy.h"
|
||||
|
||||
|
@ -36,8 +36,8 @@
|
||||
#include "core/event/axis_event.h"
|
||||
#include "core/event/mouse_event.h"
|
||||
#include "core/gestures/click_recognizer.h"
|
||||
#include "core/gestures/drag_event.h"
|
||||
#include "core/gestures/exclusive_recognizer.h"
|
||||
#include "core/gestures/gesture_info.h"
|
||||
#include "core/gestures/gesture_recognizer.h"
|
||||
#include "core/gestures/long_press_recognizer.h"
|
||||
#include "core/gestures/pan_recognizer.h"
|
||||
|
@ -23,7 +23,6 @@
|
||||
#include "core/components_ng/event/click_event.h"
|
||||
#include "core/components_ng/property/border_property.h"
|
||||
#include "core/event/ace_event_handler.h"
|
||||
#include "core/gestures/gesture_info.h"
|
||||
#include "core/pipeline/base/component.h"
|
||||
|
||||
namespace OHOS::Ace {
|
||||
|
@ -33,7 +33,6 @@
|
||||
#include "core/components/positioned/positioned_component.h"
|
||||
#include "core/components/stack/stack_element.h"
|
||||
#include "core/gestures/drag_recognizer.h"
|
||||
#include "core/gestures/gesture_info.h"
|
||||
#include "core/gestures/raw_recognizer.h"
|
||||
#include "core/pipeline/base/render_node.h"
|
||||
|
||||
|
@ -24,7 +24,6 @@
|
||||
#include "base/json/json_util.h"
|
||||
#include "core/common/card_scope.h"
|
||||
#include "core/common/container.h"
|
||||
#include "core/gestures/gesture_info.h"
|
||||
|
||||
namespace OHOS::Ace {
|
||||
namespace {
|
||||
|
@ -23,7 +23,6 @@
|
||||
#include "base/utils/noncopyable.h"
|
||||
#include "core/components_ng/event/gesture_event_actuator.h"
|
||||
#include "core/components_ng/gestures/recognizers/click_recognizer.h"
|
||||
#include "core/gestures/gesture_info.h"
|
||||
|
||||
namespace OHOS::Ace::NG {
|
||||
|
||||
|
@ -22,8 +22,8 @@
|
||||
#include "base/memory/ace_type.h"
|
||||
#include "base/memory/referenced.h"
|
||||
#include "core/components_ng/event/gesture_event_actuator.h"
|
||||
#include "core/components_ng/gestures/gesture_info.h"
|
||||
#include "core/components_ng/gestures/recognizers/sequenced_recognizer.h"
|
||||
#include "core/gestures/drag_event.h"
|
||||
|
||||
namespace OHOS::Ace::NG {
|
||||
|
||||
|
@ -20,7 +20,7 @@
|
||||
#include "core/components_ng/base/geometry_node.h"
|
||||
#include "core/components_ng/event/touch_event.h"
|
||||
#include "core/event/key_event.h"
|
||||
#include "core/gestures/gesture_info.h"
|
||||
#include "core/gestures/gesture_event.h"
|
||||
|
||||
namespace OHOS::Ace::NG {
|
||||
|
||||
|
@ -22,7 +22,6 @@
|
||||
#include "base/utils/noncopyable.h"
|
||||
#include "core/components_ng/event/gesture_event_actuator.h"
|
||||
#include "core/components_ng/gestures/recognizers/long_press_recognizer.h"
|
||||
#include "core/gestures/gesture_info.h"
|
||||
|
||||
namespace OHOS::Ace::NG {
|
||||
|
||||
|
@ -30,7 +30,7 @@
|
||||
#include "base/utils/macros.h"
|
||||
#include "base/utils/type_definition.h"
|
||||
#include "core/event/ace_events.h"
|
||||
#include "core/gestures/gesture_info.h"
|
||||
#include "core/gestures/gesture_event.h"
|
||||
#include "core/gestures/velocity.h"
|
||||
#include "core/gestures/velocity_tracker.h"
|
||||
|
||||
|
@ -20,8 +20,8 @@
|
||||
|
||||
#include "base/thread/cancelable_callback.h"
|
||||
#include "core/accessibility/accessibility_utils.h"
|
||||
#include "core/components_ng/gestures/gesture_info.h"
|
||||
#include "core/components_ng/gestures/recognizers/multi_fingers_recognizer.h"
|
||||
#include "core/gestures/click_info.h"
|
||||
|
||||
namespace OHOS::Ace::NG {
|
||||
using OnAccessibilityEventFunc = std::function<void(AccessibilityEventType)>;
|
||||
|
@ -19,7 +19,7 @@
|
||||
#include "base/memory/ace_type.h"
|
||||
#include "base/memory/referenced.h"
|
||||
#include "base/utils/noncopyable.h"
|
||||
#include "core/gestures/gesture_info.h"
|
||||
#include "core/gestures/gesture_event.h"
|
||||
|
||||
namespace OHOS::Ace::NG {
|
||||
class FrameNode;
|
||||
|
@ -20,7 +20,6 @@
|
||||
|
||||
#include "core/common/container.h"
|
||||
#include "core/components/dialog/dialog_properties.h"
|
||||
#include "core/gestures/gesture_info.h"
|
||||
|
||||
namespace OHOS::Ace {
|
||||
class ActionSheetModel {
|
||||
|
@ -20,7 +20,6 @@
|
||||
#include "core/common/ace_application_info.h"
|
||||
#include "core/components_ng/base/frame_node.h"
|
||||
#include "core/components_ng/pattern/swiper/swiper_event_hub.h"
|
||||
#include "core/gestures/gesture_info.h"
|
||||
#include "core/pipeline_ng/pipeline_context.h"
|
||||
|
||||
namespace OHOS::Ace::NG {
|
||||
|
@ -28,7 +28,6 @@
|
||||
#include "core/components_ng/pattern/scrollable/scrollable_properties.h"
|
||||
#include "core/components_v2/grid/grid_position_controller.h"
|
||||
#include "core/event/ace_events.h"
|
||||
#include "core/gestures/gesture_info.h"
|
||||
|
||||
namespace OHOS::Ace {
|
||||
|
||||
|
@ -46,7 +46,6 @@
|
||||
#include "core/components_v2/inspector/inspector_constants.h"
|
||||
#include "core/components_v2/list/list_properties.h"
|
||||
#include "core/event/mouse_event.h"
|
||||
#include "core/gestures/gesture_info.h"
|
||||
#include "core/pipeline_ng/pipeline_context.h"
|
||||
|
||||
namespace OHOS::Ace::NG {
|
||||
|
@ -22,7 +22,6 @@
|
||||
#include "core/components_ng/event/input_event.h"
|
||||
#include "core/components_ng/pattern/linear_split/linear_split_model.h"
|
||||
#include "core/event/mouse_event.h"
|
||||
#include "core/gestures/gesture_info.h"
|
||||
#include "core/pipeline_ng/pipeline_context.h"
|
||||
|
||||
namespace OHOS::Ace::NG {
|
||||
|
@ -26,7 +26,6 @@
|
||||
#include "core/components_ng/pattern/list/list_pattern.h"
|
||||
#include "core/components_ng/property/property.h"
|
||||
#include "core/components_v2/inspector/inspector_constants.h"
|
||||
#include "core/gestures/gesture_info.h"
|
||||
|
||||
namespace OHOS::Ace::NG {
|
||||
namespace {
|
||||
|
@ -36,7 +36,6 @@
|
||||
#include "core/components_ng/pattern/navrouter/navdestination_pattern.h"
|
||||
#include "core/components_ng/pattern/navrouter/navrouter_group_node.h"
|
||||
#include "core/components_ng/property/property.h"
|
||||
#include "core/gestures/gesture_info.h"
|
||||
#include "core/pipeline_ng/pipeline_context.h"
|
||||
#include "core/pipeline_ng/ui_task_scheduler.h"
|
||||
|
||||
|
@ -22,7 +22,6 @@
|
||||
#include "core/components_ng/pattern/security_component/security_component_theme.h"
|
||||
#include "core/components/common/layout/constants.h"
|
||||
#include "core/components/common/properties/text_style.h"
|
||||
#include "core/gestures/gesture_info.h"
|
||||
|
||||
namespace OHOS::Ace::NG {
|
||||
class ACE_EXPORT SecurityComponentModelNG {
|
||||
|
@ -41,7 +41,6 @@
|
||||
#include "core/components_ng/property/property.h"
|
||||
#include "core/components_v2/inspector/inspector_constants.h"
|
||||
#include "core/components_v2/inspector/utils.h"
|
||||
#include "core/gestures/gesture_info.h"
|
||||
#include "core/pipeline/pipeline_base.h"
|
||||
|
||||
namespace OHOS::Ace::NG {
|
||||
|
@ -43,7 +43,6 @@
|
||||
#include "core/components_ng/pattern/text/text_pattern.h"
|
||||
#include "core/components_ng/property/calc_length.h"
|
||||
#include "core/components_ng/property/property.h"
|
||||
#include "core/gestures/gesture_info.h"
|
||||
#include "core/pipeline/base/element_register.h"
|
||||
#include "core/pipeline_ng/pipeline_context.h"
|
||||
#ifdef ENABLE_ROSEN_BACKEND
|
||||
|
@ -32,7 +32,6 @@
|
||||
#include "core/components_ng/pattern/select_overlay/select_overlay_property.h"
|
||||
#include "core/components_ng/property/property.h"
|
||||
#include "core/components_ng/property/safe_area_insets.h"
|
||||
#include "core/gestures/gesture_info.h"
|
||||
#include "core/pipeline/base/constants.h"
|
||||
#include "core/pipeline_ng/pipeline_context.h"
|
||||
|
||||
|
@ -30,7 +30,6 @@
|
||||
#include "core/components_ng/pattern/side_bar/side_bar_theme.h"
|
||||
#include "core/components_ng/property/measure_utils.h"
|
||||
#include "core/components_v2/inspector/inspector_constants.h"
|
||||
#include "core/gestures/gesture_info.h"
|
||||
#include "core/image/image_source_info.h"
|
||||
#include "core/pipeline_ng/pipeline_context.h"
|
||||
#include "core/pipeline_ng/ui_task_scheduler.h"
|
||||
|
@ -27,7 +27,6 @@
|
||||
#include "core/components_ng/render/paragraph.h"
|
||||
#include "core/components_v2/inspector/inspector_constants.h"
|
||||
#include "core/components_v2/inspector/utils.h"
|
||||
#include "core/gestures/gesture_info.h"
|
||||
|
||||
#define DEFINE_SPAN_FONT_STYLE_ITEM(name, type) \
|
||||
public: \
|
||||
|
@ -35,7 +35,6 @@
|
||||
#include "core/components_ng/pattern/text/text_layout_property.h"
|
||||
#include "core/components_ng/pattern/text_drag/text_drag_pattern.h"
|
||||
#include "core/components_ng/property/property.h"
|
||||
#include "core/gestures/gesture_info.h"
|
||||
|
||||
#ifdef ENABLE_DRAG_FRAMEWORK
|
||||
#include "core/common/ace_engine_ext.h"
|
||||
|
@ -62,7 +62,6 @@
|
||||
#include "core/components_ng/pattern/text_field/text_selector.h"
|
||||
#include "core/components_ng/pattern/text_input/text_input_layout_algorithm.h"
|
||||
#include "core/components_ng/property/property.h"
|
||||
#include "core/gestures/gesture_info.h"
|
||||
|
||||
#if not defined(ACE_UNITTEST)
|
||||
#if defined(ENABLE_STANDARD_INPUT)
|
||||
|
@ -35,7 +35,6 @@
|
||||
#include "core/components_ng/manager/drag_drop/drag_drop_proxy.h"
|
||||
#include "core/components_ng/pattern/pattern.h"
|
||||
#include "core/components_v2/inspector/inspector_constants.h"
|
||||
#include "core/gestures/gesture_info.h"
|
||||
#include "core/pipeline_ng/test/mock/mock_pipeline_base.h"
|
||||
|
||||
using namespace testing;
|
||||
|
@ -45,7 +45,6 @@
|
||||
#include "core/components_ng/test/mock/rosen/mock_canvas.h"
|
||||
#include "core/components_ng/test/mock/theme/mock_theme_manager.h"
|
||||
#include "core/components_v2/inspector/inspector_constants.h"
|
||||
#include "core/gestures/gesture_info.h"
|
||||
#include "core/pipeline/base/element_register.h"
|
||||
#include "core/pipeline_ng/test/mock/mock_pipeline_base.h"
|
||||
#include "core/pipeline_ng/ui_task_scheduler.h"
|
||||
|
@ -64,7 +64,6 @@
|
||||
#include "core/components_ng/test/mock/render/mock_render_context.h"
|
||||
#include "core/components_ng/test/mock/theme/mock_theme_manager.h"
|
||||
#include "core/components_v2/inspector/inspector_constants.h"
|
||||
#include "core/gestures/gesture_info.h"
|
||||
#include "core/pipeline/base/element_register.h"
|
||||
#include "core/pipeline_ng/test/mock/mock_pipeline_base.h"
|
||||
#include "core/pipeline_ng/ui_task_scheduler.h"
|
||||
|
@ -31,7 +31,6 @@
|
||||
#include "core/components_v2/inspector/inspector_constants.h"
|
||||
#include "core/event/key_event.h"
|
||||
#include "core/event/touch_event.h"
|
||||
#include "core/gestures/gesture_info.h"
|
||||
#include "core/pipeline_ng/test/mock/mock_pipeline_base.h"
|
||||
#undef private
|
||||
#undef protected
|
||||
|
@ -50,7 +50,6 @@
|
||||
#include "core/components_ng/test/mock/theme/mock_theme_manager.h"
|
||||
#include "core/components_v2/inspector/inspector_constants.h"
|
||||
#include "core/event/mouse_event.h"
|
||||
#include "core/gestures/gesture_info.h"
|
||||
#include "core/pipeline_ng/test/mock/mock_pipeline_base.h"
|
||||
|
||||
|
||||
|
33
frameworks/core/gestures/click_info.h
Normal file
33
frameworks/core/gestures/click_info.h
Normal file
@ -0,0 +1,33 @@
|
||||
/*
|
||||
* Copyright (c) 2023 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.
|
||||
*/
|
||||
#ifndef FOUNDATION_ACE_FRAMEWORKS_CORE_GESTURES_CLICK_INFO_H
|
||||
#define FOUNDATION_ACE_FRAMEWORKS_CORE_GESTURES_CLICK_INFO_H
|
||||
|
||||
#include "core/event/touch_event.h"
|
||||
|
||||
namespace OHOS::Ace {
|
||||
|
||||
class ClickInfo : public TouchLocationInfo {
|
||||
DECLARE_RELATIONSHIP_OF_CLASSES(ClickInfo, TouchLocationInfo);
|
||||
|
||||
public:
|
||||
explicit ClickInfo(int32_t fingerId) : TouchLocationInfo("onClick", fingerId) {}
|
||||
~ClickInfo() override = default;
|
||||
};
|
||||
using ClickCallback = std::function<void(const ClickInfo&)>;
|
||||
|
||||
} // namespace OHOS::Ace
|
||||
|
||||
#endif // FOUNDATION_ACE_FRAMEWORKS_CORE_GESTURES_CLICK_INFO_H
|
@ -20,8 +20,8 @@
|
||||
|
||||
#include "base/thread/cancelable_callback.h"
|
||||
#include "core/gestures/multi_fingers_recognizer.h"
|
||||
#include "core/gestures/gesture_info.h"
|
||||
#include "core/pipeline/pipeline_base.h"
|
||||
#include "frameworks/core/gestures/click_info.h"
|
||||
|
||||
namespace OHOS::Ace {
|
||||
|
||||
|
@ -1,19 +1,19 @@
|
||||
/*
|
||||
* Copyright (c) 2021 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.
|
||||
*/
|
||||
* Copyright (c) 2023 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.
|
||||
*/
|
||||
|
||||
#include "gesture_info.h"
|
||||
#include "drag_event.h"
|
||||
|
||||
namespace OHOS::Ace {
|
||||
#ifdef ENABLE_DRAG_FRAMEWORK
|
257
frameworks/core/gestures/drag_event.h
Normal file
257
frameworks/core/gestures/drag_event.h
Normal file
@ -0,0 +1,257 @@
|
||||
/*
|
||||
* Copyright (c) 2023 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.
|
||||
*/
|
||||
#ifndef FOUNDATION_ACE_FRAMEWORKS_CORE_GESTURES_DRAG_EVENT_H
|
||||
#define FOUNDATION_ACE_FRAMEWORKS_CORE_GESTURES_DRAG_EVENT_H
|
||||
|
||||
#include <map>
|
||||
|
||||
#include "base/image/pixel_map.h"
|
||||
#include "base/memory/ace_type.h"
|
||||
#include "core/event/ace_events.h"
|
||||
#include "core/gestures/velocity.h"
|
||||
|
||||
#ifdef ENABLE_DRAG_FRAMEWORK
|
||||
#include "base/geometry/rect.h"
|
||||
#include "core/common/udmf/unified_data.h"
|
||||
#endif
|
||||
|
||||
namespace OHOS::Ace {
|
||||
|
||||
class PasteData : public AceType {
|
||||
DECLARE_ACE_TYPE(PasteData, AceType);
|
||||
|
||||
public:
|
||||
PasteData() = default;
|
||||
~PasteData() override = default;
|
||||
|
||||
void SetPlainText(const std::string& plainText)
|
||||
{
|
||||
plainText_ = plainText;
|
||||
}
|
||||
|
||||
const std::string& GetPlainText() const
|
||||
{
|
||||
return plainText_;
|
||||
}
|
||||
|
||||
private:
|
||||
std::string plainText_;
|
||||
};
|
||||
|
||||
#ifdef ENABLE_DRAG_FRAMEWORK
|
||||
enum class DragRet {
|
||||
DRAG_DEFAULT = -1,
|
||||
DRAG_SUCCESS = 0,
|
||||
DRAG_FAIL,
|
||||
DRAG_CANCEL,
|
||||
ENABLE_DROP,
|
||||
DISABLE_DROP,
|
||||
};
|
||||
enum class DragBehavior {
|
||||
COPY = 0,
|
||||
MOVE = 1,
|
||||
};
|
||||
#endif
|
||||
|
||||
class ACE_FORCE_EXPORT DragEvent : public AceType {
|
||||
DECLARE_ACE_TYPE(DragEvent, AceType)
|
||||
|
||||
public:
|
||||
DragEvent() = default;
|
||||
~DragEvent() override = default;
|
||||
|
||||
void SetPasteData(const RefPtr<PasteData>& pasteData)
|
||||
{
|
||||
pasteData_ = pasteData;
|
||||
}
|
||||
|
||||
RefPtr<PasteData> GetPasteData() const
|
||||
{
|
||||
return pasteData_;
|
||||
}
|
||||
|
||||
double GetScreenX() const
|
||||
{
|
||||
return screenX_;
|
||||
}
|
||||
|
||||
double GetScreenY() const
|
||||
{
|
||||
return screenY_;
|
||||
}
|
||||
|
||||
void SetScreenX(double x)
|
||||
{
|
||||
screenX_ = x;
|
||||
}
|
||||
|
||||
void SetScreenY(double y)
|
||||
{
|
||||
screenY_ = y;
|
||||
}
|
||||
|
||||
double GetX() const
|
||||
{
|
||||
return x_;
|
||||
}
|
||||
|
||||
double GetY() const
|
||||
{
|
||||
return y_;
|
||||
}
|
||||
|
||||
void SetX(double x)
|
||||
{
|
||||
x_ = x;
|
||||
}
|
||||
|
||||
void SetY(double y)
|
||||
{
|
||||
y_ = y;
|
||||
}
|
||||
|
||||
void SetDescription(const std::string& description)
|
||||
{
|
||||
description_ = description;
|
||||
}
|
||||
|
||||
const std::string& GetDescription() const
|
||||
{
|
||||
return description_;
|
||||
}
|
||||
|
||||
void SetPixmap(const RefPtr<PixelMap>& pixelMap)
|
||||
{
|
||||
pixelMap_ = pixelMap;
|
||||
}
|
||||
|
||||
RefPtr<PixelMap> GetPixmap() const
|
||||
{
|
||||
return pixelMap_;
|
||||
}
|
||||
|
||||
#ifdef ENABLE_DRAG_FRAMEWORK
|
||||
void SetData(const RefPtr<UnifiedData>& unifiedData);
|
||||
|
||||
RefPtr<UnifiedData>& GetData();
|
||||
|
||||
void SetSummary(std::map<std::string, int64_t>& summary);
|
||||
|
||||
std::map<std::string, int64_t>& GetSummary();
|
||||
|
||||
void SetResult(DragRet dragRet);
|
||||
|
||||
DragRet GetResult();
|
||||
|
||||
void SetPreviewRect(Rect previewRect);
|
||||
|
||||
Rect GetPreviewRect();
|
||||
|
||||
void UseCustomAnimation(bool useCustomAnimation);
|
||||
|
||||
bool IsUseCustomAnimation();
|
||||
|
||||
void SetUdKey(const std::string udKey);
|
||||
|
||||
std::string GetUdKey();
|
||||
|
||||
void SetDragInfo(const RefPtr<UnifiedData>& dragInfo);
|
||||
|
||||
RefPtr<UnifiedData>& GetDragInfo();
|
||||
|
||||
void SetCopy(bool copy);
|
||||
|
||||
bool IsCopy();
|
||||
|
||||
void SetIsGetDataSuccess(bool isGetDataSuccess);
|
||||
|
||||
bool IsGetDataSuccess();
|
||||
#endif
|
||||
|
||||
void SetVelocity(const Velocity& velocity)
|
||||
{
|
||||
velocity_ = velocity;
|
||||
}
|
||||
|
||||
const Velocity& GetVelocity() const
|
||||
{
|
||||
return velocity_;
|
||||
}
|
||||
|
||||
private:
|
||||
RefPtr<PasteData> pasteData_;
|
||||
double screenX_ = 0.0;
|
||||
double screenY_ = 0.0;
|
||||
double x_ = 0.0;
|
||||
double y_ = 0.0;
|
||||
std::string description_;
|
||||
RefPtr<PixelMap> pixelMap_;
|
||||
#ifdef ENABLE_DRAG_FRAMEWORK
|
||||
RefPtr<UnifiedData> unifiedData_;
|
||||
std::map<std::string, int64_t> summary_;
|
||||
std::string udKey_ = "";
|
||||
DragRet dragRet_ = DragRet::DRAG_DEFAULT;
|
||||
Rect previewRect_;
|
||||
bool useCustomAnimation_ = false;
|
||||
bool isGetDataSuccess_ = false;
|
||||
RefPtr<UnifiedData> dragInfo_;
|
||||
bool copy_ = true;
|
||||
#endif
|
||||
Velocity velocity_;
|
||||
};
|
||||
|
||||
class NotifyDragEvent : public DragEvent {
|
||||
DECLARE_ACE_TYPE(NotifyDragEvent, DragEvent)
|
||||
|
||||
public:
|
||||
NotifyDragEvent() = default;
|
||||
~NotifyDragEvent() = default;
|
||||
};
|
||||
|
||||
class ItemDragInfo : public BaseEventInfo {
|
||||
DECLARE_RELATIONSHIP_OF_CLASSES(ItemDragInfo, BaseEventInfo);
|
||||
|
||||
public:
|
||||
ItemDragInfo() : BaseEventInfo("itemDrag") {}
|
||||
~ItemDragInfo() override = default;
|
||||
|
||||
double GetX() const
|
||||
{
|
||||
return x_;
|
||||
}
|
||||
|
||||
double GetY() const
|
||||
{
|
||||
return y_;
|
||||
}
|
||||
|
||||
void SetX(double x)
|
||||
{
|
||||
x_ = x;
|
||||
}
|
||||
|
||||
void SetY(double y)
|
||||
{
|
||||
y_ = y;
|
||||
}
|
||||
|
||||
private:
|
||||
double x_ = 0.0;
|
||||
double y_ = 0.0;
|
||||
};
|
||||
|
||||
} // namespace OHOS::Ace
|
||||
|
||||
#endif // FOUNDATION_ACE_FRAMEWORKS_CORE_GESTURES_CLICK_RECOGNIZER_H
|
@ -19,7 +19,6 @@
|
||||
#include <functional>
|
||||
#include <set>
|
||||
|
||||
#include "core/gestures/gesture_info.h"
|
||||
#include "core/gestures/multi_fingers_recognizer.h"
|
||||
|
||||
namespace OHOS::Ace {
|
||||
|
376
frameworks/core/gestures/gesture_event.h
Normal file
376
frameworks/core/gestures/gesture_event.h
Normal file
@ -0,0 +1,376 @@
|
||||
/*
|
||||
* Copyright (c) 2023 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.
|
||||
*/
|
||||
#ifndef FOUNDATION_ACE_FRAMEWORKS_CORE_GESTURES_GESTURE_EVENT_H
|
||||
#define FOUNDATION_ACE_FRAMEWORKS_CORE_GESTURES_GESTURE_EVENT_H
|
||||
|
||||
#include "core/gestures/gesture_info.h"
|
||||
|
||||
namespace OHOS::Ace {
|
||||
|
||||
class GestureEvent : public BaseEventInfo {
|
||||
DECLARE_RELATIONSHIP_OF_CLASSES(GestureEvent, BaseEventInfo);
|
||||
|
||||
public:
|
||||
GestureEvent() : BaseEventInfo("gesture") {}
|
||||
~GestureEvent() override = default;
|
||||
|
||||
void SetRepeat(bool repeat)
|
||||
{
|
||||
repeat_ = repeat;
|
||||
}
|
||||
|
||||
bool GetRepeat() const
|
||||
{
|
||||
return repeat_;
|
||||
}
|
||||
|
||||
void SetOffsetX(double offsetX)
|
||||
{
|
||||
offsetX_ = offsetX;
|
||||
}
|
||||
|
||||
double GetOffsetX() const
|
||||
{
|
||||
return offsetX_;
|
||||
}
|
||||
|
||||
void SetOffsetY(double offsetY)
|
||||
{
|
||||
offsetY_ = offsetY;
|
||||
}
|
||||
|
||||
double GetOffsetY() const
|
||||
{
|
||||
return offsetY_;
|
||||
}
|
||||
|
||||
void SetScale(double scale)
|
||||
{
|
||||
scale_ = scale;
|
||||
}
|
||||
|
||||
double GetScale() const
|
||||
{
|
||||
return scale_;
|
||||
}
|
||||
|
||||
void SetAngle(double angle)
|
||||
{
|
||||
angle_ = angle;
|
||||
}
|
||||
|
||||
double GetAngle() const
|
||||
{
|
||||
return angle_;
|
||||
}
|
||||
|
||||
GestureEvent& SetGlobalPoint(const Point& globalPoint)
|
||||
{
|
||||
globalPoint_ = globalPoint;
|
||||
globalLocation_.SetX(globalPoint.GetX());
|
||||
globalLocation_.SetY(globalPoint.GetY());
|
||||
return *this;
|
||||
}
|
||||
|
||||
const Point& GetGlobalPoint() const
|
||||
{
|
||||
return globalPoint_;
|
||||
}
|
||||
|
||||
GestureEvent& SetScreenLocation(const Offset& screenLocation)
|
||||
{
|
||||
screenLocation_ = screenLocation;
|
||||
return *this;
|
||||
}
|
||||
|
||||
const Offset& GetScreenLocation() const
|
||||
{
|
||||
return screenLocation_;
|
||||
}
|
||||
|
||||
GestureEvent& SetGlobalLocation(const Offset& globalLocation)
|
||||
{
|
||||
globalLocation_ = globalLocation;
|
||||
globalPoint_.SetX(globalLocation.GetX());
|
||||
globalPoint_.SetY(globalLocation.GetY());
|
||||
return *this;
|
||||
}
|
||||
GestureEvent& SetLocalLocation(const Offset& localLocation)
|
||||
{
|
||||
localLocation_ = localLocation;
|
||||
return *this;
|
||||
}
|
||||
|
||||
const Offset& GetLocalLocation() const
|
||||
{
|
||||
return localLocation_;
|
||||
}
|
||||
const Offset& GetGlobalLocation() const
|
||||
{
|
||||
return globalLocation_;
|
||||
}
|
||||
|
||||
const Offset& GetPinchCenter() const
|
||||
{
|
||||
return pinchCenter_;
|
||||
}
|
||||
|
||||
GestureEvent& SetPinchCenter(const Offset& pinchCenter)
|
||||
{
|
||||
pinchCenter_ = pinchCenter;
|
||||
return *this;
|
||||
}
|
||||
|
||||
const std::list<FingerInfo>& GetFingerList() const
|
||||
{
|
||||
return fingerList_;
|
||||
}
|
||||
|
||||
void SetFingerList(const std::list<FingerInfo>& fingerList)
|
||||
{
|
||||
fingerList_ = fingerList;
|
||||
}
|
||||
|
||||
void SetSpeed(double speed)
|
||||
{
|
||||
speed_ = speed;
|
||||
}
|
||||
|
||||
double GetSpeed() const
|
||||
{
|
||||
return speed_;
|
||||
}
|
||||
|
||||
void SetMainSpeed(double mainSpeed)
|
||||
{
|
||||
mainSpeed_ = mainSpeed;
|
||||
}
|
||||
|
||||
double GetMainSpeed() const
|
||||
{
|
||||
return mainSpeed_;
|
||||
}
|
||||
|
||||
void SetVelocity(const Velocity& velocity)
|
||||
{
|
||||
velocity_ = velocity;
|
||||
}
|
||||
|
||||
const Velocity& GetVelocity() const
|
||||
{
|
||||
return velocity_;
|
||||
}
|
||||
|
||||
void SetMainVelocity(double mainVelocity)
|
||||
{
|
||||
mainVelocity_ = mainVelocity;
|
||||
}
|
||||
|
||||
double GetMainVelocity() const
|
||||
{
|
||||
return mainVelocity_;
|
||||
}
|
||||
|
||||
void SetPressed(bool pressed)
|
||||
{
|
||||
pressed_ = pressed;
|
||||
}
|
||||
|
||||
bool GetPressed() const
|
||||
{
|
||||
return pressed_;
|
||||
}
|
||||
|
||||
void SetDelta(const Offset& delta)
|
||||
{
|
||||
delta_ = delta;
|
||||
}
|
||||
|
||||
const Offset& GetDelta() const
|
||||
{
|
||||
return delta_;
|
||||
}
|
||||
|
||||
void SetMainDelta(double mainDelta)
|
||||
{
|
||||
mainDelta_ = mainDelta;
|
||||
}
|
||||
|
||||
double GetMainDelta() const
|
||||
{
|
||||
return mainDelta_;
|
||||
}
|
||||
|
||||
void SetInputEventType(InputEventType type)
|
||||
{
|
||||
inputEventType_ = type;
|
||||
}
|
||||
|
||||
InputEventType GetInputEventType() const
|
||||
{
|
||||
return inputEventType_;
|
||||
}
|
||||
#ifdef ENABLE_DRAG_FRAMEWORK
|
||||
void SetPointerId(int32_t pointerId)
|
||||
{
|
||||
pointerId_ = pointerId;
|
||||
}
|
||||
|
||||
int32_t GetPointerId() const
|
||||
{
|
||||
return pointerId_;
|
||||
}
|
||||
#endif // ENABLE_DRAG_FRAMEWORK
|
||||
#ifdef SECURITY_COMPONENT_ENABLE
|
||||
void SetDisplayX(double displayX)
|
||||
{
|
||||
displayX_ = displayX;
|
||||
}
|
||||
|
||||
double GetDisplayX() const
|
||||
{
|
||||
return displayX_;
|
||||
}
|
||||
|
||||
void SetDisplayY(double displayY)
|
||||
{
|
||||
displayY_ = displayY;
|
||||
}
|
||||
|
||||
double GetDisplayY() const
|
||||
{
|
||||
return displayY_;
|
||||
}
|
||||
|
||||
void SetSecCompHandleEvent(const std::shared_ptr<JsonValue>& event)
|
||||
{
|
||||
secCompHandleEvent_ = event;
|
||||
}
|
||||
|
||||
std::shared_ptr<JsonValue> GetSecCompHandleEvent() const
|
||||
{
|
||||
return secCompHandleEvent_;
|
||||
}
|
||||
|
||||
void SetEnhanceData(std::vector<uint8_t> enhanceData)
|
||||
{
|
||||
enhanceData_ = enhanceData;
|
||||
}
|
||||
|
||||
std::vector<uint8_t> GetEnhanceData() const
|
||||
{
|
||||
return enhanceData_;
|
||||
}
|
||||
#endif
|
||||
private:
|
||||
bool repeat_ = false;
|
||||
bool pressed_ = false;
|
||||
double offsetX_ = 0.0;
|
||||
double offsetY_ = 0.0;
|
||||
double scale_ = 1.0;
|
||||
double angle_ = 0.0;
|
||||
Velocity velocity_;
|
||||
double mainVelocity_ = 0.0;
|
||||
double speed_ = 0.0;
|
||||
double mainSpeed_ = 0.0;
|
||||
double mainDelta_ = 0.0;
|
||||
#ifdef ENABLE_DRAG_FRAMEWORK
|
||||
int32_t pointerId_ = 0;
|
||||
#endif // ENABLE_DRAG_FRAMEWORK
|
||||
#ifdef SECURITY_COMPONENT_ENABLE
|
||||
double displayX_ = 0.0;
|
||||
double displayY_ = 0.0;
|
||||
std::vector<uint8_t> enhanceData_;
|
||||
std::shared_ptr<JsonValue> secCompHandleEvent_;
|
||||
#endif
|
||||
Point globalPoint_;
|
||||
// global position at which the touch point contacts the screen.
|
||||
Offset globalLocation_;
|
||||
// Different from global location, The local location refers to the location of the contact point relative to the
|
||||
// current node which has the recognizer.
|
||||
Offset localLocation_;
|
||||
Offset screenLocation_;
|
||||
Offset pinchCenter_;
|
||||
Offset delta_;
|
||||
std::list<FingerInfo> fingerList_;
|
||||
InputEventType inputEventType_ = InputEventType::TOUCH_SCREEN;
|
||||
};
|
||||
|
||||
using GestureEventFunc = std::function<void(GestureEvent& info)>;
|
||||
using GestureEventNoParameter = std::function<void()>;
|
||||
|
||||
class ACE_EXPORT Gesture : public virtual AceType {
|
||||
DECLARE_ACE_TYPE(Gesture, AceType);
|
||||
|
||||
public:
|
||||
Gesture() = default;
|
||||
explicit Gesture(int32_t fingers) : fingers_(fingers) {}
|
||||
~Gesture() override = default;
|
||||
|
||||
void SetOnActionId(const GestureEventFunc& onActionId)
|
||||
{
|
||||
onActionId_ = std::make_unique<GestureEventFunc>(onActionId);
|
||||
}
|
||||
void SetOnActionStartId(const GestureEventFunc& onActionStartId)
|
||||
{
|
||||
onActionStartId_ = std::make_unique<GestureEventFunc>(onActionStartId);
|
||||
}
|
||||
void SetOnActionUpdateId(const GestureEventFunc& onActionUpdateId)
|
||||
{
|
||||
onActionUpdateId_ = std::make_unique<GestureEventFunc>(onActionUpdateId);
|
||||
}
|
||||
void SetOnActionEndId(const GestureEventFunc& onActionEndId)
|
||||
{
|
||||
onActionEndId_ = std::make_unique<GestureEventFunc>(onActionEndId);
|
||||
}
|
||||
void SetOnActionCancelId(const GestureEventNoParameter& onActionCancelId)
|
||||
{
|
||||
onActionCancelId_ = std::make_unique<GestureEventNoParameter>(onActionCancelId);
|
||||
}
|
||||
void SetPriority(GesturePriority priority)
|
||||
{
|
||||
priority_ = priority;
|
||||
}
|
||||
void SetGestureMask(GestureMask gestureMask)
|
||||
{
|
||||
gestureMask_ = gestureMask;
|
||||
}
|
||||
|
||||
GesturePriority GetPriority() const
|
||||
{
|
||||
return priority_;
|
||||
}
|
||||
|
||||
GestureMask GetGestureMask() const
|
||||
{
|
||||
return gestureMask_;
|
||||
}
|
||||
|
||||
virtual RefPtr<GestureRecognizer> CreateRecognizer(WeakPtr<PipelineBase> context) = 0;
|
||||
|
||||
protected:
|
||||
int32_t fingers_ = 1;
|
||||
GesturePriority priority_ = GesturePriority::Low;
|
||||
GestureMask gestureMask_ = GestureMask::Normal;
|
||||
std::unique_ptr<GestureEventFunc> onActionId_;
|
||||
std::unique_ptr<GestureEventFunc> onActionStartId_;
|
||||
std::unique_ptr<GestureEventFunc> onActionUpdateId_;
|
||||
std::unique_ptr<GestureEventFunc> onActionEndId_;
|
||||
std::unique_ptr<GestureEventNoParameter> onActionCancelId_;
|
||||
};
|
||||
|
||||
} // namespace OHOS::Ace
|
||||
|
||||
#endif // FOUNDATION_ACE_FRAMEWORKS_CORE_GESTURES_GESTURE_EVENT_H
|
@ -23,7 +23,7 @@
|
||||
#include "base/geometry/offset.h"
|
||||
#include "base/memory/ace_type.h"
|
||||
#include "base/utils/macros.h"
|
||||
#include "core/gestures/gesture_info.h"
|
||||
#include "core/gestures/gesture_event.h"
|
||||
|
||||
namespace OHOS::Ace {
|
||||
|
||||
|
@ -17,7 +17,6 @@
|
||||
#define FOUNDATION_ACE_FRAMEWORKS_CORE_GESTURES_GESTURE_INFO_H
|
||||
|
||||
#include <functional>
|
||||
#include <map>
|
||||
#include <list>
|
||||
#include <string>
|
||||
#include <unordered_map>
|
||||
@ -26,7 +25,6 @@
|
||||
#include "base/geometry/matrix4.h"
|
||||
#include "base/geometry/offset.h"
|
||||
#include "base/geometry/point.h"
|
||||
#include "base/image/pixel_map.h"
|
||||
#include "base/memory/ace_type.h"
|
||||
#include "base/utils/event_callback.h"
|
||||
#include "base/utils/macros.h"
|
||||
@ -35,11 +33,6 @@
|
||||
#include "core/gestures/velocity.h"
|
||||
#include "core/gestures/velocity_tracker.h"
|
||||
|
||||
#ifdef ENABLE_DRAG_FRAMEWORK
|
||||
#include "core/common/udmf/unified_data.h"
|
||||
#include "base/geometry/rect.h"
|
||||
#endif
|
||||
|
||||
namespace OHOS::Ace {
|
||||
|
||||
constexpr int32_t DEFAULT_PAN_FINGER = 1;
|
||||
@ -243,197 +236,6 @@ using SwipeDirectionFuncType = OnSwipeDirectionFunc::FunctionType;
|
||||
using OnSwipeSpeedFunc = EventCallback<void(double speed)>;
|
||||
using SwipeSpeedFuncType = OnSwipeSpeedFunc::FunctionType;
|
||||
|
||||
class PasteData : public AceType {
|
||||
DECLARE_ACE_TYPE(PasteData, AceType);
|
||||
|
||||
public:
|
||||
PasteData() = default;
|
||||
~PasteData() override = default;
|
||||
|
||||
void SetPlainText(const std::string& plainText)
|
||||
{
|
||||
plainText_ = plainText;
|
||||
}
|
||||
|
||||
const std::string& GetPlainText() const
|
||||
{
|
||||
return plainText_;
|
||||
}
|
||||
|
||||
private:
|
||||
std::string plainText_;
|
||||
};
|
||||
|
||||
#ifdef ENABLE_DRAG_FRAMEWORK
|
||||
enum class DragRet {
|
||||
DRAG_DEFAULT = -1,
|
||||
DRAG_SUCCESS = 0,
|
||||
DRAG_FAIL,
|
||||
DRAG_CANCEL,
|
||||
ENABLE_DROP,
|
||||
DISABLE_DROP,
|
||||
};
|
||||
enum class DragBehavior {
|
||||
COPY = 0,
|
||||
MOVE = 1,
|
||||
};
|
||||
#endif
|
||||
|
||||
class ACE_FORCE_EXPORT DragEvent : public AceType {
|
||||
DECLARE_ACE_TYPE(DragEvent, AceType)
|
||||
|
||||
public:
|
||||
DragEvent() = default;
|
||||
~DragEvent() override = default;
|
||||
|
||||
void SetPasteData(const RefPtr<PasteData>& pasteData)
|
||||
{
|
||||
pasteData_ = pasteData;
|
||||
}
|
||||
|
||||
RefPtr<PasteData> GetPasteData() const
|
||||
{
|
||||
return pasteData_;
|
||||
}
|
||||
|
||||
double GetScreenX() const
|
||||
{
|
||||
return screenX_;
|
||||
}
|
||||
|
||||
double GetScreenY() const
|
||||
{
|
||||
return screenY_;
|
||||
}
|
||||
|
||||
void SetScreenX(double x)
|
||||
{
|
||||
screenX_ = x;
|
||||
}
|
||||
|
||||
void SetScreenY(double y)
|
||||
{
|
||||
screenY_ = y;
|
||||
}
|
||||
|
||||
double GetX() const
|
||||
{
|
||||
return x_;
|
||||
}
|
||||
|
||||
double GetY() const
|
||||
{
|
||||
return y_;
|
||||
}
|
||||
|
||||
void SetX(double x)
|
||||
{
|
||||
x_ = x;
|
||||
}
|
||||
|
||||
void SetY(double y)
|
||||
{
|
||||
y_ = y;
|
||||
}
|
||||
|
||||
void SetDescription(const std::string& description)
|
||||
{
|
||||
description_ = description;
|
||||
}
|
||||
|
||||
const std::string& GetDescription() const
|
||||
{
|
||||
return description_;
|
||||
}
|
||||
|
||||
void SetPixmap(const RefPtr<PixelMap>& pixelMap)
|
||||
{
|
||||
pixelMap_ = pixelMap;
|
||||
}
|
||||
|
||||
RefPtr<PixelMap> GetPixmap() const
|
||||
{
|
||||
return pixelMap_;
|
||||
}
|
||||
|
||||
#ifdef ENABLE_DRAG_FRAMEWORK
|
||||
void SetData(const RefPtr<UnifiedData>& unifiedData);
|
||||
|
||||
RefPtr<UnifiedData>& GetData();
|
||||
|
||||
void SetSummary(std::map<std::string, int64_t>& summary);
|
||||
|
||||
std::map<std::string, int64_t>& GetSummary();
|
||||
|
||||
void SetResult(DragRet dragRet);
|
||||
|
||||
DragRet GetResult();
|
||||
|
||||
void SetPreviewRect(Rect previewRect);
|
||||
|
||||
Rect GetPreviewRect();
|
||||
|
||||
void UseCustomAnimation(bool useCustomAnimation);
|
||||
|
||||
bool IsUseCustomAnimation();
|
||||
|
||||
void SetUdKey(const std::string udKey);
|
||||
|
||||
std::string GetUdKey();
|
||||
|
||||
void SetDragInfo(const RefPtr<UnifiedData>& dragInfo);
|
||||
|
||||
RefPtr<UnifiedData>& GetDragInfo();
|
||||
|
||||
void SetCopy(bool copy);
|
||||
|
||||
bool IsCopy();
|
||||
|
||||
void SetIsGetDataSuccess(bool isGetDataSuccess);
|
||||
|
||||
bool IsGetDataSuccess();
|
||||
#endif
|
||||
|
||||
void SetVelocity(const Velocity& velocity)
|
||||
{
|
||||
velocity_ = velocity;
|
||||
}
|
||||
|
||||
const Velocity& GetVelocity() const
|
||||
{
|
||||
return velocity_;
|
||||
}
|
||||
|
||||
private:
|
||||
RefPtr<PasteData> pasteData_;
|
||||
double screenX_ = 0.0;
|
||||
double screenY_ = 0.0;
|
||||
double x_ = 0.0;
|
||||
double y_ = 0.0;
|
||||
std::string description_;
|
||||
RefPtr<PixelMap> pixelMap_;
|
||||
#ifdef ENABLE_DRAG_FRAMEWORK
|
||||
RefPtr<UnifiedData> unifiedData_;
|
||||
std::map<std::string, int64_t> summary_;
|
||||
std::string udKey_ = "";
|
||||
DragRet dragRet_ = DragRet::DRAG_DEFAULT;
|
||||
Rect previewRect_;
|
||||
bool useCustomAnimation_ = false;
|
||||
bool isGetDataSuccess_ = false;
|
||||
RefPtr<UnifiedData> dragInfo_;
|
||||
bool copy_ = true;
|
||||
#endif
|
||||
Velocity velocity_;
|
||||
};
|
||||
|
||||
class NotifyDragEvent : public DragEvent {
|
||||
DECLARE_ACE_TYPE(NotifyDragEvent, DragEvent)
|
||||
|
||||
public:
|
||||
NotifyDragEvent() = default;
|
||||
~NotifyDragEvent() = default;
|
||||
};
|
||||
|
||||
struct FingerInfo {
|
||||
int32_t fingerId_ = -1;
|
||||
// global position at which the touch point contacts the screen.
|
||||
@ -445,398 +247,7 @@ struct FingerInfo {
|
||||
SourceTool sourceTool_ = SourceTool::UNKNOWN;
|
||||
};
|
||||
|
||||
class ItemDragInfo : public BaseEventInfo {
|
||||
DECLARE_RELATIONSHIP_OF_CLASSES(ItemDragInfo, BaseEventInfo);
|
||||
|
||||
public:
|
||||
ItemDragInfo() : BaseEventInfo("itemDrag") {}
|
||||
~ItemDragInfo() override = default;
|
||||
|
||||
double GetX() const
|
||||
{
|
||||
return x_;
|
||||
}
|
||||
|
||||
double GetY() const
|
||||
{
|
||||
return y_;
|
||||
}
|
||||
|
||||
void SetX(double x)
|
||||
{
|
||||
x_ = x;
|
||||
}
|
||||
|
||||
void SetY(double y)
|
||||
{
|
||||
y_ = y;
|
||||
}
|
||||
|
||||
private:
|
||||
double x_ = 0.0;
|
||||
double y_ = 0.0;
|
||||
};
|
||||
|
||||
class GestureEvent : public BaseEventInfo {
|
||||
DECLARE_RELATIONSHIP_OF_CLASSES(GestureEvent, BaseEventInfo);
|
||||
|
||||
public:
|
||||
GestureEvent() : BaseEventInfo("gesture") {}
|
||||
~GestureEvent() override = default;
|
||||
|
||||
void SetRepeat(bool repeat)
|
||||
{
|
||||
repeat_ = repeat;
|
||||
}
|
||||
|
||||
bool GetRepeat() const
|
||||
{
|
||||
return repeat_;
|
||||
}
|
||||
|
||||
void SetOffsetX(double offsetX)
|
||||
{
|
||||
offsetX_ = offsetX;
|
||||
}
|
||||
|
||||
double GetOffsetX() const
|
||||
{
|
||||
return offsetX_;
|
||||
}
|
||||
|
||||
void SetOffsetY(double offsetY)
|
||||
{
|
||||
offsetY_ = offsetY;
|
||||
}
|
||||
|
||||
double GetOffsetY() const
|
||||
{
|
||||
return offsetY_;
|
||||
}
|
||||
|
||||
void SetScale(double scale)
|
||||
{
|
||||
scale_ = scale;
|
||||
}
|
||||
|
||||
double GetScale() const
|
||||
{
|
||||
return scale_;
|
||||
}
|
||||
|
||||
void SetAngle(double angle)
|
||||
{
|
||||
angle_ = angle;
|
||||
}
|
||||
|
||||
double GetAngle() const
|
||||
{
|
||||
return angle_;
|
||||
}
|
||||
|
||||
GestureEvent& SetGlobalPoint(const Point& globalPoint)
|
||||
{
|
||||
globalPoint_ = globalPoint;
|
||||
globalLocation_.SetX(globalPoint.GetX());
|
||||
globalLocation_.SetY(globalPoint.GetY());
|
||||
return *this;
|
||||
}
|
||||
|
||||
const Point& GetGlobalPoint() const
|
||||
{
|
||||
return globalPoint_;
|
||||
}
|
||||
|
||||
GestureEvent& SetScreenLocation(const Offset& screenLocation)
|
||||
{
|
||||
screenLocation_ = screenLocation;
|
||||
return *this;
|
||||
}
|
||||
|
||||
const Offset& GetScreenLocation() const
|
||||
{
|
||||
return screenLocation_;
|
||||
}
|
||||
|
||||
GestureEvent& SetGlobalLocation(const Offset& globalLocation)
|
||||
{
|
||||
globalLocation_ = globalLocation;
|
||||
globalPoint_.SetX(globalLocation.GetX());
|
||||
globalPoint_.SetY(globalLocation.GetY());
|
||||
return *this;
|
||||
}
|
||||
GestureEvent& SetLocalLocation(const Offset& localLocation)
|
||||
{
|
||||
localLocation_ = localLocation;
|
||||
return *this;
|
||||
}
|
||||
|
||||
const Offset& GetLocalLocation() const
|
||||
{
|
||||
return localLocation_;
|
||||
}
|
||||
const Offset& GetGlobalLocation() const
|
||||
{
|
||||
return globalLocation_;
|
||||
}
|
||||
|
||||
const Offset& GetPinchCenter() const
|
||||
{
|
||||
return pinchCenter_;
|
||||
}
|
||||
|
||||
GestureEvent& SetPinchCenter(const Offset& pinchCenter)
|
||||
{
|
||||
pinchCenter_ = pinchCenter;
|
||||
return *this;
|
||||
}
|
||||
|
||||
const std::list<FingerInfo>& GetFingerList() const
|
||||
{
|
||||
return fingerList_;
|
||||
}
|
||||
|
||||
void SetFingerList(const std::list<FingerInfo>& fingerList)
|
||||
{
|
||||
fingerList_ = fingerList;
|
||||
}
|
||||
|
||||
void SetSpeed(double speed)
|
||||
{
|
||||
speed_ = speed;
|
||||
}
|
||||
|
||||
double GetSpeed() const
|
||||
{
|
||||
return speed_;
|
||||
}
|
||||
|
||||
void SetMainSpeed(double mainSpeed)
|
||||
{
|
||||
mainSpeed_ = mainSpeed;
|
||||
}
|
||||
|
||||
double GetMainSpeed() const
|
||||
{
|
||||
return mainSpeed_;
|
||||
}
|
||||
|
||||
void SetVelocity(const Velocity& velocity)
|
||||
{
|
||||
velocity_ = velocity;
|
||||
}
|
||||
|
||||
const Velocity& GetVelocity() const
|
||||
{
|
||||
return velocity_;
|
||||
}
|
||||
|
||||
void SetMainVelocity(double mainVelocity)
|
||||
{
|
||||
mainVelocity_ = mainVelocity;
|
||||
}
|
||||
|
||||
double GetMainVelocity() const
|
||||
{
|
||||
return mainVelocity_;
|
||||
}
|
||||
|
||||
void SetPressed(bool pressed)
|
||||
{
|
||||
pressed_ = pressed;
|
||||
}
|
||||
|
||||
bool GetPressed() const
|
||||
{
|
||||
return pressed_;
|
||||
}
|
||||
|
||||
void SetDelta(const Offset& delta)
|
||||
{
|
||||
delta_ = delta;
|
||||
}
|
||||
|
||||
const Offset& GetDelta() const
|
||||
{
|
||||
return delta_;
|
||||
}
|
||||
|
||||
void SetMainDelta(double mainDelta)
|
||||
{
|
||||
mainDelta_ = mainDelta;
|
||||
}
|
||||
|
||||
double GetMainDelta() const
|
||||
{
|
||||
return mainDelta_;
|
||||
}
|
||||
|
||||
void SetInputEventType(InputEventType type)
|
||||
{
|
||||
inputEventType_ = type;
|
||||
}
|
||||
|
||||
InputEventType GetInputEventType() const
|
||||
{
|
||||
return inputEventType_;
|
||||
}
|
||||
#ifdef ENABLE_DRAG_FRAMEWORK
|
||||
void SetPointerId(int32_t pointerId)
|
||||
{
|
||||
pointerId_ = pointerId;
|
||||
}
|
||||
|
||||
int32_t GetPointerId() const
|
||||
{
|
||||
return pointerId_;
|
||||
}
|
||||
#endif // ENABLE_DRAG_FRAMEWORK
|
||||
#ifdef SECURITY_COMPONENT_ENABLE
|
||||
void SetDisplayX(double displayX)
|
||||
{
|
||||
displayX_ = displayX;
|
||||
}
|
||||
|
||||
double GetDisplayX() const
|
||||
{
|
||||
return displayX_;
|
||||
}
|
||||
|
||||
void SetDisplayY(double displayY)
|
||||
{
|
||||
displayY_ = displayY;
|
||||
}
|
||||
|
||||
double GetDisplayY() const
|
||||
{
|
||||
return displayY_;
|
||||
}
|
||||
|
||||
void SetSecCompHandleEvent(const std::shared_ptr<JsonValue>& event)
|
||||
{
|
||||
secCompHandleEvent_ = event;
|
||||
}
|
||||
|
||||
std::shared_ptr<JsonValue> GetSecCompHandleEvent() const
|
||||
{
|
||||
return secCompHandleEvent_;
|
||||
}
|
||||
|
||||
void SetEnhanceData(std::vector<uint8_t> enhanceData)
|
||||
{
|
||||
enhanceData_ = enhanceData;
|
||||
}
|
||||
|
||||
std::vector<uint8_t> GetEnhanceData() const
|
||||
{
|
||||
return enhanceData_;
|
||||
}
|
||||
#endif
|
||||
private:
|
||||
bool repeat_ = false;
|
||||
bool pressed_ = false;
|
||||
double offsetX_ = 0.0;
|
||||
double offsetY_ = 0.0;
|
||||
double scale_ = 1.0;
|
||||
double angle_ = 0.0;
|
||||
Velocity velocity_;
|
||||
double mainVelocity_ = 0.0;
|
||||
double speed_ = 0.0;
|
||||
double mainSpeed_ = 0.0;
|
||||
double mainDelta_ = 0.0;
|
||||
#ifdef ENABLE_DRAG_FRAMEWORK
|
||||
int32_t pointerId_ = 0;
|
||||
#endif // ENABLE_DRAG_FRAMEWORK
|
||||
#ifdef SECURITY_COMPONENT_ENABLE
|
||||
double displayX_ = 0.0;
|
||||
double displayY_ = 0.0;
|
||||
std::vector<uint8_t> enhanceData_;
|
||||
std::shared_ptr<JsonValue> secCompHandleEvent_;
|
||||
#endif
|
||||
Point globalPoint_;
|
||||
// global position at which the touch point contacts the screen.
|
||||
Offset globalLocation_;
|
||||
// Different from global location, The local location refers to the location of the contact point relative to the
|
||||
// current node which has the recognizer.
|
||||
Offset localLocation_;
|
||||
Offset screenLocation_;
|
||||
Offset pinchCenter_;
|
||||
Offset delta_;
|
||||
std::list<FingerInfo> fingerList_;
|
||||
InputEventType inputEventType_ = InputEventType::TOUCH_SCREEN;
|
||||
};
|
||||
|
||||
using GestureEventFunc = std::function<void(GestureEvent& info)>;
|
||||
using GestureEventNoParameter = std::function<void()>;
|
||||
|
||||
class ACE_EXPORT Gesture : public virtual AceType {
|
||||
DECLARE_ACE_TYPE(Gesture, AceType);
|
||||
|
||||
public:
|
||||
Gesture() = default;
|
||||
explicit Gesture(int32_t fingers) : fingers_(fingers) {}
|
||||
~Gesture() override = default;
|
||||
|
||||
void SetOnActionId(const GestureEventFunc& onActionId)
|
||||
{
|
||||
onActionId_ = std::make_unique<GestureEventFunc>(onActionId);
|
||||
}
|
||||
void SetOnActionStartId(const GestureEventFunc& onActionStartId)
|
||||
{
|
||||
onActionStartId_ = std::make_unique<GestureEventFunc>(onActionStartId);
|
||||
}
|
||||
void SetOnActionUpdateId(const GestureEventFunc& onActionUpdateId)
|
||||
{
|
||||
onActionUpdateId_ = std::make_unique<GestureEventFunc>(onActionUpdateId);
|
||||
}
|
||||
void SetOnActionEndId(const GestureEventFunc& onActionEndId)
|
||||
{
|
||||
onActionEndId_ = std::make_unique<GestureEventFunc>(onActionEndId);
|
||||
}
|
||||
void SetOnActionCancelId(const GestureEventNoParameter& onActionCancelId)
|
||||
{
|
||||
onActionCancelId_ = std::make_unique<GestureEventNoParameter>(onActionCancelId);
|
||||
}
|
||||
void SetPriority(GesturePriority priority)
|
||||
{
|
||||
priority_ = priority;
|
||||
}
|
||||
void SetGestureMask(GestureMask gestureMask)
|
||||
{
|
||||
gestureMask_ = gestureMask;
|
||||
}
|
||||
|
||||
GesturePriority GetPriority() const
|
||||
{
|
||||
return priority_;
|
||||
}
|
||||
|
||||
GestureMask GetGestureMask() const
|
||||
{
|
||||
return gestureMask_;
|
||||
}
|
||||
|
||||
virtual RefPtr<GestureRecognizer> CreateRecognizer(WeakPtr<PipelineBase> context) = 0;
|
||||
|
||||
protected:
|
||||
int32_t fingers_ = 1;
|
||||
GesturePriority priority_ = GesturePriority::Low;
|
||||
GestureMask gestureMask_ = GestureMask::Normal;
|
||||
std::unique_ptr<GestureEventFunc> onActionId_;
|
||||
std::unique_ptr<GestureEventFunc> onActionStartId_;
|
||||
std::unique_ptr<GestureEventFunc> onActionUpdateId_;
|
||||
std::unique_ptr<GestureEventFunc> onActionEndId_;
|
||||
std::unique_ptr<GestureEventNoParameter> onActionCancelId_;
|
||||
};
|
||||
|
||||
class ClickInfo : public TouchLocationInfo {
|
||||
DECLARE_RELATIONSHIP_OF_CLASSES(ClickInfo, TouchLocationInfo);
|
||||
|
||||
public:
|
||||
explicit ClickInfo(int32_t fingerId) : TouchLocationInfo("onClick", fingerId) {}
|
||||
~ClickInfo() override = default;
|
||||
};
|
||||
using ClickCallback = std::function<void(const ClickInfo&)>;
|
||||
|
||||
} // namespace OHOS::Ace
|
||||
|
||||
|
@ -24,7 +24,7 @@
|
||||
|
||||
#include "core/event/axis_event.h"
|
||||
#include "core/event/touch_event.h"
|
||||
#include "core/gestures/gesture_info.h"
|
||||
#include "core/gestures/gesture_event.h"
|
||||
|
||||
namespace OHOS::Ace {
|
||||
|
||||
|
@ -23,7 +23,7 @@
|
||||
#include "base/geometry/offset.h"
|
||||
#include "base/memory/ace_type.h"
|
||||
#include "base/utils/macros.h"
|
||||
#include "core/gestures/gesture_info.h"
|
||||
#include "core/gestures/gesture_event.h"
|
||||
|
||||
namespace OHOS::Ace {
|
||||
|
||||
|
@ -23,7 +23,7 @@
|
||||
#include "base/geometry/offset.h"
|
||||
#include "base/memory/ace_type.h"
|
||||
#include "base/utils/macros.h"
|
||||
#include "core/gestures/gesture_info.h"
|
||||
#include "core/gestures/gesture_event.h"
|
||||
|
||||
namespace OHOS::Ace {
|
||||
|
||||
|
@ -18,7 +18,7 @@
|
||||
|
||||
#include <functional>
|
||||
|
||||
#include "core/gestures/gesture_info.h"
|
||||
#include "core/gestures/gesture_event.h"
|
||||
#include "core/gestures/multi_fingers_recognizer.h"
|
||||
|
||||
namespace OHOS::Ace {
|
||||
|
@ -23,7 +23,7 @@
|
||||
#include "base/geometry/offset.h"
|
||||
#include "base/memory/ace_type.h"
|
||||
#include "base/utils/macros.h"
|
||||
#include "core/gestures/gesture_info.h"
|
||||
#include "core/gestures/gesture_event.h"
|
||||
|
||||
namespace OHOS::Ace {
|
||||
|
||||
|
@ -23,7 +23,7 @@
|
||||
#include "base/geometry/offset.h"
|
||||
#include "base/memory/ace_type.h"
|
||||
#include "base/utils/macros.h"
|
||||
#include "core/gestures/gesture_info.h"
|
||||
#include "core/gestures/gesture_event.h"
|
||||
|
||||
namespace OHOS::Ace {
|
||||
|
||||
|
@ -16,7 +16,7 @@
|
||||
#ifndef FOUNDATION_ACE_FRAMEWORKS_CORE_GESTURES_SINGLE_CHILD_GESTURE_H
|
||||
#define FOUNDATION_ACE_FRAMEWORKS_CORE_GESTURES_SINGLE_CHILD_GESTURE_H
|
||||
|
||||
#include "core/gestures/gesture_info.h"
|
||||
#include "core/gestures/gesture_event.h"
|
||||
|
||||
namespace OHOS::Ace {
|
||||
class ACE_EXPORT SingleChildGesture : public Gesture {
|
||||
|
@ -19,7 +19,7 @@
|
||||
#include "base/geometry/offset.h"
|
||||
#include "base/memory/ace_type.h"
|
||||
#include "base/utils/macros.h"
|
||||
#include "core/gestures/gesture_info.h"
|
||||
#include "core/gestures/gesture_event.h"
|
||||
|
||||
namespace OHOS::Ace {
|
||||
|
||||
|
@ -23,7 +23,7 @@
|
||||
#include "base/geometry/offset.h"
|
||||
#include "base/memory/ace_type.h"
|
||||
#include "base/utils/macros.h"
|
||||
#include "core/gestures/gesture_info.h"
|
||||
#include "core/gestures/gesture_event.h"
|
||||
|
||||
namespace OHOS::Ace {
|
||||
|
||||
|
@ -16,7 +16,7 @@
|
||||
#ifndef FOUNDATION_ACE_FRAMEWORKS_CORE_GESTURES_TIMEOUT_GESTURE_H
|
||||
#define FOUNDATION_ACE_FRAMEWORKS_CORE_GESTURES_TIMEOUT_GESTURE_H
|
||||
|
||||
#include "core/gestures/gesture_info.h"
|
||||
#include "core/gestures/gesture_event.h"
|
||||
#include "core/gestures/single_child_gesture.h"
|
||||
|
||||
#include <chrono>
|
||||
|
@ -41,7 +41,6 @@
|
||||
#include "core/common/ace_engine.h"
|
||||
#include "core/common/udmf/udmf_client.h"
|
||||
#include "core/event/ace_events.h"
|
||||
#include "core/gestures/gesture_info.h"
|
||||
#include "frameworks/bridge/common/utils/engine_helper.h"
|
||||
#endif
|
||||
|
||||
|
@ -55,7 +55,6 @@
|
||||
#include "core/components_ng/test/mock/render/mock_render_surface.h"
|
||||
#include "core/components_ng/test/mock/theme/mock_theme_manager.h"
|
||||
#include "core/components_v2/inspector/inspector_constants.h"
|
||||
#include "core/gestures/gesture_info.h"
|
||||
#include "core/image/image_source_info.h"
|
||||
#include "core/pipeline_ng/test/mock/mock_pipeline_base.h"
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user