]> git.saurik.com Git - wxWidgets.git/blob - wxPython/contrib/glcanvas/glcanvas.i
New typemaps for wxString when compiling for Python 2.0 and beyond
[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 "helpers.h"
18 #include <wx/glcanvas.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 %{
39 #if defined(__WXMSW__)
40 static wxString wxPyEmptyStr("");
41 static wxPoint wxPyDefaultPosition(-1, -1);
42 static wxSize wxPyDefaultSize(-1, -1);
43 #endif
44 %}
45
46 %pragma(python) code = "import wx"
47
48 //---------------------------------------------------------------------------
49
50 class wxPalette;
51 class wxWindow;
52 class wxSize;
53 class wxPoint;
54 class wxGLCanvas;
55
56 //---------------------------------------------------------------------------
57
58 class wxGLContext {
59 public:
60 wxGLContext(bool isRGB, wxGLCanvas *win, const wxPalette& palette = wxNullPalette);
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 wxScrolledWindow {
100 public:
101 wxGLCanvas(wxWindow *parent, wxWindowID id = -1,
102 const wxPoint& pos = wxPyDefaultPosition,
103 const wxSize& size = wxPyDefaultSize, long style = 0,
104 const char* name = "GLCanvas",
105 int *attribList = NULL,
106 const wxPalette& palette = wxNullPalette);
107
108 %pragma(python) addtomethod = "__init__:#wx._StdWindowCallbacks(self)"
109
110 void SetCurrent();
111 void SetColour(const char *colour);
112 void SwapBuffers();
113
114 wxGLContext* GetContext();
115 };
116
117
118 //---------------------------------------------------------------------------
119
120 %init %{
121
122 wxClassInfo::CleanUpClasses();
123 wxClassInfo::InitializeClasses();
124
125 %}
126
127 //---------------------------------------------------------------------------
128 //---------------------------------------------------------------------------