VTK
vtkCarbonRenderWindow.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3 Program: Visualization Toolkit
4 Module: vtkCarbonRenderWindow.h
5 
6 Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7 All rights reserved.
8 See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9 
10 This software is distributed WITHOUT ANY WARRANTY; without even
11 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12 PURPOSE. See the above copyright notice for more information.
13 
14 =========================================================================*/
33 #ifndef vtkCarbonRenderWindow_h
34 #define vtkCarbonRenderWindow_h
35 
36 #if defined(__LP64__) && __LP64__
37  #error VTK_USE_CARBON cannot work in 64 bit; use VTK_USE_COCOA instead.
38 #endif
39 #if defined(MAC_OS_X_VERSION_MAX_ALLOWED) && (MAC_OS_X_VERSION_MAX_ALLOWED >= 1070)
40  #error VTK_USE_CARBON cannot work with the OS X 10.7 SDK or later; use VTK_USE_COCOA instead.
41 #endif
42 
43 #include "vtkRenderingOpenGLModule.h" // For export macro
44 #include "vtkOpenGLRenderWindow.h"
45 
46 #include <Carbon/Carbon.h> // Carbon and Mac specific
47 #include <AGL/agl.h> // Carbon and Mac specific
48 
49 class vtkCarbonRenderWindowInternal;
50 
51 
53 {
54 public:
55  static vtkCarbonRenderWindow *New();
57  void PrintSelf(ostream& os, vtkIndent indent);
58 
60  void Start();
61 
63  void Frame();
64 
66  virtual void WindowConfigure();
67 
69  virtual void WindowInitialize();
70 
75  virtual void Initialize();
76 
81  virtual void Finalize();
82 
84  void SetOffScreenRendering(int);
85 
87  virtual void SetFullScreen(int);
88 
90  virtual void WindowRemap();
91 
93  virtual void PrefFullScreen();
94 
96 
97  virtual void SetSize(int a[2]);
98  virtual void SetSize(int,int);
100 
102  virtual int *GetSize();
103 
105 
106  virtual void SetPosition(int a[2]);
107  virtual void SetPosition(int,int);
109 
111  virtual int *GetScreenSize();
112 
114  virtual int *GetPosition();
115 
118  virtual void SetWindowName(const char *);
119 
121  void SetWindowInfo(char *);
122 
123  void SetNextWindowInfo(char *)
124  {
125  vtkWarningMacro("SetNextWindowInfo not implemented (WindowRemap not implemented).");
126  }
127 
128  //BTX
129  virtual void *GetGenericDisplayId() {return NULL;}
130  virtual void *GetGenericWindowId() {return (void *)this->WindowId;}
131  virtual void *GetGenericParentId() {return (void *)this->ParentId;}
132  virtual AGLContext GetContextId();
133  virtual void *GetGenericContext() {return (void*)this->GetContextId();}
134  virtual void SetDisplayId(void *) {}
135 
136  virtual void* GetGenericDrawable()
137  {
138  vtkWarningMacro("GetGenericDrawable Method not implemented.");
139  return 0;
140  }
141 
142  void SetParentInfo(char*)
143  {
144  vtkWarningMacro("SetParentInfo Method not implemented.");
145  }
146 
148 
149  virtual HIViewRef GetWindowId();
150  // Set the HIView window pointer.
151  void SetWindowId(void *foo) {this->SetWindowId((HIViewRef)foo);};
152  void SetNextWindowId(void*)
153  {
154  vtkWarningMacro("SetNextWindowId not implemented (WindowRemap not implemented).");
155  }
157 
159 
160  virtual void SetParentId(HIViewRef);
161  void SetParentId(void *foo) {this->SetParentId((HIViewRef)foo);};
163 
165  virtual void SetWindowId(HIViewRef);
166 
168 
169  void SetRootWindow(WindowPtr win);
170  WindowPtr GetRootWindow();
172 
173  //ETX
174 
175  // supply base class virtual function
176  vtkSetMacro(MultiSamples,int);
177  vtkGetMacro(MultiSamples,int);
178 
183  virtual void SetStereoCapableWindow(int capable);
184 
186  void MakeCurrent();
187 
190  virtual bool IsCurrent();
191 
195  void SetForceMakeCurrent();
196 
199  virtual int IsDirect();
200 
203  virtual int GetEventPending();
204 
206  int GetDepthBufferSize();
207 
209 
211  void HideCursor();
212  void ShowCursor();
214 
215  void UpdateSizeAndPosition(int xPos, int yPos, int xSize, int ySize);
216 
219  void UpdateGLRegion();
220 
221 
222 protected:
225 
226  vtkCarbonRenderWindowInternal* Internal;
227 
228  int ApplicationInitialized; // Toolboxen initialized?
229  GLint aglAttributes[64]; // input: pixel format attributes always required
230  // (reset to what was actually allocated)
231  AGLContext ContextId;
232  HIViewRef WindowId;
233  HIViewRef ParentId;
234  WindowPtr RootWindow;
236  int ScreenSize[2];
237 
240 
241 
242  // data and handlers to keep the GL view coincident with the HIView
243  EventHandlerUPP RegionEventHandlerUPP;
244  EventHandlerRef RegionEventHandler;
245  static OSStatus RegionEventProcessor(EventHandlerCallRef er,
246  EventRef event,
247  void*);
248 
249  void InitializeApplication();
250 
251  void CreateAWindow();
252  void DestroyWindow();
253 
254  void CreateOffScreenWindow(int x, int y);
255  void DestroyOffScreenWindow();
256  void ResizeOffScreenWindow(int x, int y);
257 
258 private:
259  vtkCarbonRenderWindow(const vtkCarbonRenderWindow&); // Not implemented.
260  void operator=(const vtkCarbonRenderWindow&); // Not implemented.
261 };
262 
263 #endif
OpenGL rendering window.
virtual void SetOffScreenRendering(int)
virtual void Finalize()=0
virtual void SetForceMakeCurrent()
virtual void SetWindowInfo(char *)=0
virtual void * GetGenericDrawable()
virtual void WindowRemap()=0
virtual void * GetGenericWindowId()
void PrintSelf(ostream &os, vtkIndent indent)
virtual void HideCursor()=0
static vtkRenderWindow * New()
virtual int * GetScreenSize()=0
vtkCarbonRenderWindowInternal * Internal
virtual void SetWindowId(void *)=0
virtual void SetFullScreen(int)=0
virtual int GetEventPending()=0
virtual void SetSize(int, int)
virtual void SetStereoCapableWindow(int capable)
virtual int IsDirect()
virtual bool IsCurrent()=0
virtual void SetParentId(void *)=0
a simple class to control print indentation
Definition: vtkIndent.h:38
virtual void DestroyWindow()=0
#define VTKRENDERINGOPENGL_EXPORT
virtual void MakeCurrent()=0
EventHandlerUPP RegionEventHandlerUPP
virtual int * GetPosition()
virtual void Frame()=0
virtual void * GetGenericContext()
virtual int * GetSize()
virtual void SetDisplayId(void *)
virtual void * GetGenericDisplayId()
Carbon OpenGL rendering window.
virtual void Start()=0
virtual void SetWindowName(const char *)
virtual void SetPosition(int, int)
virtual void CreateAWindow()=0
EventHandlerRef RegionEventHandler
virtual void ShowCursor()=0
virtual void * GetGenericParentId()