// 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 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, Reparent, ShowMinimized, ShowNormal, WindowActivate, WindowDeactivate, ShowToParent, HideToParent, ShowMaximized, ShowFullScreen, Accel, Wheel, AccelAvailable, CaptionChange, IconChange, ParentFontChange, ApplicationFontChange, ParentPaletteChange, ApplicationPaletteChange, PaletteChange, Clipboard, Speech, SockAct, AccelOverride, DeferredDelete, DragEnter, DragMove, DragLeave, Drop, DragResponse, ChildInserted, ChildRemoved, LayoutHint, ShowWindowRequest, WindowBlocked, WindowUnblocked, ActivateControl, DeactivateControl, ContextMenu, IMStart, IMCompose, IMEnd, Accessibility, TabletMove, LocaleChange, LanguageChange, LayoutDirectionChange, Style, TabletPress, TabletRelease, OkRequest, HelpRequest, IconDrag, WindowStateChange, User, MaxUser, }; TQEvent(Type); TQEvent(TQEvent&); virtual ~TQEvent(); Type type() const; bool spontaneous() const; %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: case TQEvent::AccelOverride: 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; case TQEvent::IconDrag: sipClass = sipClass_TQIconDragEvent; break; 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; case TQEvent::ContextMenu: sipClass = sipClass_TQContextMenuEvent; break; case TQEvent::IMStart: case TQEvent::IMEnd: sipClass = sipClass_TQIMEvent; break; case TQEvent::IMCompose: sipClass = sipClass_TQIMComposeEvent; break; case TQEvent::TabletMove: case TQEvent::TabletPress: case TQEvent::TabletRelease: sipClass = sipClass_TQTabletEvent; break; default: sipClass = (sipCpp -> type() < TQEvent::User ? sipClass_TQEvent : sipClass_TQCustomEvent); } %End }; class TQTimerEvent : TQEvent { %TypeHeaderCode #include %End public: TQTimerEvent(int); int timerId() const; }; class TQMouseEvent : TQEvent { %TypeHeaderCode #include %End public: TQMouseEvent(Type,const TQPoint &,int,int); TQMouseEvent(Type,const TQPoint &,const TQPoint &,int,int); const TQPoint &pos() const; const TQPoint &globalPos() const; int x() const; int y() const; int globalX() const; int globalY() const; ButtonState button() const; ButtonState state() const; ButtonState stateAfter() const; bool isAccepted() const; void accept(); void ignore(); }; class TQWheelEvent : TQEvent { %TypeHeaderCode #include %End public: TQWheelEvent(const TQPoint &,int,int,Orientation = Vertical); TQWheelEvent(const TQPoint &,const TQPoint &,int,int, Orientation = Vertical); 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; Orientation orientation() const; bool isAccepted() const; void accept(); void ignore(); }; class TQTabletEvent : TQEvent { %TypeHeaderCode #include %End public: enum TabletDevice { NoDevice, Puck, Stylus, Eraser }; TQTabletEvent(Type,const TQPoint &,const TQPoint &,int,int,int,int, const TQPair &); 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(); }; class TQKeyEvent : TQEvent { %TypeHeaderCode #include %End public: TQKeyEvent(Type,int,int,int,const TQString & = TQString::null,bool = 0, ushort = 1); int key() const; int ascii() const; bool isAccepted() const; void accept(); void ignore(); ButtonState state() const; ButtonState stateAfter() const; TQString text() const; bool isAutoRepeat() const; int count() const; }; class TQFocusEvent : TQEvent { %TypeHeaderCode #include %End public: TQFocusEvent(Type); bool gotFocus() const; bool lostFocus() const; enum Reason { Mouse, Tab, Backtab, ActiveWindow, Popup, Shortcut, Other }; static Reason reason(); static void setReason(Reason); static void resetReason(); }; class TQPaintEvent : TQEvent { %TypeHeaderCode #include %End public: TQPaintEvent(const TQRegion &,bool = 1); TQPaintEvent(const TQRect &,bool = 1); TQPaintEvent(const TQRegion &,const TQRect &,bool = 1); const TQRect &rect() const; const TQRegion ®ion() const; bool erased() const; }; 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(); }; class TQIconDragEvent : TQEvent { %TypeHeaderCode #include %End public: TQIconDragEvent(); bool isAccepted() const; void accept(); void ignore(); }; class TQShowEvent : TQEvent { %TypeHeaderCode #include %End public: TQShowEvent(); }; class TQHideEvent : TQEvent { %TypeHeaderCode #include %End public: TQHideEvent(); }; 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; }; 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(); int selectionLength() const; }; class TQIMComposeEvent : TQIMEvent { %TypeHeaderCode #include %End public: TQIMComposeEvent(Type,const TQString &,int,int); }; %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 %If (TQt_DRAGANDDROP) 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(); }; 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: TQChildEvent(Type,TQObject *); TQObject *child() const; bool inserted() const; bool removed() const; }; class TQCustomEvent : TQEvent { %TypeHeaderCode #include %End public: TQCustomEvent(Type,SIP_PYOBJECT /Transfer/); TQCustomEvent(int); ~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 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 %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 };