1 /*=========================================================================
3 Program: Visualization Toolkit
4 Module: $RCSfile: vtkMFCInteractor.h,v $
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
11 Copyright (c) 1993-1998 Ken Martin, Will Schroeder, Bill Lorensen.
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.
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.
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.
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.
41 =========================================================================*/
42 // .NAME vtkMFCInteractor - provide an event driven interface
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.
51 // vtkRenderWindowInteractor vtkWin32OpenGLRenderWindow
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.
58 // r - reset camera view
59 // w - turn all actors wireframe
60 // s - turn all actors surface
64 #ifndef __vtkMFCInteractor_h
65 #define __vtkMFCInteractor_h
67 #include "vtkWin32Header.h"
68 #include "vtkRenderWindowInteractor.h"
72 class VTK_EXPORT vtkMFCInteractor : public vtkRenderWindowInteractor
77 static vtkMFCInteractor *New() {return new vtkMFCInteractor;};
78 const char *GetClassName() {return "vtkMFCInteractor";};
79 void PrintSelf(ostream& os, vtkIndent indent);
81 virtual void Initialize();
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);
99 void UpdateSize(int cx,int cy);
102 void DescribePixelFormat(HDC hDC,DWORD,int);
103 void Update2(HDC hDC);
104 void BitBlt(CDC *pDC,int x_position,int y_position);
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);
116 void StartTiming(int count);
134 HBITMAP WindowBitmap;
136 CRect WindowRectangle;
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);