]> git.saurik.com Git - wxWidgets.git/blob - wxPython/contrib/glcanvas/glcanvas.i
New PyCrust files
[wxWidgets.git] / wxPython / contrib / glcanvas / glcanvas.i
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: glcanvas.i
3 // Purpose: SWIG definitions for the OpenGL wxWindows classes
4 //
5 // Author: Robin Dunn
6 //
7 // Created: 15-Mar-1999
8 // RCS-ID: $Id$
9 // Copyright: (c) 1998 by Total Control Software
10 // Licence: wxWindows license
11 /////////////////////////////////////////////////////////////////////////////
12
13
14 %module glcanvas
15
16 %{
17 #include "export.h"
18 #ifdef __WXMSW__
19 #include "myglcanvas.h"
20 #else
21 #include <wx/glcanvas.h>
22 #endif
23
24 %}
25
26 //---------------------------------------------------------------------------
27
28 %include typemaps.i
29 %include my_typemaps.i
30
31 %extern wx.i
32 %extern windows.i
33 %extern windows2.i
34 %extern windows3.i
35 %extern frames.i
36 %extern _defs.i
37 %extern misc.i
38 %extern gdi.i
39 %extern controls.i
40 %extern events.i
41
42
43 %pragma(python) code = "import wx"
44
45 //---------------------------------------------------------------------------
46
47 class wxPalette;
48 class wxWindow;
49 class wxSize;
50 class wxPoint;
51 class wxGLCanvas;
52
53 //---------------------------------------------------------------------------
54
55 class wxGLContext : public wxObject {
56 public:
57 wxGLContext(bool isRGB, wxGLCanvas *win,
58 const wxPalette& palette = wxNullPalette);
59 ~wxGLContext();
60
61 void SetCurrent();
62 void SetColour(const char *colour);
63 void SwapBuffers();
64
65 #ifdef __WXGTK__
66 void SetupPixelFormat();
67 void SetupPalette(const wxPalette& palette);
68 wxPalette CreateDefaultPalette();
69 wxPalette* GetPalette();
70 #endif
71
72 wxWindow* GetWindow();
73 };
74
75 //---------------------------------------------------------------------------
76
77 %typemap(python, in) int *attribList (int *temp) {
78 int i;
79 if (PySequence_Check($source)) {
80 int size = PyObject_Length($source);
81 temp = new int[size+1]; // (int*)malloc((size + 1) * sizeof(int));
82 for (i = 0; i < size; i++) {
83 temp[i] = PyInt_AsLong(PySequence_GetItem($source, i));
84 }
85 temp[size] = 0;
86 $target = temp;
87 }
88 }
89
90 %typemap(python, freearg) int *attribList
91 {
92 delete [] $source;
93 }
94
95
96
97 class wxGLCanvas : public wxScrolledWindow {
98 public:
99 wxGLCanvas(wxWindow *parent, wxWindowID id = -1,
100 const wxPoint& pos = wxDefaultPosition,
101 const wxSize& size = wxDefaultSize, long style = 0,
102 const char* name = "GLCanvas",
103 int *attribList = NULL,
104 const wxPalette& palette = wxNullPalette);
105
106 %name(wxGLCanvasWithContext)
107 wxGLCanvas( wxWindow *parent,
108 const wxGLContext *shared = NULL,
109 wxWindowID id = -1,
110 const wxPoint& pos = wxDefaultPosition,
111 const wxSize& size = wxDefaultSize,
112 long style = 0,
113 const char* name = "GLCanvas",
114 int *attribList = NULL,
115 const wxPalette& palette = wxNullPalette );
116
117 // bool Create(wxWindow *parent, wxWindowID id,
118 // const wxPoint& pos, const wxSize& size, long style, const wxString& name);
119
120 %pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
121 %pragma(python) addtomethod = "wxGLCanvasWithContext:val._setOORInfo(self)"
122
123 void SetCurrent();
124 void SetColour(const char *colour);
125 void SwapBuffers();
126
127 wxGLContext* GetContext();
128
129 #ifdef __WXMSW__
130 void SetupPixelFormat(int *attribList = NULL);
131 void SetupPalette(const wxPalette& palette);
132 wxPalette CreateDefaultPalette();
133 wxPalette* GetPalette();
134 #endif
135 };
136
137
138 //---------------------------------------------------------------------------
139
140 %init %{
141
142 wxClassInfo::CleanUpClasses();
143 wxClassInfo::InitializeClasses();
144
145 %}
146
147 //---------------------------------------------------------------------------
148 //---------------------------------------------------------------------------