~oif-team/ubuntu/natty/qt4-x11/xi2.1

« back to all changes in this revision

Viewing changes to src/gui/kernel/qevent.h

  • Committer: Bazaar Package Importer
  • Author(s): Adam Conrad
  • Date: 2005-08-24 04:09:09 UTC
  • Revision ID: james.westby@ubuntu.com-20050824040909-xmxe9jfr4a0w5671
Tags: upstream-4.0.0
ImportĀ upstreamĀ versionĀ 4.0.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/****************************************************************************
 
2
**
 
3
** Copyright (C) 1992-2005 Trolltech AS. All rights reserved.
 
4
**
 
5
** This file is part of the gui module of the Qt Toolkit.
 
6
**
 
7
** This file may be distributed under the terms of the Q Public License
 
8
** as defined by Trolltech AS of Norway and appearing in the file
 
9
** LICENSE.QPL included in the packaging of this file.
 
10
**
 
11
** This file may be distributed and/or modified under the terms of the
 
12
** GNU General Public License version 2 as published by the Free Software
 
13
** Foundation and appearing in the file LICENSE.GPL included in the
 
14
** packaging of this file.
 
15
**
 
16
** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for
 
17
**   information about Qt Commercial License Agreements.
 
18
** See http://www.trolltech.com/qpl/ for QPL licensing information.
 
19
** See http://www.trolltech.com/gpl/ for GPL licensing information.
 
20
**
 
21
** Contact info@trolltech.com if any conditions of this licensing are
 
22
** not clear to you.
 
23
**
 
24
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
 
25
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
 
26
**
 
27
****************************************************************************/
 
28
 
 
29
#ifndef QEVENT_H
 
30
#define QEVENT_H
 
31
 
 
32
#include "QtGui/qwindowdefs.h"
 
33
#include "QtCore/qobject.h"
 
34
#include "QtGui/qregion.h"
 
35
#include "QtCore/qnamespace.h"
 
36
#include "QtCore/qstring.h"
 
37
#include "QtGui/qkeysequence.h"
 
38
#include "QtCore/qcoreevent.h"
 
39
#include "QtGui/qmime.h"
 
40
#include "QtGui/qdrag.h"
 
41
#include "QtCore/qvariant.h"
 
42
 
 
43
class QAction;
 
44
 
 
45
class Q_GUI_EXPORT QInputEvent : public QEvent
 
46
{
 
47
public:
 
48
    QInputEvent(Type type, Qt::KeyboardModifiers modifiers = Qt::NoModifier);
 
49
    ~QInputEvent();
 
50
    inline Qt::KeyboardModifiers modifiers() const { return modState; }
 
51
protected:
 
52
    Qt::KeyboardModifiers modState;
 
53
};
 
54
 
 
55
 
 
56
class Q_GUI_EXPORT QMouseEvent : public QInputEvent
 
57
{
 
58
public:
 
59
    QMouseEvent(Type type, const QPoint &pos, Qt::MouseButton button,
 
60
                Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers);
 
61
    QMouseEvent(Type type, const QPoint &pos, const QPoint &globalPos,
 
62
                Qt::MouseButton button, Qt::MouseButtons buttons,
 
63
                Qt::KeyboardModifiers modifiers);
 
64
    ~QMouseEvent();
 
65
 
 
66
    inline const QPoint &pos() const { return p; }
 
67
    inline const QPoint &globalPos() const { return g; }
 
68
    inline int x() const { return p.x(); }
 
69
    inline int y() const { return p.y(); }
 
70
    inline int globalX() const { return g.x(); }
 
71
    inline int globalY() const { return g.y(); }
 
72
    inline Qt::MouseButton button() const { return b; }
 
73
    inline Qt::MouseButtons buttons() const { return mouseState; }
 
74
 
 
75
#ifdef QT3_SUPPORT
 
76
    QT3_SUPPORT_CONSTRUCTOR QMouseEvent(Type type, const QPoint &pos, Qt::ButtonState button, int state);
 
77
    QT3_SUPPORT_CONSTRUCTOR QMouseEvent(Type type, const QPoint &pos, const QPoint &globalPos,
 
78
                                      Qt::ButtonState button, int state);
 
79
    inline QT3_SUPPORT Qt::ButtonState state() const
 
80
    { return Qt::ButtonState((mouseState^b)|int(modifiers())); }
 
81
    inline QT3_SUPPORT Qt::ButtonState stateAfter() const
 
82
    { return Qt::ButtonState(int(mouseState)|int(modifiers())); }
 
83
#endif
 
84
protected:
 
85
    QPoint p, g;
 
86
    Qt::MouseButton b;
 
87
    Qt::MouseButtons mouseState;
 
88
};
 
89
 
 
90
class Q_GUI_EXPORT QHoverEvent : public QEvent
 
91
{
 
92
public:
 
93
    QHoverEvent(Type type, const QPoint &pos, const QPoint &oldPos);
 
94
    ~QHoverEvent();
 
95
 
 
96
    inline const QPoint &pos() const { return p; }
 
97
    inline const QPoint &oldPos() const { return op; }
 
98
 
 
99
protected:
 
100
    QPoint p, op;
 
101
};
 
102
 
 
103
#ifndef QT_NO_WHEELEVENT
 
104
class Q_GUI_EXPORT QWheelEvent : public QInputEvent
 
105
{
 
106
public:
 
107
    QWheelEvent(const QPoint &pos, int delta,
 
108
                Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers,
 
109
                Qt::Orientation orient = Qt::Vertical);
 
110
    QWheelEvent(const QPoint &pos, const QPoint& globalPos, int delta,
 
111
                Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers,
 
112
                Qt::Orientation orient = Qt::Vertical);
 
113
    ~QWheelEvent();
 
114
 
 
115
    inline int delta() const { return d; }
 
116
    inline const QPoint &pos() const { return p; }
 
117
    inline const QPoint &globalPos()   const { return g; }
 
118
    inline int x() const { return p.x(); }
 
119
    inline int y() const { return p.y(); }
 
120
    inline int globalX() const { return g.x(); }
 
121
    inline int globalY() const { return g.y(); }
 
122
 
 
123
    inline Qt::MouseButtons buttons() const { return mouseState; }
 
124
    Qt::Orientation orientation() const { return o; }
 
125
 
 
126
#ifdef QT3_SUPPORT
 
127
    QT3_SUPPORT_CONSTRUCTOR QWheelEvent(const QPoint &pos, int delta, int state,
 
128
                                      Qt::Orientation orient = Qt::Vertical);
 
129
    QT3_SUPPORT_CONSTRUCTOR QWheelEvent(const QPoint &pos, const QPoint& globalPos, int delta, int state,
 
130
                                      Qt::Orientation orient = Qt::Vertical);
 
131
    inline QT3_SUPPORT Qt::ButtonState state() const
 
132
    { return static_cast<Qt::ButtonState>(int(buttons())|int(modifiers())); }
 
133
#endif
 
134
protected:
 
135
    QPoint p;
 
136
    QPoint g;
 
137
    int d;
 
138
    Qt::MouseButtons mouseState;
 
139
    Qt::Orientation o;
 
140
};
 
141
#endif
 
142
 
 
143
class Q_GUI_EXPORT QTabletEvent : public QInputEvent
 
144
{
 
145
public:
 
146
    enum TabletDevice { NoDevice, Puck, Stylus, Airbrush, FourDMouse,
 
147
                        XFreeEraser /*internal*/ };
 
148
    enum PointerType { UnknownPointer, Pen, Cursor, Eraser };
 
149
    QTabletEvent(Type t, const QPoint &pos, const QPoint &globalPos, const QPointF &hiResGlobalPos,
 
150
                 int device, int pointerType, qreal pressure, int xTilt, int yTilt,
 
151
                 qreal tangentialPressure, qreal rotation, int z,
 
152
                 Qt::KeyboardModifiers keyState, qint64 uniqueID);
 
153
    ~QTabletEvent();
 
154
 
 
155
    inline const QPoint &pos() const { return mPos; }
 
156
    inline const QPoint &globalPos() const { return mGPos; }
 
157
    inline const QPointF &hiResGlobalPos() const { return mHiResGlobalPos; }
 
158
    inline int x() const { return mPos.x(); }
 
159
    inline int y() const { return mPos.y(); }
 
160
    inline int globalX() const { return mGPos.x(); }
 
161
    inline int globalY() const { return mGPos.y(); }
 
162
    inline qreal hiResGlobalX() const { return mHiResGlobalPos.x(); }
 
163
    inline qreal hiResGlobalY() const { return mHiResGlobalPos.y(); }
 
164
    inline TabletDevice device() const { return TabletDevice(mDev); }
 
165
    inline PointerType pointerType() const { return PointerType(mPointerType); }
 
166
    inline qint64 uniqueId() const { return mUnique; }
 
167
    inline qreal pressure() const { return mPress; }
 
168
    inline int z() const { return mZ; }
 
169
    inline qreal tangentialPressure() const { return mTangential; }
 
170
    inline qreal rotation() const { return mRot; }
 
171
    inline int xTilt() const { return mXT; }
 
172
    inline int yTilt() const { return mYT; }
 
173
 
 
174
protected:
 
175
    QPoint mPos, mGPos;
 
176
    QPointF mHiResGlobalPos;
 
177
    int mDev, mPointerType, mXT, mYT, mZ;
 
178
    qreal mPress, mTangential, mRot;
 
179
    qint64 mUnique;
 
180
 
 
181
    // I don't know what the future holds for tablets but there could be some
 
182
    // new devices coming along, and there seem to be "holes" in the
 
183
    // OS-specific events for this.
 
184
    void *mExtra;
 
185
 
 
186
};
 
187
 
 
188
 
 
189
class Q_GUI_EXPORT QKeyEvent : public QInputEvent
 
190
{
 
191
public:
 
192
    QKeyEvent(Type type, int key, Qt::KeyboardModifiers modifiers,
 
193
              const QString& text = QString(),
 
194
              bool autorep = false, ushort count = 1);
 
195
    ~QKeyEvent();
 
196
 
 
197
    int key() const { return k; }
 
198
    Qt::KeyboardModifiers modifiers() const;
 
199
    inline QString text() const { return txt; }
 
200
    inline bool isAutoRepeat() const { return autor; }
 
201
    inline int count() const { return int(c); }
 
202
 
 
203
#ifdef QT3_SUPPORT
 
204
    inline QT3_SUPPORT_CONSTRUCTOR QKeyEvent(Type type, int key, int /*ascii*/,
 
205
                                           int modifiers, const QString& text = QString(),
 
206
                                           bool autorep = false, ushort count = 1)
 
207
        : QInputEvent(type, (Qt::KeyboardModifiers)(modifiers & (int)Qt::KeyButtonMask)), txt(text), k(key),
 
208
          c(count), autor(autorep)
 
209
    {
 
210
        if (key >= Qt::Key_Back && key <= Qt::Key_MediaLast)
 
211
            ignore();
 
212
    }
 
213
    inline QT3_SUPPORT int ascii() const
 
214
    { return (txt.length() ? txt.unicode()->toLatin1() : 0); }
 
215
    inline QT3_SUPPORT Qt::ButtonState state() const { return Qt::ButtonState(QInputEvent::modifiers()); }
 
216
    inline QT3_SUPPORT Qt::ButtonState stateAfter() const { return Qt::ButtonState(modifiers()); }
 
217
#endif
 
218
 
 
219
protected:
 
220
    QString txt;
 
221
    int k;
 
222
    ushort c;
 
223
    uint autor:1;
 
224
};
 
225
 
 
226
 
 
227
class Q_GUI_EXPORT QFocusEvent : public QEvent
 
228
{
 
229
public:
 
230
    QFocusEvent(Type type, Qt::FocusReason reason=Qt::OtherFocusReason);
 
231
    ~QFocusEvent();
 
232
 
 
233
    inline bool gotFocus() const { return type() == FocusIn; }
 
234
    inline bool lostFocus() const { return type() == FocusOut; }
 
235
 
 
236
#ifdef QT3_SUPPORT
 
237
    enum Reason { Mouse=Qt::MouseFocusReason, Tab=Qt::TabFocusReason,
 
238
                  Backtab=Qt::BacktabFocusReason, MenuBar=Qt::MenuBarFocusReason,
 
239
                  ActiveWindow=Qt::ActiveWindowFocusReason, Other=Qt::OtherFocusReason,
 
240
                  Popup=Qt::PopupFocusReason, Shortcut=Qt::ShortcutFocusReason };
 
241
#endif
 
242
    Qt::FocusReason reason();
 
243
 
 
244
private:
 
245
    Qt::FocusReason m_reason;
 
246
};
 
247
 
 
248
 
 
249
class Q_GUI_EXPORT QPaintEvent : public QEvent
 
250
{
 
251
public:
 
252
    QPaintEvent(const QRegion& paintRegion);
 
253
    QPaintEvent(const QRect &paintRect);
 
254
    ~QPaintEvent();
 
255
 
 
256
    inline const QRect &rect() const { return m_rect; }
 
257
    inline const QRegion &region() const { return m_region; }
 
258
 
 
259
#ifdef QT3_SUPPORT
 
260
    QT_COMPAT_CONSTRUCTOR QPaintEvent(const QRegion &paintRegion, const QRect &paintRect);
 
261
    inline QT3_SUPPORT bool erased() const { return m_erased; }
 
262
    inline QT3_SUPPORT void setErased(bool b) { m_erased = b; }
 
263
#endif
 
264
 
 
265
protected:
 
266
    friend class QApplication;
 
267
    friend class QCoreApplication;
 
268
    QRect m_rect;
 
269
    QRegion m_region;
 
270
    bool m_erased;
 
271
};
 
272
 
 
273
 
 
274
#ifdef Q_WS_QWS
 
275
class QWSUpdateEvent : public QPaintEvent
 
276
{
 
277
public:
 
278
    QWSUpdateEvent(const QRegion& paintRegion);
 
279
    QWSUpdateEvent(const QRect &paintRect);
 
280
    ~QWSUpdateEvent();
 
281
};
 
282
#endif
 
283
 
 
284
 
 
285
class Q_GUI_EXPORT QMoveEvent : public QEvent
 
286
{
 
287
public:
 
288
    QMoveEvent(const QPoint &pos, const QPoint &oldPos);
 
289
    ~QMoveEvent();
 
290
 
 
291
    inline const QPoint &pos() const { return p; }
 
292
    inline const QPoint &oldPos() const { return oldp;}
 
293
protected:
 
294
    QPoint p, oldp;
 
295
    friend class QApplication;
 
296
    friend class QCoreApplication;
 
297
};
 
298
 
 
299
 
 
300
class Q_GUI_EXPORT QResizeEvent : public QEvent
 
301
{
 
302
public:
 
303
    QResizeEvent(const QSize &size, const QSize &oldSize);
 
304
    ~QResizeEvent();
 
305
 
 
306
    inline const QSize &size() const { return s; }
 
307
    inline const QSize &oldSize()const { return olds;}
 
308
protected:
 
309
    QSize s, olds;
 
310
    friend class QApplication;
 
311
    friend class QCoreApplication;
 
312
};
 
313
 
 
314
 
 
315
class Q_GUI_EXPORT QCloseEvent : public QEvent
 
316
{
 
317
public:
 
318
    QCloseEvent();
 
319
    ~QCloseEvent();
 
320
};
 
321
 
 
322
 
 
323
class Q_GUI_EXPORT QIconDragEvent : public QEvent
 
324
{
 
325
public:
 
326
    QIconDragEvent();
 
327
    ~QIconDragEvent();
 
328
};
 
329
 
 
330
 
 
331
class Q_GUI_EXPORT QShowEvent : public QEvent
 
332
{
 
333
public:
 
334
    QShowEvent();
 
335
    ~QShowEvent();
 
336
};
 
337
 
 
338
 
 
339
class Q_GUI_EXPORT QHideEvent : public QEvent
 
340
{
 
341
public:
 
342
    QHideEvent();
 
343
    ~QHideEvent();
 
344
};
 
345
 
 
346
 
 
347
class Q_GUI_EXPORT QContextMenuEvent : public QInputEvent
 
348
{
 
349
public:
 
350
    enum Reason { Mouse, Keyboard, Other };
 
351
 
 
352
    QContextMenuEvent(Reason reason, const QPoint &pos, const QPoint &globalPos);
 
353
    QContextMenuEvent(Reason reason, const QPoint &pos);
 
354
    ~QContextMenuEvent();
 
355
 
 
356
    inline int x() const { return p.x(); }
 
357
    inline int y() const { return p.y(); }
 
358
    inline int globalX() const { return gp.x(); }
 
359
    inline int globalY() const { return gp.y(); }
 
360
 
 
361
    inline const QPoint& pos() const { return p; }
 
362
    inline const QPoint& globalPos() const { return gp; }
 
363
 
 
364
    inline Reason reason() const { return Reason(reas); }
 
365
 
 
366
#ifdef QT3_SUPPORT
 
367
    QT3_SUPPORT_CONSTRUCTOR QContextMenuEvent(Reason reason, const QPoint &pos, const QPoint &globalPos, int);
 
368
    QT3_SUPPORT_CONSTRUCTOR QContextMenuEvent(Reason reason, const QPoint &pos, int);
 
369
 
 
370
    QT3_SUPPORT Qt::ButtonState state() const;
 
371
#endif
 
372
protected:
 
373
    QPoint p;
 
374
    QPoint gp;
 
375
    uint reas : 8;
 
376
};
 
377
 
 
378
class Q_GUI_EXPORT QInputMethodEvent : public QEvent
 
379
{
 
380
public:
 
381
    enum AttributeType {
 
382
       TextFormat,
 
383
       Cursor,
 
384
       Language,
 
385
       Ruby
 
386
    };
 
387
    class Attribute {
 
388
    public:
 
389
        Attribute(AttributeType t, int s, int l, QVariant val) : type(t), start(s), length(l), value(val) {}
 
390
        AttributeType type;
 
391
 
 
392
        int start;
 
393
        int length;
 
394
        QVariant value;
 
395
    };
 
396
    QInputMethodEvent();
 
397
    QInputMethodEvent(const QString &preeditText, const QList<Attribute> &attributes);
 
398
    void setCommitString(const QString &commitString, int replaceFrom = 0, int replaceLength = 0);
 
399
 
 
400
    inline const QList<Attribute> &attributes() const { return attrs; }
 
401
    inline const QString &preeditString() const { return preedit; }
 
402
 
 
403
    inline const QString &commitString() const { return commit; }
 
404
    inline int replacementStart() const { return replace_from; }
 
405
    inline int replacementLength() const { return replace_length; }
 
406
 
 
407
    QInputMethodEvent(const QInputMethodEvent &other);
 
408
 
 
409
private:
 
410
    QString preedit;
 
411
    QList<Attribute> attrs;
 
412
    QString commit;
 
413
    int replace_from;
 
414
    int replace_length;
 
415
};
 
416
 
 
417
#ifndef QT_NO_DRAGANDDROP
 
418
 
 
419
class QMimeData;
 
420
 
 
421
class Q_GUI_EXPORT QDropEvent : public QEvent
 
422
// QT3_SUPPORT
 
423
                              , public QMimeSource
 
424
// END QT3_SUPPORT
 
425
{
 
426
public:
 
427
    QDropEvent(const QPoint& pos, Qt::DropActions actions, const QMimeData *data,
 
428
               Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers, Type type = Drop);
 
429
    ~QDropEvent();
 
430
 
 
431
    inline const QPoint &pos() const { return p; }
 
432
    inline Qt::MouseButtons mouseButtons() const { return mouseState; }
 
433
    inline Qt::KeyboardModifiers keyboardModifiers() const { return modState; }
 
434
 
 
435
    inline Qt::DropActions possibleActions() const { return act; }
 
436
    inline Qt::DropAction proposedAction() const { return default_action; }
 
437
    inline void acceptProposedAction() { drop_action = default_action; accept(); }
 
438
 
 
439
    inline Qt::DropAction dropAction() const { return drop_action; }
 
440
    void setDropAction(Qt::DropAction action);
 
441
 
 
442
    QWidget* source() const;
 
443
    inline const QMimeData *mimeData() const { return mdata; }
 
444
 
 
445
// QT3_SUPPORT
 
446
    const char* format(int n = 0) const;
 
447
    QByteArray encodedData(const char*) const;
 
448
    bool provides(const char*) const;
 
449
// END QT3_SUPPORT
 
450
#ifdef QT3_SUPPORT
 
451
    inline void accept() { QEvent::accept(); }
 
452
    inline QT3_SUPPORT void accept(bool y) { setAccepted(y); }
 
453
    inline QT3_SUPPORT QByteArray data(const char* f) const { return encodedData(f); }
 
454
 
 
455
    enum Action { Copy, Link, Move, Private, UserAction = Private };
 
456
    QT3_SUPPORT Action action() const;
 
457
    inline QT3_SUPPORT void acceptAction(bool y = true)  { if (y) { drop_action = default_action; accept(); } }
 
458
    inline QT3_SUPPORT void setPoint(const QPoint& np) { p = np; }
 
459
#endif
 
460
 
 
461
 
 
462
protected:
 
463
    QPoint p;
 
464
    Qt::MouseButtons mouseState;
 
465
    Qt::KeyboardModifiers modState;
 
466
    Qt::DropActions act;
 
467
    Qt::DropAction drop_action;
 
468
    Qt::DropAction default_action;
 
469
    const QMimeData *mdata;
 
470
    mutable QList<QByteArray> fmts; // only used for QT3_SUPPORT
 
471
};
 
472
 
 
473
 
 
474
class Q_GUI_EXPORT QDragMoveEvent : public QDropEvent
 
475
{
 
476
public:
 
477
    QDragMoveEvent(const QPoint &pos, Qt::DropActions actions, const QMimeData *data,
 
478
                   Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers, Type type = DragMove);
 
479
    ~QDragMoveEvent();
 
480
 
 
481
    inline QRect answerRect() const { return rect; }
 
482
 
 
483
    inline void accept() { QDropEvent::accept(); }
 
484
    inline void ignore() { QDropEvent::ignore(); }
 
485
 
 
486
    inline void accept(const QRect & r) { accept(); rect = r; }
 
487
    inline void ignore(const QRect & r) { ignore(); rect = r; }
 
488
 
 
489
#ifdef QT3_SUPPORT
 
490
    inline QT3_SUPPORT void accept(bool y) { setAccepted(y); }
 
491
#endif
 
492
 
 
493
protected:
 
494
    QRect rect;
 
495
};
 
496
 
 
497
 
 
498
class Q_GUI_EXPORT QDragEnterEvent : public QDragMoveEvent
 
499
{
 
500
public:
 
501
    QDragEnterEvent(const QPoint &pos, Qt::DropActions actions, const QMimeData *data,
 
502
                    Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers);
 
503
    ~QDragEnterEvent();
 
504
};
 
505
 
 
506
 
 
507
/* An internal class */
 
508
class Q_GUI_EXPORT QDragResponseEvent : public QEvent
 
509
{
 
510
public:
 
511
    QDragResponseEvent(bool accepted);
 
512
    ~QDragResponseEvent();
 
513
 
 
514
    inline bool dragAccepted() const { return a; }
 
515
protected:
 
516
    bool a;
 
517
};
 
518
 
 
519
 
 
520
class Q_GUI_EXPORT QDragLeaveEvent : public QEvent
 
521
{
 
522
public:
 
523
    QDragLeaveEvent();
 
524
    ~QDragLeaveEvent();
 
525
};
 
526
#endif // QT_NO_DRAGANDDROP
 
527
 
 
528
 
 
529
class Q_GUI_EXPORT QHelpEvent : public QEvent
 
530
{
 
531
public:
 
532
    QHelpEvent(Type type, const QPoint &pos, const QPoint &globalPos);
 
533
    ~QHelpEvent();
 
534
 
 
535
    inline int x() const { return p.x(); }
 
536
    inline int y() const { return p.y(); }
 
537
    inline int globalX() const { return gp.x(); }
 
538
    inline int globalY() const { return gp.y(); }
 
539
 
 
540
    inline const QPoint& pos()  const { return p; }
 
541
    inline const QPoint& globalPos() const { return gp; }
 
542
 
 
543
private:
 
544
    QPoint p;
 
545
    QPoint gp;
 
546
};
 
547
 
 
548
 
 
549
class Q_GUI_EXPORT QStatusTipEvent : public QEvent
 
550
{
 
551
public:
 
552
    QStatusTipEvent(const QString &tip);
 
553
    ~QStatusTipEvent();
 
554
 
 
555
    inline QString tip() const { return s; }
 
556
private:
 
557
    QString s;
 
558
};
 
559
 
 
560
class Q_GUI_EXPORT QWhatsThisClickedEvent : public QEvent
 
561
{
 
562
public:
 
563
    QWhatsThisClickedEvent(const QString &href);
 
564
    ~QWhatsThisClickedEvent();
 
565
 
 
566
    inline QString href() const { return s; }
 
567
private:
 
568
    QString s;
 
569
};
 
570
 
 
571
 
 
572
class Q_GUI_EXPORT QActionEvent : public QEvent
 
573
{
 
574
    QAction *act, *bef;
 
575
public:
 
576
    QActionEvent(int type, QAction *action, QAction *before = 0);
 
577
    ~QActionEvent();
 
578
 
 
579
    inline QAction *action() const { return act; }
 
580
    inline QAction *before() const { return bef; }
 
581
};
 
582
 
 
583
 
 
584
class Q_GUI_EXPORT QFileOpenEvent : public QEvent
 
585
{
 
586
public:
 
587
    QFileOpenEvent(const QString &file);
 
588
    ~QFileOpenEvent();
 
589
 
 
590
    inline QString file() const { return f; }
 
591
private:
 
592
    QString f;
 
593
};
 
594
 
 
595
class Q_GUI_EXPORT QToolBarChangeEvent : public QEvent
 
596
{
 
597
public:
 
598
    QToolBarChangeEvent(bool t);
 
599
    ~QToolBarChangeEvent();
 
600
 
 
601
    inline bool toggle() const { return tog; }
 
602
private:
 
603
    uint tog : 1;
 
604
};
 
605
 
 
606
class Q_GUI_EXPORT QShortcutEvent : public QEvent
 
607
{
 
608
public:
 
609
    QShortcutEvent(const QKeySequence &key, int id, bool ambiguous = false);
 
610
    ~QShortcutEvent();
 
611
 
 
612
    inline const QKeySequence &key() { return sequence; }
 
613
    inline int shortcutId() { return sid; }
 
614
    inline bool isAmbiguous() { return ambig; }
 
615
protected:
 
616
    QKeySequence sequence;
 
617
    bool ambig;
 
618
    int  sid;
 
619
};
 
620
 
 
621
class Q_GUI_EXPORT QClipboardEvent : public QEvent
 
622
{
 
623
public:
 
624
    QClipboardEvent(QEventPrivate *data);
 
625
    ~QClipboardEvent();
 
626
 
 
627
    QEventPrivate *data() { return d; };
 
628
};
 
629
 
 
630
class Q_GUI_EXPORT QWindowStateChangeEvent: public QEvent
 
631
{
 
632
public:
 
633
    QWindowStateChangeEvent(Qt::WindowStates aOldState);
 
634
    ~QWindowStateChangeEvent();
 
635
 
 
636
    inline Qt::WindowStates oldState() const { return ostate; }
 
637
 
 
638
private:
 
639
    Qt::WindowStates ostate;
 
640
};
 
641
 
 
642
#ifndef QT_NO_DEBUG_STREAM
 
643
Q_GUI_EXPORT QDebug operator<<(QDebug, const QEvent *);
 
644
#endif
 
645
 
 
646
#endif // QEVENT_H