KWayland

datasource_interface.h
1 /*
2  SPDX-FileCopyrightText: 2014 Martin Gräßlin <[email protected]>
3 
4  SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
5 */
6 #ifndef WAYLAND_SERVER_DATA_SOURCE_INTERFACE_H
7 #define WAYLAND_SERVER_DATA_SOURCE_INTERFACE_H
8 
9 #include <QObject>
10 
11 #include <KWayland/Server/kwaylandserver_export.h>
12 
13 #include "datadevicemanager_interface.h"
14 #include "resource.h"
15 
16 namespace KWayland
17 {
18 namespace Server
19 {
20 /**
21  * @brief Represents the Resource for the wl_data_source interface.
22  **/
23 class KWAYLANDSERVER_EXPORT DataSourceInterface : public Resource
24 {
25  Q_OBJECT
26 public:
27  ~DataSourceInterface() override;
28 
29  void accept(const QString &mimeType);
30  void requestData(const QString &mimeType, qint32 fd);
31  void cancel();
32 
33  QStringList mimeTypes() const;
34 
35  static DataSourceInterface *get(wl_resource *native);
36 
37  /**
38  * @returns The Drag and Drop actions supported by this DataSourceInterface.
39  * @since 5.42
40  **/
41  DataDeviceManagerInterface::DnDActions supportedDragAndDropActions() const;
42 
43  /**
44  * The user performed the drop action during a drag and drop operation.
45  * @since 5.42
46  **/
47  void dropPerformed();
48  /**
49  * The drop destination finished interoperating with this data source.
50  * @since 5.42
51  **/
52  void dndFinished();
53  /**
54  * This event indicates the @p action selected by the compositor after matching the
55  * source/destination side actions. Only one action (or none) will be offered here.
56  * @since 5.42
57  **/
58  void dndAction(DataDeviceManagerInterface::DnDAction action);
59 
60 Q_SIGNALS:
61  void mimeTypeOffered(const QString &);
62  /**
63  * Emitted whenever this DataSourceInterface changes the supported drag and drop actions
64  * @since 5.42
65  **/
66  void supportedDragAndDropActionsChanged();
67 
68 private:
69  friend class DataDeviceManagerInterface;
70  explicit DataSourceInterface(DataDeviceManagerInterface *parent, wl_resource *parentResource);
71 
72  class Private;
73  Private *d_func() const;
74 };
75 
76 }
77 }
78 
79 Q_DECLARE_METATYPE(KWayland::Server::DataSourceInterface *)
80 
81 #endif
Represents the Resource for the wl_data_source interface.
DnDAction
Drag and Drop actions supported by the DataSourceInterface.
Represents a bound Resource.
Definition: resource.h:31
Represents the Global for wl_data_device_manager interface.
virtual QVariant get(ScriptableExtension *callerPrincipal, quint64 objId, const QString &propName)
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Mon Jan 30 2023 03:56:23 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.