0023284: Using 'memcpy' on class that contains a virtual method
[occt.git] / samples / qt / Graphic3dDemo / inc / View.h
1 #ifndef VIEW_H
2 #define VIEW_H
3
4 #include <qwidget.h>
5
6 #include <AIS_InteractiveContext.hxx>
7 #include <V3d_View.hxx>
8 #include <AIS_Trihedron.hxx>
9
10 #include "MDIWindow.h"
11 #include "Document.h"
12 #include "ViewOperations.h"
13 #include "ViewDlg.h"
14 #include "ObjectDlg.h"
15 #include "ShapeDlg.h"
16
17 class QRubberBand;
18
19 class View: public QWidget
20 {
21         Q_OBJECT
22         enum CurrentAction3d { CurAction3d_Nothing,
23                                      CurAction3d_DynamicZooming,
24                                      CurAction3d_WindowZooming,
25                          CurAction3d_DynamicPanning,
26                          CurAction3d_GlobalPanning,
27                          CurAction3d_DynamicRotation,
28                          CurAction3d_MagnifyView
29   };
30
31 public:
32   View( Handle(AIS_InteractiveContext), QWidget* parent, MDIWindow* );
33   ~View();
34         
35   void               setCurrentAction();
36   Handle_V3d_View&   getView();
37   void               startAction( ViewOperations::Action );
38
39 signals:
40         void        selectionChanged();
41         void        noActiveActions();
42         void        ViewInitialized();
43
44 public slots:
45         void        onBackground();
46         void        paintEvent( QPaintEvent * e);
47         void        resizeEvent( QResizeEvent* e);
48
49 private slots:
50   void        onImportObject();
51   void        onEditObjectProperties();
52   void        onCreateShape();
53   void        onLoadBox();
54   void        onLoadSphere();
55   void        onLoadTorus();
56   void        onLoadLine();
57   void        onRemoveObject();
58   void        onWireframeMode();
59   void        onShadingMode();
60   void        onDisplayTrihedron();
61   void        onEraseTrihedron();
62
63
64 protected:
65         void        mousePressEvent ( QMouseEvent* e);
66         void        mouseReleaseEvent ( QMouseEvent* e);
67         void        mouseMoveEvent ( QMouseEvent* e);
68   void        init();
69
70
71 private:
72   void        onLButtonDown( Qt::KeyboardModifiers nFlags, const QPoint point );
73   void        onRButtonDown( Qt::KeyboardModifiers nFlags, const QPoint point );
74   void        onLButtonUp( Qt::KeyboardModifiers nFlags, const QPoint point );
75   void        onRButtonUp( Qt::KeyboardModifiers nFlags, const QPoint point );
76   void        onMouseMove( Qt::MouseButtons btns, Qt::KeyboardModifiers nFlags, const QPoint point );
77   void        DragEvent( int x, int y, int TheState );
78   void        InputEvent( int x, int y );  
79   void        MoveEvent( int x, int y ); 
80   void        MultiMoveEvent( int x, int y ); 
81   void        MultiDragEvent( int x, int y, int TheState ); 
82   void        MultiInputEvent( int x, int y ); 
83   void        Popup(); 
84   void        DrawRectangle ( int MinX, int MinY, int MaxX, int MaxY, bool Draw );
85
86 private:
87   MDIWindow*                      myMDI;
88   QRubberBand*                    myRubberBand;
89   ObjectDlg*                      myObjDlg;
90   ShapeDlg*                       myShapeDlg;
91         Standard_Integer                myFirst;
92         Handle_V3d_View                 myView;
93         Handle_AIS_InteractiveContext   myContext;
94   Handle_AIS_Trihedron            myTrihedron;
95         CurrentAction3d                 myCurrentMode;
96   Standard_Integer                myXmin;
97   Standard_Integer                myYmin;  
98   Standard_Integer                myXmax;
99   Standard_Integer                myYmax;
100   Quantity_Factor                 myCurZoom;
101   Standard_Boolean                myComputedModeIsOn;
102   Standard_Integer                myCycleCounter;
103 };
104
105 #endif