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 
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 
203  virtual void HideCursor();
204  virtual void ShowCursor();
205  virtual void SetCursorPosition(int x, int y);
207 
209  virtual void SetCurrentCursor(int);
210 
213  virtual int GetViewCreated();
214 
217  virtual int GetWindowCreated();
218 
220 
221  void SetContextId(void *);
222  void *GetContextId();
223  virtual void *GetGenericContext() {return this->GetContextId();}
225 
234  virtual void SetRootWindow(void *);
235 
237  virtual void *GetRootWindow();
238 
247  virtual void SetWindowId(void *);
248 
250 
251  virtual void *GetWindowId();
252  virtual void *GetGenericWindowId() {return this->GetWindowId();}
254 
259  virtual void SetParentId(void *nsview);
260 
262 
265  virtual void *GetParentId();
266  virtual void *GetGenericParentId() { return this->GetParentId(); }
268 
270 
272  void SetPixelFormat(void *pixelFormat);
273  void *GetPixelFormat();
275 
276 protected:
279 
280  void CreateGLContext();
281 
282  void CreateAWindow();
283  void DestroyWindow();
284  void DestroyOffScreenWindow();
285 
286  int OffScreenInitialized;
287  int OnScreenInitialized;
288 
290 
292  void SetCocoaManager(void *manager);
293  void *GetCocoaManager();
295 
296  void SetCocoaServer(void *server); // Really a vtkCocoaServer*
297  void *GetCocoaServer();
298 
299 private:
300  vtkCocoaRenderWindow(const vtkCocoaRenderWindow&); // Not implemented.
301  void operator=(const vtkCocoaRenderWindow&); // Not implemented.
302 
303 private:
304  // Important: this class cannot contain Objective-C instance
305  // variables for 2 reasons:
306  // 1) C++ files include this header
307  // 2) because of garbage collection (the GC scanner does not scan objects create by C++'s new)
308  // Instead, use the CocoaManager dictionary to keep a collection
309  // of what would otherwise be Objective-C instance variables.
310  void *CocoaManager; // Really an NSMutableDictionary*
311 
312  int WindowCreated;
313  int ViewCreated;
314  int CursorHidden;
315 
316  int ForceMakeCurrent;
317  char *Capabilities;
318 };
319 
320 #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.
#define VTKRENDERINGOPENGL2_EXPORT
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()