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 
71  virtual void SetFullScreen(int);
72 
75  virtual void WindowRemap();
76 
79  virtual void PrefFullScreen();
80 
82 
83  virtual void SetSize(int a[2]);
84  virtual void SetSize(int,int);
86 
88  virtual int *GetSize();
89 
91 
92  virtual void SetPosition(int a[2]);
93  virtual void SetPosition(int,int);
95 
97  virtual int *GetScreenSize();
98 
100  virtual int *GetPosition();
101 
104  virtual void SetWindowName(const char *);
105 
106  void SetNextWindowInfo(char *)
107  {
108  vtkWarningMacro("SetNextWindowInfo not implemented (WindowRemap not implemented).");
109  }
110  virtual void* GetGenericDrawable()
111  {
112  vtkWarningMacro("Method not implemented.");
113  return 0;
114  }
115  virtual void SetDisplayId(void*)
116  {
117  vtkWarningMacro("Method not implemented.");
118  }
119  virtual void *GetGenericDisplayId()
120  {
121  vtkWarningMacro("Method not implemented.");
122  return 0;
123  }
124 
128  virtual void SetWindowInfo(char*);
129 
133  virtual void SetParentInfo(char*);
134 
135  void SetNextWindowId(void*)
136  {
137  vtkWarningMacro("SetNextWindowId not implemented (WindowRemap not implemented).");
138  }
139 
140 
142  virtual void StereoUpdate();
143 
148  virtual void SetStereoCapableWindow(int capable);
149 
151  virtual void MakeCurrent();
152 
155  virtual bool IsCurrent();
156 
158  void UpdateContext();
159 
161  const char *ReportCapabilities();
162 
164  int SupportsOpenGL();
165 
167  int IsDirect();
168 
172  virtual void SetForceMakeCurrent();
173 
176  virtual int GetEventPending();
177 
179 
180  virtual void SetupPalette(void *hDC);
181  virtual void SetupPixelFormat(void *hDC, void *dwFlags, int debug,
182  int bpp=16, int zbpp=16);
184 
186  void Finalize();
187 
189  int GetDepthBufferSize();
190 
192 
195  virtual void HideCursor();
196  virtual void ShowCursor();
197  virtual void SetCursorPosition(int x, int y);
199 
201  virtual void SetCurrentCursor(int);
202 
205  virtual int GetWindowCreated();
206 
208 
209  void SetContextId(void *);
210  void *GetContextId();
211  virtual void *GetGenericContext() {return this->GetContextId();}
213 
222  virtual void SetRootWindow(void *);
223 
225  virtual void *GetRootWindow();
226 
235  virtual void SetWindowId(void *);
236 
238 
239  virtual void *GetWindowId();
240  virtual void *GetGenericWindowId() {return this->GetWindowId();}
242 
247  virtual void SetParentId(void *nsview);
248 
250 
253  virtual void *GetParentId();
254  virtual void *GetGenericParentId() { return this->GetParentId(); }
256 
258 
260  vtkGetMacro(ScaleFactor, double);
262 
264 
266  void SetPixelFormat(void *pixelFormat);
267  void *GetPixelFormat();
269 
270 protected:
273 
274  void CreateGLContext();
275 
276  void CreateAWindow();
277  void DestroyWindow();
278  void DestroyOffScreenWindow();
279 
282 
283  // Using CGFloat would be better, but doing it this way avoids pulling in
284  // Apple headers, which cause problems with the 10.3 SDK and python wrappings.
285 #if defined(__LP64__) && __LP64__
286  double ScaleFactor;
287 #else
288  float ScaleFactor;
289 #endif
290 
292 
294  void SetCocoaManager(void *manager);
295  void *GetCocoaManager();
297 
298 private:
299  vtkCocoaRenderWindow(const vtkCocoaRenderWindow&); // Not implemented.
300  void operator=(const vtkCocoaRenderWindow&); // Not implemented.
301 
302 private:
303  // Important: this class cannot contain Objective-C instance
304  // variables for 2 reasons:
305  // 1) C++ files include this header
306  // 2) because of garbage collection (the GC scanner does not scan objects create by C++'s new)
307  // Instead, use the CocoaManager dictionary to keep a collection
308  // of what would otherwise be Objective-C instance variables.
309  void *CocoaManager; // Really an NSMutableDictionary*
310 
311  int WindowCreated;
312  int ViewCreated;
313  int CursorHidden;
314 
315  int ForceMakeCurrent;
316  char *Capabilities;
317 };
318 
319 #endif