00001 #ifndef ARENAVIEW_H 00002 #define ARENAVIEW_H 00003 00004 #include <QGraphicsView> 00005 #include <QDragEnterEvent> 00006 #include <QDragMoveEvent> 00007 #include <QDragLeaveEvent> 00008 #include <QDropEvent> 00009 00010 #include "arenacontroller.h" 00011 00012 class Arena; 00013 class ArenaScene; 00014 class ArenaSceneElement; 00015 00016 class ArenaView : public QGraphicsView 00017 { 00018 Q_OBJECT 00019 public: 00020 ArenaView(ArenaController *controller, QWidget *parent = 0); 00021 00022 void drawForeground(QPainter *painter, const QRectF &rect); 00023 void drawBackground(QPainter *painter, const QRectF &rect); 00024 void mouseMoveEvent(QMouseEvent *event); 00025 void mousePressEvent(QMouseEvent *event); 00026 void mouseReleaseEvent(QMouseEvent *event); 00027 void wheelEvent(QWheelEvent *event); 00028 00029 void setArena(Arena *arena) { m_arena = arena; } 00030 00031 public slots: 00032 void slotZoomIn(); 00033 void slotZoomOut(); 00034 00035 private slots: 00036 void slotGridPaintingDisabled(); 00037 00038 private: 00039 void dragEnterEvent(QDragEnterEvent *event); 00040 void dragMoveEvent(QDragMoveEvent *event); 00041 void dropEvent(QDropEvent *event); 00042 void dragLeaveEvent(QDragLeaveEvent *event); 00043 00044 void dragStarted(); 00045 void dragEnded(); 00046 00047 ArenaScene* arenaScene(); 00048 00049 Arena* m_arena; 00050 // Remember if we're currently in rubber band selection mode 00051 bool m_rubberBandActive; 00052 QPoint m_lastMousePos; 00053 QPointF m_lastMousePosScene; 00054 ArenaController *m_controller; 00055 }; 00056 00057 #endif // ARENAVIEW_H