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