Eneboo - Documentación para desarrolladores
|
00001 /*************************************************************************** 00002 AQSEvent_p.h 00003 ------------------- 00004 begin : 29/01/2011 00005 copyright : (C) 2003-2011 by InfoSiAL S.L. 00006 email : mail@infosial.com 00007 ***************************************************************************/ 00008 /*************************************************************************** 00009 * This program is free software; you can redistribute it and/or modify * 00010 * it under the terms of the GNU General Public License as published by * 00011 * the Free Software Foundation; version 2 of the License. * 00012 ***************************************************************************/ 00013 /*************************************************************************** 00014 Este programa es software libre. Puede redistribuirlo y/o modificarlo 00015 bajo los términos de la Licencia Pública General de GNU en su 00016 versión 2, publicada por la Free Software Foundation. 00017 ***************************************************************************/ 00018 00019 #ifndef AQSEVENT_P_H_ 00020 #define AQSEVENT_P_H_ 00021 00022 #include "AQSVoidPtr_p.h" 00023 00024 class AQSEvent : public AQSVoidPtr 00025 { 00026 Q_OBJECT 00027 00028 Q_PROPERTY(int type READ type) 00029 Q_PROPERTY(bool spontaneous READ spontaneous) 00030 Q_PROPERTY(QMap eventData READ eventData) 00031 00032 AQ_DECLARE_AQS_VOID(Event, VoidPtr); 00033 00034 public: 00035 int type() const { 00036 AQ_CALL_RET_V(type(), int); 00037 } 00038 00039 bool spontaneous() const { 00040 AQ_CALL_RET_V(spontaneous(), bool); 00041 } 00042 00043 QMap<QString, QVariant> eventData() const { 00044 QMap<QString, QVariant> ret; 00045 if (!o_) 00046 return ret; 00047 00048 switch (type()) { 00049 case QEvent::ContextMenu: { 00050 QContextMenuEvent *ev = static_cast<QContextMenuEvent *>(o_); 00051 ret["pos"] = ev->pos(); 00052 ret["globalPos"] = ev->globalPos(); 00053 ret["state"] = ev->state(); 00054 ret["reason"] = ev->reason(); 00055 break; 00056 } 00057 00058 case QEvent::MouseMove: 00059 case QEvent::MouseButtonDblClick: 00060 case QEvent::MouseButtonRelease: 00061 case QEvent::MouseButtonPress: { 00062 QMouseEvent *ev = static_cast<QMouseEvent *>(o_); 00063 ret["pos"] = ev->pos(); 00064 ret["globalPos"] = ev->globalPos(); 00065 ret["state"] = ev->state(); 00066 ret["button"] = ev->button(); 00067 ret["stateAfter"] = ev->stateAfter(); 00068 break; 00069 } 00070 00071 case QEvent::Timer: { 00072 QTimerEvent *ev = static_cast<QTimerEvent *>(o_); 00073 ret["timerId"] = ev->timerId(); 00074 break; 00075 } 00076 00077 case QEvent::Wheel: { 00078 QWheelEvent *ev = static_cast<QWheelEvent *>(o_); 00079 ret["pos"] = ev->pos(); 00080 ret["globalPos"] = ev->globalPos(); 00081 ret["state"] = ev->state(); 00082 ret["delta"] = ev->delta(); 00083 ret["orientation"] = ev->orientation(); 00084 break; 00085 } 00086 00087 case QEvent::KeyRelease: 00088 case QEvent::KeyPress: { 00089 QKeyEvent *ev = static_cast<QKeyEvent *>(o_); 00090 ret["state"] = ev->state(); 00091 ret["stateAfter"] = ev->stateAfter(); 00092 ret["key"] = ev->key(); 00093 ret["ascii"] = ev->ascii(); 00094 ret["text"] = ev->text(); 00095 ret["count"] = ev->count(); 00096 ret["isAutoRepeat"] = ev->isAutoRepeat(); 00097 break; 00098 } 00099 00100 case QEvent::Paint: { 00101 QPaintEvent *ev = static_cast<QPaintEvent *>(o_); 00102 ret["rect"] = ev->rect(); 00103 ret["erased"] = ev->erased(); 00104 break; 00105 } 00106 00107 case QEvent::Resize: { 00108 QResizeEvent *ev = static_cast<QResizeEvent *>(o_); 00109 ret["size"] = ev->size(); 00110 ret["oldSize"] = ev->oldSize(); 00111 break; 00112 } 00113 00114 case QEvent::Move: { 00115 QMoveEvent *ev = static_cast<QMoveEvent *>(o_); 00116 ret["pos"] = ev->pos(); 00117 ret["oldPos"] = ev->oldPos(); 00118 break; 00119 } 00120 } 00121 return ret; 00122 } 00123 00124 void setEvent(QEvent *ev) { 00125 o_ = ev; 00126 } 00127 00128 public slots: 00129 QTimerEvent *castTimerEvent() const { 00130 return static_cast<QTimerEvent *>(o_); 00131 } 00132 QMouseEvent *castMouseEvent() const { 00133 return static_cast<QMouseEvent *>(o_); 00134 } 00135 QWheelEvent *castWheelEvent() const { 00136 return static_cast<QWheelEvent *>(o_); 00137 } 00138 QKeyEvent *castKeyEvent() const { 00139 return static_cast<QKeyEvent *>(o_); 00140 } 00141 QFocusEvent *castFocusEvent() const { 00142 return static_cast<QFocusEvent *>(o_); 00143 } 00144 QPaintEvent *castPaintEvent() const { 00145 return static_cast<QPaintEvent *>(o_); 00146 } 00147 QMoveEvent *castMoveEvent() const { 00148 return static_cast<QMoveEvent *>(o_); 00149 } 00150 QResizeEvent *castResizeEvent() const { 00151 return static_cast<QResizeEvent *>(o_); 00152 } 00153 QCloseEvent *castCloseEvent() const { 00154 return static_cast<QCloseEvent *>(o_); 00155 } 00156 QIconDragEvent *castIconDragEvent() const { 00157 return static_cast<QIconDragEvent *>(o_); 00158 } 00159 QShowEvent *castShowEvent() const { 00160 return static_cast<QShowEvent *>(o_); 00161 } 00162 QHideEvent *castHideEvent() const { 00163 return static_cast<QHideEvent *>(o_); 00164 } 00165 QContextMenuEvent *castContextMenuEvent() const { 00166 return static_cast<QContextMenuEvent *>(o_); 00167 } 00168 QIMEvent *castIMEvent() const { 00169 return static_cast<QIMEvent *>(o_); 00170 } 00171 QDropEvent *castDropEvent() const { 00172 return static_cast<QDropEvent *>(o_); 00173 } 00174 QDragMoveEvent *castDragMoveEvent() const { 00175 return static_cast<QDragMoveEvent *>(o_); 00176 } 00177 QDragEnterEvent *castDragEnterEvent() const { 00178 return static_cast<QDragEnterEvent *>(o_); 00179 } 00180 QDragLeaveEvent *castDragLeaveEvent() const { 00181 return static_cast<QDragLeaveEvent *>(o_); 00182 } 00183 QChildEvent *castChildEvent() const { 00184 return static_cast<QChildEvent *>(o_); 00185 } 00186 QCustomEvent *castCustomEvent() const { 00187 return static_cast<QCustomEvent *>(o_); 00188 } 00189 00190 //@AQ_BEGIN_DEF_PUB_SLOTS@ 00191 //@AQ_END_DEF_PUB_SLOTS@ 00192 }; 00193 00194 //@AQ_BEGIN_IMP_PUB_SLOTS@ 00195 //@AQ_END_IMP_PUB_SLOTS@ 00196 00197 #endif /* AQSEVENT_P_H_ */ 00198 00199 // @AQSVOIDPTR@ 00200