1 /* 2 * Copyright (c) 2023 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 DRAG_DATA_H 17 #define DRAG_DATA_H 18 19 #include <functional> 20 #include <memory> 21 #include <vector> 22 23 #include "pixel_map.h" 24 25 namespace OHOS { 26 namespace Msdp { 27 namespace DeviceStatus { 28 constexpr size_t MAX_BUFFER_SIZE { 512 }; 29 struct ShadowInfo { 30 std::shared_ptr<OHOS::Media::PixelMap> pixelMap { nullptr }; 31 int32_t x { -1 }; 32 int32_t y { -1 }; 33 }; 34 35 struct DragData { 36 ShadowInfo shadowInfo; 37 std::vector<uint8_t> buffer; 38 std::string udKey; 39 int32_t sourceType { -1 }; 40 int32_t dragNum { -1 }; 41 int32_t pointerId { -1 }; 42 int32_t displayX { -1 }; 43 int32_t displayY { -1 }; 44 int32_t displayId { -1 }; 45 bool hasCanceledAnimation { false }; 46 }; 47 48 enum class DragState { 49 ERROR = 0, 50 START = 1, 51 STOP = 2, 52 CANCEL = 3, 53 MOTION_DRAGGING = 4 54 }; 55 56 enum class DragResult { 57 DRAG_SUCCESS = 0, 58 DRAG_FAIL = 1, 59 DRAG_CANCEL = 2, 60 DRAG_EXCEPTION = 3 61 }; 62 63 struct DragNotifyMsg { 64 int32_t displayX { -1 }; 65 int32_t displayY { -1 }; 66 int32_t targetPid { -1 }; 67 DragResult result { DragResult::DRAG_FAIL }; 68 }; 69 70 struct DragAnimationData { 71 int32_t displayX { -1 }; 72 int32_t displayY { -1 }; 73 int32_t offsetX { -1 }; 74 int32_t offsetY { -1 }; 75 std::shared_ptr<OHOS::Media::PixelMap> pixelMap { nullptr }; 76 }; 77 78 enum class DragCursorStyle { 79 DEFAULT = 0, 80 FORBIDDEN, 81 COPY, 82 MOVE 83 }; 84 85 } // namespace DeviceStatus 86 } // namespace Msdp 87 } // namespace OHOS 88 #endif // DRAG_DATA_H