dali-adaptor: Multi-Window DnD Feature Implementation
[platform/core/uifw/dali-adaptor.git] / dali / internal / drag-and-drop / common / drag-and-drop-impl.h
1 #ifndef DALI_INTERNAL_DRAG_AND_DROP_H
2 #define DALI_INTERNAL_DRAG_AND_DROP_H
3
4 /*
5  * Copyright (c) 2022 Samsung Electronics Co., Ltd.
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  *
19  */
20
21 // EXTERNAL INCLUDES
22 #include <dali/public-api/object/base-object.h>
23
24 // INTERNAL INCLUDES
25 #include <dali/devel-api/adaptor-framework/window-devel.h>
26 #include <dali/devel-api/adaptor-framework/drag-and-drop.h>
27
28 namespace Dali
29 {
30 namespace Internal
31 {
32 namespace Adaptor
33 {
34 /**
35  * Implementation of the DragAndDrop
36  */
37 class DragAndDrop : public Dali::BaseObject
38 {
39 public:
40   /**
41    * Constructor
42    */
43   DragAndDrop() = default;
44
45   /**
46    * Destructor
47    */
48   ~DragAndDrop() override = default;
49
50   /**
51    * @copydoc Dali::DragAndDrop::StartDragAndDrop()
52    */
53   virtual bool StartDragAndDrop(Dali::Actor source, Dali::Actor shadow, const std::string& dragData) = 0;
54
55   /**
56    * @copydoc Dali::DragAndDrop::AddListener()
57    */
58   virtual bool AddListener(Dali::Actor target, Dali::DragAndDrop::DragAndDropFunction callback) = 0;
59
60   /**
61    * @copydoc Dali::DragAndDrop::SendData()
62    */
63   virtual void SendData(void* event) = 0;
64
65   /**
66    * @copydoc Dali::DragAndDrop::ReceiveData()
67    */
68   virtual void ReceiveData(void* event) = 0;
69
70   /**
71    * @copydoc Dali::DragAndDrop::CalculateDragEvent()
72    */
73   virtual bool CalculateDragEvent(void* event) = 0;
74
75   /**
76    * @copydoc Dali::DragAndDrop::CalculateViewRegion()
77    */
78   virtual bool CalculateViewRegion(void* event) = 0;
79
80 private:
81   DragAndDrop(const DragAndDrop&) = delete;
82   DragAndDrop& operator=(DragAndDrop&) = delete;
83
84 }; // class DragAndDrop
85
86 extern Dali::DragAndDrop GetDragAndDrop();
87
88 } // namespace Adaptor
89
90 } // namespace Internal
91
92 inline static Internal::Adaptor::DragAndDrop& GetImplementation(Dali::DragAndDrop& dnd)
93 {
94   DALI_ASSERT_ALWAYS(dnd && "DragAndDrop handle is empty");
95   BaseObject& handle = dnd.GetBaseObject();
96   return static_cast<Internal::Adaptor::DragAndDrop&>(handle);
97 }
98
99 inline static const Internal::Adaptor::DragAndDrop& GetImplementation(const Dali::DragAndDrop& dnd)
100 {
101   DALI_ASSERT_ALWAYS(dnd && "DragAndDrop handle is empty");
102   const BaseObject& handle = dnd.GetBaseObject();
103   return static_cast<const Internal::Adaptor::DragAndDrop&>(handle);
104 }
105
106 } // namespace Dali
107
108 #endif // DALI_INTERNAL_DRAG_AND_DROP_H