• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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_MANAGER_H
17 #define DRAG_DATA_MANAGER_H
18 
19 #include <string>
20 
21 #include "pixel_map.h"
22 #include "pointer_style.h"
23 #include "singleton.h"
24 
25 #include "drag_data.h"
26 
27 namespace OHOS {
28 namespace Msdp {
29 namespace DeviceStatus {
30 class DragDataManager final {
31     DECLARE_SINGLETON(DragDataManager);
32 
33 public:
34     DISALLOW_MOVE(DragDataManager);
35 
36     void Init(const DragData &dragData, const MMI::PointerStyle &pointerStyle);
37     DragData GetDragData() const;
38     void SetDragStyle(DragCursorStyle style);
39     void SetShadowInfo(const ShadowInfo &shadowInfo);
40     DragCursorStyle GetDragStyle() const;
41     std::u16string GetDragMessage() const;
42     void SetDragWindowVisible(bool visible);
43     bool GetDragWindowVisible() const;
44     int32_t GetShadowOffset(int32_t& offsetX, int32_t& offsetY, int32_t& width, int32_t& height) const;
45     void ResetDragData();
46     void SetTargetTid(int32_t tokenId);
47     int32_t GetTargetTid() const;
48     void SetTargetPid(int32_t pid);
49     int32_t GetTargetPid() const;
50     void SetMotionDrag(bool isMotionDrag);
51     bool IsMotionDrag() const;
52 private:
53     DragData dragData_;
54     OHOS::MMI::PointerStyle pointerStyle_;
55     DragCursorStyle dragStyle_ { DragCursorStyle::DEFAULT };
56     std::u16string dragMessage_;
57     bool visible_ { false };
58     int32_t targetTid_ { -1 };
59     int32_t targetPid_ { -1 };
60     bool isMotionDrag_ { false };
61 };
62 
63 #define DRAG_DATA_MGR OHOS::Singleton<DragDataManager>::GetInstance()
64 
65 } // namespace DeviceStatus
66 } // namespace Msdp
67 } // namespace OHOS
68 #endif // DRAG_DATA_MANAGER_H