]> git.saurik.com Git - wxWidgets.git/blob - wxPython/contrib/glcanvas/glcanvas.i
nicer version compilation fix for wxUSE_WCHAR_T=0 (why should we duplicate definition...
[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, 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
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
96 class wxGLCanvas : public wxScrolledWindow {
97 public:
98 wxGLCanvas(wxWindow *parent, wxWindowID id = -1,
99 const wxPoint& pos = wxDefaultPosition,
100 const wxSize& size = wxDefaultSize, long style = 0,
101 const char* name = "GLCanvas",
102 int *attribList = NULL,
103 const wxPalette& palette = wxNullPalette);
104
105 %pragma(python) addtomethod = "__init__:#wx._StdWindowCallbacks(self)"
106
107 void SetCurrent();
108 void SetColour(const char *colour);
109 void SwapBuffers();
110
111 wxGLContext* GetContext();
112 };
113
114
115 //---------------------------------------------------------------------------
116
117 %init %{
118
119 wxClassInfo::CleanUpClasses();
120 wxClassInfo::InitializeClasses();
121
122 %}
123
124 //---------------------------------------------------------------------------
125 //---------------------------------------------------------------------------