1 #ifndef DALI_INTERNAL_DRAG_AND_DROP_H
2 #define DALI_INTERNAL_DRAG_AND_DROP_H
5 * Copyright (c) 2022 Samsung Electronics Co., Ltd.
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
11 * http://www.apache.org/licenses/LICENSE-2.0
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.
22 #include <dali/public-api/object/base-object.h>
25 #include <dali/devel-api/adaptor-framework/window-devel.h>
26 #include <dali/devel-api/adaptor-framework/drag-and-drop.h>
35 * Implementation of the DragAndDrop
37 class DragAndDrop : public Dali::BaseObject
43 DragAndDrop() = default;
48 ~DragAndDrop() override = default;
51 * @copydoc Dali::DragAndDrop::StartDragAndDrop()
53 virtual bool StartDragAndDrop(Dali::Actor source, Dali::Window shadowWindow, const Dali::DragAndDrop::DragData& data, Dali::DragAndDrop::SourceFunction callback) = 0;
56 * @copydoc Dali::DragAndDrop::AddListener()
58 virtual bool AddListener(Dali::Actor target, Dali::DragAndDrop::DragAndDropFunction callback) = 0;
61 * @copydoc Dali::DragAndDrop::RemoveListener()
63 virtual bool RemoveListener(Dali::Actor target) = 0;
66 * @copydoc Dali::DragAndDrop::SendData()
68 virtual void SendData(void* event) = 0;
71 * @copydoc Dali::DragAndDrop::ReceiveData()
73 virtual void ReceiveData(void* event) = 0;
76 * @copydoc Dali::DragAndDrop::CalculateDragEvent()
78 virtual bool CalculateDragEvent(void* event) = 0;
81 * @copydoc Dali::DragAndDrop::CalculateViewRegion()
83 virtual bool CalculateViewRegion(void* event) = 0;
86 DragAndDrop(const DragAndDrop&) = delete;
87 DragAndDrop& operator=(DragAndDrop&) = delete;
89 }; // class DragAndDrop
91 extern Dali::DragAndDrop GetDragAndDrop();
93 } // namespace Adaptor
95 } // namespace Internal
97 inline static Internal::Adaptor::DragAndDrop& GetImplementation(Dali::DragAndDrop& dnd)
99 DALI_ASSERT_ALWAYS(dnd && "DragAndDrop handle is empty");
100 BaseObject& handle = dnd.GetBaseObject();
101 return static_cast<Internal::Adaptor::DragAndDrop&>(handle);
104 inline static const Internal::Adaptor::DragAndDrop& GetImplementation(const Dali::DragAndDrop& dnd)
106 DALI_ASSERT_ALWAYS(dnd && "DragAndDrop handle is empty");
107 const BaseObject& handle = dnd.GetBaseObject();
108 return static_cast<const Internal::Adaptor::DragAndDrop&>(handle);
113 #endif // DALI_INTERNAL_DRAG_AND_DROP_H