00001 #ifndef VIEWCANVAS_H 00002 #define VIEWCANVAS_H 00003 00004 00005 #include <qwidget.h> 00006 #include <qcanvas.h> 00007 #include <qpixmap.h> 00008 #include <QMessageBox.h> 00009 00010 class viewWidgetImpl; 00011 00012 00014 00018 class TMyCanvasView: public QCanvasView 00019 { 00020 public: 00022 00025 TMyCanvasView (QCanvas* canvas, QWidget* parent); 00026 virtual ~TMyCanvasView(); 00028 00032 int getLastLeftCX(); 00034 00038 int getLastLeftCY(); 00040 00044 int getLastRightCX(); 00046 00050 int getLastRightCY(); 00052 00055 void setMainWindow(viewWidgetImpl* mw); 00056 protected: 00057 void mousePressEvent ( QMouseEvent * e ); 00058 void contentsMousePressEvent(QMouseEvent*); 00059 private: 00060 viewWidgetImpl* mainWindow; 00061 int lastLeftClickX; 00062 int lastLeftClickY; 00063 int lastRightClickX; 00064 int lastRightClickY; 00065 }; 00066 00067 class viewCanvas : public QWidget 00068 { 00069 00070 public: 00071 viewCanvas (QWidget *parent = 0, const char *name = 0); 00072 ~viewCanvas () {} 00073 void setCanvas (QPixmap *pixmap); 00074 TMyCanvasView* getCanvasView(); 00075 00076 00077 public slots: 00078 void setLine(int xa, int ya, int xe, int ye); 00079 void setCross(int x, int y); 00080 void setCanvas (QPixmap *pixmap, int x, int y); 00081 void setBackground (QColor color); 00082 00083 00084 private: 00085 00086 QCanvas *canvas; 00087 TMyCanvasView *canvasView; 00088 QCanvasLine* camLine; 00089 QCanvasLine* cross1; 00090 QCanvasLine* cross2; 00091 protected: 00092 void mousePressEvent ( QMouseEvent * e ); 00093 void paintEvent (QPaintEvent *event); 00094 }; 00095 00096 #include "viewWidgetImpl.h" 00097 00098 #endif // VIEWCANVAS_H