0023776: Redesign of MFC samples after V2d viewer removing
[occt.git] / samples / mfc / standard / Common / OCC_3dView.h
1 // OCC_3dView.h: interface for the OCC_3dView class.
2 //
3 //////////////////////////////////////////////////////////////////////
4
5 #if !defined(AFX_OCC_3DVIEW_H__1F4065AE_39C4_11D7_8611_0060B0EE281E__INCLUDED_)
6 #define AFX_OCC_3DVIEW_H__1F4065AE_39C4_11D7_8611_0060B0EE281E__INCLUDED_
7
8 #if _MSC_VER > 1000
9 #pragma once
10 #endif // _MSC_VER > 1000
11
12 #include "OCC_BaseView.h"
13 #include "OCC_3dDoc.h"
14 #include <Standard_Macro.hxx>
15
16 enum CurAction3d { 
17   CurAction3d_Nothing,
18   CurAction3d_DynamicZooming,
19   CurAction3d_WindowZooming,
20   CurAction3d_DynamicPanning,
21   CurAction3d_GlobalPanning,
22   CurAction3d_DynamicRotation
23 };
24
25 class AFX_EXT_CLASS OCC_3dView : public OCC_BaseView  
26 {
27         DECLARE_DYNCREATE(OCC_3dView)
28 public:
29         OCC_3dView();
30         virtual ~OCC_3dView();
31
32         OCC_3dDoc* GetDocument();
33         void FitAll() {   if ( !myView.IsNull() ) myView->FitAll();  myView->ZFitAll(); };
34         void Redraw() {   if ( !myView.IsNull() ) myView->Redraw(); };
35
36         void SetZoom ( const Quantity_Factor& Coef  ) {   myView->SetZoom ( Coef  );  };
37
38   Handle_V3d_View& GetView() { return myView; }
39 // Overrides
40         // ClassWizard generated virtual function overrides
41         //{{AFX_VIRTUAL(OCC_3dView)
42         public:
43         virtual void OnDraw(CDC* pDC);  // overridden to draw this view
44         virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
45         virtual void OnInitialUpdate();
46         //}}AFX_VIRTUAL
47
48 // Generated message map functions
49 protected:
50         //{{AFX_MSG(OCC_3dView)
51         afx_msg void OnBUTTONAxo();
52         afx_msg void OnBUTTONBack();
53         afx_msg void OnBUTTONBottom();
54         afx_msg void OnBUTTONFront();
55         afx_msg void OnBUTTONHlrOff();
56         afx_msg void OnBUTTONHlrOn();
57         afx_msg void OnBUTTONLeft();
58         afx_msg void OnBUTTONPan();
59         afx_msg void OnBUTTONPanGlo();
60         afx_msg void OnBUTTONReset();
61         afx_msg void OnBUTTONRight();
62         afx_msg void OnBUTTONRot();
63         afx_msg void OnBUTTONTop();
64         afx_msg void OnBUTTONZoomAll();
65     afx_msg void OnFileExportImage();
66         afx_msg void OnSize(UINT nType, int cx, int cy);
67         afx_msg void OnBUTTONZoomProg();
68         afx_msg void OnBUTTONZoomWin();
69         afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
70         afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
71         afx_msg void OnMButtonDown(UINT nFlags, CPoint point);
72         afx_msg void OnMButtonUp(UINT nFlags, CPoint point);
73         afx_msg void OnMouseMove(UINT nFlags, CPoint point);
74         afx_msg void OnRButtonDown(UINT nFlags, CPoint point);
75         afx_msg void OnRButtonUp(UINT nFlags, CPoint point);
76         afx_msg void OnUpdateBUTTONHlrOff(CCmdUI* pCmdUI);
77         afx_msg void OnUpdateBUTTONHlrOn(CCmdUI* pCmdUI);
78         afx_msg void OnUpdateBUTTONPanGlo(CCmdUI* pCmdUI);
79         afx_msg void OnUpdateBUTTONPan(CCmdUI* pCmdUI);
80         afx_msg void OnUpdateBUTTONZoomProg(CCmdUI* pCmdUI);
81         afx_msg void OnUpdateBUTTONZoomWin(CCmdUI* pCmdUI);
82         afx_msg void OnUpdateBUTTONRot(CCmdUI* pCmdUI);
83         afx_msg void OnModifyChangeBackground();
84         //}}AFX_MSG
85         DECLARE_MESSAGE_MAP()
86
87 #ifdef _DEBUG
88         virtual void AssertValid() const;
89         virtual void Dump(CDumpContext& dc) const;
90 #endif
91
92 protected:
93         Handle_V3d_View          myView;
94     CurAction3d                  myCurrentMode;
95     Standard_Integer     myXmin;
96     Standard_Integer     myYmin;  
97     Standard_Integer     myXmax;
98     Standard_Integer     myYmax;
99     Quantity_Factor      myCurZoom;
100     Standard_Boolean     myDegenerateModeIsOn;
101         Standard_Integer         myWidth;
102         Standard_Integer         myHeight;
103
104         enum LineStyle { Solid, Dot, ShortDash, LongDash, Default };
105         CPen*  m_Pen;
106
107     virtual void DrawRectangle (const Standard_Integer  MinX  ,
108                                                 const Standard_Integer  MinY  ,
109                                 const Standard_Integer  MaxX  ,
110                                                 const Standard_Integer  MaxY  ,
111                                                     const Standard_Boolean  Draw  ,
112                                 const LineStyle aLineStyle = Default  );
113 };
114
115 #ifndef _DEBUG  // debug version in OCC_3dView.cpp
116 inline OCC_3dDoc* OCC_3dView::GetDocument()
117    { return (OCC_3dDoc*)m_pDocument; }
118 #endif
119
120 #endif // !defined(AFX_OCC_3DVIEW_H__1F4065AE_39C4_11D7_8611_0060B0EE281E__INCLUDED_)