File indexing completed on 2024-05-19 16:35:18
0001 /* 0002 SPDX-FileCopyrightText: 2014 Martin Gräßlin <mgraesslin@kde.org> 0003 SPDX-FileCopyrightText: 2020 David Edmundson <davidedmundson@kde.org> 0004 0005 SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL 0006 */ 0007 #pragma once 0008 0009 #include "kwin_export.h" 0010 0011 #include "abstract_data_source.h" 0012 #include "datadevicemanager_interface.h" 0013 0014 namespace KWaylandServer 0015 { 0016 class DataSourceInterfacePrivate; 0017 0018 /** 0019 * @brief Represents the Resource for the wl_data_source interface. 0020 */ 0021 class KWIN_EXPORT DataSourceInterface : public AbstractDataSource 0022 { 0023 Q_OBJECT 0024 public: 0025 virtual ~DataSourceInterface(); 0026 0027 void accept(const QString &mimeType) override; 0028 void requestData(const QString &mimeType, qint32 fd) override; 0029 void cancel() override; 0030 0031 QStringList mimeTypes() const override; 0032 0033 static DataSourceInterface *get(wl_resource *native); 0034 0035 /** 0036 * @returns The Drag and Drop actions supported by this DataSourceInterface. 0037 */ 0038 DataDeviceManagerInterface::DnDActions supportedDragAndDropActions() const override; 0039 DataDeviceManagerInterface::DnDAction selectedDndAction() const override; 0040 void dropPerformed() override; 0041 void dndFinished() override; 0042 void dndAction(DataDeviceManagerInterface::DnDAction action) override; 0043 void dndCancelled() override; 0044 0045 wl_resource *resource() const; 0046 0047 wl_client *client() const override; 0048 0049 bool isAccepted() const override; 0050 void setAccepted(bool accepted); 0051 0052 private: 0053 friend class DataDeviceManagerInterfacePrivate; 0054 explicit DataSourceInterface(wl_resource *resource); 0055 0056 std::unique_ptr<DataSourceInterfacePrivate> d; 0057 }; 0058 0059 } 0060 0061 Q_DECLARE_METATYPE(KWaylandServer::DataSourceInterface *)