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