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