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