]> git.saurik.com Git - wxWidgets.git/blob - wxPython/contrib/glcanvas/glcanvas.i
don't draw focus rect for custom drawn items when the list control doesn't have focus
[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 %define DOCSTRING
15 "`GLCanvas` provides an OpenGL Context on a `wx.Window`."
16 %enddef
17
18 %module(package="wx", docstring=DOCSTRING) glcanvas
19
20 %{
21 #include "wx/wxPython/wxPython.h"
22 #include "wx/wxPython/pyclasses.h"
23
24 #include <wx/glcanvas.h>
25
26 %}
27
28 //---------------------------------------------------------------------------
29
30 %import core.i
31 %pythoncode { wx = _core }
32 %pythoncode { __docfilter__ = wx.__DocFilter(globals()) }
33
34
35 MAKE_CONST_WXSTRING2(GLCanvasNameStr, wxT("GLCanvas"));
36 MAKE_CONST_WXSTRING_NOSWIG(EmptyString);
37
38
39 %include _glcanvas_rename.i
40
41 //---------------------------------------------------------------------------
42
43 class wxPalette;
44
45 //---------------------------------------------------------------------------
46
47 MustHaveApp(wxGLContext);
48
49 class wxGLContext : public wxObject {
50 public:
51 #ifndef __WXMAC__
52 wxGLContext(bool isRGB, wxGLCanvas *win,
53 const wxPalette& palette = wxNullPalette,
54 const wxGLContext* other = NULL);
55 #else
56 %extend {
57 wxGLContext(bool isRGB, wxGLCanvas *win,
58 const wxPalette& palette = wxNullPalette,
59 const wxGLContext* other = NULL) {
60 AGLPixelFormat fmt; // TODO: How should this be initialized?
61 return new wxGLContext(fmt, win, palette, other);
62 }
63 }
64
65 #endif
66 ~wxGLContext();
67
68 void SetCurrent();
69 void SetColour(const wxString& colour);
70 void SwapBuffers();
71
72 #ifdef __WXGTK__
73 void SetupPixelFormat();
74 void SetupPalette(const wxPalette& palette);
75 wxPalette CreateDefaultPalette();
76 wxPalette* GetPalette();
77 #endif
78
79 wxWindow* GetWindow();
80 };
81
82 //---------------------------------------------------------------------------
83
84 enum {
85 WX_GL_RGBA, // use true color palette
86 WX_GL_BUFFER_SIZE, // bits for buffer if not WX_GL_RGBA
87 WX_GL_LEVEL, // 0 for main buffer, >0 for overlay, <0 for underlay
88 WX_GL_DOUBLEBUFFER, // use doublebuffer
89 WX_GL_STEREO, // use stereoscopic display
90 WX_GL_AUX_BUFFERS, // number of auxiliary buffers
91 WX_GL_MIN_RED, // use red buffer with most bits (> MIN_RED bits)
92 WX_GL_MIN_GREEN, // use green buffer with most bits (> MIN_GREEN bits)
93 WX_GL_MIN_BLUE, // use blue buffer with most bits (> MIN_BLUE bits)
94 WX_GL_MIN_ALPHA, // use blue buffer with most bits (> MIN_ALPHA bits)
95 WX_GL_DEPTH_SIZE, // bits for Z-buffer (0,16,32)
96 WX_GL_STENCIL_SIZE, // bits for stencil buffer
97 WX_GL_MIN_ACCUM_RED, // use red accum buffer with most bits (> MIN_ACCUM_RED bits)
98 WX_GL_MIN_ACCUM_GREEN, // use green buffer with most bits (> MIN_ACCUM_GREEN bits)
99 WX_GL_MIN_ACCUM_BLUE, // use blue buffer with most bits (> MIN_ACCUM_BLUE bits)
100 WX_GL_MIN_ACCUM_ALPHA // use blue buffer with most bits (> MIN_ACCUM_ALPHA bits)
101 };
102
103
104 %typemap(in) int *attribList (int *temp) {
105 int i;
106 if (PySequence_Check($input)) {
107 int size = PyObject_Length($input);
108 temp = new int[size+1]; // (int*)malloc((size + 1) * sizeof(int));
109 for (i = 0; i < size; i++) {
110 temp[i] = PyInt_AsLong(PySequence_GetItem($input, i));
111 }
112 temp[size] = 0;
113 $1 = temp;
114 }
115 }
116
117 %typemap(freearg) int *attribList
118 {
119 delete [] $1;
120 }
121
122
123
124 MustHaveApp(wxGLCanvas);
125
126 class wxGLCanvas : public wxWindow {
127 public:
128 %pythonAppend wxGLCanvas "self._setOORInfo(self)"
129 wxGLCanvas(wxWindow *parent, wxWindowID id = -1,
130 const wxPoint& pos = wxDefaultPosition,
131 const wxSize& size = wxDefaultSize, long style = 0,
132 const wxString& name = wxPyGLCanvasNameStr,
133 int *attribList = NULL,
134 const wxPalette& palette = wxNullPalette);
135
136 %pythonAppend wxGLCanvas "val._setOORInfo(val)"
137 %RenameCtor(GLCanvasWithContext,
138 wxGLCanvas( wxWindow *parent,
139 const wxGLContext *shared = NULL,
140 wxWindowID id = -1,
141 const wxPoint& pos = wxDefaultPosition,
142 const wxSize& size = wxDefaultSize,
143 long style = 0,
144 const wxString& name = wxPyGLCanvasNameStr,
145 int *attribList = NULL,
146 const wxPalette& palette = wxNullPalette ));
147
148
149 void SetCurrent();
150 void SetColour(const wxString& colour);
151 void SwapBuffers();
152
153 wxGLContext* GetContext();
154
155 #ifdef __WXMSW__
156 void SetupPixelFormat(int *attribList = NULL);
157 void SetupPalette(const wxPalette& palette);
158 wxPalette CreateDefaultPalette();
159 wxPalette* GetPalette();
160 #endif
161 };
162
163
164 //---------------------------------------------------------------------------
165
166 %init %{
167
168 %}
169
170 //---------------------------------------------------------------------------
171 //---------------------------------------------------------------------------