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:
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 
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 
196 
199  virtual int IsDirect();
200 
203  virtual int GetEventPending();
204 
207 
209 
211  void HideCursor();
212  void ShowCursor();
214 
215  void UpdateSizeAndPosition(int xPos, int yPos, int xSize, int ySize);
216 
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 
250 
253 
254  void CreateOffScreenWindow(int x, int y);
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
vtkCarbonRenderWindow::GetGenericParentId
virtual void * GetGenericParentId()
Definition: vtkCarbonRenderWindow.h:131
vtkCarbonRenderWindow::GetRootWindow
WindowPtr GetRootWindow()
vtkCarbonRenderWindow::RegionEventHandler
EventHandlerRef RegionEventHandler
Definition: vtkCarbonRenderWindow.h:244
vtkCarbonRenderWindow::IsDirect
virtual int IsDirect()
vtkCarbonRenderWindow::WindowInitialize
virtual void WindowInitialize()
vtkCarbonRenderWindow::GetContextId
virtual AGLContext GetContextId()
vtkCarbonRenderWindow::SetParentId
virtual void SetParentId(HIViewRef)
vtkCarbonRenderWindow::New
static vtkCarbonRenderWindow * New()
vtkCarbonRenderWindow::InitializeApplication
void InitializeApplication()
vtkCarbonRenderWindow::SetNextWindowInfo
void SetNextWindowInfo(char *)
Definition: vtkCarbonRenderWindow.h:123
vtkCarbonRenderWindow::SetWindowName
virtual void SetWindowName(const char *)
vtkRenderingOpenGLModule.h
vtkCarbonRenderWindow::SetParentId
void SetParentId(void *foo)
Definition: vtkCarbonRenderWindow.h:161
vtkCarbonRenderWindow::SetWindowInfo
void SetWindowInfo(char *)
vtkTypeMacro
#define vtkTypeMacro(thisClass, superclass)
Definition: vtkSetGet.h:642
vtkCarbonRenderWindow::SetNextWindowId
void SetNextWindowId(void *)
Definition: vtkCarbonRenderWindow.h:152
vtkgl::x
GLint GLint GLint GLint GLint x
Definition: vtkgl.h:11318
vtkCarbonRenderWindow::ContextId
AGLContext ContextId
Definition: vtkCarbonRenderWindow.h:231
vtkCarbonRenderWindow::WindowRemap
virtual void WindowRemap()
vtkCarbonRenderWindow::DestroyOffScreenWindow
void DestroyOffScreenWindow()
vtkCarbonRenderWindow::WindowConfigure
virtual void WindowConfigure()
vtkgl::event
struct _cl_event * event
Definition: vtkgl.h:14387
vtkCarbonRenderWindow::IsCurrent
virtual bool IsCurrent()
vtkCarbonRenderWindow::GetGenericWindowId
virtual void * GetGenericWindowId()
Definition: vtkCarbonRenderWindow.h:130
vtkCarbonRenderWindow::OwnWindow
int OwnWindow
Definition: vtkCarbonRenderWindow.h:235
vtkCarbonRenderWindow::PrefFullScreen
virtual void PrefFullScreen()
vtkCarbonRenderWindow::SetPosition
virtual void SetPosition(int, int)
vtkCarbonRenderWindow::SetOffScreenRendering
void SetOffScreenRendering(int)
vtkCarbonRenderWindow::UpdateSizeAndPosition
void UpdateSizeAndPosition(int xPos, int yPos, int xSize, int ySize)
vtkOpenGLRenderWindow.h
vtkCarbonRenderWindow::GetGenericDrawable
virtual void * GetGenericDrawable()
Definition: vtkCarbonRenderWindow.h:136
vtkCarbonRenderWindow::HideCursor
void HideCursor()
vtkCarbonRenderWindow::Initialize
virtual void Initialize()
vtkCarbonRenderWindow::vtkCarbonRenderWindow
vtkCarbonRenderWindow()
vtkCarbonRenderWindow::ParentId
HIViewRef ParentId
Definition: vtkCarbonRenderWindow.h:233
vtkCarbonRenderWindow::UpdateGLRegion
void UpdateGLRegion()
vtkCarbonRenderWindow::SetWindowId
void SetWindowId(void *foo)
Definition: vtkCarbonRenderWindow.h:151
vtkCarbonRenderWindow::GetWindowId
virtual HIViewRef GetWindowId()
vtkCarbonRenderWindow::MakeCurrent
void MakeCurrent()
vtkCarbonRenderWindow::ApplicationInitialized
int ApplicationInitialized
Definition: vtkCarbonRenderWindow.h:228
vtkCarbonRenderWindow::WindowId
HIViewRef WindowId
Definition: vtkCarbonRenderWindow.h:232
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:39
vtkCarbonRenderWindow::GetPosition
virtual int * GetPosition()
vtkCarbonRenderWindow::GetGenericDisplayId
virtual void * GetGenericDisplayId()
Definition: vtkCarbonRenderWindow.h:129
vtkCarbonRenderWindow::Start
void Start()
vtkCarbonRenderWindow::GetScreenSize
virtual int * GetScreenSize()
vtkCarbonRenderWindow::SetFullScreen
virtual void SetFullScreen(int)
vtkCarbonRenderWindow::DestroyWindow
void DestroyWindow()
vtkCarbonRenderWindow::SetForceMakeCurrent
void SetForceMakeCurrent()
vtkCarbonRenderWindow::SetStereoCapableWindow
virtual void SetStereoCapableWindow(int capable)
vtkGetMacro
#define vtkGetMacro(name, type)
Definition: vtkSetGet.h:93
vtkCarbonRenderWindow::SetDisplayId
virtual void SetDisplayId(void *)
Definition: vtkCarbonRenderWindow.h:134
vtkCarbonRenderWindow::Frame
void Frame()
vtkgl::a
GLboolean GLboolean GLboolean GLboolean a
Definition: vtkgl.h:12312
vtkgl::GLint
typedef GLint(APIENTRYP PFNGLGETATTRIBLOCATIONPROC)(GLuint program
vtkCarbonRenderWindow::RegionEventProcessor
static OSStatus RegionEventProcessor(EventHandlerCallRef er, EventRef event, void *)
vtkCarbonRenderWindow::GetEventPending
virtual int GetEventPending()
vtkCarbonRenderWindow::GetSize
virtual int * GetSize()
vtkSetMacro
vtkSetMacro(IgnoreDriverBugs, bool)
vtkCarbonRenderWindow::SetSize
virtual void SetSize(int a[2])
vtkCarbonRenderWindow::CreateOffScreenWindow
void CreateOffScreenWindow(int x, int y)
vtkCarbonRenderWindow::GetGenericContext
virtual void * GetGenericContext()
Definition: vtkCarbonRenderWindow.h:133
vtkgl::y
GLint GLint GLint GLint GLint GLint y
Definition: vtkgl.h:11318
vtkCarbonRenderWindow::SetSize
virtual void SetSize(int, int)
vtkCarbonRenderWindow::GetDepthBufferSize
int GetDepthBufferSize()
vtkCarbonRenderWindow::Internal
vtkCarbonRenderWindowInternal * Internal
Definition: vtkCarbonRenderWindow.h:226
vtkCarbonRenderWindow::SetRootWindow
void SetRootWindow(WindowPtr win)
vtkCarbonRenderWindow::RootWindow
WindowPtr RootWindow
Definition: vtkCarbonRenderWindow.h:234
vtkOpenGLRenderWindow
OpenGL rendering window.
Definition: vtkOpenGLRenderWindow.h:41
vtkCarbonRenderWindow::Finalize
virtual void Finalize()
vtkCarbonRenderWindow::ForceMakeCurrent
int ForceMakeCurrent
Definition: vtkCarbonRenderWindow.h:239
vtkCarbonRenderWindow::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent)
vtkWarningMacro
#define vtkWarningMacro(x)
Definition: vtkSetGet.h:471
vtkCarbonRenderWindow::SetWindowId
virtual void SetWindowId(HIViewRef)
vtkCarbonRenderWindow::ResizeOffScreenWindow
void ResizeOffScreenWindow(int x, int y)
vtkCarbonRenderWindow
Carbon OpenGL rendering window.
Definition: vtkCarbonRenderWindow.h:53
vtkCarbonRenderWindow::CreateAWindow
void CreateAWindow()
vtkCarbonRenderWindow::ShowCursor
void ShowCursor()
vtkCarbonRenderWindow::CursorHidden
int CursorHidden
Definition: vtkCarbonRenderWindow.h:238
vtkCarbonRenderWindow::RegionEventHandlerUPP
EventHandlerUPP RegionEventHandlerUPP
Definition: vtkCarbonRenderWindow.h:243
vtkCarbonRenderWindow::SetParentInfo
void SetParentInfo(char *)
Definition: vtkCarbonRenderWindow.h:142
vtkCarbonRenderWindow::~vtkCarbonRenderWindow
~vtkCarbonRenderWindow()
VTKRENDERINGOPENGL_EXPORT
#define VTKRENDERINGOPENGL_EXPORT
Definition: vtkRenderingOpenGLModule.h:15
vtkCarbonRenderWindow::SetPosition
virtual void SetPosition(int a[2])