]> Shamusworld >> Repos - architektonas/blob - src/widgets/qg_graphicview.h
Check in prior to mucking around with preview/snapper rendering...
[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 // This is just crap. Why have a klunky listener interface when we have slots/signals???
41 // That's what I thought!!!
42                 // Methods from RS_LayerListListener Interface:
43 //              virtual void layerEdited(RS_Layer *);
44 //              virtual void layerRemoved(RS_Layer *);
45 //              virtual void layerToggled(RS_Layer *);
46
47         protected:
48                 virtual void emulateMouseMoveEvent();
49                 virtual void mousePressEvent(QMouseEvent * e);
50                 virtual void mouseReleaseEvent(QMouseEvent * e);
51                 virtual void mouseMoveEvent(QMouseEvent * e);
52                 virtual void tabletEvent(QTabletEvent * e);
53                 virtual void leaveEvent(QEvent *);
54                 virtual void enterEvent(QEvent *);
55                 virtual void focusInEvent(QFocusEvent *);
56                 virtual void focusOutEvent(QFocusEvent *);
57                 virtual void wheelEvent(QWheelEvent * e);
58                 virtual void keyPressEvent(QKeyEvent * e);
59                 virtual void keyReleaseEvent(QKeyEvent * e);
60
61                 void paintEvent(QPaintEvent *);
62                 virtual void resizeEvent(QResizeEvent * e);
63
64 #warning "!!! File preview needs porting to Qt4 !!!"
65 //              void previewUrl(const Q3Url &u);
66
67         private:
68                 void CommonInitialization(void);
69
70         private slots:
71                 void slotHScrolled(int value);
72                 void slotVScrolled(int value);
73
74         private:
75 #warning "!!! Double buffering is not necessary anymore !!!"
76                 //! Buffer for double-buffering
77                 QPixmap * buffer;
78 //              int refCount;
79
80         protected:
81                 int lastWidth;
82                 int lastHeight;
83                 //! Horizontal scrollbar.
84 //              QG_ScrollBar * hScrollBar;
85                 QScrollBar * hScrollBar;
86                 //! Vertical scrollbar.
87 //              QG_ScrollBar * vScrollBar;
88                 QScrollBar * vScrollBar;
89                 //! Layout used to fit in the view and the scrollbars.
90                 QGridLayout * layout;
91                 //! Label for grid spacing.
92                 QLabel * gridStatus;
93                 //! CAD mouse cursor
94                 QCursor * curCad;
95                 //! Delete mouse cursor
96                 QCursor * curDel;
97                 //! Select mouse cursor
98                 QCursor * curSelect;
99                 //! Magnifying glass mouse cursor
100                 QCursor * curMagnifier;
101                 //! Hand mouse cursor
102                 QCursor * curHand;
103 };
104
105 #endif