Merge "DALi Version 2.1.12" 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::Actor shadow, const Dali::DragAndDrop::DragData& data) = 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::SendData()
67    */
68   virtual void SendData(void* event) = 0;
69
70   /**
71    * @copydoc Dali::DragAndDrop::ReceiveData()
72    */
73   virtual void ReceiveData(void* event) = 0;
74
75   /**
76    * @copydoc Dali::DragAndDrop::CalculateDragEvent()
77    */
78   virtual bool CalculateDragEvent(void* event) = 0;
79
80   /**
81    * @copydoc Dali::DragAndDrop::CalculateViewRegion()
82    */
83   virtual bool CalculateViewRegion(void* event) = 0;
84
85 private:
86   DragAndDrop(const DragAndDrop&) = delete;
87   DragAndDrop& operator=(DragAndDrop&) = delete;
88
89 }; // class DragAndDrop
90
91 extern Dali::DragAndDrop GetDragAndDrop();
92
93 } // namespace Adaptor
94
95 } // namespace Internal
96
97 inline static Internal::Adaptor::DragAndDrop& GetImplementation(Dali::DragAndDrop& dnd)
98 {
99   DALI_ASSERT_ALWAYS(dnd && "DragAndDrop handle is empty");
100   BaseObject& handle = dnd.GetBaseObject();
101   return static_cast<Internal::Adaptor::DragAndDrop&>(handle);
102 }
103
104 inline static const Internal::Adaptor::DragAndDrop& GetImplementation(const Dali::DragAndDrop& dnd)
105 {
106   DALI_ASSERT_ALWAYS(dnd && "DragAndDrop handle is empty");
107   const BaseObject& handle = dnd.GetBaseObject();
108   return static_cast<const Internal::Adaptor::DragAndDrop&>(handle);
109 }
110
111 } // namespace Dali
112
113 #endif // DALI_INTERNAL_DRAG_AND_DROP_H