Changeset View
Changeset View
Standalone View
Standalone View
src/client/datasource.h
Show All 15 Lines | |||||
16 | 16 | | |||
17 | You should have received a copy of the GNU Lesser General Public | 17 | You should have received a copy of the GNU Lesser General Public | ||
18 | License along with this library. If not, see <http://www.gnu.org/licenses/>. | 18 | License along with this library. If not, see <http://www.gnu.org/licenses/>. | ||
19 | *********************************************************************/ | 19 | *********************************************************************/ | ||
20 | #ifndef WAYLAND_DATASOURCE_H | 20 | #ifndef WAYLAND_DATASOURCE_H | ||
21 | #define WAYLAND_DATASOURCE_H | 21 | #define WAYLAND_DATASOURCE_H | ||
22 | 22 | | |||
23 | #include "buffer.h" | 23 | #include "buffer.h" | ||
24 | #include "datadevicemanager.h" | ||||
24 | 25 | | |||
25 | #include <QObject> | 26 | #include <QObject> | ||
26 | 27 | | |||
27 | #include <KWayland/Client/kwaylandclient_export.h> | 28 | #include <KWayland/Client/kwaylandclient_export.h> | ||
28 | 29 | | |||
29 | struct wl_data_source; | 30 | struct wl_data_source; | ||
30 | class QMimeType; | 31 | class QMimeType; | ||
31 | 32 | | |||
▲ Show 20 Lines • Show All 48 Lines • ▼ Show 20 Line(s) | 50 | public: | |||
80 | /** | 81 | /** | ||
81 | * @returns @c true if managing a wl_data_source. | 82 | * @returns @c true if managing a wl_data_source. | ||
82 | **/ | 83 | **/ | ||
83 | bool isValid() const; | 84 | bool isValid() const; | ||
84 | 85 | | |||
85 | void offer(const QString &mimeType); | 86 | void offer(const QString &mimeType); | ||
86 | void offer(const QMimeType &mimeType); | 87 | void offer(const QMimeType &mimeType); | ||
87 | 88 | | |||
89 | /** | ||||
90 | * Sets the actions that the source side client supports for this | ||||
91 | * operation. | ||||
92 | * | ||||
93 | * This request must be made once only, and can only be made on sources | ||||
94 | * used in drag-and-drop, so it must be performed before | ||||
95 | * @link{DataDevice::startDrag}. Attempting to use the source other than | ||||
96 | * for drag-and-drop will raise a protocol error. | ||||
97 | **/ | ||||
98 | void setDragAndDropActions(DataDeviceManager::DnDActions actions); | ||||
99 | | ||||
100 | /** | ||||
101 | * The currently selected drag and drop action by the compositor. | ||||
102 | * @see selectedDragAndDropActionChanged | ||||
103 | * @since 5.XX | ||||
104 | **/ | ||||
105 | DataDeviceManager::DnDAction selectedDragAndDropAction() const; | ||||
106 | | ||||
88 | operator wl_data_source*(); | 107 | operator wl_data_source*(); | ||
89 | operator wl_data_source*() const; | 108 | operator wl_data_source*() const; | ||
90 | 109 | | |||
91 | Q_SIGNALS: | 110 | Q_SIGNALS: | ||
92 | /** | 111 | /** | ||
93 | * Emitted when a target accepts pointer_focus or motion events. If | 112 | * Emitted when a target accepts pointer_focus or motion events. If | ||
94 | * a target does not accept any of the offered types, @p mimeType is empty. | 113 | * a target does not accept any of the offered types, @p mimeType is empty. | ||
95 | **/ | 114 | **/ | ||
96 | void targetAccepts(const QString &mimeType); | 115 | void targetAccepts(const QString &mimeType); | ||
97 | /** | 116 | /** | ||
98 | * Request for data from the client. Send the data as the | 117 | * Request for data from the client. Send the data as the | ||
99 | * specified @p mimeType over the passed file descriptor @p fd, then close | 118 | * specified @p mimeType over the passed file descriptor @p fd, then close | ||
100 | * it. | 119 | * it. | ||
101 | **/ | 120 | **/ | ||
102 | void sendDataRequested(const QString &mimeType, qint32 fd); | 121 | void sendDataRequested(const QString &mimeType, qint32 fd); | ||
103 | /** | 122 | /** | ||
104 | * This DataSource has been replaced by another DataSource. | 123 | * This DataSource has been replaced by another DataSource. | ||
105 | * The client should clean up and destroy this DataSource. | 124 | * The client should clean up and destroy this DataSource. | ||
106 | **/ | 125 | **/ | ||
107 | void cancelled(); | 126 | void cancelled(); | ||
108 | 127 | | |||
128 | /** | ||||
129 | * The drag-and-drop operation physically finished. | ||||
130 | * | ||||
131 | * The user performed the drop action. This signal does not | ||||
132 | * indicate acceptance, @link{cancelled} may still be | ||||
133 | * emitted afterwards if the drop destination does not accept any | ||||
134 | * mime type. | ||||
135 | * | ||||
136 | * However, this signal might not be received if the | ||||
137 | * compositor cancelled the drag-and-drop operation before this | ||||
138 | * signal could happen. | ||||
139 | * | ||||
140 | * Note that the DataSource may still be used in the future and | ||||
141 | * should not be destroyed here. | ||||
142 | * @since 5.XX | ||||
143 | **/ | ||||
144 | void dragAndDropPerformed(); | ||||
145 | | ||||
146 | /** | ||||
147 | * The drag-and-drop operation concluded. | ||||
148 | * | ||||
149 | * The drop destination finished interoperating with this DataSource, | ||||
150 | * so the client is now free to destroy this DataSource. | ||||
151 | * | ||||
152 | * If the action used to perform the operation was "move", the | ||||
153 | * source can now delete the transferred data. | ||||
154 | * @since 5.XX | ||||
155 | */ | ||||
156 | void dragAndDropFinished(); | ||||
157 | | ||||
158 | /** | ||||
159 | * Emitted whenever the selected drag and drop action changes. | ||||
160 | * @see selectedDragAndDropAction | ||||
161 | * @since 5.XX | ||||
162 | **/ | ||||
163 | void selectedDragAndDropActionChanged(); | ||||
164 | | ||||
109 | private: | 165 | private: | ||
110 | class Private; | 166 | class Private; | ||
111 | QScopedPointer<Private> d; | 167 | QScopedPointer<Private> d; | ||
112 | }; | 168 | }; | ||
113 | 169 | | |||
114 | } | 170 | } | ||
115 | } | 171 | } | ||
116 | 172 | | |||
117 | #endif | 173 | #endif |