cf8ea1bfb691acc50331ce4e05c319918b8fd18e
[occt.git] / samples / mfc / occtdemo / Common / WNT / OCCDemoView.h
1 // OCCDemoView.h : interface of the COCCDemoView class
2 //
3 /////////////////////////////////////////////////////////////////////////////
4
5 #if !defined(AFX_OCCDEMOVIEW_H__57A6A230_7B4F_11D5_BA4A_0060B0EE18EA__INCLUDED_)
6 #define AFX_OCCDEMOVIEW_H__57A6A230_7B4F_11D5_BA4A_0060B0EE18EA__INCLUDED_
7
8 #if _MSC_VER > 1000
9 #pragma once
10 #endif // _MSC_VER > 1000
11
12 enum View3D_CurrentAction { 
13   CurAction3d_Nothing,
14   CurAction3d_DynamicZooming,
15   CurAction3d_WindowZooming,
16   CurAction3d_DynamicPanning,
17   CurAction3d_GlobalPanning,
18   CurAction3d_DynamicRotation
19 };
20
21 class COCCDemoView : public CView
22 {
23 protected: // create from serialization only
24         COCCDemoView();
25         DECLARE_DYNCREATE(COCCDemoView)
26
27 // Attributes
28 public:
29         COCCDemoDoc* GetDocument();
30
31 // Operations
32 public:
33   void InitButtons();
34   void Reset();
35   void FitAll() {   myView->FitAll();  myView->ZFitAll();  };
36   void GetViewCenter(V3d_Coordinate& Xc, V3d_Coordinate& Yc);
37   void SetViewCenter(const V3d_Coordinate Xc, const V3d_Coordinate Yc);
38   void GetViewEye(V3d_Coordinate& X, V3d_Coordinate& Y, V3d_Coordinate& Z);
39   void SetViewEye(const V3d_Coordinate X,const V3d_Coordinate Y,const V3d_Coordinate Z);
40   Quantity_Factor GetViewScale();
41   void SetViewScale(const Quantity_Factor Coef);
42
43
44 // Overrides
45         // ClassWizard generated virtual function overrides
46         //{{AFX_VIRTUAL(COCCDemoView)
47         public:
48         virtual void OnDraw(CDC* pDC);  // overridden to draw this view
49         virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
50         virtual void OnInitialUpdate();
51         protected:
52         //}}AFX_VIRTUAL
53
54 // Implementation
55 public:
56         virtual ~COCCDemoView();
57 #ifdef _DEBUG
58         virtual void AssertValid() const;
59         virtual void Dump(CDumpContext& dc) const;
60 #endif
61
62 protected:
63
64 // Generated message map functions
65 protected:
66         //{{AFX_MSG(COCCDemoView)
67         afx_msg void OnBUTTONAxo();
68         afx_msg void OnBUTTONBack();
69         afx_msg void OnBUTTONBottom();
70         afx_msg void OnBUTTONFront();
71         afx_msg void OnBUTTONHlrOn();
72         afx_msg void OnBUTTONLeft();
73         afx_msg void OnBUTTONPan();
74         afx_msg void OnBUTTONPanGlo();
75         afx_msg void OnBUTTONReset();
76         afx_msg void OnBUTTONRight();
77         afx_msg void OnBUTTONRot();
78         afx_msg void OnBUTTONTop();
79         afx_msg void OnBUTTONZoomAll();
80         afx_msg void OnSize(UINT nType, int cx, int cy);
81         afx_msg void OnBUTTONZoomProg();
82         afx_msg void OnBUTTONZoomWin();
83         afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
84         afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
85         afx_msg void OnMouseMove(UINT nFlags, CPoint point);
86         afx_msg void OnRButtonDown(UINT nFlags, CPoint point);
87         afx_msg void OnRButtonUp(UINT nFlags, CPoint point);
88         afx_msg void OnUpdateBUTTONPanGlo(CCmdUI* pCmdUI);
89         afx_msg void OnUpdateBUTTONPan(CCmdUI* pCmdUI);
90         afx_msg void OnUpdateBUTTONZoomProg(CCmdUI* pCmdUI);
91         afx_msg void OnUpdateBUTTONZoomWin(CCmdUI* pCmdUI);
92         afx_msg void OnUpdateBUTTONRot(CCmdUI* pCmdUI);
93         afx_msg void OnBUTTONWire();
94         afx_msg void OnBUTTONShade();
95         afx_msg void OnUpdateBUTTONHlrOn(CCmdUI* pCmdUI);
96         afx_msg void OnUpdateBUTTONShade(CCmdUI* pCmdUI);
97         afx_msg void OnUpdateBUTTONWire(CCmdUI* pCmdUI);
98         //}}AFX_MSG
99         DECLARE_MESSAGE_MAP()
100
101 private:
102   void RedrawVisMode();
103
104 private:
105   enum VisMode { VIS_WIREFRAME, VIS_SHADE, VIS_HLR };
106   Handle(V3d_View)     myView;
107   Handle(Graphic3d_GraphicDriver) myGraphicDriver;
108   View3D_CurrentAction myCurrentMode;
109   VisMode              myVisMode;
110   Standard_Integer     myXmin;
111   Standard_Integer     myYmin;  
112   Standard_Integer     myXmax;
113   Standard_Integer     myYmax;
114   Quantity_Factor      myCurZoom;
115
116 private:
117   enum LineStyle { Solid, Dot, ShortDash, LongDash, Default };
118   CPen*  m_Pen;
119   virtual void DrawRectangle (const Standard_Integer  MinX  ,
120                               const Standard_Integer  MinY  ,
121                               const Standard_Integer  MaxX  ,
122                               const Standard_Integer  MaxY  ,
123                               const Standard_Boolean  Draw  ,
124                               const LineStyle aLineStyle = Default  );
125
126 };
127
128 #ifndef _DEBUG  // debug version in OCCDemoView.cpp
129 inline COCCDemoDoc* COCCDemoView::GetDocument()
130    { return (COCCDemoDoc*)m_pDocument; }
131 #endif
132
133 /////////////////////////////////////////////////////////////////////////////
134
135 //{{AFX_INSERT_LOCATION}}
136 // Microsoft Visual C++ will insert additional declarations immediately before the previous line.
137
138 #endif // !defined(AFX_OCCDEMOVIEW_H__57A6A230_7B4F_11D5_BA4A_0060B0EE18EA__INCLUDED_)