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 "vtkRenderingOpenGL2Module.h" // For export macro
46 #include "vtkOpenGLRenderWindow.h"
47 
48 class VTKRENDERINGOPENGL2_EXPORT vtkCocoaRenderWindow : public vtkOpenGLRenderWindow
49 {
50 public:
51  static vtkCocoaRenderWindow *New();
53  void PrintSelf(ostream& os, vtkIndent indent);
54 
56  virtual void Start();
57 
59  virtual void Frame();
60 
62  virtual void WindowConfigure();
63 
67  virtual void Initialize();
68 
73  virtual void SetFullScreen(int);
74 
77  virtual void WindowRemap();
78 
81  virtual void PrefFullScreen();
82 
84 
85  virtual void SetSize(int a[2]);
86  virtual void SetSize(int,int);
88 
90  virtual int *GetSize();
91 
93 
94  virtual void SetPosition(int a[2]);
95  virtual void SetPosition(int,int);
97 
99  virtual int *GetScreenSize();
100 
102  virtual int *GetPosition();
103 
106  virtual void SetWindowName(const char *);
107 
108  void SetNextWindowInfo(char *)
109  {
110  vtkWarningMacro("SetNextWindowInfo not implemented (WindowRemap not implemented).");
111  }
112  virtual void* GetGenericDrawable()
113  {
114  vtkWarningMacro("Method not implemented.");
115  return 0;
116  }
117  virtual void SetDisplayId(void*)
118  {
119  vtkWarningMacro("Method not implemented.");
120  }
121  virtual void *GetGenericDisplayId()
122  {
123  vtkWarningMacro("Method not implemented.");
124  return 0;
125  }
126 
130  virtual void SetWindowInfo(char*);
131 
135  virtual void SetParentInfo(char*);
136 
137  void SetNextWindowId(void*)
138  {
139  vtkWarningMacro("SetNextWindowId not implemented (WindowRemap not implemented).");
140  }
141 
144  virtual bool InitializeFromCurrentContext();
145 
147  virtual void StereoUpdate();
148 
153  virtual void SetStereoCapableWindow(int capable);
154 
156  virtual void MakeCurrent();
157 
160  virtual bool IsCurrent();
161 
166  virtual bool IsDrawable();
167 
169  void UpdateContext();
170 
172  const char *ReportCapabilities();
173 
175  int SupportsOpenGL();
176 
178  int IsDirect();
179 
183  virtual void SetForceMakeCurrent();
184 
187  virtual int GetEventPending();
188 
190 
191  virtual void SetupPalette(void *hDC);
192  virtual void SetupPixelFormat(void *hDC, void *dwFlags, int debug,
193  int bpp=16, int zbpp=16);
195 
197  void Finalize();
198 
200  int GetDepthBufferSize();
201 
203 
206  virtual void HideCursor();
207  virtual void ShowCursor();
208  virtual void SetCursorPosition(int x, int y);
210 
212  virtual void SetCurrentCursor(int);
213 
216  virtual int GetViewCreated();
217 
220  virtual int GetWindowCreated();
221 
223 
224  void SetContextId(void *);
225  void *GetContextId();
226  virtual void *GetGenericContext() {return this->GetContextId();}
228 
237  virtual void SetRootWindow(void *);
238 
240  virtual void *GetRootWindow();
241 
250  virtual void SetWindowId(void *);
251 
253 
254  virtual void *GetWindowId();
255  virtual void *GetGenericWindowId() {return this->GetWindowId();}
257 
262  virtual void SetParentId(void *nsview);
263 
265 
268  virtual void *GetParentId();
269  virtual void *GetGenericParentId() { return this->GetParentId(); }
271 
273 
275  void SetPixelFormat(void *pixelFormat);
276  void *GetPixelFormat();
278 
279 protected:
282 
283  void CreateGLContext();
284 
285  void CreateAWindow();
286  void DestroyWindow();
287  void DestroyOffScreenWindow();
288 
289  int OffScreenInitialized;
290  int OnScreenInitialized;
291 
293 
295  void SetCocoaManager(void *manager);
296  void *GetCocoaManager();
298 
299  void SetCocoaServer(void *server); // Really a vtkCocoaServer*
300  void *GetCocoaServer();
301 
302 private:
303  vtkCocoaRenderWindow(const vtkCocoaRenderWindow&); // Not implemented.
304  void operator=(const vtkCocoaRenderWindow&); // Not implemented.
305 
306 private:
307  // Important: this class cannot contain Objective-C instance
308  // variables for 2 reasons:
309  // 1) C++ files include this header
310  // 2) because of garbage collection (the GC scanner does not scan objects create by C++'s new)
311  // Instead, use the CocoaManager dictionary to keep a collection
312  // of what would otherwise be Objective-C instance variables.
313  void *CocoaManager; // Really an NSMutableDictionary*
314 
315  int WindowCreated;
316  int ViewCreated;
317  int CursorHidden;
318 
319  int ForceMakeCurrent;
320  char *Capabilities;
321 };
322 
323 #endif
OpenGL rendering window.
virtual void Finalize()=0
virtual void SetForceMakeCurrent()
virtual void SetWindowInfo(char *)=0
virtual void WindowRemap()=0
void PrintSelf(ostream &os, vtkIndent indent)
virtual void HideCursor()=0
virtual void * GetGenericParentId()
Cocoa OpenGL rendering window.
static vtkRenderWindow * New()
virtual int * GetScreenSize()=0
virtual void SetWindowId(void *)=0
virtual void * GetGenericDrawable()
virtual void SetCurrentCursor(int)
virtual void SetFullScreen(int)=0
virtual void * GetGenericDisplayId()
virtual int GetEventPending()=0
virtual void SetSize(int, int)
virtual void SetStereoCapableWindow(int capable)
virtual const char * ReportCapabilities()
virtual int IsDirect()
virtual int SupportsOpenGL()
virtual void SetParentInfo(char *)=0
virtual bool IsCurrent()=0
virtual void SetParentId(void *)=0
a simple class to control print indentation
Definition: vtkIndent.h:38
virtual void DestroyWindow()=0
virtual void MakeCurrent()=0
virtual void SetDisplayId(void *)
virtual void SetCursorPosition(int, int)
virtual int * GetPosition()
virtual void Frame()=0
virtual int * GetSize()
virtual void * GetGenericContext()
virtual bool InitializeFromCurrentContext()
virtual void Start()=0
virtual void SetWindowName(const char *)
virtual void SetPosition(int, int)
virtual void StereoUpdate()
virtual void CreateAWindow()=0
virtual void * GetGenericWindowId()
virtual void ShowCursor()=0
virtual bool IsDrawable()