00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016 #include "QGo4RootCanvas.h"
00017
00018 #include "Riostream.h"
00019
00020 #include "TCanvas.h"
00021
00022 #include "qapplication.h"
00023 #include "qstring.h"
00024 #include "qcursor.h"
00025 #include "qdragobject.h"
00026
00027 QGo4RootCanvas::QGo4RootCanvas(QWidget *parent, const char *name, TCanvas *c) :
00028 TQRootCanvas(parent, name, c),
00029 fxShowEventStatus(false)
00030 {
00031 setAcceptDrops(true);
00032 setSizeIncrement( QSize( 100, 100 ) );
00033 setBaseSize(QSize(800, 500));
00034 Resize();
00035 Update();
00036 }
00037
00038 QGo4RootCanvas::~QGo4RootCanvas()
00039 {
00040 }
00041
00042 void QGo4RootCanvas::setShowEventStatus(bool s)
00043 {
00044 fxShowEventStatus = s;
00045 }
00046
00047 bool QGo4RootCanvas::showEventStatus() const
00048 {
00049 return fxShowEventStatus;
00050 }
00051
00052 void QGo4RootCanvas::mouseMoveEvent(QMouseEvent *e)
00053 {
00054 TQRootCanvas::mouseMoveEvent(e);
00055 if(fxShowEventStatus) {
00056 TObject* selected = fCanvas->GetSelected();
00057 Int_t px = fCanvas->GetEventX();
00058 Int_t py = fCanvas->GetEventY();
00059 QString buffer = "";
00060 if (selected!=0) {
00061 buffer = selected->GetName();
00062 buffer += " ";
00063 buffer += selected->GetObjectInfo(px,py);
00064 } else {
00065 buffer = "No seleceted object x = ";
00066 buffer += QString::number(px);
00067 buffer += " y = ";
00068 buffer += QString::number(py);
00069 }
00070 emit CanvasStatusEvent(buffer.latin1());
00071 }
00072 }
00073
00074 void QGo4RootCanvas::dragEnterEvent(QDragEnterEvent* e)
00075 {
00076 if (QTextDrag::canDecode(e))
00077 e->accept();
00078 }
00079
00080 void QGo4RootCanvas::dropEvent(QDropEvent* event)
00081 {
00082 TObject *object = 0;
00083 QPoint Pos = event->pos();
00084 TPad* pad = Pick(Pos.x(), Pos.y(), object);
00085
00086 if (pad!=0)
00087 emit CanvasDropEvent(event, pad);
00088 }
00089
00090 void QGo4RootCanvas::performResize()
00091 {
00092 QApplication::setOverrideCursor(Qt::WaitCursor);
00093 TQRootCanvas::performResize();
00094 emit DoCanvasResize();
00095 QApplication::restoreOverrideCursor();
00096 }
00097
00098 void QGo4RootCanvas::leaveEvent(QEvent* e)
00099 {
00100 TQRootCanvas::leaveEvent(e);
00101 emit CanvasLeaveEvent();
00102 }
00103
00104