Back to index

lightning-sunbird  0.9+nobinonly
mozqwidget.cpp
Go to the documentation of this file.
00001 #include "mozqwidget.h"
00002 
00003 #include "nsCommonWidget.h"
00004 
00005 #include <qevent.h>
00006 
00007 MozQWidget::MozQWidget(nsCommonWidget *receiver, QWidget *parent,
00008                        const char *name, WFlags f)
00009     : QWidget(parent, name, f),
00010       mReceiver(receiver)
00011 {
00012 }
00013 
00014 bool MozQWidget::event(QEvent *e)
00015 {
00016     bool ignore = false;
00017     switch(e->type()) {
00018     case QEvent::Accessibility:
00019     {
00020         qDebug("accessibility event received");
00021     }
00022     break;
00023     case QEvent::MouseButtonPress:
00024     {
00025         QMouseEvent *ms = (QMouseEvent*)(e);
00026         ignore = mReceiver->mousePressEvent(ms);
00027     }
00028     break;
00029     case QEvent::MouseButtonRelease:
00030     {
00031         QMouseEvent *ms = (QMouseEvent*)(e);
00032         ignore = mReceiver->mouseReleaseEvent(ms);
00033     }
00034     break;
00035     case QEvent::MouseButtonDblClick:
00036     {
00037         QMouseEvent *ms = (QMouseEvent*)(e);
00038         ignore = mReceiver->mouseDoubleClickEvent(ms);
00039     }
00040     break;
00041     case QEvent::MouseMove:
00042     {
00043         QMouseEvent *ms = (QMouseEvent*)(e);
00044         ignore = mReceiver->mouseMoveEvent(ms);
00045     }
00046     break;
00047     case QEvent::KeyPress:
00048     {
00049         QKeyEvent *kev = (QKeyEvent*)(e);
00050         ignore = mReceiver->keyPressEvent(kev);
00051     }
00052     break;
00053     case QEvent::KeyRelease:
00054     {
00055         QKeyEvent *kev = (QKeyEvent*)(e);
00056         ignore = mReceiver->keyReleaseEvent(kev);
00057     }
00058     break;
00059     case QEvent::IMStart:
00060     {
00061         QIMEvent *iev = (QIMEvent*)(e);
00062         ignore = mReceiver->imStartEvent(iev);
00063     }
00064     break;
00065     case QEvent::IMCompose:
00066     {
00067         QIMEvent *iev = (QIMEvent*)(e);
00068         ignore = mReceiver->imComposeEvent(iev);
00069     }
00070     break;
00071     case QEvent::IMEnd:
00072     {
00073         QIMEvent *iev = (QIMEvent*)(e);
00074         ignore = mReceiver->imEndEvent(iev);
00075     }
00076     break;
00077     case QEvent::FocusIn:
00078     {
00079         QFocusEvent *fev = (QFocusEvent*)(e);
00080         mReceiver->focusInEvent(fev);
00081         return TRUE;
00082     }
00083     break;
00084     case QEvent::FocusOut:
00085     {
00086         QFocusEvent *fev = (QFocusEvent*)(e);
00087         mReceiver->focusOutEvent(fev);
00088         return TRUE;
00089     }
00090     break;
00091     case QEvent::Enter:
00092     {
00093         ignore = mReceiver->enterEvent(e);
00094     }
00095     break;
00096     case QEvent::Leave:
00097     {
00098         ignore = mReceiver->enterEvent(e);
00099     }
00100     break;
00101     case QEvent::Paint:
00102     {
00103         QPaintEvent *ev = (QPaintEvent*)(e);
00104         mReceiver->paintEvent(ev);
00105     }
00106     break;
00107     case QEvent::Move:
00108     {
00109         QMoveEvent *mev = (QMoveEvent*)(e);
00110         ignore = mReceiver->moveEvent(mev);
00111     }
00112     break;
00113     case QEvent::Resize:
00114     {
00115         QResizeEvent *rev = (QResizeEvent*)(e);
00116         ignore = mReceiver->resizeEvent(rev);
00117     }
00118         break;
00119     case QEvent::Show:
00120     {
00121         QShowEvent *sev = (QShowEvent*)(e);
00122         mReceiver->showEvent(sev);
00123     }
00124     break;
00125     case QEvent::Hide:
00126     {
00127         QHideEvent *hev = (QHideEvent*)(e);
00128         ignore = mReceiver->hideEvent(hev);
00129     }
00130         break;
00131     case QEvent::Close:
00132     {
00133         QCloseEvent *cev = (QCloseEvent*)(e);
00134         ignore = mReceiver->closeEvent(cev);
00135     }
00136     break;
00137     case QEvent::Wheel:
00138     {
00139         QWheelEvent *wev = (QWheelEvent*)(e);
00140         ignore = mReceiver->wheelEvent(wev);
00141     }
00142     break;
00143     case QEvent::ContextMenu:
00144     {
00145         QContextMenuEvent *cev = (QContextMenuEvent*)(e);
00146         ignore = mReceiver->contextMenuEvent(cev);
00147     }
00148     break;
00149     case QEvent::DragEnter:
00150     {
00151         QDragEnterEvent *dev = (QDragEnterEvent*)(e);
00152         ignore = mReceiver->dragEnterEvent(dev);
00153     }
00154         break;
00155     case QEvent::DragMove:
00156     {
00157         QDragMoveEvent *dev = (QDragMoveEvent*)(e);
00158         ignore = mReceiver->dragMoveEvent(dev);
00159     }
00160     break;
00161     case QEvent::DragLeave:
00162     {
00163         QDragLeaveEvent *dev = (QDragLeaveEvent*)(e);
00164         ignore = mReceiver->dragLeaveEvent(dev);
00165     }
00166     break;
00167     case QEvent::Drop:
00168     {
00169         QDropEvent *dev = (QDropEvent*)(e);
00170         ignore = mReceiver->dropEvent(dev);
00171     }
00172     break;
00173     default:
00174         break;
00175     }
00176 
00177     QWidget::event(e);
00178 
00179     return !ignore;
00180 }
00181 
00182 void MozQWidget::setModal(bool modal)
00183 {
00184     if (modal)
00185         setWFlags(Qt::WShowModal);
00186     else
00187         clearWFlags(Qt::WShowModal);
00188 }