]> Shamusworld >> Repos - architektonas/blob - src/widgets/qg_graphicview.h
Refactoring: Moved RS_GraphicView to GraphicView.
[architektonas] / src / widgets / qg_graphicview.h
1 #ifndef QG_GRAPHICVIEW_H
2 #define QG_GRAPHICVIEW_H
3
4 #include <QtGui>
5 #include "graphicview.h"
6 #include "rs_layerlistlistener.h"
7 #include "rs_blocklistlistener.h"
8 #include "qg_scrollbar.h"
9
10 class RS_Preview;
11 class PaintInterface;
12
13 /**
14  * This is the Qt implementation of a widget which can view a
15  * graphic.
16  *
17  * Instances of this class can be linked to layer lists using
18  * addLayerListListener().
19  */
20 //class QG_GraphicView: public QWidget, public RS_GraphicView, //public Q3FilePreview,
21 class QG_GraphicView: public QWidget, public GraphicView, //public Q3FilePreview,
22         public RS_LayerListListener, public RS_BlockListListener
23 {
24         Q_OBJECT
25
26         public:
27                 QG_GraphicView(QWidget * parent = 0, const char * name = 0, Qt::WindowFlags f = 0);
28                 virtual ~QG_GraphicView();
29
30                 virtual int getWidth();
31                 virtual int getHeight();
32                 virtual void redraw();
33                 virtual void adjustOffsetControls();
34                 virtual void adjustZoomControls();
35                 virtual void setBackground(const RS_Color & bg);
36                 virtual void setMouseCursor(RS2::CursorType c);
37                 virtual void updateGridStatusWidget(const QString & text);
38
39                 // Methods from RS_LayerListListener Interface:
40                 virtual void layerEdited(RS_Layer *);
41                 virtual void layerRemoved(RS_Layer *);
42                 virtual void layerToggled(RS_Layer *);
43
44         protected:
45                 virtual void emulateMouseMoveEvent();
46                 virtual void mousePressEvent(QMouseEvent * e);
47                 virtual void mouseReleaseEvent(QMouseEvent * e);
48                 virtual void mouseMoveEvent(QMouseEvent * e);
49                 virtual void tabletEvent(QTabletEvent * e);
50                 virtual void leaveEvent(QEvent *);
51                 virtual void enterEvent(QEvent *);
52                 virtual void focusInEvent(QFocusEvent *);
53                 virtual void focusOutEvent(QFocusEvent *);
54                 virtual void wheelEvent(QWheelEvent * e);
55                 virtual void keyPressEvent(QKeyEvent * e);
56                 virtual void keyReleaseEvent(QKeyEvent * e);
57
58                 void paintEvent(QPaintEvent *);
59                 virtual void resizeEvent(QResizeEvent * e);
60
61 #warning "!!! File preview needs porting to Qt4 !!!"
62 //              void previewUrl(const Q3Url &u);
63
64         private slots:
65                 void slotHScrolled(int value);
66                 void slotVScrolled(int value);
67
68         private:
69 #warning "!!! Double buffering is not necessary anymore !!!"
70                 //! Buffer for double-buffering
71                 QPixmap * buffer;
72 //              int refCount;
73
74         protected:
75                 int lastWidth;
76                 int lastHeight;
77                 //! Horizontal scrollbar.
78                 QG_ScrollBar * hScrollBar;
79                 //! Vertical scrollbar.
80                 QG_ScrollBar * vScrollBar;
81                 //! Layout used to fit in the view and the scrollbars.
82                 QGridLayout * layout;
83                 //! Label for grid spacing.
84                 QLabel * gridStatus;
85                 //! CAD mouse cursor
86                 QCursor * curCad;
87                 //! Delete mouse cursor
88                 QCursor * curDel;
89                 //! Select mouse cursor
90                 QCursor * curSelect;
91                 //! Magnifying glass mouse cursor
92                 QCursor * curMagnifier;
93                 //! Hand mouse cursor
94                 QCursor * curHand;
95 };
96
97 #endif