// This is the SIP interface definition for TQEvent, TQChildEvent, TQCloseEvent, // TQIconDragEvent, TQContextMenuEvent, TQCustomEvent, TQDragEnterEvent, // TQDragLeaveEvent, TQDragMoveEvent, TQDropEvent, TQFocusEvent, TQHideEvent, // TQIMEvent, TQIMComposeEvent, TQKeyEvent, TQMouseEvent, TQMoveEvent, TQPaintEvent, // TQResizeEvent, TQShowEvent, TQTabletEvent, TQTimerEvent, TQWheelEvent. // // Copyright (c) 2007 // Riverbank Computing Limited // // This file is part of PyTQt. // // This copy of PyTQt 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. // // PyTQt 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 // PyTQt; see the file LICENSE. If not, write to the Free Software Foundation, // Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. %ExportedDoc TQEvent TQEvent is fully implemented. Instances of TQEvents are automatically converted to the correct sub-class. TQChildEvent TQChildEvent is fully implemented. TQCloseEvent TQCloseEvent is fully implemented. TQIconDragEvent (TQt v3.3+) TQIconDragEvent is fully implemented. TQContextMenuEvent (TQt v3+) TQContextMenuEvent is fully implemented. TQCustomEvent TQCustomEvent is fully implemented. Any Python object can be passed as the event data and its reference count is increased. TQDragEnterEvent TQDragEnterEvent is fully implemented. TQDragLeaveEvent TQDragLeaveEvent is fully implemented. TQDragMoveEvent TQDragMoveEvent is fully implemented. TQDropEvent TQDropEvent is fully implemented. TQFocusEvent TQFocusEvent is fully implemented. TQHideEvent TQHideEvent is fully implemented. TQIMComposeEvent (TQt v3.1+) TQIMComposeEvent is fully implemented. TQIMEvent (TQt v3+) TQIMEvent is fully implemented. TQKeyEvent TQKeyEvent is fully implemented. TQMouseEvent TQMouseEvent is fully implemented. TQMoveEvent TQMoveEvent is fully implemented. TQPaintEvent TQPaintEvent is fully implemented. TQResizeEvent TQResizeEvent is fully implemented. TQShowEvent TQShowEvent is fully implemented. TQTabletEvent (TQt v3+) TQTabletEvent is fully implemented. TQTimerEvent TQTimerEvent is fully implemented. TQWheelEvent (TQt v2+) TQWheelEvent is fully implemented. %End %ModuleHeaderCode #include %End %If (- TQt_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 TQEvent { %TypeHeaderCode #include %End public: TQEvent(int); TQEvent(TQEvent&); int type() const; %ConvertToSubClassCode switch (sipCpp -> type()) { case Event_Timer: sipClass = sipClass_TQTimerEvent; break; case Event_MouseButtonPress: case Event_MouseButtonRelease: case Event_MouseButtonDblClick: case Event_MouseMove: sipClass = sipClass_TQMouseEvent; break; case Event_KeyPress: case Event_KeyRelease: sipClass = sipClass_TQKeyEvent; break; case Event_FocusIn: case Event_FocusOut: sipClass = sipClass_TQFocusEvent; break; case Event_Paint: sipClass = sipClass_TQPaintEvent; break; case Event_Move: sipClass = sipClass_TQMoveEvent; break; case Event_Resize: sipClass = sipClass_TQResizeEvent; break; case Event_Close: sipClass = sipClass_TQCloseEvent; break; case Event_Show: sipClass = sipClass_TQShowEvent; break; case Event_Hide: sipClass = sipClass_TQHideEvent; break; case Event_DragMove: sipClass = sipClass_TQDragMoveEvent; break; case Event_DragEnter: sipClass = sipClass_TQDragEnterEvent; break; case Event_DragLeave: sipClass = sipClass_TQDragLeaveEvent; break; case Event_Drop: sipClass = sipClass_TQDropEvent; break; case Event_ChildInserted: case Event_ChildRemoved: sipClass = sipClass_TQChildEvent; break; default: sipClass = NULL; } %End }; %End %If (TQt_2_00 -) class TQEvent : TQt { %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 (TQt_2_1_0 -) Reparent, ShowMinimized, ShowNormal, WindowActivate, WindowDeactivate, ShowToParent, HideToParent, ShowMaximized, %End %If (TQt_3_0_0 -) ShowFullScreen, %End Accel, Wheel, AccelAvailable, %If (TQt_2_1_0 -) CaptionChange, IconChange, ParentFontChange, ApplicationFontChange, ParentPaletteChange, ApplicationPaletteChange, %End %If (TQt_3_0_0 -) PaletteChange, %End Clipboard, %If (TQt_2_2_0 -) Speech, %End SockAct, %If (TQt_2_2_0 -) AccelOverride, %End %If (TQt_3_0_0 -) DeferredDelete, %End DragEnter, DragMove, DragLeave, Drop, DragResponse, ChildInserted, ChildRemoved, LayoutHint, %If (TQt_2_2_0 -) ShowWindowRequest, %End %If (TQt_3_3_0 -) WindowBlocked, WindowUnblocked, %End ActivateControl, DeactivateControl, %If (TQt_2_1_0 - TQt_2_2_0) Configure, ConfigureLayout, %End %If (TQt_3_0_0 -) ContextMenu, IMStart, IMCompose, IMEnd, Accessibility, %End %If (TQt_3_0_0 - TQt_3_1_0) Tablet, %End %If (TQt_3_1_0 -) TabletMove, LocaleChange, LanguageChange, LayoutDirectionChange, Style, TabletPress, TabletRelease, %End %If (TQt_3_3_0 -) OkRequest, HelpRequest, IconDrag, WindowStateChange, %End User, %If (TQt_3_0_0 -) MaxUser, %End }; TQEvent(Type); TQEvent(TQEvent&); virtual ~TQEvent(); Type type() const; %If (TQt_3_0_0 -) bool spontaneous() const; %End %ConvertToSubClassCode switch (sipCpp -> type()) { case TQEvent::Timer: sipClass = sipClass_TQTimerEvent; break; case TQEvent::MouseButtonPress: case TQEvent::MouseButtonRelease: case TQEvent::MouseButtonDblClick: case TQEvent::MouseMove: sipClass = sipClass_TQMouseEvent; break; case TQEvent::Accel: #if QT_VERSION >= 220 case TQEvent::AccelOverride: #endif case TQEvent::KeyPress: case TQEvent::KeyRelease: sipClass = sipClass_TQKeyEvent; break; case TQEvent::FocusIn: case TQEvent::FocusOut: sipClass = sipClass_TQFocusEvent; break; case TQEvent::Paint: sipClass = sipClass_TQPaintEvent; break; case TQEvent::Move: sipClass = sipClass_TQMoveEvent; break; case TQEvent::Resize: sipClass = sipClass_TQResizeEvent; break; case TQEvent::Close: sipClass = sipClass_TQCloseEvent; break; #if QT_VERSION >= 0x030300 case TQEvent::IconDrag: sipClass = sipClass_TQIconDragEvent; break; #endif case TQEvent::Wheel: sipClass = sipClass_TQWheelEvent; break; case TQEvent::Show: sipClass = sipClass_TQShowEvent; break; case TQEvent::Hide: sipClass = sipClass_TQHideEvent; break; #if defined(SIP_FEATURE_TQt_DRAGANDDROP) case TQEvent::DragMove: sipClass = sipClass_TQDragMoveEvent; break; case TQEvent::DragEnter: sipClass = sipClass_TQDragEnterEvent; break; case TQEvent::DragLeave: sipClass = sipClass_TQDragLeaveEvent; break; case TQEvent::Drop: sipClass = sipClass_TQDropEvent; break; #endif case TQEvent::ChildInserted: case TQEvent::ChildRemoved: sipClass = sipClass_TQChildEvent; break; #if QT_VERSION >= 0x030000 case TQEvent::ContextMenu: sipClass = sipClass_TQContextMenuEvent; break; case TQEvent::IMStart: case TQEvent::IMEnd: sipClass = sipClass_TQIMEvent; break; #endif #if QT_VERSION >= 0x030000 && QT_VERSION < 0x030100 case TQEvent::IMCompose: sipClass = sipClass_TQIMEvent; break; case TQEvent::Tablet: sipClass = sipClass_TQTabletEvent; break; #endif #if QT_VERSION >= 0x030100 case TQEvent::IMCompose: sipClass = sipClass_TQIMComposeEvent; break; case TQEvent::TabletMove: case TQEvent::TabletPress: case TQEvent::TabletRelease: sipClass = sipClass_TQTabletEvent; break; #endif default: sipClass = (sipCpp -> type() < TQEvent::User ? sipClass_TQEvent : sipClass_TQCustomEvent); } %End }; %End class TQTimerEvent : TQEvent { %TypeHeaderCode #include %End public: TQTimerEvent(int); int timerId() const; }; class TQMouseEvent : TQEvent { %TypeHeaderCode #include %End public: %If (- TQt_2_00) TQMouseEvent(int,const TQPoint &,int,int); TQMouseEvent(int,const TQPoint &,const TQPoint &,int,int); %End %If (TQt_2_00 -) TQMouseEvent(Type,const TQPoint &,int,int); TQMouseEvent(Type,const TQPoint &,const TQPoint &,int,int); %End const TQPoint &pos() const; const TQPoint &globalPos() const; int x() const; int y() const; int globalX() const; int globalY() const; %If (- TQt_2_00) int button() const; int state() const; %End %If (TQt_2_00 -) ButtonState button() const; ButtonState state() const; ButtonState stateAfter() const; %End %If (TQt_3_0_0 -) bool isAccepted() const; void accept(); void ignore(); %End }; %If (TQt_2_00 -) class TQWheelEvent : TQEvent { %TypeHeaderCode #include %End public: %If (- TQt_3_0_0) TQWheelEvent(const TQPoint &,int,int); TQWheelEvent(const TQPoint &,const TQPoint &,int,int); %End %If (TQt_3_0_0 -) TQWheelEvent(const TQPoint &,int,int,Orientation = Vertical); TQWheelEvent(const TQPoint &,const TQPoint &,int,int, Orientation = Vertical); %End int delta() const; const TQPoint &pos() const; const TQPoint &globalPos() const; int x() const; int y() const; int globalX() const; int globalY() const; ButtonState state() const; %If (TQt_3_0_0 -) Orientation orientation() const; %End bool isAccepted() const; void accept(); void ignore(); }; %End %If (TQt_3_0_0 -) class TQTabletEvent : TQEvent { %TypeHeaderCode #include %End public: enum TabletDevice { NoDevice, Puck, Stylus, Eraser }; %If (- TQt_3_1_0) TQTabletEvent(const TQPoint &,int,int,int,int,const TQPair &); %End %If (TQt_3_1_0 -) TQTabletEvent(Type,const TQPoint &,const TQPoint &,int,int,int,int, const TQPair &); %End TQTabletEvent(const TQPoint &,const TQPoint &,int,int,int,int, const TQPair &); int pressure() const; int xTilt() const; int yTilt() const; const TQPoint &pos() const; const TQPoint &globalPos() const; int x() const; int y() const; int globalX() const; int globalY() const; TabletDevice device() const; int isAccepted() const; void accept(); void ignore(); TQPair uniqueId(); }; %End class TQKeyEvent : TQEvent { %TypeHeaderCode #include %End public: %If (- TQt_2_00) TQKeyEvent(int,int,int,int); %End %If (TQt_2_00 -) TQKeyEvent(Type,int,int,int,const TQString & = TQString::null,bool = 0, ushort = 1); %End int key() const; int ascii() const; bool isAccepted() const; void accept(); void ignore(); %If (- TQt_2_00) int state() const; %End %If (TQt_2_00 -) ButtonState state() const; ButtonState stateAfter() const; TQString text() const; bool isAutoRepeat() const; int count() const; %End }; class TQFocusEvent : TQEvent { %TypeHeaderCode #include %End public: %If (- TQt_2_00) TQFocusEvent(int); %End %If (TQt_2_00 -) TQFocusEvent(Type); %End bool gotFocus() const; bool lostFocus() const; %If (TQt_2_1_0 -) %If (- TQt_3_0_0) enum Reason { Mouse, Tab, ActiveWindow, Popup, Shortcut, Other }; %End %If (TQt_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 TQPaintEvent : TQEvent { %TypeHeaderCode #include %End public: %If (- TQt_2_00) TQPaintEvent(const TQRect &); %End %If (TQt_2_00 -) TQPaintEvent(const TQRegion &,bool = 1); TQPaintEvent(const TQRect &,bool = 1); %End %If (TQt_3_3_0 -) TQPaintEvent(const TQRegion &,const TQRect &,bool = 1); %End const TQRect &rect() const; %If (TQt_2_00 -) const TQRegion ®ion() const; bool erased() const; %End }; class TQMoveEvent : TQEvent { %TypeHeaderCode #include %End public: TQMoveEvent(const TQPoint &,const TQPoint &); const TQPoint &pos() const; const TQPoint &oldPos() const; }; class TQResizeEvent : TQEvent { %TypeHeaderCode #include %End public: TQResizeEvent(const TQSize &,const TQSize &); const TQSize &size() const; const TQSize &oldSize() const; }; class TQCloseEvent : TQEvent { %TypeHeaderCode #include %End public: TQCloseEvent(); bool isAccepted() const; void accept(); void ignore(); }; %If (TQt_3_3_0 -) class TQIconDragEvent : TQEvent { %TypeHeaderCode #include %End public: TQIconDragEvent(); bool isAccepted() const; void accept(); void ignore(); }; %End class TQShowEvent : TQEvent { %TypeHeaderCode #include %End public: %If (- TQt_3_0_0) TQShowEvent(bool); bool spontaneous() const; %End %If (TQt_3_0_0 -) TQShowEvent(); %End }; class TQHideEvent : TQEvent { %TypeHeaderCode #include %End public: %If (- TQt_3_0_0) TQHideEvent(bool); bool spontaneous() const; %End %If (TQt_3_0_0 -) TQHideEvent(); %End }; %If (TQt_3_0_0 -) class TQContextMenuEvent : TQEvent { %TypeHeaderCode #include %End public: enum Reason { Mouse, Keyboard, Other }; TQContextMenuEvent(Reason,const TQPoint &,const TQPoint &,int); TQContextMenuEvent(Reason,const TQPoint &,int); int x() const; int y() const; int globalX() const; int globalY() const; const TQPoint &pos() const; const TQPoint &globalPos() const; ButtonState state() const; bool isAccepted() const; bool isConsumed() const; void consume(); void accept(); void ignore(); Reason reason() const; }; %End %If (TQt_3_0_0 -) class TQIMEvent : TQEvent { %TypeHeaderCode #include %End public: TQIMEvent(Type,const TQString &,int); const TQString &text() const; int cursorPos() const; bool isAccepted() const; void accept(); void ignore(); %If (TQt_3_1_0 -) int selectionLength() const; %End }; %End %If (TQt_3_1_0 -) class TQIMComposeEvent : TQIMEvent { %TypeHeaderCode #include %End public: TQIMComposeEvent(Type,const TQString &,int,int); }; %End %If (- TQt_2_00) class TQDropEvent : TQEvent { %TypeHeaderCode #include %End public: TQDropEvent(const TQPoint &); const TQPoint &pos() const; bool isAccepted() const; void accept(); void ignore(); TQByteArray data(const char *); }; %End %If (TQt_2_00 -) %If (TQt_DRAGANDDROP) class TQDropEvent : TQEvent, TQMimeSource { %TypeHeaderCode #include %End public: TQDropEvent(const TQPoint &,Type = Drop); const TQPoint &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; TQWidget *source() const; const char *format(int = 0) const; TQByteArray encodedData(const char *) const; bool provides(const char *) const; TQByteArray data(const char *) const; void setPoint(const TQPoint &); }; %End %End %If (- TQt_2_00) class TQDragMoveEvent : TQEvent { %TypeHeaderCode #include %End public: TQDragMoveEvent(const TQPoint &); const TQPoint &pos() const; bool isAccepted() const; void accept(); void ignore(); void accept(const TQRect &); void ignore(const TQRect &); TQRect answerRect() const; const char *format(int = 0); bool provides(const char *); TQByteArray data(const char *); protected: TQDragMoveEvent(const TQPoint &,int); }; %End %If (TQt_DRAGANDDROP) %If (TQt_2_00 -) class TQDragMoveEvent : TQDropEvent { %TypeHeaderCode #include %End public: TQDragMoveEvent(const TQPoint &,Type = DragMove); TQRect answerRect() const; void accept(bool = 1); void accept(const TQRect &); void ignore(const TQRect &); void ignore(); }; %End class TQDragEnterEvent : TQDragMoveEvent { %TypeHeaderCode #include %End public: TQDragEnterEvent(const TQPoint &); }; class TQDragLeaveEvent : TQEvent { %TypeHeaderCode #include %End public: TQDragLeaveEvent(); }; %End class TQChildEvent : TQEvent { %TypeHeaderCode #include %End public: %If (- TQt_2_00) TQChildEvent(int,TQWidget *); %End %If (TQt_2_00 -) TQChildEvent(Type,TQObject *); %End %If (- TQt_2_00) TQWidget *child() const; %End %If (TQt_2_00 -) TQObject *child() const; %End bool inserted() const; bool removed() const; }; class TQCustomEvent : TQEvent { %TypeHeaderCode #include %End public: %If (- TQt_2_00) TQCustomEvent(int,SIP_PYOBJECT /Transfer/); %End %If (TQt_2_00 -) TQCustomEvent(Type,SIP_PYOBJECT /Transfer/); %End %If (TQt_2_1_0 -) TQCustomEvent(int); %End ~TQCustomEvent(); %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 -> TQCustomEvent::data()); // In case the event has been created from C++ code. if (!sipRes) sipRes = Py_None; Py_INCREF(sipRes); %End %If (TQt_2_1_0 -) void setData(SIP_PYOBJECT /Transfer/); %MethodCode // We need to garbage collect any current data. PyObject *old = reinterpret_cast(sipCpp -> TQCustomEvent::data()); sipCpp -> TQCustomEvent::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 -> TQCustomEvent::data()); if (obj) sipRes = sipVisit(obj, sipArg); else sipRes = 0; %End %GCClearCode // Support the Python garbage collector. PyObject *obj = reinterpret_cast(sipCpp -> TQCustomEvent::data()); sipCpp -> TQCustomEvent::setData(0); Py_XDECREF(obj); sipRes = 0; %End };