]>
Commit | Line | Data |
---|---|---|
4b123bb9 HH |
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 | %{ | |
1e7ecb7b | 17 | #include "export.h" |
4c9993c3 | 18 | #include <wx/glcanvas.h> |
4b123bb9 HH |
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 | ||
4b123bb9 HH |
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 { | |
51 | public: | |
52 | wxGLContext(bool isRGB, wxGLCanvas *win, const wxPalette& palette = wxNullPalette); | |
53 | ~wxGLContext(); | |
54 | ||
55 | void SetCurrent(); | |
56 | void SetColour(const char *colour); | |
57 | void SwapBuffers(); | |
58 | ||
59 | #ifdef __WXGTK__ | |
60 | void SetupPixelFormat(); | |
61 | void SetupPalette(const wxPalette& palette); | |
62 | wxPalette CreateDefaultPalette(); | |
63 | wxPalette* GetPalette(); | |
64 | #endif | |
65 | ||
66 | wxWindow* GetWindow(); | |
67 | }; | |
68 | ||
69 | //--------------------------------------------------------------------------- | |
70 | ||
c368d904 RD |
71 | %typemap(python, in) int *attribList (int *temp) { |
72 | int i; | |
73 | if (PySequence_Check($source)) { | |
74 | int size = PyObject_Length($source); | |
75 | temp = new int[size+1]; // (int*)malloc((size + 1) * sizeof(int)); | |
76 | for (i = 0; i < size; i++) { | |
77 | temp[i] = PyInt_AsLong(PySequence_GetItem($source, i)); | |
78 | } | |
79 | temp[size] = 0; | |
80 | $target = temp; | |
81 | } | |
82 | } | |
83 | ||
84 | %typemap(python, freearg) int *attribList | |
85 | { | |
86 | delete [] $source; | |
87 | } | |
88 | ||
89 | ||
90 | ||
4b123bb9 HH |
91 | class wxGLCanvas : public wxScrolledWindow { |
92 | public: | |
93 | wxGLCanvas(wxWindow *parent, wxWindowID id = -1, | |
1e7ecb7b RD |
94 | const wxPoint& pos = wxDefaultPosition, |
95 | const wxSize& size = wxDefaultSize, long style = 0, | |
4b123bb9 | 96 | const char* name = "GLCanvas", |
c368d904 | 97 | int *attribList = NULL, |
4b123bb9 HH |
98 | const wxPalette& palette = wxNullPalette); |
99 | ||
f6bcfd97 | 100 | %pragma(python) addtomethod = "__init__:#wx._StdWindowCallbacks(self)" |
4b123bb9 HH |
101 | |
102 | void SetCurrent(); | |
103 | void SetColour(const char *colour); | |
104 | void SwapBuffers(); | |
105 | ||
106 | wxGLContext* GetContext(); | |
107 | }; | |
108 | ||
109 | ||
110 | //--------------------------------------------------------------------------- | |
111 | ||
4b123bb9 HH |
112 | %init %{ |
113 | ||
e508a2b6 RD |
114 | wxClassInfo::CleanUpClasses(); |
115 | wxClassInfo::InitializeClasses(); | |
4b123bb9 HH |
116 | |
117 | %} | |
118 | ||
119 | //--------------------------------------------------------------------------- | |
120 | //--------------------------------------------------------------------------- |