1/****************************************************************************
2**
3** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
4** Contact: http://www.qt-project.org/legal
5**
6** This file is part of the QtGui module of the Qt Toolkit.
7**
8** $QT_BEGIN_LICENSE:LGPL$
9** Commercial License Usage
10** Licensees holding valid commercial Qt licenses may use this file in
11** accordance with the commercial license agreement provided with the
12** Software or, alternatively, in accordance with the terms contained in
13** a written agreement between you and Digia. For licensing terms and
14** conditions see http://qt.digia.com/licensing. For further information
15** use the contact form at http://qt.digia.com/contact-us.
16**
17** GNU Lesser General Public License Usage
18** Alternatively, this file may be used under the terms of the GNU Lesser
19** General Public License version 2.1 as published by the Free Software
20** Foundation and appearing in the file LICENSE.LGPL included in the
21** packaging of this file. Please review the following information to
22** ensure the GNU Lesser General Public License version 2.1 requirements
23** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
24**
25** In addition, as a special exception, Digia gives you certain additional
26** rights. These rights are described in the Digia Qt LGPL Exception
27** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
28**
29** GNU General Public License Usage
30** Alternatively, this file may be used under the terms of the GNU
31** General Public License version 3.0 as published by the Free Software
32** Foundation and appearing in the file LICENSE.GPL included in the
33** packaging of this file. Please review the following information to
34** ensure the GNU General Public License version 3.0 requirements will be
35** met: http://www.gnu.org/copyleft/gpl.html.
36**
37**
38** $QT_END_LICENSE$
39**
40****************************************************************************/
41
42#ifndef QGRAPHICSSCENEEVENT_H
43#define QGRAPHICSSCENEEVENT_H
44
45#include <QtCore/qcoreevent.h>
46#include <QtCore/qpoint.h>
47#include <QtCore/qscopedpointer.h>
48#include <QtCore/qrect.h>
49#include <QtGui/qpolygon.h>
50#include <QtCore/qset.h>
51#include <QtCore/qhash.h>
52
53QT_BEGIN_HEADER
54
55QT_BEGIN_NAMESPACE
56
57QT_MODULE(Gui)
58
59#if !defined(QT_NO_GRAPHICSVIEW) || (QT_EDITION & QT_MODULE_GRAPHICSVIEW) != QT_MODULE_GRAPHICSVIEW
60
61class QMimeData;
62class QPointF;
63class QSizeF;
64class QWidget;
65
66class QGraphicsSceneEventPrivate;
67class Q_GUI_EXPORT QGraphicsSceneEvent : public QEvent
68{
69public:
70 QGraphicsSceneEvent(Type type);
71 ~QGraphicsSceneEvent();
72
73 QWidget *widget() const;
74 void setWidget(QWidget *widget);
75
76protected:
77 QGraphicsSceneEvent(QGraphicsSceneEventPrivate &dd, Type type = None);
78 QScopedPointer<QGraphicsSceneEventPrivate> d_ptr;
79 Q_DECLARE_PRIVATE(QGraphicsSceneEvent)
80private:
81 Q_DISABLE_COPY(QGraphicsSceneEvent)
82};
83
84class QGraphicsSceneMouseEventPrivate;
85class Q_GUI_EXPORT QGraphicsSceneMouseEvent : public QGraphicsSceneEvent
86{
87public:
88 QGraphicsSceneMouseEvent(Type type = None);
89 ~QGraphicsSceneMouseEvent();
90
91 QPointF pos() const;
92 void setPos(const QPointF &pos);
93
94 QPointF scenePos() const;
95 void setScenePos(const QPointF &pos);
96
97 QPoint screenPos() const;
98 void setScreenPos(const QPoint &pos);
99
100 QPointF buttonDownPos(Qt::MouseButton button) const;
101 void setButtonDownPos(Qt::MouseButton button, const QPointF &pos);
102
103 QPointF buttonDownScenePos(Qt::MouseButton button) const;
104 void setButtonDownScenePos(Qt::MouseButton button, const QPointF &pos);
105
106 QPoint buttonDownScreenPos(Qt::MouseButton button) const;
107 void setButtonDownScreenPos(Qt::MouseButton button, const QPoint &pos);
108
109 QPointF lastPos() const;
110 void setLastPos(const QPointF &pos);
111
112 QPointF lastScenePos() const;
113 void setLastScenePos(const QPointF &pos);
114
115 QPoint lastScreenPos() const;
116 void setLastScreenPos(const QPoint &pos);
117
118 Qt::MouseButtons buttons() const;
119 void setButtons(Qt::MouseButtons buttons);
120
121 Qt::MouseButton button() const;
122 void setButton(Qt::MouseButton button);
123
124 Qt::KeyboardModifiers modifiers() const;
125 void setModifiers(Qt::KeyboardModifiers modifiers);
126
127private:
128 Q_DECLARE_PRIVATE(QGraphicsSceneMouseEvent)
129 Q_DISABLE_COPY(QGraphicsSceneMouseEvent)
130};
131
132class QGraphicsSceneWheelEventPrivate;
133class Q_GUI_EXPORT QGraphicsSceneWheelEvent : public QGraphicsSceneEvent
134{
135public:
136 QGraphicsSceneWheelEvent(Type type = None);
137 ~QGraphicsSceneWheelEvent();
138
139 QPointF pos() const;
140 void setPos(const QPointF &pos);
141
142 QPointF scenePos() const;
143 void setScenePos(const QPointF &pos);
144
145 QPoint screenPos() const;
146 void setScreenPos(const QPoint &pos);
147
148 Qt::MouseButtons buttons() const;
149 void setButtons(Qt::MouseButtons buttons);
150
151 Qt::KeyboardModifiers modifiers() const;
152 void setModifiers(Qt::KeyboardModifiers modifiers);
153
154 int delta() const;
155 void setDelta(int delta);
156
157 Qt::Orientation orientation() const;
158 void setOrientation(Qt::Orientation orientation);
159
160private:
161 Q_DECLARE_PRIVATE(QGraphicsSceneWheelEvent)
162 Q_DISABLE_COPY(QGraphicsSceneWheelEvent)
163};
164
165class QGraphicsSceneContextMenuEventPrivate;
166class Q_GUI_EXPORT QGraphicsSceneContextMenuEvent : public QGraphicsSceneEvent
167{
168public:
169 enum Reason { Mouse, Keyboard, Other };
170
171 QGraphicsSceneContextMenuEvent(Type type = None);
172 ~QGraphicsSceneContextMenuEvent();
173
174 QPointF pos() const;
175 void setPos(const QPointF &pos);
176
177 QPointF scenePos() const;
178 void setScenePos(const QPointF &pos);
179
180 QPoint screenPos() const;
181 void setScreenPos(const QPoint &pos);
182
183 Qt::KeyboardModifiers modifiers() const;
184 void setModifiers(Qt::KeyboardModifiers modifiers);
185
186 Reason reason() const;
187 void setReason(Reason reason);
188
189private:
190 Q_DECLARE_PRIVATE(QGraphicsSceneContextMenuEvent)
191 Q_DISABLE_COPY(QGraphicsSceneContextMenuEvent)
192};
193
194class QGraphicsSceneHoverEventPrivate;
195class Q_GUI_EXPORT QGraphicsSceneHoverEvent : public QGraphicsSceneEvent
196{
197public:
198 QGraphicsSceneHoverEvent(Type type = None);
199 ~QGraphicsSceneHoverEvent();
200
201 QPointF pos() const;
202 void setPos(const QPointF &pos);
203
204 QPointF scenePos() const;
205 void setScenePos(const QPointF &pos);
206
207 QPoint screenPos() const;
208 void setScreenPos(const QPoint &pos);
209
210 QPointF lastPos() const;
211 void setLastPos(const QPointF &pos);
212
213 QPointF lastScenePos() const;
214 void setLastScenePos(const QPointF &pos);
215
216 QPoint lastScreenPos() const;
217 void setLastScreenPos(const QPoint &pos);
218
219 Qt::KeyboardModifiers modifiers() const;
220 void setModifiers(Qt::KeyboardModifiers modifiers);
221
222private:
223 Q_DECLARE_PRIVATE(QGraphicsSceneHoverEvent)
224 Q_DISABLE_COPY(QGraphicsSceneHoverEvent)
225};
226
227class QGraphicsSceneHelpEventPrivate;
228class Q_GUI_EXPORT QGraphicsSceneHelpEvent : public QGraphicsSceneEvent
229{
230public:
231 QGraphicsSceneHelpEvent(Type type = None);
232 ~QGraphicsSceneHelpEvent();
233
234 QPointF scenePos() const;
235 void setScenePos(const QPointF &pos);
236
237 QPoint screenPos() const;
238 void setScreenPos(const QPoint &pos);
239
240private:
241 Q_DECLARE_PRIVATE(QGraphicsSceneHelpEvent)
242 Q_DISABLE_COPY(QGraphicsSceneHelpEvent)
243};
244
245class QGraphicsSceneDragDropEventPrivate;
246class Q_GUI_EXPORT QGraphicsSceneDragDropEvent : public QGraphicsSceneEvent
247{
248public:
249 QGraphicsSceneDragDropEvent(Type type = None);
250 ~QGraphicsSceneDragDropEvent();
251
252 QPointF pos() const;
253 void setPos(const QPointF &pos);
254
255 QPointF scenePos() const;
256 void setScenePos(const QPointF &pos);
257
258 QPoint screenPos() const;
259 void setScreenPos(const QPoint &pos);
260
261 Qt::MouseButtons buttons() const;
262 void setButtons(Qt::MouseButtons buttons);
263
264 Qt::KeyboardModifiers modifiers() const;
265 void setModifiers(Qt::KeyboardModifiers modifiers);
266
267 Qt::DropActions possibleActions() const;
268 void setPossibleActions(Qt::DropActions actions);
269
270 Qt::DropAction proposedAction() const;
271 void setProposedAction(Qt::DropAction action);
272 void acceptProposedAction();
273
274 Qt::DropAction dropAction() const;
275 void setDropAction(Qt::DropAction action);
276
277 QWidget *source() const;
278 void setSource(QWidget *source);
279
280 const QMimeData *mimeData() const;
281 void setMimeData(const QMimeData *data);
282
283private:
284 Q_DECLARE_PRIVATE(QGraphicsSceneDragDropEvent)
285 Q_DISABLE_COPY(QGraphicsSceneDragDropEvent)
286};
287
288class QGraphicsSceneResizeEventPrivate;
289class Q_GUI_EXPORT QGraphicsSceneResizeEvent : public QGraphicsSceneEvent
290{
291 Q_DECLARE_PRIVATE(QGraphicsSceneResizeEvent)
292 Q_DISABLE_COPY(QGraphicsSceneResizeEvent)
293public:
294 QGraphicsSceneResizeEvent();
295 ~QGraphicsSceneResizeEvent();
296
297 QSizeF oldSize() const;
298 void setOldSize(const QSizeF &size);
299
300 QSizeF newSize() const;
301 void setNewSize(const QSizeF &size);
302};
303
304class QGraphicsSceneMoveEventPrivate;
305class Q_GUI_EXPORT QGraphicsSceneMoveEvent : public QGraphicsSceneEvent
306{
307 Q_DECLARE_PRIVATE(QGraphicsSceneMoveEvent)
308 Q_DISABLE_COPY(QGraphicsSceneMoveEvent)
309public:
310 QGraphicsSceneMoveEvent();
311 ~QGraphicsSceneMoveEvent();
312
313 QPointF oldPos() const;
314 void setOldPos(const QPointF &pos);
315
316 QPointF newPos() const;
317 void setNewPos(const QPointF &pos);
318};
319
320#endif // QT_NO_GRAPHICSVIEW
321
322QT_END_NAMESPACE
323
324QT_END_HEADER
325
326#endif
327