Main Page | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members | Related Pages

Rendering/vtkCocoaRenderWindow.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    $RCSfile: vtkCocoaRenderWindow.h,v $
00005 
00006   Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
00007   All rights reserved.
00008   See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
00009 
00010      This software is distributed WITHOUT ANY WARRANTY; without even
00011      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
00012      PURPOSE.  See the above copyright notice for more information.
00013 
00014 =========================================================================*/
00023 #ifndef __vtkCocoaRenderWindow_h
00024 #define __vtkCocoaRenderWindow_h
00025 
00026 #include "vtkOpenGLRenderWindow.h"
00027 #include <OpenGL/gl.h> // Needed for types used in public interface
00028 
00029 class vtkIdList;
00030 
00031 class VTK_RENDERING_EXPORT vtkCocoaRenderWindow : public vtkOpenGLRenderWindow
00032 {
00033 public:
00034   static vtkCocoaRenderWindow *New();
00035   vtkTypeRevisionMacro(vtkCocoaRenderWindow,vtkOpenGLRenderWindow);
00036   void PrintSelf(ostream& os, vtkIndent indent);
00037 
00039   virtual void Start(void);
00040 
00042   virtual void Frame(void);
00043 
00045   virtual void WindowConfigure(void);
00046 
00048   virtual void WindowInitialize(void);
00049 
00051   virtual void Initialize(void);
00052 
00054   virtual void SetFullScreen(int);
00055 
00057   virtual void WindowRemap(void);
00058 
00060   virtual void PrefFullScreen(void);
00061 
00063   virtual void SetSize(int,int);
00064 
00066   virtual int *GetSize();
00067 
00069   virtual void SetPosition(int,int);
00070   
00072   virtual int *GetScreenSize();
00073 
00075   virtual int *GetPosition();
00076 
00079   virtual void SetWindowName(const char *);
00080   
00082   virtual void SetWindowInfo(void *);
00083 
00084   void SetNextWindowInfo(char *)
00085      {
00086         vtkWarningMacro("SetNextWindowInfo not implemented (WindowRemap not implemented).");
00087      }
00088 
00089 
00090   //BTX
00091   virtual void *GetGenericDisplayId() {return (void *)this->ContextId;};
00092   virtual void *GetGenericWindowId()  {return (void *)this->WindowId;};
00093   virtual void *GetGenericContext()   {return (void *)this->DeviceContext;};
00094   virtual void SetDisplayId(void *) {};
00095   virtual void SetParentId(void *) 
00096     {
00097       vtkWarningMacro("Method not implemented.");
00098     }
00099   virtual void* GetGenericParentId()
00100     {
00101       vtkWarningMacro("Method not implemented.");
00102       return 0;
00103     }
00104   virtual void* GetGenericDrawable()
00105     {
00106       vtkWarningMacro("Method not implemented.");
00107       return 0;
00108     }
00109   virtual void SetWindowInfo(char*)
00110     {
00111       vtkWarningMacro("Method not implemented.");
00112     }
00113   virtual void SetParentInfo(char*)
00114     {
00115       vtkWarningMacro("Method not implemented.");
00116     }
00117 
00119   virtual void *GetWindowId();
00120 
00122   virtual void  SetWindowId(void *);
00123 
00124   void SetNextWindowId(void*)
00125     {
00126        vtkWarningMacro("SetNextWindowId not implemented (WindowRemap not implemented).");
00127     }
00128 
00129   
00130   void  SetContextId(void *);   // hsr
00131   void  SetDeviceContext(void *);       // hsr
00132 
00133   //ETX
00134 
00135   // supply base class virtual function
00136   vtkSetMacro(MultiSamples,int);
00137   vtkGetMacro(MultiSamples,int);
00138 
00140   virtual void StereoUpdate();
00141   
00146   virtual void SetStereoCapableWindow(int capable);
00147 
00149   virtual void MakeCurrent();
00150 
00152   const char *ReportCapabilities();
00153 
00155   int SupportsOpenGL();
00156 
00158   int IsDirect();
00159 
00163   virtual void SetForceMakeCurrent();
00164 
00167   virtual  int GetEventPending();
00168 
00176   virtual void SetupPalette(void *hDC);
00177   virtual void SetupPixelFormat(void *hDC, void *dwFlags, int debug, 
00178                                 int bpp=16, int zbpp=16);
00180   
00182   void Clean();
00183 
00185   void RegisterTextureResource (GLuint id);
00186 
00188   int GetDepthBufferSize();
00189 
00191 
00193   virtual void HideCursor();
00194   virtual void ShowCursor();
00196   
00197   void UpdateSizeAndPosition(int xPos, int yPos, int xSize, int ySize);
00198 
00199   
00200 protected:
00201   vtkCocoaRenderWindow();
00202   ~vtkCocoaRenderWindow();
00203 
00204   int       ApplicationInitialized; //NSApplication called?
00205   void     *ContextId;
00206   void     *DeviceContext;
00207   void     *WindowId;
00208   void     *WindowController;
00209   int       OwnWindow;
00210   int       ScreenSize[2];
00211   int       MultiSamples;
00212   vtkIdList *TextureResourceIds;
00213 
00214   int GetPixelData(int x,int y,int x2,int y2,int front, unsigned char* data);
00215   int GetZbufferData( int x1, int y1, int x2, int y2, float* z );
00216   int GetRGBAPixelData(int x,int y,int x2,int y2, int front, float* data);
00217   int GetRGBACharPixelData(int x,int y,int x2,int y2, int front,
00218                            unsigned char* data);
00219 
00220   // the following is used to support rendering into memory
00221 //  void *MemoryDataHeader;
00222 //  void *MemoryBuffer;
00223 //  unsigned char *MemoryData;  // the data in the DIBSection
00224 //  void *MemoryHdc;
00225 
00226   int ScreenMapped;
00227   int ScreenWindowSize[2];
00228   void *ScreenDeviceContext;
00229   int ScreenDoubleBuffer;
00230   void *ScreenContextId;
00231 
00232   int CursorHidden;
00233   int ForceMakeCurrent;
00234 
00235   char *Capabilities;
00236 
00237 private:
00238   vtkCocoaRenderWindow(const vtkCocoaRenderWindow&);  // Not implemented.
00239   void operator=(const vtkCocoaRenderWindow&);  // Not implemented.
00240 };
00241 
00242 #endif