00001 #ifndef BALL_VIEW_WIDGETS_CANVASWIDGET_H
00002 #define BALL_VIEW_WIDGETS_CANVASWIDGET_H
00003
00004 #ifndef BALL_COMMON_GLOBAL_H
00005 # include <BALL/COMMON/global.h>
00006 #endif
00007
00008 #include <QCanvasWidget>
00009 #include <QtGui/qpixmap.h>
00010 #include <QtGui/qpainter.h>
00011 #include <vector>
00012
00013 namespace BALL
00014 {
00015 namespace VIEW
00016 {
00018 class BALL_VIEW_EXPORT CanvasWidget
00019 : public QCanvasView
00020 {
00021 Q_OBJECT
00022
00023 public:
00024
00026 class BALL_VIEW_EXPORT PixmapItem
00027 : public QCanvasRectangle
00028 {
00029 public:
00030
00031 PixmapItem(QCanvas* canvas, const QPixmap& pixmap);
00032
00033 PixmapItem(const PixmapItem& pixitem);
00034
00035 virtual ~PixmapItem();
00036
00037 QPixmap& getPixmap();
00038
00039 protected:
00040
00041 void drawShape(QPainter& p);
00042
00043 QPixmap pixmap_;
00044
00045 };
00046
00048 CanvasWidget (QWidget *parent = 0,
00049 const char* name = 0,
00050 Qt::WFlags f = 0);
00051
00052
00053
00054 virtual ~CanvasWidget();
00055
00057 void showObjects()
00058 throw();
00059
00060 public slots:
00061
00062 virtual void zoomIn()
00063 throw();
00064
00065 virtual void zoomOut()
00066 throw();
00067
00068 virtual void zoom(float xfactor,float yfactor)
00069 throw();
00070
00071 virtual void zoomToFit()
00072 throw();
00073
00074 protected:
00075
00076
00077 CanvasWidget(const CanvasWidget& )
00078 throw()
00079 : QCanvasView() {};
00080
00081 QCanvas canvas_;
00082 std::vector<QCanvasItem*> objects_;
00083
00084 };
00085
00086 }
00087 }
00088
00089 #endif