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