Merge "Added UIThreadLoader to GLIB framework" into devel/master
[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::Window shadowWindow, const Dali::DragAndDrop::DragData& data, Dali::DragAndDrop::SourceFunction callback) = 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::RemoveListener()
62    */
63   virtual bool RemoveListener(Dali::Actor target) = 0;
64
65   /**
66    * @copydoc Dali::DragAndDrop::AddListener()
67    */
68   virtual bool AddListener(Dali::Window window, Dali::DragAndDrop::DragAndDropFunction callback) = 0;
69
70   /**
71    * @copydoc Dali::DragAndDrop::RemoveListener()
72    */
73   virtual bool RemoveListener(Dali::Window target) = 0;
74
75   /**
76    * @copydoc Dali::DragAndDrop::SendData()
77    */
78   virtual void SendData(void* event) = 0;
79
80   /**
81    * @copydoc Dali::DragAndDrop::ReceiveData()
82    */
83   virtual void ReceiveData(void* event) = 0;
84
85   /**
86    * @copydoc Dali::DragAndDrop::CalculateDragEvent()
87    */
88   virtual bool CalculateDragEvent(void* event) = 0;
89
90   /**
91    * @copydoc Dali::DragAndDrop::CalculateViewRegion()
92    */
93   virtual bool CalculateViewRegion(void* event) = 0;
94
95 private:
96   DragAndDrop(const DragAndDrop&) = delete;
97   DragAndDrop& operator=(DragAndDrop&) = delete;
98
99 }; // class DragAndDrop
100
101 extern Dali::DragAndDrop GetDragAndDrop();
102
103 } // namespace Adaptor
104
105 } // namespace Internal
106
107 inline static Internal::Adaptor::DragAndDrop& GetImplementation(Dali::DragAndDrop& dnd)
108 {
109   DALI_ASSERT_ALWAYS(dnd && "DragAndDrop handle is empty");
110   BaseObject& handle = dnd.GetBaseObject();
111   return static_cast<Internal::Adaptor::DragAndDrop&>(handle);
112 }
113
114 inline static const Internal::Adaptor::DragAndDrop& GetImplementation(const Dali::DragAndDrop& dnd)
115 {
116   DALI_ASSERT_ALWAYS(dnd && "DragAndDrop handle is empty");
117   const BaseObject& handle = dnd.GetBaseObject();
118   return static_cast<const Internal::Adaptor::DragAndDrop&>(handle);
119 }
120
121 } // namespace Dali
122
123 #endif // DALI_INTERNAL_DRAG_AND_DROP_H