OSDN Git Service

FIRST REPOSITORY
[eos/hostdependOTHERS.git] / HP / util / HP / include / vtk / vtkMFCInteractor.h
1 /*=========================================================================
2
3   Program:   Visualization Toolkit
4   Module:    $RCSfile: vtkMFCInteractor.h,v $
5   Language:  C++
6   Date:      $Date: 2002/02/01 06:33:18 $
7   Version:   $Revision: 1.1.1.1 $
8   Thanks:    to Horst Schreiber for developing this MFC code
9
10   
11 Copyright (c) 1993-1998 Ken Martin, Will Schroeder, Bill Lorensen.
12
13 This software is copyrighted by Ken Martin, Will Schroeder and Bill Lorensen.
14 The following terms apply to all files associated with the software unless
15 explicitly disclaimed in individual files. This copyright specifically does
16 not apply to the related textbook "The Visualization Toolkit" ISBN
17 013199837-4 published by Prentice Hall which is covered by its own copyright.
18
19 The authors hereby grant permission to use, copy, and distribute this
20 software and its documentation for any purpose, provided that existing
21 copyright notices are retained in all copies and that this notice is included
22 verbatim in any distributions. Additionally, the authors grant permission to
23 modify this software and its documentation for any purpose, provided that
24 such modifications are not distributed without the explicit consent of the
25 authors and that existing copyright notices are retained in all copies. Some
26 of the algorithms implemented by this software are patented, observe all
27 applicable patent law.
28
29 IN NO EVENT SHALL THE AUTHORS OR DISTRIBUTORS BE LIABLE TO ANY PARTY FOR
30 DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT
31 OF THE USE OF THIS SOFTWARE, ITS DOCUMENTATION, OR ANY DERIVATIVES THEREOF,
32 EVEN IF THE AUTHORS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33
34 THE AUTHORS AND DISTRIBUTORS SPECIFICALLY DISCLAIM ANY WARRANTIES, INCLUDING,
35 BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
36 PARTICULAR PURPOSE, AND NON-INFRINGEMENT.  THIS SOFTWARE IS PROVIDED ON AN
37 "AS IS" BASIS, AND THE AUTHORS AND DISTRIBUTORS HAVE NO OBLIGATION TO PROVIDE
38 MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
39
40
41 =========================================================================*/
42 // .NAME vtkMFCInteractor - provide an event driven interface 
43 // to the renderer
44 // .SECTION Description
45 // vtkMFCInteractor is a convenience object that provides event 
46 // event bindings to common graphics functions. For example, camera
47 // zoom-in/zoom-out, azimuth, and roll. It is one of the window system
48 // specific subclasses of vtkRenderWindowInteractor.
49
50 // .SECTION see also
51 // vtkRenderWindowInteractor vtkWin32OpenGLRenderWindow
52
53 // .SECTION Event Bindings
54 // Mouse bindings: Button 1 - rotate, Button 2 - pan, Button 3 - zoom
55 // The distance from the center of the renderer viewport determines
56 // how quickly to rotate, pan and zoom.
57 // Keystrokes:
58 //    r - reset camera view
59 //    w - turn all actors wireframe
60 //    s - turn all actors surface
61 //    e - exits
62
63
64 #ifndef __vtkMFCInteractor_h
65 #define __vtkMFCInteractor_h
66
67 #include "vtkWin32Header.h"
68 #include "vtkRenderWindowInteractor.h"
69
70 #define HDIB HANDLE
71
72 class VTK_EXPORT vtkMFCInteractor : public vtkRenderWindowInteractor
73 {
74 public:
75   vtkMFCInteractor();
76   ~vtkMFCInteractor();
77   static vtkMFCInteractor *New() {return new vtkMFCInteractor;};
78   const char *GetClassName() {return "vtkMFCInteractor";};
79   void PrintSelf(ostream& os, vtkIndent indent);
80   
81   virtual void Initialize();
82   virtual void Start();
83
84   //BTX
85
86   // Description: 
87   // Various methods that a MFCView class can forward
88   // to this class to be handled. The methods basically
89   // parallel their MFCView counterparts.
90   void OnMouseMove(CWnd *,UINT nFlags, CPoint point);
91   void OnRButtonDown(CWnd *,UINT nFlags, CPoint point);
92   void OnRButtonUp(CWnd *,UINT nFlags, CPoint point);
93   void OnLButtonDown(CWnd *,UINT nFlags, CPoint point);
94   void OnLButtonUp(CWnd *,UINT nFlags, CPoint point);
95   void OnSize(CWnd *,UINT nType, int cx, int cy);
96   void OnTimer(CWnd *,UINT);
97   void OnChar(CWnd *,UINT nChar, UINT nRepCnt, UINT nFlags);
98
99   void UpdateSize(int cx,int cy);
100
101   void Update();
102   void DescribePixelFormat(HDC hDC,DWORD,int);
103   void Update2(HDC hDC);
104   void BitBlt(CDC *pDC,int x_position,int y_position);
105   HBITMAP GetBitmap();
106   HDIB GetDIB();
107   void GetBitmapInfo(LPBITMAPINFOHEADER);
108   void SetupLogicalPalette(void);
109   void DoPalette(HDC hDC);
110   HDIB GetDIB(int width, int height, int bitsperpixel);
111   BOOL StretchDIB(CDC *pDC,int x_position,int y_position, int x_width, int y_width,
112                                                          int width, int height, int bitsperpixel);
113   BOOL SaveBMP(LPCTSTR lpszPathName,int width, int height, int bitsperpixel);
114   void Initialize(HWND hwnd, CRect *rcBounds,vtkRenderWindow *renw);
115 #ifdef TIMER
116   void StartTiming(int count);
117   void StopTiming();
118   void OnEnterIdle();
119 #endif
120
121
122 protected:
123   HANDLE Mutex;
124   HWND  WindowId;
125   UINT  TimerId;
126   int   WindowLeft;
127   int   WindowTop;
128   int   WindowWidth;
129   int   WindowHeight;
130   HGLRC WindowRC;
131   CDC  *MemoryDC;
132   HWND  WindowHandle;
133   HDC   WindowDC;
134   HBITMAP WindowBitmap;
135   HBITMAP OldBitmap;    
136   CRect  WindowRectangle;
137   CPoint LastPosition;
138   unsigned int MiliSeconds;
139   vtkRenderWindow *RenderWindow;
140   HPALETTE WindowPalette;
141   void MakeDirectRenderer(HWND hwnd, CRect *rcBounds,vtkRenderWindow *renw);
142   void MakeIndirectRenderer(int,int,int,vtkRenderWindow *);
143   void CreateBMPFile(HWND hwnd, LPTSTR pszFile, PBITMAPINFO pbi,HBITMAP hBMP, HDC hDC);
144   PBITMAPINFO CreateBitmapInfoStruct(HWND hwnd, HBITMAP hBmp);
145   //ETX
146 };
147
148 #endif
149
150