VTK
vtkCocoaRenderWindow.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3 Program: Visualization Toolkit
4 Module: vtkCocoaRenderWindow.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 =========================================================================*/
42 #ifndef vtkCocoaRenderWindow_h
43 #define vtkCocoaRenderWindow_h
44 
45 #include "vtkRenderingOpenGLModule.h" // For export macro
46 #include "vtkOpenGLRenderWindow.h"
47 
48 class VTKRENDERINGOPENGL_EXPORT vtkCocoaRenderWindow : public vtkOpenGLRenderWindow
49 {
50 public:
51  static vtkCocoaRenderWindow *New();
53  void PrintSelf(ostream& os, vtkIndent indent) VTK_OVERRIDE;
54 
58  void Start() VTK_OVERRIDE;
59 
63  void Frame() VTK_OVERRIDE;
64 
68  virtual void WindowConfigure();
69 
78  virtual void Initialize();
79 
86  void SetFullScreen(int) VTK_OVERRIDE;
87 
91  void WindowRemap() VTK_OVERRIDE;
92 
97  virtual void PrefFullScreen();
98 
100 
103  void SetSize(int a[2]) VTK_OVERRIDE;
104  void SetSize(int,int) VTK_OVERRIDE;
106 
110  int *GetSize() VTK_OVERRIDE;
111 
113 
116  void SetPosition(int a[2]) VTK_OVERRIDE;
117  void SetPosition(int,int) VTK_OVERRIDE;
119 
123  int *GetScreenSize() VTK_OVERRIDE;
124 
128  int *GetPosition() VTK_OVERRIDE;
129 
134  void SetWindowName(const char *) VTK_OVERRIDE;
135 
136  void SetNextWindowInfo(char *) VTK_OVERRIDE
137  {
138  vtkWarningMacro("SetNextWindowInfo not implemented (WindowRemap not implemented).");
139  }
140  void* GetGenericDrawable() VTK_OVERRIDE
141  {
142  vtkWarningMacro("Method not implemented.");
143  return 0;
144  }
145  void SetDisplayId(void*) VTK_OVERRIDE
146  {
147  vtkWarningMacro("Method not implemented.");
148  }
149  void *GetGenericDisplayId() VTK_OVERRIDE
150  {
151  vtkWarningMacro("Method not implemented.");
152  return 0;
153  }
154 
160  void SetWindowInfo(char*) VTK_OVERRIDE;
161 
167  void SetParentInfo(char*) VTK_OVERRIDE;
168 
169  void SetNextWindowId(void*) VTK_OVERRIDE
170  {
171  vtkWarningMacro("SetNextWindowId not implemented (WindowRemap not implemented).");
172  }
173 
178  bool InitializeFromCurrentContext() VTK_OVERRIDE;
179 
183  void StereoUpdate() VTK_OVERRIDE;
184 
191  void SetStereoCapableWindow(int capable) VTK_OVERRIDE;
192 
196  void MakeCurrent() VTK_OVERRIDE;
197 
201  bool IsCurrent() VTK_OVERRIDE;
202 
209  bool IsDrawable() VTK_OVERRIDE;
210 
214  void UpdateContext();
215 
219  const char *ReportCapabilities() VTK_OVERRIDE;
220 
224  int SupportsOpenGL() VTK_OVERRIDE;
225 
229  int IsDirect() VTK_OVERRIDE;
230 
236  void SetForceMakeCurrent() VTK_OVERRIDE;
237 
242  int GetEventPending() VTK_OVERRIDE;
243 
245 
248  virtual void SetupPalette(void *hDC);
249  virtual void SetupPixelFormat(void *hDC, void *dwFlags, int debug,
250  int bpp=16, int zbpp=16);
252 
256  void Finalize() VTK_OVERRIDE;
257 
261  int GetDepthBufferSize() VTK_OVERRIDE;
262 
264 
270  void HideCursor() VTK_OVERRIDE;
271  void ShowCursor() VTK_OVERRIDE;
272  void SetCursorPosition(int x, int y) VTK_OVERRIDE;
274 
278  void SetCurrentCursor(int) VTK_OVERRIDE;
279 
284  virtual int GetViewCreated();
285 
290  virtual int GetWindowCreated();
291 
293 
296  void SetContextId(void *);
297  void *GetContextId();
298  void *GetGenericContext() VTK_OVERRIDE {return this->GetContextId();}
300 
311  virtual void SetRootWindow(void *);
312 
316  virtual void *GetRootWindow();
317 
328  void SetWindowId(void *) VTK_OVERRIDE;
329 
333  virtual void *GetWindowId();
334  void *GetGenericWindowId() VTK_OVERRIDE {return this->GetWindowId();}
335 
342  void SetParentId(void *nsview) VTK_OVERRIDE;
343 
349  virtual void *GetParentId();
350  void *GetGenericParentId() VTK_OVERRIDE { return this->GetParentId(); }
351 
361  void SetWantsBestResolution(bool wantsBest);
362  bool GetWantsBestResolution();
363 
365 
368  void SetPixelFormat(void *pixelFormat);
369  void *GetPixelFormat();
371 
372 protected:
374  ~vtkCocoaRenderWindow() VTK_OVERRIDE;
375 
376  void CreateGLContext();
377 
378  void CreateAWindow() VTK_OVERRIDE;
379  void DestroyWindow() VTK_OVERRIDE;
380  void DestroyOffScreenWindow();
381 
384 
386 
390  void SetCocoaManager(void *manager);
391  void *GetCocoaManager();
393 
394  void SetCocoaServer(void *server); // Really a vtkCocoaServer*
395  void *GetCocoaServer();
396 
397 private:
398  vtkCocoaRenderWindow(const vtkCocoaRenderWindow&) VTK_DELETE_FUNCTION;
399  void operator=(const vtkCocoaRenderWindow&) VTK_DELETE_FUNCTION;
400 
401 private:
402  // Important: this class cannot contain Objective-C instance
403  // variables for 2 reasons:
404  // 1) C++ files include this header
405  // 2) because of garbage collection (the GC scanner does not scan objects create by C++'s new)
406  // Instead, use the CocoaManager dictionary to keep a collection
407  // of what would otherwise be Objective-C instance variables.
408  void *CocoaManager; // Really an NSMutableDictionary*
409 
410  int WindowCreated;
411  int ViewCreated;
412  int CursorHidden;
413 
414  int ForceMakeCurrent;
415  char *Capabilities;
416 
417  bool WantsBestResolution;
418 };
419 
420 #endif
int GetDepthBufferSize() override
Get the size of the depth buffer.
OpenGL rendering window.
virtual void Finalize()=0
Finalize the rendering process.
virtual void SetForceMakeCurrent()
If called, allow MakeCurrent() to skip cache-check when called.
void * GetGenericDrawable() override
Dummy stubs for vtkWindow API.
virtual void HideCursor()=0
Hide or Show the mouse cursor, it is nice to be able to hide the default cursor if you want VTK to di...
Cocoa OpenGL rendering window.
void SetDisplayId(void *) override
Dummy stubs for vtkWindow API.
void StereoUpdate() override
Update system if needed due to stereo rendering.
static vtkRenderWindow * New()
Construct an instance of vtkRenderWindow with its screen size set to 300x300, borders turned on...
bool InitializeFromCurrentContext() override
Initialize the render window from the information associated with the currently activated OpenGL cont...
virtual void SetCurrentCursor(int)
Change the shape of the cursor.
void SetNextWindowId(void *) override
Dummy stubs for vtkWindow API.
virtual int GetEventPending()=0
Check to see if a mouse button has been pressed.
virtual void SetStereoCapableWindow(int capable)
Prescribe that the window be created in a stereo-capable mode.
virtual int IsDirect()
Is this render window using hardware acceleration? 0-false, 1-true.
virtual bool IsCurrent()=0
Tells if this window is the current graphics context for the calling thread.
void SetWindowId(void *) override=0
Dummy stubs for vtkWindow API.
a simple class to control print indentation
Definition: vtkIndent.h:39
virtual void DestroyWindow()=0
Destroy a not-off-screen window.
void SetWindowInfo(char *) override=0
Dummy stubs for vtkWindow API.
void * GetGenericDisplayId() override
Dummy stubs for vtkWindow API.
void * GetGenericContext() override
Accessors for the OpenGL context (Really an NSOpenGLContext*).
int SupportsOpenGL() override
Does this render window support OpenGL? 0-false, 1-true.
virtual void SetCursorPosition(int, int)
Hide or Show the mouse cursor, it is nice to be able to hide the default cursor if you want VTK to di...
const char * ReportCapabilities() override
Get report of capabilities for the render window.
void SetParentId(void *) override=0
Dummy stubs for vtkWindow API.
void SetParentInfo(char *) override=0
Dummy stubs for vtkWindow API.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
void * GetGenericParentId() override
Dummy stubs for vtkWindow API.
virtual void Start()=0
Initialize the rendering process.
virtual void CreateAWindow()=0
Create a not-off-screen window.
void MakeCurrent() override=0
Attempt to make this window the current graphics context for the calling thread.
void * GetGenericWindowId() override
Dummy stubs for vtkWindow API.
virtual void ShowCursor()=0
Hide or Show the mouse cursor, it is nice to be able to hide the default cursor if you want VTK to di...
virtual bool IsDrawable()
Test if the window has a valid drawable.