BALL  1.4.2
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
canvasWidget.h
Go to the documentation of this file.
1 // -*- Mode: C++; tab-width: 2; -*-
2 // vi: set ts=2:
3 //
4 
5 #ifndef BALL_VIEW_WIDGETS_CANVASWIDGET_H
6 #define BALL_VIEW_WIDGETS_CANVASWIDGET_H
7 
8 #ifndef BALL_COMMON_GLOBAL_H
9 # include <BALL/COMMON/global.h>
10 #endif
11 
12 #include <QCanvasWidget>
13 #include <QtGui/QPixmap>
14 #include <QtGui/QPainter>
15 #include <vector>
16 
17 namespace BALL
18 {
19  namespace VIEW
20  {
23  : public QCanvasView
24  {
25  Q_OBJECT
26 
27  public:
28 
31  : public QCanvasRectangle
32  {
33  public:
34 
35  PixmapItem(QCanvas* canvas, const QPixmap& pixmap);
36 
37  PixmapItem(const PixmapItem& pixitem);
38 
39  virtual ~PixmapItem();
40 
41  QPixmap& getPixmap();
42 
43  protected:
44 
45  void drawShape(QPainter& p);
46 
47  QPixmap pixmap_;
48 
49  }; //end of class PixmapItem
50 
52  CanvasWidget (QWidget *parent = 0,
53  const char* name = 0,
54  Qt::WFlags f = 0);
55 
56 
57  //Destructor
58  virtual ~CanvasWidget();
59 
61  void showObjects();
62 
63  public slots:
64 
65  virtual void zoomIn();
66 
67  virtual void zoomOut();
68 
69  virtual void zoom(float xfactor,float yfactor);
70 
71  virtual void zoomToFit();
72 
73  protected:
74 
75  //Copyconstructor doesn't work because of the QT private copy constructors
76  CanvasWidget(const CanvasWidget& /*cw*/)
77  : QCanvasView() {};
78 
79  QCanvas canvas_;
80  std::vector<QCanvasItem*> objects_; //e.g PixItem, Polygonzuege
81 
82  };//end of class CanvasWidget
83 
84  }
85 }
86 
87 #endif