// This is the SIP interface definition for QEvent, QChildEvent, QCloseEvent, // QIconDragEvent, QContextMenuEvent, QCustomEvent, QDragEnterEvent, // QDragLeaveEvent, QDragMoveEvent, QDropEvent, QFocusEvent, QHideEvent, // QIMEvent, QIMComposeEvent, QKeyEvent, QMouseEvent, QMoveEvent, QPaintEvent, // QResizeEvent, QShowEvent, QTabletEvent, QTimerEvent, QWheelEvent. // // Copyright (c) 2007 // Riverbank Computing Limited // // This file is part of PyQt. // // This copy of PyQt is free software; you can redistribute it and/or modify it // under the terms of the GNU General Public License as published by the Free // Software Foundation; either version 2, or (at your option) any later // version. // // PyQt is supplied in the hope that it will be useful, but WITHOUT ANY // WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS // FOR A PARTICULAR PURPOSE. See the GNU General Public License for more // details. // // You should have received a copy of the GNU General Public License along with // PyQt; see the file LICENSE. If not, write to the Free Software Foundation, // Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. %ExportedDoc QEvent QEvent is fully implemented. Instances of QEvents are automatically converted to the correct sub-class. QChildEvent QChildEvent is fully implemented. QCloseEvent QCloseEvent is fully implemented. QIconDragEvent (Qt v3.3+) QIconDragEvent is fully implemented. QContextMenuEvent (Qt v3+) QContextMenuEvent is fully implemented. QCustomEvent QCustomEvent is fully implemented. Any Python object can be passed as the event data and its reference count is increased. QDragEnterEvent QDragEnterEvent is fully implemented. QDragLeaveEvent QDragLeaveEvent is fully implemented. QDragMoveEvent QDragMoveEvent is fully implemented. QDropEvent QDropEvent is fully implemented. QFocusEvent QFocusEvent is fully implemented. QHideEvent QHideEvent is fully implemented. QIMComposeEvent (Qt v3.1+) QIMComposeEvent is fully implemented. QIMEvent (Qt v3+) QIMEvent is fully implemented. QKeyEvent QKeyEvent is fully implemented. QMouseEvent QMouseEvent is fully implemented. QMoveEvent QMoveEvent is fully implemented. QPaintEvent QPaintEvent is fully implemented. QResizeEvent QResizeEvent is fully implemented. QShowEvent QShowEvent is fully implemented. QTabletEvent (Qt v3+) QTabletEvent is fully implemented. QTimerEvent QTimerEvent is fully implemented. QWheelEvent (Qt v2+) QWheelEvent is fully implemented. %End %ModuleHeaderCode #include %End %If (- Qt_2_00) const int Event_None; const int Event_Timer; const int Event_MouseButtonPress; const int Event_MouseButtonRelease; const int Event_MouseButtonDblClick; const int Event_MouseMove; const int Event_KeyPress; const int Event_KeyRelease; const int Event_FocusIn; const int Event_FocusOut; const int Event_Enter; const int Event_Leave; const int Event_Paint; const int Event_Move; const int Event_Resize; const int Event_Create; const int Event_Destroy; const int Event_Show; const int Event_Hide; const int Event_Close; const int Event_Quit; const int Event_Accel; const int Event_Clipboard; const int Event_SockAct; const int Event_DragEnter; const int Event_DragMove; const int Event_DragLeave; const int Event_Drop; const int Event_DragResponse; const int Event_ChildInserted; const int Event_ChildRemoved; const int Event_LayoutHint; const int Event_ActivateControl; const int Event_DeactivateControl; const int Event_User; enum ButtonState { NoButton = 0x00, LeftButton = 0x01, RightButton = 0x02, MidButton = 0x04, MouseButtonMask = 0x07, ShiftButton = 0x08, ControlButton = 0x10, AltButton = 0x20, KeyButtonMask = 0x38 }; class QEvent { %TypeHeaderCode #include %End public: QEvent(int); QEvent(QEvent&); int type() const; %ConvertToSubClassCode switch (sipCpp -> type()) { case Event_Timer: sipClass = sipClass_QTimerEvent; break; case Event_MouseButtonPress: case Event_MouseButtonRelease: case Event_MouseButtonDblClick: case Event_MouseMove: sipClass = sipClass_QMouseEvent; break; case Event_KeyPress: case Event_KeyRelease: sipClass = sipClass_QKeyEvent; break; case Event_FocusIn: case Event_FocusOut: sipClass = sipClass_QFocusEvent; break; case Event_Paint: sipClass = sipClass_QPaintEvent; break; case Event_Move: sipClass = sipClass_QMoveEvent; break; case Event_Resize: sipClass = sipClass_QResizeEvent; break; case Event_Close: sipClass = sipClass_QCloseEvent; break; case Event_Show: sipClass = sipClass_QShowEvent; break; case Event_Hide: sipClass = sipClass_QHideEvent; break; case Event_DragMove: sipClass = sipClass_QDragMoveEvent; break; case Event_DragEnter: sipClass = sipClass_QDragEnterEvent; break; case Event_DragLeave: sipClass = sipClass_QDragLeaveEvent; break; case Event_Drop: sipClass = sipClass_QDropEvent; break; case Event_ChildInserted: case Event_ChildRemoved: sipClass = sipClass_QChildEvent; break; default: sipClass = NULL; } %End }; %End %If (Qt_2_00 -) class QEvent : Qt { %TypeHeaderCode #include %End public: enum Type { None, Timer, MouseButtonPress, MouseButtonRelease, MouseButtonDblClick, MouseMove, KeyPress, KeyRelease, FocusIn, FocusOut, Enter, Leave, Paint, Move, Resize, Create, Destroy, Show, Hide, Close, Quit, %If (Qt_2_1_0 -) Reparent, ShowMinimized, ShowNormal, WindowActivate, WindowDeactivate, ShowToParent, HideToParent, ShowMaximized, %End %If (Qt_3_0_0 -) ShowFullScreen, %End Accel, Wheel, AccelAvailable, %If (Qt_2_1_0 -) CaptionChange, IconChange, ParentFontChange, ApplicationFontChange, ParentPaletteChange, ApplicationPaletteChange, %End %If (Qt_3_0_0 -) PaletteChange, %End Clipboard, %If (Qt_2_2_0 -) Speech, %End SockAct, %If (Qt_2_2_0 -) AccelOverride, %End %If (Qt_3_0_0 -) DeferredDelete, %End DragEnter, DragMove, DragLeave, Drop, DragResponse, ChildInserted, ChildRemoved, LayoutHint, %If (Qt_2_2_0 -) ShowWindowRequest, %End %If (Qt_3_3_0 -) WindowBlocked, WindowUnblocked, %End ActivateControl, DeactivateControl, %If (Qt_2_1_0 - Qt_2_2_0) Configure, ConfigureLayout, %End %If (Qt_3_0_0 -) ContextMenu, IMStart, IMCompose, IMEnd, Accessibility, %End %If (Qt_3_0_0 - Qt_3_1_0) Tablet, %End %If (Qt_3_1_0 -) TabletMove, LocaleChange, LanguageChange, LayoutDirectionChange, Style, TabletPress, TabletRelease, %End %If (Qt_3_3_0 -) OkRequest, HelpRequest, IconDrag, WindowStateChange, %End User, %If (Qt_3_0_0 -) MaxUser, %End }; QEvent(Type); QEvent(QEvent&); virtual ~QEvent(); Type type() const; %If (Qt_3_0_0 -) bool spontaneous() const; %End %ConvertToSubClassCode switch (sipCpp -> type()) { case QEvent::Timer: sipClass = sipClass_QTimerEvent; break; case QEvent::MouseButtonPress: case QEvent::MouseButtonRelease: case QEvent::MouseButtonDblClick: case QEvent::MouseMove: sipClass = sipClass_QMouseEvent; break; case QEvent::Accel: #if QT_VERSION >= 220 case QEvent::AccelOverride: #endif case QEvent::KeyPress: case QEvent::KeyRelease: sipClass = sipClass_QKeyEvent; break; case QEvent::FocusIn: case QEvent::FocusOut: sipClass = sipClass_QFocusEvent; break; case QEvent::Paint: sipClass = sipClass_QPaintEvent; break; case QEvent::Move: sipClass = sipClass_QMoveEvent; break; case QEvent::Resize: sipClass = sipClass_QResizeEvent; break; case QEvent::Close: sipClass = sipClass_QCloseEvent; break; #if QT_VERSION >= 0x030300 case QEvent::IconDrag: sipClass = sipClass_QIconDragEvent; break; #endif case QEvent::Wheel: sipClass = sipClass_QWheelEvent; break; case QEvent::Show: sipClass = sipClass_QShowEvent; break; case QEvent::Hide: sipClass = sipClass_QHideEvent; break; #if defined(SIP_FEATURE_Qt_DRAGANDDROP) case QEvent::DragMove: sipClass = sipClass_QDragMoveEvent; break; case QEvent::DragEnter: sipClass = sipClass_QDragEnterEvent; break; case QEvent::DragLeave: sipClass = sipClass_QDragLeaveEvent; break; case QEvent::Drop: sipClass = sipClass_QDropEvent; break; #endif case QEvent::ChildInserted: case QEvent::ChildRemoved: sipClass = sipClass_QChildEvent; break; #if QT_VERSION >= 0x030000 case QEvent::ContextMenu: sipClass = sipClass_QContextMenuEvent; break; case QEvent::IMStart: case QEvent::IMEnd: sipClass = sipClass_QIMEvent; break; #endif #if QT_VERSION >= 0x030000 && QT_VERSION < 0x030100 case QEvent::IMCompose: sipClass = sipClass_QIMEvent; break; case QEvent::Tablet: sipClass = sipClass_QTabletEvent; break; #endif #if QT_VERSION >= 0x030100 case QEvent::IMCompose: sipClass = sipClass_QIMComposeEvent; break; case QEvent::TabletMove: case QEvent::TabletPress: case QEvent::TabletRelease: sipClass = sipClass_QTabletEvent; break; #endif default: sipClass = (sipCpp -> type() < QEvent::User ? sipClass_QEvent : sipClass_QCustomEvent); } %End }; %End class QTimerEvent : QEvent { %TypeHeaderCode #include %End public: QTimerEvent(int); int timerId() const; }; class QMouseEvent : QEvent { %TypeHeaderCode #include %End public: %If (- Qt_2_00) QMouseEvent(int,const QPoint &,int,int); QMouseEvent(int,const QPoint &,const QPoint &,int,int); %End %If (Qt_2_00 -) QMouseEvent(Type,const QPoint &,int,int); QMouseEvent(Type,const QPoint &,const QPoint &,int,int); %End const QPoint &pos() const; const QPoint &globalPos() const; int x() const; int y() const; int globalX() const; int globalY() const; %If (- Qt_2_00) int button() const; int state() const; %End %If (Qt_2_00 -) ButtonState button() const; ButtonState state() const; ButtonState stateAfter() const; %End %If (Qt_3_0_0 -) bool isAccepted() const; void accept(); void ignore(); %End }; %If (Qt_2_00 -) class QWheelEvent : QEvent { %TypeHeaderCode #include %End public: %If (- Qt_3_0_0) QWheelEvent(const QPoint &,int,int); QWheelEvent(const QPoint &,const QPoint &,int,int); %End %If (Qt_3_0_0 -) QWheelEvent(const QPoint &,int,int,Orientation = Vertical); QWheelEvent(const QPoint &,const QPoint &,int,int, Orientation = Vertical); %End int delta() const; const QPoint &pos() const; const QPoint &globalPos() const; int x() const; int y() const; int globalX() const; int globalY() const; ButtonState state() const; %If (Qt_3_0_0 -) Orientation orientation() const; %End bool isAccepted() const; void accept(); void ignore(); }; %End %If (Qt_3_0_0 -) class QTabletEvent : QEvent { %TypeHeaderCode #include %End public: enum TabletDevice { NoDevice, Puck, Stylus, Eraser }; %If (- Qt_3_1_0) QTabletEvent(const QPoint &,int,int,int,int,const QPair &); %End %If (Qt_3_1_0 -) QTabletEvent(Type,const QPoint &,const QPoint &,int,int,int,int, const QPair &); %End QTabletEvent(const QPoint &,const QPoint &,int,int,int,int, const QPair &); int pressure() const; int xTilt() const; int yTilt() const; const QPoint &pos() const; const QPoint &globalPos() const; int x() const; int y() const; int globalX() const; int globalY() const; TabletDevice device() const; int isAccepted() const; void accept(); void ignore(); QPair uniqueId(); }; %End class QKeyEvent : QEvent { %TypeHeaderCode #include %End public: %If (- Qt_2_00) QKeyEvent(int,int,int,int); %End %If (Qt_2_00 -) QKeyEvent(Type,int,int,int,const QString & = QString::null,bool = 0, ushort = 1); %End int key() const; int ascii() const; bool isAccepted() const; void accept(); void ignore(); %If (- Qt_2_00) int state() const; %End %If (Qt_2_00 -) ButtonState state() const; ButtonState stateAfter() const; QString text() const; bool isAutoRepeat() const; int count() const; %End }; class QFocusEvent : QEvent { %TypeHeaderCode #include %End public: %If (- Qt_2_00) QFocusEvent(int); %End %If (Qt_2_00 -) QFocusEvent(Type); %End bool gotFocus() const; bool lostFocus() const; %If (Qt_2_1_0 -) %If (- Qt_3_0_0) enum Reason { Mouse, Tab, ActiveWindow, Popup, Shortcut, Other }; %End %If (Qt_3_0_0 -) enum Reason { Mouse, Tab, Backtab, ActiveWindow, Popup, Shortcut, Other }; %End static Reason reason(); static void setReason(Reason); static void resetReason(); %End }; class QPaintEvent : QEvent { %TypeHeaderCode #include %End public: %If (- Qt_2_00) QPaintEvent(const QRect &); %End %If (Qt_2_00 -) QPaintEvent(const QRegion &,bool = 1); QPaintEvent(const QRect &,bool = 1); %End %If (Qt_3_3_0 -) QPaintEvent(const QRegion &,const QRect &,bool = 1); %End const QRect &rect() const; %If (Qt_2_00 -) const QRegion ®ion() const; bool erased() const; %End }; class QMoveEvent : QEvent { %TypeHeaderCode #include %End public: QMoveEvent(const QPoint &,const QPoint &); const QPoint &pos() const; const QPoint &oldPos() const; }; class QResizeEvent : QEvent { %TypeHeaderCode #include %End public: QResizeEvent(const QSize &,const QSize &); const QSize &size() const; const QSize &oldSize() const; }; class QCloseEvent : QEvent { %TypeHeaderCode #include %End public: QCloseEvent(); bool isAccepted() const; void accept(); void ignore(); }; %If (Qt_3_3_0 -) class QIconDragEvent : QEvent { %TypeHeaderCode #include %End public: QIconDragEvent(); bool isAccepted() const; void accept(); void ignore(); }; %End class QShowEvent : QEvent { %TypeHeaderCode #include %End public: %If (- Qt_3_0_0) QShowEvent(bool); bool spontaneous() const; %End %If (Qt_3_0_0 -) QShowEvent(); %End }; class QHideEvent : QEvent { %TypeHeaderCode #include %End public: %If (- Qt_3_0_0) QHideEvent(bool); bool spontaneous() const; %End %If (Qt_3_0_0 -) QHideEvent(); %End }; %If (Qt_3_0_0 -) class QContextMenuEvent : QEvent { %TypeHeaderCode #include %End public: enum Reason { Mouse, Keyboard, Other }; QContextMenuEvent(Reason,const QPoint &,const QPoint &,int); QContextMenuEvent(Reason,const QPoint &,int); int x() const; int y() const; int globalX() const; int globalY() const; const QPoint &pos() const; const QPoint &globalPos() const; ButtonState state() const; bool isAccepted() const; bool isConsumed() const; void consume(); void accept(); void ignore(); Reason reason() const; }; %End %If (Qt_3_0_0 -) class QIMEvent : QEvent { %TypeHeaderCode #include %End public: QIMEvent(Type,const QString &,int); const QString &text() const; int cursorPos() const; bool isAccepted() const; void accept(); void ignore(); %If (Qt_3_1_0 -) int selectionLength() const; %End }; %End %If (Qt_3_1_0 -) class QIMComposeEvent : QIMEvent { %TypeHeaderCode #include %End public: QIMComposeEvent(Type,const QString &,int,int); }; %End %If (- Qt_2_00) class QDropEvent : QEvent { %TypeHeaderCode #include %End public: QDropEvent(const QPoint &); const QPoint &pos() const; bool isAccepted() const; void accept(); void ignore(); QByteArray data(const char *); }; %End %If (Qt_2_00 -) %If (Qt_DRAGANDDROP) class QDropEvent : QEvent, QMimeSource { %TypeHeaderCode #include %End public: QDropEvent(const QPoint &,Type = Drop); const QPoint &pos() const; bool isAccepted() const; void accept(bool = 1); void ignore(); bool isActionAccepted() const; void acceptAction(bool = 1); enum Action { Copy, Link, Move, Private, UserAction = 100 }; void setAction(Action); Action action() const; QWidget *source() const; const char *format(int = 0) const; QByteArray encodedData(const char *) const; bool provides(const char *) const; QByteArray data(const char *) const; void setPoint(const QPoint &); }; %End %End %If (- Qt_2_00) class QDragMoveEvent : QEvent { %TypeHeaderCode #include %End public: QDragMoveEvent(const QPoint &); const QPoint &pos() const; bool isAccepted() const; void accept(); void ignore(); void accept(const QRect &); void ignore(const QRect &); QRect answerRect() const; const char *format(int = 0); bool provides(const char *); QByteArray data(const char *); protected: QDragMoveEvent(const QPoint &,int); }; %End %If (Qt_DRAGANDDROP) %If (Qt_2_00 -) class QDragMoveEvent : QDropEvent { %TypeHeaderCode #include %End public: QDragMoveEvent(const QPoint &,Type = DragMove); QRect answerRect() const; void accept(bool = 1); void accept(const QRect &); void ignore(const QRect &); void ignore(); }; %End class QDragEnterEvent : QDragMoveEvent { %TypeHeaderCode #include %End public: QDragEnterEvent(const QPoint &); }; class QDragLeaveEvent : QEvent { %TypeHeaderCode #include %End public: QDragLeaveEvent(); }; %End class QChildEvent : QEvent { %TypeHeaderCode #include %End public: %If (- Qt_2_00) QChildEvent(int,QWidget *); %End %If (Qt_2_00 -) QChildEvent(Type,QObject *); %End %If (- Qt_2_00) QWidget *child() const; %End %If (Qt_2_00 -) QObject *child() const; %End bool inserted() const; bool removed() const; }; class QCustomEvent : QEvent { %TypeHeaderCode #include %End public: %If (- Qt_2_00) QCustomEvent(int,SIP_PYOBJECT /Transfer/); %End %If (Qt_2_00 -) QCustomEvent(Type,SIP_PYOBJECT /Transfer/); %End %If (Qt_2_1_0 -) QCustomEvent(int); %End ~QCustomEvent(); %VirtualCatcherCode // We need to garbage collect any current data. PyObject *old = reinterpret_cast(data()); SIP_BLOCK_THREADS Py_XDECREF(old); SIP_UNBLOCK_THREADS %End SIP_PYOBJECT data() const; %MethodCode // We need to cast the result. sipRes = reinterpret_cast(sipCpp -> QCustomEvent::data()); // In case the event has been created from C++ code. if (!sipRes) sipRes = Py_None; Py_INCREF(sipRes); %End %If (Qt_2_1_0 -) void setData(SIP_PYOBJECT /Transfer/); %MethodCode // We need to garbage collect any current data. PyObject *old = reinterpret_cast(sipCpp -> QCustomEvent::data()); sipCpp -> QCustomEvent::setData(a0); Py_XDECREF(old); %End %End %GCTraverseCode // Support the Python garbage collector. Although it's not obviously // documented, we can't release the GIL in traverse code. PyObject *obj = reinterpret_cast(sipCpp -> QCustomEvent::data()); if (obj) sipRes = sipVisit(obj, sipArg); else sipRes = 0; %End %GCClearCode // Support the Python garbage collector. PyObject *obj = reinterpret_cast(sipCpp -> QCustomEvent::data()); sipCpp -> QCustomEvent::setData(0); Py_XDECREF(obj); sipRes = 0; %End };