1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>
Qt Toolkit - qevent.h include file
</title><style type="text/css"><!--
h3.fn,span.fn { margin-left: 1cm; text-indent: -1cm; }
a:link { color: #004faf; text-decoration: none }
a:visited { color: #672967; text-decoration: none }body { background: white; color: black; }
--></style>
</head><body bgcolor="#ffffff">
<table width="100%">
<tr><td><a href="index.html">
<img width="100" height="100" src="qtlogo.png"
alt="Home" border="0"><img width="100"
height="100" src="face.png" alt="Home" border="0">
</a><td valign=top><div align=right><img src="dochead.png" width="472" height="27"><br>
<a href="classes.html"><b>Classes</b></a>
-<a href="annotated.html">Annotated</a>
- <a href="hierarchy.html">Tree</a>
-<a href="functions.html">Functions</a>
-<a href="index.html">Home</a>
-<a href="topicals.html"><b>Structure</b></a>
</div>
</table>
<h1 align=center>qevent.h</h1><br clear="all">
This is the verbatim text of the qevent.h include file. It is
provided only for illustration; the copyright
remains with Trolltech.
<hr>
<pre>
/****************************************************************************
** $Id: qt/src/kernel/qevent.h 2.3.2 edited 2001-01-26 $
**
** Definition of event classes
**
** Created : 931029
**
** Copyright (C) 1992-2000 Trolltech AS. All rights reserved.
**
** This file is part of the kernel module of the Qt GUI Toolkit.
**
** This file may be distributed under the terms of the Q Public License
** as defined by Trolltech AS of Norway and appearing in the file
** LICENSE.QPL included in the packaging of this file.
**
** This file may be distributed and/or modified under the terms of the
** GNU General Public License version 2 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file.
**
** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition
** licenses may use this file in accordance with the Qt Commercial License
** Agreement provided with the Software.
**
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for
** information about Qt Commercial License Agreements.
** See http://www.trolltech.com/qpl/ for QPL licensing information.
** See http://www.trolltech.com/gpl/ for GPL licensing information.
**
** Contact info@trolltech.com if any conditions of this licensing are
** not clear to you.
**
**********************************************************************/
#ifndef QEVENT_H
#define QEVENT_H
#ifndef QT_H
#include "qwindowdefs.h"
#include "qregion.h"
#include "qnamespace.h"
#include "qmime.h"
#endif // QT_H
class Q_EXPORT <a href="qevent.html">QEvent</a>: public Qt // event base class
{
public:
enum Type {
// NOTE: if you get a strange compiler error on the line with "None",
// it's probably because you're trying to include X11, which
// has a mess of #defines in it. Put the messy X11 includes
// *AFTER* the nice clean Qt includes.
None = 0, // invalid event
Timer = 1, // timer event
MouseButtonPress = 2, // mouse button pressed
MouseButtonRelease = 3, // mouse button released
MouseButtonDblClick= 4, // mouse button double click
MouseMove = 5, // mouse move
KeyPress = 6, // key pressed
KeyRelease = 7, // key released
FocusIn = 8, // keyboard focus received
FocusOut = 9, // keyboard focus lost
Enter = 10, // mouse enters widget
Leave = 11, // mouse leaves widget
Paint = 12, // paint widget
Move = 13, // move widget
Resize = 14, // resize widget
Create = 15, // after object creation
Destroy = 16, // during object destruction
Show = 17, // widget is shown
Hide = 18, // widget is hidden
Close = 19, // request to close widget
Quit = 20, // request to quit application
Reparent = 21, // widget has been reparented
ShowMinimized = 22, // widget is shown minimized
ShowNormal = 23, // widget is shown normal
WindowActivate = 24, // window was activated
WindowDeactivate = 25, // window was deactivated
ShowToParent = 26, // widget is shown to parent
HideToParent = 27, // widget is hidden to parent
ShowMaximized = 28, // widget is shown maximized
Accel = 30, // accelerator event
Wheel = 31, // wheel event
AccelAvailable = 32, // accelerator available event
CaptionChange = 33, // caption changed
IconChange = 34, // icon changed
ParentFontChange = 35, // parent font changed
ApplicationFontChange = 36, // application font changed
ParentPaletteChange = 37, // parent font changed
ApplicationPaletteChange = 38, // application palette changed
Clipboard = 40, // internal clipboard event
Speech = 42, // reserved for speech input
SockAct = 50, // socket activation
AccelOverride = 51, // accelerator override event
DragEnter = 60, // drag moves into widget
DragMove = 61, // drag moves in widget
DragLeave = 62, // drag leaves or is cancelled
Drop = 63, // actual drop
DragResponse = 64, // drag accepted/rejected
ChildInserted = 70, // new child widget
ChildRemoved = 71, // deleted child widget
LayoutHint = 72, // child min/max size changed
ShowWindowRequest = 73, // widget's window should be mapped
ActivateControl = 80, // ActiveX activation
DeactivateControl = 81, // ActiveX deactivation
User = 1000 // first user event id
};
QEvent( Type type ) : t(type), posted(FALSE) {}
virtual ~QEvent();
Type type() const { return t; }
protected:
Type t;
private:
bool posted;
#if defined(_CC_MSVC_)
friend class QEvent;
#endif
friend class QApplication;
friend class QBaseApplication;
};
class Q_EXPORT <a href="qtimerevent.html">QTimerEvent</a> : public <a href="qevent.html">QEvent</a>
{
public:
QTimerEvent( int timerId )
: QEvent(Timer), id(timerId) {}
int timerId() const { return id; }
protected:
int id;
};
class Q_EXPORT <a href="qmouseevent.html">QMouseEvent</a> : public <a href="qevent.html">QEvent</a>
{
public:
QMouseEvent( Type type, const QPoint &pos, int button, int state );
QMouseEvent( Type type, const QPoint &pos, const QPoint&globalPos,
int button, int state )
: QEvent(type), p(pos), g(globalPos), b(button),s((ushort)state) {};
const QPoint &pos() const { return p; }
const QPoint &globalPos() const { return g; }
int x() const { return p.x(); }
int y() const { return p.y(); }
int globalX() const { return g.x(); }
int globalY() const { return g.y(); }
ButtonState button() const { return (ButtonState) b; }
ButtonState state() const { return (ButtonState) s; }
ButtonState stateAfter() const;
protected:
QPoint p;
QPoint g;
int b; // ### Make ushort in 3.0? Here it's an int...
ushort s; // ### ...and here an ushort. But both are ButtonState!
};
class Q_EXPORT <a href="qwheelevent.html">QWheelEvent</a> : public <a href="qevent.html">QEvent</a>
{
public:
QWheelEvent( const QPoint &pos, int delta, int state );
QWheelEvent( const QPoint &pos, const QPoint& globalPos, int delta, int state )
: QEvent(Wheel), p(pos), g(globalPos), d(delta), s((ushort)state),
accpt(TRUE) {}
int delta() const { return d; }
const QPoint &pos() const { return p; }
const QPoint &globalPos() const { return g; }
int x() const { return p.x(); }
int y() const { return p.y(); }
int globalX() const { return g.x(); }
int globalY() const { return g.y(); }
ButtonState state() const { return ButtonState(s); }
bool isAccepted() const { return accpt; }
void accept() { accpt = TRUE; }
void ignore() { accpt = FALSE; }
protected:
QPoint p;
QPoint g;
int d;
ushort s;
bool accpt;
};
class Q_EXPORT <a href="qkeyevent.html">QKeyEvent</a> : public <a href="qevent.html">QEvent</a>
{
public:
QKeyEvent( Type type, int key, int ascii, int state,
const QString& text=QString::null, bool autorep=FALSE, ushort count=1 )
: QEvent(type), txt(text), k((ushort)key), s((ushort)state),
a((uchar)ascii), accpt(TRUE), autor(autorep), c(count) {}
int key() const { return k; }
int ascii() const { return a; }
ButtonState state() const { return ButtonState(s); }
ButtonState stateAfter() const;
bool isAccepted() const { return accpt; }
QString text() const { return txt; }
bool isAutoRepeat() const { return autor; }
int count() const { return int(c); }
void accept() { accpt = TRUE; }
void ignore() { accpt = FALSE; }
protected:
QString txt;
ushort k, s;
uchar a;
uint accpt:1;
uint autor:1;
ushort c;
};
class Q_EXPORT <a href="qfocusevent.html">QFocusEvent</a> : public <a href="qevent.html">QEvent</a>
{
public:
QFocusEvent( Type type )
: QEvent(type) {}
bool gotFocus() const { return type() == FocusIn; }
bool lostFocus() const { return type() == FocusOut; }
enum Reason { Mouse, Tab, ActiveWindow, Popup, Shortcut, Other };
static Reason reason();
static void setReason( Reason reason );
static void resetReason();
private:
static Reason m_reason;
static Reason prev_reason;
};
class Q_EXPORT <a href="qpaintevent.html">QPaintEvent</a> : public <a href="qevent.html">QEvent</a>
{
public:
QPaintEvent( const QRegion& paintRegion, bool erased = TRUE)
: QEvent(Paint),
rec(paintRegion.boundingRect()),
reg(paintRegion),
erase(erased){}
QPaintEvent( const QRect &paintRect, bool erased = TRUE )
: QEvent(Paint),
rec(paintRect),
reg(paintRect),
erase(erased){}
const QRect &rect() const { return rec; }
const QRegion &region() const { return reg; }
bool erased() const { return erase; }
protected:
friend class QApplication;
friend class QBaseApplication;
QRect rec;
QRegion reg;
bool erase;
};
class Q_EXPORT <a href="qmoveevent.html">QMoveEvent</a> : public <a href="qevent.html">QEvent</a>
{
public:
QMoveEvent( const QPoint &pos, const QPoint &oldPos )
: QEvent(Move), p(pos), oldp(oldPos) {}
const QPoint &pos() const { return p; }
const QPoint &oldPos()const { return oldp;}
protected:
QPoint p, oldp;
friend class QApplication;
friend class QBaseApplication;
};
class Q_EXPORT <a href="qresizeevent.html">QResizeEvent</a> : public <a href="qevent.html">QEvent</a>
{
public:
QResizeEvent( const QSize &size, const QSize &oldSize )
: QEvent(Resize), s(size), olds(oldSize) {}
const QSize &size() const { return s; }
const QSize &oldSize()const { return olds;}
protected:
QSize s, olds;
friend class QApplication;
friend class QBaseApplication;
};
class Q_EXPORT <a href="qcloseevent.html">QCloseEvent</a> : public <a href="qevent.html">QEvent</a>
{
public:
QCloseEvent()
: QEvent(Close), accpt(FALSE) {}
bool isAccepted() const { return accpt; }
void accept() { accpt = TRUE; }
void ignore() { accpt = FALSE; }
protected:
bool accpt;
};
class Q_EXPORT <a href="qshowevent.html">QShowEvent</a> : public <a href="qevent.html">QEvent</a>
{
public:
QShowEvent(bool spontaneous)
: QEvent(Show), spont(spontaneous) {}
bool spontaneous() const { return spont; }
protected:
bool spont;
};
class Q_EXPORT <a href="qhideevent.html">QHideEvent</a> : public <a href="qevent.html">QEvent</a>
{
public:
QHideEvent(bool spontaneous)
: QEvent(Hide), spont(spontaneous) {}
bool spontaneous() const { return spont; }
protected:
bool spont;
};
#ifndef QT_NO_DRAGANDDROP
// This class is rather closed at the moment. If you need to create your
// own DND event objects, write to qt-bugs@trolltech.com and we'll try to
// find a way to extend it so it covers your needs.
class Q_EXPORT <a href="qdropevent.html">QDropEvent</a> : public <a href="qevent.html">QEvent</a>, public <a href="qmimesource.html">QMimeSource</a>
{
public:
QDropEvent( const QPoint& pos, Type typ=Drop )
: QEvent(typ), p(pos),
act(0), accpt(0), accptact(0), resv(0),
d(0)
{}
const QPoint &pos() const { return p; }
bool isAccepted() const { return accpt || accptact; }
void accept(bool y=TRUE) { accpt = y; }
void ignore() { accpt = FALSE; }
bool isActionAccepted() const { return accptact; }
void acceptAction(bool y=TRUE) { accptact = y; }
enum Action { Copy, Link, Move, Private, UserAction=100 };
void setAction( Action a ) { act = (uint)a; }
Action action() const { return Action(act); }
QWidget* source() const;
const char* format( int n = 0 ) const;
QByteArray encodedData( const char* ) const;
bool provides( const char* ) const;
QByteArray data(const char* f) const { return encodedData(f); }
void setPoint( const QPoint& np ) { p = np; }
protected:
QPoint p;
uint act:8;
uint accpt:1;
uint accptact:1;
uint resv:5;
void * d;
};
class Q_EXPORT <a href="qdragmoveevent.html">QDragMoveEvent</a> : public <a href="qdropevent.html">QDropEvent</a>
{
public:
QDragMoveEvent( const QPoint& pos, Type typ=DragMove )
: QDropEvent(pos,typ),
rect( pos, QSize( 1, 1 ) ) {}
QRect answerRect() const { return rect; }
void accept( bool y=TRUE ) { QDropEvent::accept(y); }
void accept( const QRect & r) { accpt = TRUE; rect = r; }
void ignore( const QRect & r) { accpt =FALSE; rect = r; }
void ignore() { QDropEvent::ignore(); }
protected:
QRect rect;
};
class Q_EXPORT <a href="qdragenterevent.html">QDragEnterEvent</a> : public <a href="qdragmoveevent.html">QDragMoveEvent</a>
{
public:
QDragEnterEvent( const QPoint& pos ) :
QDragMoveEvent(pos, DragEnter) { }
};
/* An internal class */
class Q_EXPORT QDragResponseEvent : public <a href="qevent.html">QEvent</a>
{
public:
QDragResponseEvent( bool accepted )
: QEvent(DragResponse), a(accepted) {}
bool dragAccepted() const { return a; }
protected:
bool a;
};
class Q_EXPORT <a href="qdragleaveevent.html">QDragLeaveEvent</a> : public <a href="qevent.html">QEvent</a>
{
public:
QDragLeaveEvent()
: QEvent(DragLeave) {}
};
#endif // QT_NO_DRAGANDDROP
class Q_EXPORT <a href="qchildevent.html">QChildEvent</a> : public <a href="qevent.html">QEvent</a>
{
public:
QChildEvent( Type type, QObject *child )
: QEvent(type), c(child) {}
QObject *child() const { return c; }
bool inserted() const { return t == ChildInserted; }
bool removed() const { return t == ChildRemoved; }
protected:
QObject *c;
};
class Q_EXPORT <a href="qcustomevent.html">QCustomEvent</a> : public <a href="qevent.html">QEvent</a>
{
public:
QCustomEvent( int type );
QCustomEvent( Type type, void *data )
: QEvent(type), d(data) {};
void *data() const { return d; }
void setData( void* data ) { d = data; }
private:
void *d;
};
#endif // QEVENT_H
</pre>
<p><address><hr><div align="center">
<table width="100%" cellspacing="0" border="0"><tr>
<td>Copyright 2001 Trolltech<td><a href="http://www.trolltech.com/trademarks.html">Trademarks</a>
<td align="right"><div align="right">Qt version 2.3.2</div>
</table></div></address></body></html>
|