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