1 /* 2 * Copyright (c) 2024 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 #ifndef FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_MANAGER_DRAG_DROP_UTILS_INTERNAL_DRAG_ACTION_H 17 #define FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_MANAGER_DRAG_DROP_UTILS_INTERNAL_DRAG_ACTION_H 18 19 #include <cstddef> 20 #include <cstdint> 21 #include <functional> 22 #include <mutex> 23 #include <pthread.h> 24 #include <string> 25 #include <vector> 26 27 #include "base/geometry/dimension_offset.h" 28 #include "base/image/pixel_map.h" 29 #include "base/memory/ace_type.h" 30 #include "base/memory/referenced.h" 31 #include "core/common/interaction/interaction_interface.h" 32 #include "core/components_ng/base/frame_node.h" 33 #include "core/components_ng/gestures/gesture_info.h" 34 #include "core/gestures/drag_event.h" 35 36 namespace OHOS::Ace::NG { 37 38 enum class DragAdapterState { INIT, PENDING, SENDING, REJECT, SUCCESS }; 39 40 enum class DragAdapterStatus { UNKNOWN = -1, STARTED, ENDED }; 41 struct ArkUIInternalDragAndDropInfo { 42 OHOS::Ace::NG::DragEvent dragEvent; 43 DragAdapterStatus dragStatus; 44 }; 45 46 struct ArkUIInteralDragAction { 47 int32_t instanceId; 48 int32_t pointer; 49 void** pixelMapArray; 50 int32_t size; 51 int32_t x; 52 int32_t y; 53 void* data; 54 int32_t displayId = 0; 55 OHOS::Ace::NG::ArkUIInternalDragAndDropInfo* dropInfo; 56 OHOS::Ace::NG::DragPreviewOption previewOption; 57 DragAdapterState dragState = DragAdapterState::INIT; 58 RefPtr<OHOS::Ace::UnifiedData> unifiedData; 59 std::string extraParams; 60 int32_t sourceType = 0; 61 float dipScale = 0.0; 62 void* userData; 63 std::function<void(const OHOS::Ace::DragNotifyMsg& info, int32_t status)> callback; 64 float windowScale = 1.0f; 65 std::mutex mutex; 66 std::mutex dragStateMutex; 67 std::vector<RefPtr<PixelMap>> pixelMapList; 68 bool hasHandle = false; 69 float touchPointX = 0.0; 70 float touchPointY = 0.0; 71 bool hasTouchPoint = false; 72 }; 73 } // namespace OHOS::Ace::NG 74 #endif // FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_MANAGER_DRAG_DROP_UTILS_INTERNAL_DRAG_ACTION_H