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 vtkCarbonRenderWindow does not work in 64 bit
38 #endif
39 
40 #include "vtkOpenGLRenderWindow.h"
41 
42 // The 10.3.9 SDK (and older probably) have a bug in fp.h (in the Carbon
43 // umbrella framework) which this works around. Without this, there
44 // would be a compile error from the Carbon header if Python wrappings
45 // were enabled.
46 #include <AvailabilityMacros.h> // Needed for MAC_OS_X_VERSION_MAX_ALLOWED
47 #if MAC_OS_X_VERSION_MAX_ALLOWED < 1040
48  #define scalb scalbn
49 #endif
50 
51 #include <Carbon/Carbon.h> // Carbon and Mac specific
52 #include <AGL/agl.h> // Carbon and Mac specific
53 
54 class vtkCarbonRenderWindowInternal;
55 
56 
58 {
59 public:
60  static vtkCarbonRenderWindow *New();
62  void PrintSelf(ostream& os, vtkIndent indent);
63 
65  void Start();
66 
68  void Frame();
69 
71  virtual void WindowConfigure();
72 
74  virtual void WindowInitialize();
75 
80  virtual void Initialize();
81 
86  virtual void Finalize();
87 
89  void SetOffScreenRendering(int);
90 
92  virtual void SetFullScreen(int);
93 
95  virtual void WindowRemap();
96 
98  virtual void PrefFullScreen();
99 
101 
102  virtual void SetSize(int a[2]);
103  virtual void SetSize(int,int);
105 
107  virtual int *GetSize();
108 
110 
111  virtual void SetPosition(int*);
112  virtual void SetPosition(int,int);
114 
116  virtual int *GetScreenSize();
117 
119  virtual int *GetPosition();
120 
123  virtual void SetWindowName(const char *);
124 
126  void SetWindowInfo(char *);
127 
128  void SetNextWindowInfo(char *)
129  {
130  vtkWarningMacro("SetNextWindowInfo not implemented (WindowRemap not implemented).");
131  }
132 
133  //BTX
134  virtual void *GetGenericDisplayId() {return NULL;}
135  virtual void *GetGenericWindowId() {return (void *)this->WindowId;}
136  virtual void *GetGenericParentId() {return (void *)this->ParentId;}
137  virtual AGLContext GetContextId();
138  virtual void *GetGenericContext() {return (void*)this->GetContextId();}
139  virtual void SetDisplayId(void *) {}
140 
141  virtual void* GetGenericDrawable()
142  {
143  vtkWarningMacro("GetGenericDrawable Method not implemented.");
144  return 0;
145  }
146 
147  void SetParentInfo(char*)
148  {
149  vtkWarningMacro("SetParentInfo Method not implemented.");
150  }
151 
153 
154  virtual HIViewRef GetWindowId();
155  // Set the HIView window pointer.
156  void SetWindowId(void *foo) {this->SetWindowId((HIViewRef)foo);};
157  void SetNextWindowId(void*)
158  {
159  vtkWarningMacro("SetNextWindowId not implemented (WindowRemap not implemented).");
160  }
162 
164 
165  virtual void SetParentId(HIViewRef);
166  void SetParentId(void *foo) {this->SetParentId((HIViewRef)foo);};
168 
170  virtual void SetWindowId(HIViewRef);
171 
173 
174  void SetRootWindow(WindowPtr win);
175  WindowPtr GetRootWindow();
177 
178  //ETX
179 
180  // supply base class virtual function
181  vtkSetMacro(MultiSamples,int);
182  vtkGetMacro(MultiSamples,int);
183 
188  virtual void SetStereoCapableWindow(int capable);
189 
191  void MakeCurrent();
192 
195  virtual bool IsCurrent();
196 
200  void SetForceMakeCurrent();
201 
204  virtual int IsDirect();
205 
208  virtual int GetEventPending();
209 
211  int GetDepthBufferSize();
212 
214 
216  void HideCursor();
217  void ShowCursor();
219 
220  void UpdateSizeAndPosition(int xPos, int yPos, int xSize, int ySize);
221 
224  void UpdateGLRegion();
225 
226 
227 protected:
230 
231  vtkCarbonRenderWindowInternal* Internal;
232 
233  int ApplicationInitialized; // Toolboxen initialized?
234  GLint aglAttributes[64]; // input: pixel format attributes always required
235  // (reset to what was actually allocated)
236  AGLContext ContextId;
237  HIViewRef WindowId;
238  HIViewRef ParentId;
239  WindowPtr RootWindow;
241  int ScreenSize[2];
242 
245 
246 
247  // data and handlers to keep the GL view coincident with the HIView
248  EventHandlerUPP RegionEventHandlerUPP;
249  EventHandlerRef RegionEventHandler;
250  static OSStatus RegionEventProcessor(EventHandlerCallRef er,
251  EventRef event,
252  void*);
253 
254  void InitializeApplication();
255 
256  void CreateAWindow();
257  void DestroyWindow();
258 
259  void CreateOffScreenWindow(int x, int y);
260  void DestroyOffScreenWindow();
261  void ResizeOffScreenWindow(int x, int y);
262 
263 private:
264  vtkCarbonRenderWindow(const vtkCarbonRenderWindow&); // Not implemented.
265  void operator=(const vtkCarbonRenderWindow&); // Not implemented.
266 };
267 
268 #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:37
virtual void DestroyWindow()=0
virtual void MakeCurrent()=0
EventHandlerUPP RegionEventHandlerUPP
virtual int * GetPosition()
virtual void Frame()=0
#define VTK_RENDERING_EXPORT
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()