]> git.saurik.com Git - wxWidgets.git/blob - wxPython/contrib/glcanvas/glcanvas.i
wxGLCanvas updates
[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 #ifndef __WXMAC__ // fix this?
58 wxGLContext(bool isRGB, wxGLCanvas *win,
59 const wxPalette& palette = wxNullPalette);
60 #endif
61 ~wxGLContext();
62
63 void SetCurrent();
64 void SetColour(const char *colour);
65 void SwapBuffers();
66
67 #ifdef __WXGTK__
68 void SetupPixelFormat();
69 void SetupPalette(const wxPalette& palette);
70 wxPalette CreateDefaultPalette();
71 wxPalette* GetPalette();
72 #endif
73
74 wxWindow* GetWindow();
75 };
76
77 //---------------------------------------------------------------------------
78
79 %typemap(python, in) int *attribList (int *temp) {
80 int i;
81 if (PySequence_Check($source)) {
82 int size = PyObject_Length($source);
83 temp = new int[size+1]; // (int*)malloc((size + 1) * sizeof(int));
84 for (i = 0; i < size; i++) {
85 temp[i] = PyInt_AsLong(PySequence_GetItem($source, i));
86 }
87 temp[size] = 0;
88 $target = temp;
89 }
90 }
91
92 %typemap(python, freearg) int *attribList
93 {
94 delete [] $source;
95 }
96
97
98
99 class wxGLCanvas : public wxWindow {
100 public:
101 wxGLCanvas(wxWindow *parent, wxWindowID id = -1,
102 const wxPoint& pos = wxDefaultPosition,
103 const wxSize& size = wxDefaultSize, long style = 0,
104 const char* name = "GLCanvas",
105 int *attribList = NULL,
106 const wxPalette& palette = wxNullPalette);
107
108 %name(wxGLCanvasWithContext)
109 wxGLCanvas( wxWindow *parent,
110 const wxGLContext *shared = NULL,
111 wxWindowID id = -1,
112 const wxPoint& pos = wxDefaultPosition,
113 const wxSize& size = wxDefaultSize,
114 long style = 0,
115 const char* name = "GLCanvas",
116 int *attribList = NULL,
117 const wxPalette& palette = wxNullPalette );
118
119 // bool Create(wxWindow *parent, wxWindowID id,
120 // const wxPoint& pos, const wxSize& size, long style, const wxString& name);
121
122 %pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
123 %pragma(python) addtomethod = "wxGLCanvasWithContext:val._setOORInfo(self)"
124
125 void SetCurrent();
126 void SetColour(const char *colour);
127 void SwapBuffers();
128
129 wxGLContext* GetContext();
130
131 #ifdef __WXMSW__
132 void SetupPixelFormat(int *attribList = NULL);
133 void SetupPalette(const wxPalette& palette);
134 wxPalette CreateDefaultPalette();
135 wxPalette* GetPalette();
136 #endif
137 };
138
139
140 //---------------------------------------------------------------------------
141
142 %init %{
143
144 wxClassInfo::CleanUpClasses();
145 wxClassInfo::InitializeClasses();
146
147 %}
148
149 //---------------------------------------------------------------------------
150 //---------------------------------------------------------------------------