]> git.saurik.com Git - wxWidgets.git/blob - include/wx/osx/glcanvas.h
add support for GtkFontChooserDialog, new in GTK 3.2
[wxWidgets.git] / include / wx / osx / glcanvas.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/osx/glcanvas.h
3 // Purpose: wxGLCanvas, for using OpenGL with wxWidgets under Macintosh
4 // Author: Stefan Csomor
5 // Modified by:
6 // Created: 1998-01-01
7 // RCS-ID: $Id$
8 // Copyright: (c) Stefan Csomor
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
11
12 #ifndef _WX_GLCANVAS_H_
13 #define _WX_GLCANVAS_H_
14
15 #ifdef __WXOSX_IPHONE__
16 #import <OpenGLES/ES1/gl.h>
17 #import <OpenGLES/ES1/glext.h>
18 #define wxUSE_OPENGL_EMULATION 1
19 #else
20 #include <OpenGL/gl.h>
21 #endif
22
23 #include "wx/vector.h"
24
25 // low level calls
26
27 WXDLLIMPEXP_GL WXGLContext WXGLCreateContext( WXGLPixelFormat pixelFormat, WXGLContext shareContext );
28 WXDLLIMPEXP_GL void WXGLDestroyContext( WXGLContext context );
29
30 WXDLLIMPEXP_GL WXGLContext WXGLGetCurrentContext();
31 WXDLLIMPEXP_GL bool WXGLSetCurrentContext(WXGLContext context);
32
33 WXDLLIMPEXP_GL WXGLPixelFormat WXGLChoosePixelFormat(const int *attribList);
34 WXDLLIMPEXP_GL void WXGLDestroyPixelFormat( WXGLPixelFormat pixelFormat );
35
36 class WXDLLIMPEXP_GL wxGLContext : public wxGLContextBase
37 {
38 public:
39 wxGLContext(wxGLCanvas *win, const wxGLContext *other = NULL);
40 virtual ~wxGLContext();
41
42 virtual bool SetCurrent(const wxGLCanvas& win) const;
43
44 // Mac-specific
45 WXGLContext GetWXGLContext() const { return m_glContext; }
46
47 private:
48 WXGLContext m_glContext;
49
50 wxDECLARE_NO_COPY_CLASS(wxGLContext);
51 };
52
53 class WXDLLIMPEXP_GL wxGLCanvas : public wxGLCanvasBase
54 {
55 public:
56 wxGLCanvas(wxWindow *parent,
57 wxWindowID id = wxID_ANY,
58 const int *attribList = NULL,
59 const wxPoint& pos = wxDefaultPosition,
60 const wxSize& size = wxDefaultSize,
61 long style = 0,
62 const wxString& name = wxGLCanvasName,
63 const wxPalette& palette = wxNullPalette);
64
65 bool Create(wxWindow *parent,
66 wxWindowID id = wxID_ANY,
67 const wxPoint& pos = wxDefaultPosition,
68 const wxSize& size = wxDefaultSize,
69 long style = 0,
70 const wxString& name = wxGLCanvasName,
71 const int *attribList = NULL,
72 const wxPalette& palette = wxNullPalette);
73
74 virtual ~wxGLCanvas();
75
76 // implement wxGLCanvasBase methods
77 virtual bool SwapBuffers();
78
79
80 // Mac-specific functions
81 // ----------------------
82
83 // return true if multisample extension is supported
84 static bool IsAGLMultiSampleAvailable();
85
86 // return the pixel format used by this window
87 WXGLPixelFormat GetWXGLPixelFormat() const { return m_glFormat; }
88
89 // update the view port of the current context to match this window
90 void SetViewport();
91
92
93 // deprecated methods
94 // ------------------
95
96 #if WXWIN_COMPATIBILITY_2_8
97 wxDEPRECATED(
98 wxGLCanvas(wxWindow *parent,
99 wxWindowID id = wxID_ANY,
100 const wxPoint& pos = wxDefaultPosition,
101 const wxSize& size = wxDefaultSize,
102 long style = 0,
103 const wxString& name = wxGLCanvasName,
104 const int *attribList = NULL,
105 const wxPalette& palette = wxNullPalette)
106 );
107
108 wxDEPRECATED(
109 wxGLCanvas(wxWindow *parent,
110 const wxGLContext *shared,
111 wxWindowID id = wxID_ANY,
112 const wxPoint& pos = wxDefaultPosition,
113 const wxSize& size = wxDefaultSize,
114 long style = 0,
115 const wxString& name = wxGLCanvasName,
116 const int *attribList = NULL,
117 const wxPalette& palette = wxNullPalette)
118 );
119
120 wxDEPRECATED(
121 wxGLCanvas(wxWindow *parent,
122 const wxGLCanvas *shared,
123 wxWindowID id = wxID_ANY,
124 const wxPoint& pos = wxDefaultPosition,
125 const wxSize& size = wxDefaultSize,
126 long style = 0,
127 const wxString& name = wxGLCanvasName,
128 const int *attribList = NULL,
129 const wxPalette& palette = wxNullPalette)
130 );
131 #endif // WXWIN_COMPATIBILITY_2_8
132
133 // implementation-only from now on
134
135 #if wxOSX_USE_CARBON
136 // Unlike some other platforms, this must get called if you override it,
137 // i.e. don't forget "event.Skip()" in your EVT_SIZE handler
138 void OnSize(wxSizeEvent& event);
139
140 virtual void MacSuperChangedPosition();
141 virtual void MacTopLevelWindowChangedPosition();
142 virtual void MacVisibilityChanged();
143
144 void MacUpdateView();
145
146 GLint GetAglBufferName() const { return m_bufferName; }
147 #endif
148
149 protected:
150 WXGLPixelFormat m_glFormat;
151
152 #if wxOSX_USE_CARBON
153 bool m_macCanvasIsShown,
154 m_needsUpdate;
155 WXGLContext m_dummyContext;
156 GLint m_bufferName;
157 #endif
158
159 DECLARE_EVENT_TABLE()
160 DECLARE_CLASS(wxGLCanvas)
161 };
162
163 #endif // _WX_GLCANVAS_H_