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 QEVENT_H |
43 | #define QEVENT_H |
44 | |
45 | #include <QtGui/qwindowdefs.h> |
46 | #include <QtCore/qobject.h> |
47 | #include <QtGui/qregion.h> |
48 | #include <QtCore/qnamespace.h> |
49 | #include <QtCore/qstring.h> |
50 | #include <QtGui/qkeysequence.h> |
51 | #include <QtCore/qcoreevent.h> |
52 | #include <QtGui/qmime.h> |
53 | #include <QtGui/qdrag.h> |
54 | #include <QtCore/qvariant.h> |
55 | #include <QtCore/qmap.h> |
56 | #include <QtCore/qset.h> |
57 | #include <QtCore/qfile.h> |
58 | |
59 | #ifdef Q_OS_SYMBIAN |
60 | class RFile; |
61 | #endif |
62 | |
63 | QT_BEGIN_HEADER |
64 | |
65 | QT_BEGIN_NAMESPACE |
66 | |
67 | QT_MODULE(Gui) |
68 | |
69 | class QAction; |
70 | #ifndef QT_NO_GESTURES |
71 | class QGesture; |
72 | #endif |
73 | |
74 | class Q_GUI_EXPORT QInputEvent : public QEvent |
75 | { |
76 | public: |
77 | QInputEvent(Type type, Qt::KeyboardModifiers modifiers = Qt::NoModifier); |
78 | ~QInputEvent(); |
79 | inline Qt::KeyboardModifiers modifiers() const { return modState; } |
80 | inline void setModifiers(Qt::KeyboardModifiers amodifiers) { modState = amodifiers; } |
81 | protected: |
82 | Qt::KeyboardModifiers modState; |
83 | }; |
84 | |
85 | class Q_GUI_EXPORT QMouseEvent : public QInputEvent |
86 | { |
87 | public: |
88 | QMouseEvent(Type type, const QPoint &pos, Qt::MouseButton button, |
89 | Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers); |
90 | QMouseEvent(Type type, const QPoint &pos, const QPoint &globalPos, |
91 | Qt::MouseButton button, Qt::MouseButtons buttons, |
92 | Qt::KeyboardModifiers modifiers); |
93 | ~QMouseEvent(); |
94 | |
95 | inline const QPoint &pos() const { return p; } |
96 | inline const QPoint &globalPos() const { return g; } |
97 | inline int x() const { return p.x(); } |
98 | inline int y() const { return p.y(); } |
99 | inline int globalX() const { return g.x(); } |
100 | inline int globalY() const { return g.y(); } |
101 | inline Qt::MouseButton button() const { return b; } |
102 | inline Qt::MouseButtons buttons() const { return mouseState; } |
103 | |
104 | static QMouseEvent *createExtendedMouseEvent(Type type, const QPointF &pos, |
105 | const QPoint &globalPos, Qt::MouseButton button, |
106 | Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers); |
107 | inline bool hasExtendedInfo() const { return reinterpret_cast<const QMouseEvent *>(d) == this; } |
108 | QPointF posF() const; |
109 | |
110 | #ifdef QT3_SUPPORT |
111 | QT3_SUPPORT_CONSTRUCTOR QMouseEvent(Type type, const QPoint &pos, Qt::ButtonState button, int state); |
112 | QT3_SUPPORT_CONSTRUCTOR QMouseEvent(Type type, const QPoint &pos, const QPoint &globalPos, |
113 | Qt::ButtonState button, int state); |
114 | inline QT3_SUPPORT Qt::ButtonState state() const |
115 | { return Qt::ButtonState((mouseState^b)|int(modifiers())); } |
116 | inline QT3_SUPPORT Qt::ButtonState stateAfter() const |
117 | { return Qt::ButtonState(int(mouseState)|int(modifiers())); } |
118 | #endif |
119 | protected: |
120 | QPoint p, g; |
121 | Qt::MouseButton b; |
122 | Qt::MouseButtons mouseState; |
123 | }; |
124 | |
125 | class Q_GUI_EXPORT QHoverEvent : public QEvent |
126 | { |
127 | public: |
128 | QHoverEvent(Type type, const QPoint &pos, const QPoint &oldPos); |
129 | ~QHoverEvent(); |
130 | |
131 | inline const QPoint &pos() const { return p; } |
132 | inline const QPoint &oldPos() const { return op; } |
133 | |
134 | protected: |
135 | QPoint p, op; |
136 | }; |
137 | |
138 | #ifndef QT_NO_WHEELEVENT |
139 | class Q_GUI_EXPORT QWheelEvent : public QInputEvent |
140 | { |
141 | public: |
142 | QWheelEvent(const QPoint &pos, int delta, |
143 | Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers, |
144 | Qt::Orientation orient = Qt::Vertical); |
145 | QWheelEvent(const QPoint &pos, const QPoint& globalPos, int delta, |
146 | Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers, |
147 | Qt::Orientation orient = Qt::Vertical); |
148 | ~QWheelEvent(); |
149 | |
150 | inline int delta() const { return d; } |
151 | inline const QPoint &pos() const { return p; } |
152 | inline const QPoint &globalPos() const { return g; } |
153 | inline int x() const { return p.x(); } |
154 | inline int y() const { return p.y(); } |
155 | inline int globalX() const { return g.x(); } |
156 | inline int globalY() const { return g.y(); } |
157 | |
158 | inline Qt::MouseButtons buttons() const { return mouseState; } |
159 | Qt::Orientation orientation() const { return o; } |
160 | |
161 | #ifdef QT3_SUPPORT |
162 | QT3_SUPPORT_CONSTRUCTOR QWheelEvent(const QPoint &pos, int delta, int state, |
163 | Qt::Orientation orient = Qt::Vertical); |
164 | QT3_SUPPORT_CONSTRUCTOR QWheelEvent(const QPoint &pos, const QPoint& globalPos, int delta, int state, |
165 | Qt::Orientation orient = Qt::Vertical); |
166 | inline QT3_SUPPORT Qt::ButtonState state() const |
167 | { return static_cast<Qt::ButtonState>(int(buttons())|int(modifiers())); } |
168 | #endif |
169 | protected: |
170 | QPoint p; |
171 | QPoint g; |
172 | int d; |
173 | Qt::MouseButtons mouseState; |
174 | Qt::Orientation o; |
175 | }; |
176 | #endif |
177 | |
178 | #ifndef QT_NO_TABLETEVENT |
179 | class Q_GUI_EXPORT QTabletEvent : public QInputEvent |
180 | { |
181 | public: |
182 | enum TabletDevice { NoDevice, Puck, Stylus, Airbrush, FourDMouse, |
183 | XFreeEraser /*internal*/, RotationStylus }; |
184 | enum PointerType { UnknownPointer, Pen, Cursor, Eraser }; |
185 | QTabletEvent(Type t, const QPoint &pos, const QPoint &globalPos, const QPointF &hiResGlobalPos, |
186 | int device, int pointerType, qreal pressure, int xTilt, int yTilt, |
187 | qreal tangentialPressure, qreal rotation, int z, |
188 | Qt::KeyboardModifiers keyState, qint64 uniqueID); |
189 | ~QTabletEvent(); |
190 | |
191 | inline const QPoint &pos() const { return mPos; } |
192 | inline const QPoint &globalPos() const { return mGPos; } |
193 | inline const QPointF &hiResGlobalPos() const { return mHiResGlobalPos; } |
194 | inline int x() const { return mPos.x(); } |
195 | inline int y() const { return mPos.y(); } |
196 | inline int globalX() const { return mGPos.x(); } |
197 | inline int globalY() const { return mGPos.y(); } |
198 | inline qreal hiResGlobalX() const { return mHiResGlobalPos.x(); } |
199 | inline qreal hiResGlobalY() const { return mHiResGlobalPos.y(); } |
200 | inline TabletDevice device() const { return TabletDevice(mDev); } |
201 | inline PointerType pointerType() const { return PointerType(mPointerType); } |
202 | inline qint64 uniqueId() const { return mUnique; } |
203 | inline qreal pressure() const { return mPress; } |
204 | inline int z() const { return mZ; } |
205 | inline qreal tangentialPressure() const { return mTangential; } |
206 | inline qreal rotation() const { return mRot; } |
207 | inline int xTilt() const { return mXT; } |
208 | inline int yTilt() const { return mYT; } |
209 | |
210 | protected: |
211 | QPoint mPos, mGPos; |
212 | QPointF mHiResGlobalPos; |
213 | int mDev, mPointerType, mXT, mYT, mZ; |
214 | qreal mPress, mTangential, mRot; |
215 | qint64 mUnique; |
216 | |
217 | // I don't know what the future holds for tablets but there could be some |
218 | // new devices coming along, and there seem to be "holes" in the |
219 | // OS-specific events for this. |
220 | void *; |
221 | }; |
222 | #endif // QT_NO_TABLETEVENT |
223 | |
224 | class Q_GUI_EXPORT QKeyEvent : public QInputEvent |
225 | { |
226 | public: |
227 | QKeyEvent(Type type, int key, Qt::KeyboardModifiers modifiers, const QString& text = QString(), |
228 | bool autorep = false, ushort count = 1); |
229 | ~QKeyEvent(); |
230 | |
231 | int key() const { return k; } |
232 | #ifndef QT_NO_SHORTCUT |
233 | bool matches(QKeySequence::StandardKey key) const; |
234 | #endif |
235 | Qt::KeyboardModifiers modifiers() const; |
236 | inline QString text() const { return txt; } |
237 | inline bool isAutoRepeat() const { return autor; } |
238 | inline int count() const { return int(c); } |
239 | |
240 | // Functions for the extended key event information |
241 | static QKeyEvent *createExtendedKeyEvent(Type type, int key, Qt::KeyboardModifiers modifiers, |
242 | quint32 nativeScanCode, quint32 nativeVirtualKey, |
243 | quint32 nativeModifiers, |
244 | const QString& text = QString(), bool autorep = false, |
245 | ushort count = 1); |
246 | inline bool hasExtendedInfo() const { return reinterpret_cast<const QKeyEvent*>(d) == this; } |
247 | quint32 nativeScanCode() const; |
248 | quint32 nativeVirtualKey() const; |
249 | quint32 nativeModifiers() const; |
250 | |
251 | #ifdef QT3_SUPPORT |
252 | inline QT3_SUPPORT_CONSTRUCTOR QKeyEvent(Type type, int key, int /*ascii*/, |
253 | int modifiers, const QString& text = QString(), |
254 | bool autorep = false, ushort count = 1) |
255 | : QInputEvent(type, Qt::KeyboardModifiers(modifiers & (int)Qt::KeyButtonMask)), txt(text), k(key), |
256 | c(count), autor(autorep) |
257 | { |
258 | if (key >= Qt::Key_Back && key <= Qt::Key_MediaLast) |
259 | ignore(); |
260 | } |
261 | inline QT3_SUPPORT int ascii() const |
262 | { return (txt.length() ? txt.unicode()->toLatin1() : 0); } |
263 | inline QT3_SUPPORT Qt::ButtonState state() const { return Qt::ButtonState(QInputEvent::modifiers()); } |
264 | inline QT3_SUPPORT Qt::ButtonState stateAfter() const { return Qt::ButtonState(modifiers()); } |
265 | #endif |
266 | |
267 | protected: |
268 | QString txt; |
269 | int k; |
270 | ushort c; |
271 | uint autor:1; |
272 | }; |
273 | |
274 | |
275 | class Q_GUI_EXPORT QFocusEvent : public QEvent |
276 | { |
277 | public: |
278 | QFocusEvent(Type type, Qt::FocusReason reason=Qt::OtherFocusReason); |
279 | ~QFocusEvent(); |
280 | |
281 | inline bool gotFocus() const { return type() == FocusIn; } |
282 | inline bool lostFocus() const { return type() == FocusOut; } |
283 | |
284 | #ifdef QT3_SUPPORT |
285 | enum Reason { Mouse=Qt::MouseFocusReason, Tab=Qt::TabFocusReason, |
286 | Backtab=Qt::BacktabFocusReason, MenuBar=Qt::MenuBarFocusReason, |
287 | ActiveWindow=Qt::ActiveWindowFocusReason, Other=Qt::OtherFocusReason, |
288 | Popup=Qt::PopupFocusReason, Shortcut=Qt::ShortcutFocusReason }; |
289 | #endif |
290 | Qt::FocusReason reason(); |
291 | Qt::FocusReason reason() const; |
292 | |
293 | private: |
294 | Qt::FocusReason m_reason; |
295 | }; |
296 | |
297 | |
298 | class Q_GUI_EXPORT QPaintEvent : public QEvent |
299 | { |
300 | public: |
301 | QPaintEvent(const QRegion& paintRegion); |
302 | QPaintEvent(const QRect &paintRect); |
303 | ~QPaintEvent(); |
304 | |
305 | inline const QRect &rect() const { return m_rect; } |
306 | inline const QRegion ®ion() const { return m_region; } |
307 | |
308 | #ifdef QT3_SUPPORT |
309 | QT3_SUPPORT_CONSTRUCTOR QPaintEvent(const QRegion &paintRegion, const QRect &paintRect); |
310 | inline QT3_SUPPORT bool erased() const { return m_erased; } |
311 | inline QT3_SUPPORT void setErased(bool b) { m_erased = b; } |
312 | #endif |
313 | |
314 | protected: |
315 | friend class QApplication; |
316 | friend class QCoreApplication; |
317 | QRect m_rect; |
318 | QRegion m_region; |
319 | bool m_erased; |
320 | }; |
321 | |
322 | class QUpdateLaterEvent : public QEvent |
323 | { |
324 | public: |
325 | QUpdateLaterEvent(const QRegion& paintRegion); |
326 | ~QUpdateLaterEvent(); |
327 | |
328 | inline const QRegion ®ion() const { return m_region; } |
329 | |
330 | protected: |
331 | QRegion m_region; |
332 | }; |
333 | |
334 | class Q_GUI_EXPORT QMoveEvent : public QEvent |
335 | { |
336 | public: |
337 | QMoveEvent(const QPoint &pos, const QPoint &oldPos); |
338 | ~QMoveEvent(); |
339 | |
340 | inline const QPoint &pos() const { return p; } |
341 | inline const QPoint &oldPos() const { return oldp;} |
342 | protected: |
343 | QPoint p, oldp; |
344 | friend class QApplication; |
345 | friend class QCoreApplication; |
346 | }; |
347 | |
348 | |
349 | class Q_GUI_EXPORT QResizeEvent : public QEvent |
350 | { |
351 | public: |
352 | QResizeEvent(const QSize &size, const QSize &oldSize); |
353 | ~QResizeEvent(); |
354 | |
355 | inline const QSize &size() const { return s; } |
356 | inline const QSize &oldSize()const { return olds;} |
357 | protected: |
358 | QSize s, olds; |
359 | friend class QApplication; |
360 | friend class QCoreApplication; |
361 | }; |
362 | |
363 | |
364 | class Q_GUI_EXPORT QCloseEvent : public QEvent |
365 | { |
366 | public: |
367 | QCloseEvent(); |
368 | ~QCloseEvent(); |
369 | }; |
370 | |
371 | |
372 | class Q_GUI_EXPORT QIconDragEvent : public QEvent |
373 | { |
374 | public: |
375 | QIconDragEvent(); |
376 | ~QIconDragEvent(); |
377 | }; |
378 | |
379 | |
380 | class Q_GUI_EXPORT QShowEvent : public QEvent |
381 | { |
382 | public: |
383 | QShowEvent(); |
384 | ~QShowEvent(); |
385 | }; |
386 | |
387 | |
388 | class Q_GUI_EXPORT QHideEvent : public QEvent |
389 | { |
390 | public: |
391 | QHideEvent(); |
392 | ~QHideEvent(); |
393 | }; |
394 | |
395 | #ifndef QT_NO_CONTEXTMENU |
396 | class Q_GUI_EXPORT : public QInputEvent |
397 | { |
398 | public: |
399 | enum { , , }; |
400 | |
401 | (Reason reason, const QPoint &pos, const QPoint &globalPos, |
402 | Qt::KeyboardModifiers modifiers); |
403 | (Reason reason, const QPoint &pos, const QPoint &globalPos); |
404 | (Reason reason, const QPoint &pos); |
405 | (); |
406 | |
407 | inline int () const { return p.x(); } |
408 | inline int () const { return p.y(); } |
409 | inline int () const { return gp.x(); } |
410 | inline int () const { return gp.y(); } |
411 | |
412 | inline const QPoint& () const { return p; } |
413 | inline const QPoint& () const { return gp; } |
414 | |
415 | inline Reason () const { return Reason(reas); } |
416 | |
417 | #ifdef QT3_SUPPORT |
418 | QT3_SUPPORT_CONSTRUCTOR QContextMenuEvent(Reason reason, const QPoint &pos, const QPoint &globalPos, int); |
419 | QT3_SUPPORT_CONSTRUCTOR QContextMenuEvent(Reason reason, const QPoint &pos, int); |
420 | |
421 | QT3_SUPPORT Qt::ButtonState state() const; |
422 | #endif |
423 | protected: |
424 | QPoint ; |
425 | QPoint ; |
426 | uint : 8; |
427 | }; |
428 | #endif // QT_NO_CONTEXTMENU |
429 | |
430 | #ifndef QT_NO_INPUTMETHOD |
431 | class Q_GUI_EXPORT QInputMethodEvent : public QEvent |
432 | { |
433 | public: |
434 | enum AttributeType { |
435 | TextFormat, |
436 | Cursor, |
437 | Language, |
438 | Ruby, |
439 | Selection |
440 | }; |
441 | class Attribute { |
442 | public: |
443 | Attribute(AttributeType t, int s, int l, QVariant val) : type(t), start(s), length(l), value(val) {} |
444 | AttributeType type; |
445 | |
446 | int start; |
447 | int length; |
448 | QVariant value; |
449 | }; |
450 | QInputMethodEvent(); |
451 | QInputMethodEvent(const QString &preeditText, const QList<Attribute> &attributes); |
452 | void setCommitString(const QString &commitString, int replaceFrom = 0, int replaceLength = 0); |
453 | |
454 | inline const QList<Attribute> &attributes() const { return attrs; } |
455 | inline const QString &preeditString() const { return preedit; } |
456 | |
457 | inline const QString &commitString() const { return commit; } |
458 | inline int replacementStart() const { return replace_from; } |
459 | inline int replacementLength() const { return replace_length; } |
460 | |
461 | QInputMethodEvent(const QInputMethodEvent &other); |
462 | |
463 | private: |
464 | QString preedit; |
465 | QList<Attribute> attrs; |
466 | QString commit; |
467 | int replace_from; |
468 | int replace_length; |
469 | }; |
470 | #endif // QT_NO_INPUTMETHOD |
471 | |
472 | #ifndef QT_NO_DRAGANDDROP |
473 | |
474 | class QMimeData; |
475 | |
476 | class Q_GUI_EXPORT QDropEvent : public QEvent |
477 | // QT3_SUPPORT |
478 | , public QMimeSource |
479 | // END QT3_SUPPORT |
480 | { |
481 | public: |
482 | QDropEvent(const QPoint& pos, Qt::DropActions actions, const QMimeData *data, |
483 | Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers, Type type = Drop); |
484 | ~QDropEvent(); |
485 | |
486 | inline const QPoint &pos() const { return p; } |
487 | inline Qt::MouseButtons mouseButtons() const { return mouseState; } |
488 | inline Qt::KeyboardModifiers keyboardModifiers() const { return modState; } |
489 | |
490 | inline Qt::DropActions possibleActions() const { return act; } |
491 | inline Qt::DropAction proposedAction() const { return default_action; } |
492 | inline void acceptProposedAction() { drop_action = default_action; accept(); } |
493 | |
494 | inline Qt::DropAction dropAction() const { return drop_action; } |
495 | void setDropAction(Qt::DropAction action); |
496 | |
497 | QWidget* source() const; |
498 | inline const QMimeData *mimeData() const { return mdata; } |
499 | |
500 | // QT3_SUPPORT |
501 | const char* format(int n = 0) const; |
502 | QByteArray encodedData(const char*) const; |
503 | bool provides(const char*) const; |
504 | // END QT3_SUPPORT |
505 | #ifdef QT3_SUPPORT |
506 | inline void accept() { QEvent::accept(); } |
507 | inline QT3_SUPPORT void accept(bool y) { setAccepted(y); } |
508 | inline QT3_SUPPORT QByteArray data(const char* f) const { return encodedData(f); } |
509 | |
510 | enum Action { Copy, Link, Move, Private, UserAction = Private }; |
511 | QT3_SUPPORT Action action() const; |
512 | inline QT3_SUPPORT void acceptAction(bool y = true) { if (y) { drop_action = default_action; accept(); } } |
513 | inline QT3_SUPPORT void setPoint(const QPoint& np) { p = np; } |
514 | #endif |
515 | |
516 | |
517 | protected: |
518 | friend class QApplication; |
519 | QPoint p; |
520 | Qt::MouseButtons mouseState; |
521 | Qt::KeyboardModifiers modState; |
522 | Qt::DropActions act; |
523 | Qt::DropAction drop_action; |
524 | Qt::DropAction default_action; |
525 | const QMimeData *mdata; |
526 | mutable QList<QByteArray> fmts; // only used for QT3_SUPPORT |
527 | }; |
528 | |
529 | |
530 | class Q_GUI_EXPORT QDragMoveEvent : public QDropEvent |
531 | { |
532 | public: |
533 | QDragMoveEvent(const QPoint &pos, Qt::DropActions actions, const QMimeData *data, |
534 | Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers, Type type = DragMove); |
535 | ~QDragMoveEvent(); |
536 | |
537 | inline QRect answerRect() const { return rect; } |
538 | |
539 | inline void accept() { QDropEvent::accept(); } |
540 | inline void ignore() { QDropEvent::ignore(); } |
541 | |
542 | inline void accept(const QRect & r) { accept(); rect = r; } |
543 | inline void ignore(const QRect & r) { ignore(); rect = r; } |
544 | |
545 | #ifdef QT3_SUPPORT |
546 | inline QT3_SUPPORT void accept(bool y) { setAccepted(y); } |
547 | #endif |
548 | |
549 | protected: |
550 | friend class QApplication; |
551 | QRect rect; |
552 | }; |
553 | |
554 | |
555 | class Q_GUI_EXPORT QDragEnterEvent : public QDragMoveEvent |
556 | { |
557 | public: |
558 | QDragEnterEvent(const QPoint &pos, Qt::DropActions actions, const QMimeData *data, |
559 | Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers); |
560 | ~QDragEnterEvent(); |
561 | }; |
562 | |
563 | |
564 | /* An internal class */ |
565 | class Q_GUI_EXPORT QDragResponseEvent : public QEvent |
566 | { |
567 | public: |
568 | QDragResponseEvent(bool accepted); |
569 | ~QDragResponseEvent(); |
570 | |
571 | inline bool dragAccepted() const { return a; } |
572 | protected: |
573 | bool a; |
574 | }; |
575 | |
576 | |
577 | class Q_GUI_EXPORT QDragLeaveEvent : public QEvent |
578 | { |
579 | public: |
580 | QDragLeaveEvent(); |
581 | ~QDragLeaveEvent(); |
582 | }; |
583 | #endif // QT_NO_DRAGANDDROP |
584 | |
585 | |
586 | class Q_GUI_EXPORT QHelpEvent : public QEvent |
587 | { |
588 | public: |
589 | QHelpEvent(Type type, const QPoint &pos, const QPoint &globalPos); |
590 | ~QHelpEvent(); |
591 | |
592 | inline int x() const { return p.x(); } |
593 | inline int y() const { return p.y(); } |
594 | inline int globalX() const { return gp.x(); } |
595 | inline int globalY() const { return gp.y(); } |
596 | |
597 | inline const QPoint& pos() const { return p; } |
598 | inline const QPoint& globalPos() const { return gp; } |
599 | |
600 | private: |
601 | QPoint p; |
602 | QPoint gp; |
603 | }; |
604 | |
605 | #ifndef QT_NO_STATUSTIP |
606 | class Q_GUI_EXPORT QStatusTipEvent : public QEvent |
607 | { |
608 | public: |
609 | QStatusTipEvent(const QString &tip); |
610 | ~QStatusTipEvent(); |
611 | |
612 | inline QString tip() const { return s; } |
613 | private: |
614 | QString s; |
615 | }; |
616 | #endif |
617 | |
618 | #ifndef QT_NO_WHATSTHIS |
619 | class Q_GUI_EXPORT QWhatsThisClickedEvent : public QEvent |
620 | { |
621 | public: |
622 | QWhatsThisClickedEvent(const QString &href); |
623 | ~QWhatsThisClickedEvent(); |
624 | |
625 | inline QString href() const { return s; } |
626 | private: |
627 | QString s; |
628 | }; |
629 | #endif |
630 | |
631 | #ifndef QT_NO_ACTION |
632 | class Q_GUI_EXPORT QActionEvent : public QEvent |
633 | { |
634 | QAction *act, *bef; |
635 | public: |
636 | QActionEvent(int type, QAction *action, QAction *before = 0); |
637 | ~QActionEvent(); |
638 | |
639 | inline QAction *action() const { return act; } |
640 | inline QAction *before() const { return bef; } |
641 | }; |
642 | #endif |
643 | |
644 | class Q_GUI_EXPORT QFileOpenEvent : public QEvent |
645 | { |
646 | public: |
647 | QFileOpenEvent(const QString &file); |
648 | QFileOpenEvent(const QUrl &url); |
649 | #ifdef Q_OS_SYMBIAN |
650 | QFileOpenEvent(const RFile &fileHandle); |
651 | #endif |
652 | ~QFileOpenEvent(); |
653 | |
654 | inline QString file() const { return f; } |
655 | QUrl url() const; |
656 | bool openFile(QFile &file, QIODevice::OpenMode flags) const; |
657 | private: |
658 | QString f; |
659 | }; |
660 | |
661 | #ifndef QT_NO_TOOLBAR |
662 | class Q_GUI_EXPORT QToolBarChangeEvent : public QEvent |
663 | { |
664 | public: |
665 | QToolBarChangeEvent(bool t); |
666 | ~QToolBarChangeEvent(); |
667 | |
668 | inline bool toggle() const { return tog; } |
669 | private: |
670 | uint tog : 1; |
671 | }; |
672 | #endif |
673 | |
674 | #ifndef QT_NO_SHORTCUT |
675 | class Q_GUI_EXPORT QShortcutEvent : public QEvent |
676 | { |
677 | public: |
678 | QShortcutEvent(const QKeySequence &key, int id, bool ambiguous = false); |
679 | ~QShortcutEvent(); |
680 | |
681 | inline const QKeySequence &key() { return sequence; } |
682 | inline const QKeySequence &key() const { return sequence; } |
683 | inline int shortcutId() { return sid; } |
684 | inline int shortcutId() const { return sid; } |
685 | inline bool isAmbiguous() { return ambig; } |
686 | inline bool isAmbiguous() const { return ambig; } |
687 | protected: |
688 | QKeySequence sequence; |
689 | bool ambig; |
690 | int sid; |
691 | }; |
692 | #endif |
693 | |
694 | #ifndef QT_NO_CLIPBOARD |
695 | class Q_GUI_EXPORT QClipboardEvent : public QEvent |
696 | { |
697 | public: |
698 | QClipboardEvent(QEventPrivate *data); |
699 | ~QClipboardEvent(); |
700 | |
701 | QEventPrivate *data() { return d; } |
702 | }; |
703 | #endif |
704 | |
705 | class Q_GUI_EXPORT QWindowStateChangeEvent: public QEvent |
706 | { |
707 | public: |
708 | QWindowStateChangeEvent(Qt::WindowStates aOldState); |
709 | QWindowStateChangeEvent(Qt::WindowStates aOldState, bool isOverride); |
710 | ~QWindowStateChangeEvent(); |
711 | |
712 | inline Qt::WindowStates oldState() const { return ostate; } |
713 | bool isOverride() const; |
714 | |
715 | private: |
716 | Qt::WindowStates ostate; |
717 | }; |
718 | |
719 | #ifdef QT3_SUPPORT |
720 | class QMenuBar; |
721 | class Q_GUI_EXPORT QMenubarUpdatedEvent: public QEvent |
722 | { |
723 | public: |
724 | QMenubarUpdatedEvent(QMenuBar * const menBar); |
725 | inline QMenuBar *menuBar() { return m_menuBar; } |
726 | private: |
727 | QMenuBar *m_menuBar; |
728 | }; |
729 | #endif |
730 | |
731 | #ifndef QT_NO_DEBUG_STREAM |
732 | Q_GUI_EXPORT QDebug operator<<(QDebug, const QEvent *); |
733 | #endif |
734 | |
735 | #ifndef QT_NO_SHORTCUT |
736 | inline bool operator==(QKeyEvent *e, QKeySequence::StandardKey key){return (e ? e->matches(key) : false);} |
737 | inline bool operator==(QKeySequence::StandardKey key, QKeyEvent *e){return (e ? e->matches(key) : false);} |
738 | #endif // QT_NO_SHORTCUT |
739 | |
740 | class QTouchEventTouchPointPrivate; |
741 | class Q_GUI_EXPORT QTouchEvent : public QInputEvent |
742 | { |
743 | public: |
744 | class Q_GUI_EXPORT TouchPoint |
745 | { |
746 | public: |
747 | TouchPoint(int id = -1); |
748 | TouchPoint(const QTouchEvent::TouchPoint &other); |
749 | ~TouchPoint(); |
750 | |
751 | int id() const; |
752 | |
753 | Qt::TouchPointState state() const; |
754 | bool isPrimary() const; |
755 | |
756 | QPointF pos() const; |
757 | QPointF startPos() const; |
758 | QPointF lastPos() const; |
759 | |
760 | QPointF scenePos() const; |
761 | QPointF startScenePos() const; |
762 | QPointF lastScenePos() const; |
763 | |
764 | QPointF screenPos() const; |
765 | QPointF startScreenPos() const; |
766 | QPointF lastScreenPos() const; |
767 | |
768 | QPointF normalizedPos() const; |
769 | QPointF startNormalizedPos() const; |
770 | QPointF lastNormalizedPos() const; |
771 | |
772 | QRectF rect() const; |
773 | QRectF sceneRect() const; |
774 | QRectF screenRect() const; |
775 | |
776 | qreal pressure() const; |
777 | |
778 | // internal |
779 | void setId(int id); |
780 | void setState(Qt::TouchPointStates state); |
781 | void setPos(const QPointF &pos); |
782 | void setScenePos(const QPointF &scenePos); |
783 | void setScreenPos(const QPointF &screenPos); |
784 | void setNormalizedPos(const QPointF &normalizedPos); |
785 | void setStartPos(const QPointF &startPos); |
786 | void setStartScenePos(const QPointF &startScenePos); |
787 | void setStartScreenPos(const QPointF &startScreenPos); |
788 | void setStartNormalizedPos(const QPointF &startNormalizedPos); |
789 | void setLastPos(const QPointF &lastPos); |
790 | void setLastScenePos(const QPointF &lastScenePos); |
791 | void setLastScreenPos(const QPointF &lastScreenPos); |
792 | void setLastNormalizedPos(const QPointF &lastNormalizedPos); |
793 | void setRect(const QRectF &rect); |
794 | void setSceneRect(const QRectF &sceneRect); |
795 | void setScreenRect(const QRectF &screenRect); |
796 | void setPressure(qreal pressure); |
797 | QTouchEvent::TouchPoint &operator=(const QTouchEvent::TouchPoint &other); |
798 | |
799 | private: |
800 | QTouchEventTouchPointPrivate *d; |
801 | friend class QApplication; |
802 | friend class QApplicationPrivate; |
803 | }; |
804 | |
805 | enum DeviceType { |
806 | TouchScreen, |
807 | TouchPad |
808 | }; |
809 | |
810 | QTouchEvent(QEvent::Type eventType, |
811 | QTouchEvent::DeviceType deviceType = TouchScreen, |
812 | Qt::KeyboardModifiers modifiers = Qt::NoModifier, |
813 | Qt::TouchPointStates touchPointStates = 0, |
814 | const QList<QTouchEvent::TouchPoint> &touchPoints = QList<QTouchEvent::TouchPoint>()); |
815 | ~QTouchEvent(); |
816 | |
817 | inline QWidget *widget() const { return _widget; } |
818 | inline QTouchEvent::DeviceType deviceType() const { return _deviceType; } |
819 | inline Qt::TouchPointStates touchPointStates() const { return _touchPointStates; } |
820 | inline const QList<QTouchEvent::TouchPoint> &touchPoints() const { return _touchPoints; } |
821 | |
822 | // internal |
823 | inline void setWidget(QWidget *awidget) { _widget = awidget; } |
824 | inline void setDeviceType(DeviceType adeviceType) { _deviceType = adeviceType; } |
825 | inline void setTouchPointStates(Qt::TouchPointStates aTouchPointStates) { _touchPointStates = aTouchPointStates; } |
826 | inline void setTouchPoints(const QList<QTouchEvent::TouchPoint> &atouchPoints) { _touchPoints = atouchPoints; } |
827 | |
828 | protected: |
829 | QWidget *_widget; |
830 | QTouchEvent::DeviceType _deviceType; |
831 | Qt::TouchPointStates _touchPointStates; |
832 | QList<QTouchEvent::TouchPoint> _touchPoints; |
833 | |
834 | friend class QApplication; |
835 | friend class QApplicationPrivate; |
836 | }; |
837 | |
838 | #ifndef QT_NO_GESTURES |
839 | class QGesture; |
840 | class QGestureEventPrivate; |
841 | class Q_GUI_EXPORT QGestureEvent : public QEvent |
842 | { |
843 | public: |
844 | QGestureEvent(const QList<QGesture *> &gestures); |
845 | ~QGestureEvent(); |
846 | |
847 | QList<QGesture *> gestures() const; |
848 | QGesture *gesture(Qt::GestureType type) const; |
849 | |
850 | QList<QGesture *> activeGestures() const; |
851 | QList<QGesture *> canceledGestures() const; |
852 | |
853 | #ifdef Q_NO_USING_KEYWORD |
854 | inline void setAccepted(bool accepted) { QEvent::setAccepted(accepted); } |
855 | inline bool isAccepted() const { return QEvent::isAccepted(); } |
856 | |
857 | inline void accept() { QEvent::accept(); } |
858 | inline void ignore() { QEvent::ignore(); } |
859 | #else |
860 | using QEvent::setAccepted; |
861 | using QEvent::isAccepted; |
862 | using QEvent::accept; |
863 | using QEvent::ignore; |
864 | #endif |
865 | |
866 | void setAccepted(QGesture *, bool); |
867 | void accept(QGesture *); |
868 | void ignore(QGesture *); |
869 | bool isAccepted(QGesture *) const; |
870 | |
871 | void setAccepted(Qt::GestureType, bool); |
872 | void accept(Qt::GestureType); |
873 | void ignore(Qt::GestureType); |
874 | bool isAccepted(Qt::GestureType) const; |
875 | |
876 | void setWidget(QWidget *widget); |
877 | QWidget *widget() const; |
878 | |
879 | #ifndef QT_NO_GRAPHICSVIEW |
880 | QPointF mapToGraphicsScene(const QPointF &gesturePoint) const; |
881 | #endif |
882 | |
883 | private: |
884 | QGestureEventPrivate *d_func(); |
885 | const QGestureEventPrivate *d_func() const; |
886 | |
887 | friend class QApplication; |
888 | friend class QGestureManager; |
889 | }; |
890 | #endif // QT_NO_GESTURES |
891 | |
892 | QT_END_NAMESPACE |
893 | |
894 | QT_END_HEADER |
895 | |
896 | #endif // QEVENT_H |
897 | |