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 =========================================================================*/
41 #ifndef __vtkCocoaRenderWindow_h
42 #define __vtkCocoaRenderWindow_h
43 
44 #include "vtkOpenGLRenderWindow.h"
45 
47 {
48 public:
49  static vtkCocoaRenderWindow *New();
51  void PrintSelf(ostream& os, vtkIndent indent);
52 
54  virtual void Start();
55 
57  virtual void Frame();
58 
60  virtual void WindowConfigure();
61 
65  virtual void Initialize();
66 
68  virtual void SetFullScreen(int);
69 
71  virtual void WindowRemap();
72 
74  virtual void PrefFullScreen();
75 
77 
78  virtual void SetSize(int*);
79  virtual void SetSize(int,int);
81 
83  virtual int *GetSize();
84 
86 
87  virtual void SetPosition(int*);
88  virtual void SetPosition(int,int);
90 
92  virtual int *GetScreenSize();
93 
95  virtual int *GetPosition();
96 
99  virtual void SetWindowName(const char *);
100 
101  void SetNextWindowInfo(char *)
102  {
103  vtkWarningMacro("SetNextWindowInfo not implemented (WindowRemap not implemented).");
104  }
105  virtual void* GetGenericDrawable()
106  {
107  vtkWarningMacro("Method not implemented.");
108  return 0;
109  }
110  virtual void SetDisplayId(void*)
111  {
112  vtkWarningMacro("Method not implemented.");
113  }
114  virtual void *GetGenericDisplayId()
115  {
116  vtkWarningMacro("Method not implemented.");
117  return 0;
118  }
119 
123  virtual void SetWindowInfo(char*);
124 
128  virtual void SetParentInfo(char*);
129 
130  void SetNextWindowId(void*)
131  {
132  vtkWarningMacro("SetNextWindowId not implemented (WindowRemap not implemented).");
133  }
134 
135 
137  virtual void StereoUpdate();
138 
143  virtual void SetStereoCapableWindow(int capable);
144 
146  virtual void MakeCurrent();
147 
150  virtual bool IsCurrent();
151 
153  void UpdateContext();
154 
156  const char *ReportCapabilities();
157 
159  int SupportsOpenGL();
160 
162  int IsDirect();
163 
167  virtual void SetForceMakeCurrent();
168 
171  virtual int GetEventPending();
172 
174 
175  virtual void SetupPalette(void *hDC);
176  virtual void SetupPixelFormat(void *hDC, void *dwFlags, int debug,
177  int bpp=16, int zbpp=16);
179 
181  void Finalize();
182 
184  void RegisterTextureResource (GLuint id);
185 
187  int GetDepthBufferSize();
188 
190 
193  virtual void HideCursor();
194  virtual void ShowCursor();
195  virtual void SetCursorPosition(int x, int y);
197 
199  virtual void SetCurrentCursor(int);
200 
203  virtual int GetWindowCreated();
204 
206 
207  void SetContextId(void *);
208  void *GetContextId();
209  virtual void *GetGenericContext() {return this->GetContextId();}
211 
220  virtual void SetRootWindow(void *);
221 
223  virtual void *GetRootWindow();
224 
233  virtual void SetWindowId(void *);
234 
236 
237  virtual void *GetWindowId();
238  virtual void *GetGenericWindowId() {return this->GetWindowId();}
240 
245  virtual void SetParentId(void *nsview);
246 
248 
251  virtual void *GetParentId();
252  virtual void *GetGenericParentId() { return this->GetParentId(); }
254 
256 
258  vtkGetMacro(ScaleFactor, double);
260 
262 
264  void SetPixelFormat(void *pixelFormat);
265  void *GetPixelFormat();
267 
268 protected:
271 
272  void CreateGLContext();
273 
274  void CreateAWindow();
275  void DestroyWindow();
276  void DestroyOffScreenWindow();
277 
280 
281  // Using CGFloat would be better, but doing it this way avoids pulling in
282  // Apple headers, which cause problems with the 10.3 SDK and python wrappings.
283 #if defined(__LP64__) && __LP64__
284  double ScaleFactor;
285 #else
286  float ScaleFactor;
287 #endif
288 
290 
292  void SetCocoaManager(void *manager);
293  void *GetCocoaManager();
295 
296 private:
297  vtkCocoaRenderWindow(const vtkCocoaRenderWindow&); // Not implemented.
298  void operator=(const vtkCocoaRenderWindow&); // Not implemented.
299 
300 private:
301  // Important: this class cannot contain Objective-C instance
302  // variables for 2 reasons:
303  // 1) C++ files include this header
304  // 2) because of garbage collection (the GC scanner does not scan objects create by C++'s new)
305  // Instead, use the CocoaManager dictionary to keep a collection
306  // of what would otherwise be Objective-C instance variables.
307  void *CocoaManager; // Really an NSMutableDictionary*
308 
309  int WindowCreated;
310  int ViewCreated;
311  int CursorHidden;
312 
313  int ForceMakeCurrent;
314  char *Capabilities;
315 };
316 
317 #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:37
virtual void DestroyWindow()=0
virtual void MakeCurrent()=0
virtual void SetDisplayId(void *)
virtual void SetCursorPosition(int, int)
virtual int * GetPosition()
virtual void Frame()=0
#define VTK_RENDERING_EXPORT
virtual int * GetSize()
virtual void * GetGenericContext()
void RegisterTextureResource(GLuint id)
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