BALL  1.4.1
canvasWidget.h
Go to the documentation of this file.
00001 // -*- Mode: C++; tab-width: 2; -*-
00002 // vi: set ts=2:
00003 //
00004 
00005 #ifndef BALL_VIEW_WIDGETS_CANVASWIDGET_H
00006 #define BALL_VIEW_WIDGETS_CANVASWIDGET_H
00007 
00008 #ifndef BALL_COMMON_GLOBAL_H
00009 # include <BALL/COMMON/global.h>
00010 #endif
00011 
00012 #include <QCanvasWidget>
00013 #include <QtGui/QPixmap>
00014 #include <QtGui/QPainter>
00015 #include <vector>
00016 
00017 namespace BALL
00018 {
00019   namespace VIEW
00020   {      
00022     class BALL_VIEW_EXPORT CanvasWidget
00023       : public QCanvasView
00024     {
00025       Q_OBJECT    
00026 
00027       public:
00028       
00030       class BALL_VIEW_EXPORT PixmapItem
00031         : public QCanvasRectangle
00032       {
00033         public:
00034           
00035         PixmapItem(QCanvas* canvas, const QPixmap& pixmap);
00036         
00037         PixmapItem(const PixmapItem& pixitem);
00038 
00039         virtual ~PixmapItem();
00040   
00041         QPixmap& getPixmap();
00042 
00043         protected:
00044 
00045         void drawShape(QPainter& p);
00046 
00047         QPixmap pixmap_;
00048   
00049       }; //end of class PixmapItem
00050 
00052       CanvasWidget (QWidget *parent  = 0, 
00053                     const char* name = 0, 
00054                     Qt::WFlags f         = 0);
00055                 
00056 
00057       //Destructor
00058       virtual ~CanvasWidget();  
00059       
00061       void showObjects();
00062       
00063     public slots:
00064 
00065       virtual void zoomIn();
00066 
00067       virtual void zoomOut();
00068 
00069       virtual void zoom(float xfactor,float yfactor);
00070 
00071       virtual void zoomToFit();
00072 
00073     protected:  
00074 
00075       //Copyconstructor doesn't work because of the QT private copy constructors
00076       CanvasWidget(const CanvasWidget& /*cw*/)
00077         : QCanvasView() {};
00078 
00079       QCanvas canvas_;
00080       std::vector<QCanvasItem*> objects_; //e.g PixItem, Polygonzuege
00081       
00082     };//end of class CanvasWidget
00083 
00084   }
00085 }
00086 
00087 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines