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