1 /////////////////////////////////////////////////////////////////////////////
 
   3 // Purpose:     SWIG definitions for the OpenGL wxWindows classes
 
   7 // Created:     15-Mar-1999
 
   9 // Copyright:   (c) 1998 by Total Control Software
 
  10 // Licence:     wxWindows license
 
  11 /////////////////////////////////////////////////////////////////////////////
 
  19 #include "myglcanvas.h"
 
  21 #include <wx/glcanvas.h>
 
  26 //---------------------------------------------------------------------------
 
  29 %include my_typemaps.i
 
  43 %pragma(python) code = "import wx"
 
  45 //---------------------------------------------------------------------------
 
  53 //---------------------------------------------------------------------------
 
  55 class wxGLContext : public wxObject {
 
  57 #ifndef __WXMAC__  //  fix this?
 
  58     wxGLContext(bool isRGB, wxGLCanvas *win,
 
  59                 const wxPalette& palette = wxNullPalette);
 
  64     void SetColour(const char *colour);
 
  68     void SetupPixelFormat();
 
  69     void SetupPalette(const wxPalette& palette);
 
  70     wxPalette CreateDefaultPalette();
 
  71     wxPalette* GetPalette();
 
  74     wxWindow* GetWindow();
 
  77 //---------------------------------------------------------------------------
 
  80     WX_GL_RGBA,              // use true color palette
 
  81     WX_GL_BUFFER_SIZE,       // bits for buffer if not WX_GL_RGBA
 
  82     WX_GL_LEVEL,             // 0 for main buffer, >0 for overlay, <0 for underlay
 
  83     WX_GL_DOUBLEBUFFER,      // use doublebuffer
 
  84     WX_GL_STEREO,            // use stereoscopic display
 
  85     WX_GL_AUX_BUFFERS,       // number of auxiliary buffers
 
  86     WX_GL_MIN_RED,           // use red buffer with most bits (> MIN_RED bits)
 
  87     WX_GL_MIN_GREEN,         // use green buffer with most bits (> MIN_GREEN bits)
 
  88     WX_GL_MIN_BLUE,          // use blue buffer with most bits (> MIN_BLUE bits)
 
  89     WX_GL_MIN_ALPHA,         // use blue buffer with most bits (> MIN_ALPHA bits)
 
  90     WX_GL_DEPTH_SIZE,        // bits for Z-buffer (0,16,32)
 
  91     WX_GL_STENCIL_SIZE,      // bits for stencil buffer
 
  92     WX_GL_MIN_ACCUM_RED,     // use red accum buffer with most bits (> MIN_ACCUM_RED bits)
 
  93     WX_GL_MIN_ACCUM_GREEN,   // use green buffer with most bits (> MIN_ACCUM_GREEN bits)
 
  94     WX_GL_MIN_ACCUM_BLUE,    // use blue buffer with most bits (> MIN_ACCUM_BLUE bits)
 
  95     WX_GL_MIN_ACCUM_ALPHA    // use blue buffer with most bits (> MIN_ACCUM_ALPHA bits)
 
  99 %typemap(python, in) int *attribList (int *temp) {
 
 101     if (PySequence_Check($source)) {
 
 102         int size = PyObject_Length($source);
 
 103         temp = new int[size+1]; // (int*)malloc((size + 1) * sizeof(int));
 
 104         for (i = 0; i < size; i++) {
 
 105             temp[i] = PyInt_AsLong(PySequence_GetItem($source, i));
 
 112 %typemap(python, freearg) int *attribList
 
 119 class wxGLCanvas : public wxWindow {
 
 121     wxGLCanvas(wxWindow *parent, wxWindowID id = -1,
 
 122                const wxPoint& pos = wxDefaultPosition,
 
 123                const wxSize& size = wxDefaultSize, long style = 0,
 
 124                const char* name = "GLCanvas",
 
 125                int *attribList = NULL,
 
 126                const wxPalette& palette = wxNullPalette);
 
 128     %name(wxGLCanvasWithContext)
 
 129         wxGLCanvas( wxWindow *parent,
 
 130                     const wxGLContext *shared = NULL,
 
 132                     const wxPoint& pos = wxDefaultPosition,
 
 133                     const wxSize& size = wxDefaultSize,
 
 135                     const char* name = "GLCanvas",
 
 136                     int *attribList = NULL,
 
 137                     const wxPalette& palette = wxNullPalette );
 
 139 //      bool Create(wxWindow *parent, wxWindowID id,
 
 140 //                  const wxPoint& pos, const wxSize& size, long style, const wxString& name);
 
 142     %pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
 
 143     %pragma(python) addtomethod = "wxGLCanvasWithContext:val._setOORInfo(self)"
 
 146     void SetColour(const char *colour);
 
 149     wxGLContext* GetContext();
 
 152     void SetupPixelFormat(int *attribList = NULL);
 
 153     void SetupPalette(const wxPalette& palette);
 
 154     wxPalette CreateDefaultPalette();
 
 155     wxPalette* GetPalette();
 
 160 //---------------------------------------------------------------------------
 
 164     wxClassInfo::CleanUpClasses();
 
 165     wxClassInfo::InitializeClasses();
 
 169 //---------------------------------------------------------------------------
 
 170 //---------------------------------------------------------------------------