]> git.saurik.com Git - wxWidgets.git/blob - include/wx/mac/carbon/glcanvas.h
Added wxDataViewCustomRenderer::RenderText() for renderer simple text in platform...
[wxWidgets.git] / include / wx / mac / carbon / glcanvas.h
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
15 #ifdef __DARWIN__
16 # include <OpenGL/gl.h>
17 # include <AGL/agl.h>
18 #else
19 # include <gl.h>
20 # include <agl.h>
21 #endif
22
23 class WXDLLEXPORT wxGLContext : public wxGLContextBase
24 {
25 public:
26 wxGLContext(wxGLCanvas *win, const wxGLContext *other = NULL);
27 virtual ~wxGLContext();
28
29 virtual void SetCurrent(const wxGLCanvas& win) const;
30
31 // Mac-specific
32 AGLContext GetAGLContext() const { return m_aglContext; }
33
34 private:
35 AGLContext m_aglContext;
36
37 DECLARE_NO_COPY_CLASS(wxGLContext)
38 };
39
40 class WXDLLEXPORT wxGLCanvas : public wxGLCanvasBase
41 {
42 public:
43 wxGLCanvas(wxWindow *parent,
44 wxWindowID id = wxID_ANY,
45 const int *attribList = NULL,
46 const wxPoint& pos = wxDefaultPosition,
47 const wxSize& size = wxDefaultSize,
48 long style = 0,
49 const wxString& name = wxGLCanvasName,
50 const wxPalette& palette = wxNullPalette);
51
52 bool Create(wxWindow *parent,
53 wxWindowID id = wxID_ANY,
54 const wxPoint& pos = wxDefaultPosition,
55 const wxSize& size = wxDefaultSize,
56 long style = 0,
57 const wxString& name = wxGLCanvasName,
58 const int *attribList = NULL,
59 const wxPalette& palette = wxNullPalette);
60
61 virtual ~wxGLCanvas();
62
63 // implement wxGLCanvasBase methods
64 virtual void SwapBuffers();
65
66
67 // Mac-specific functions
68 // ----------------------
69
70 // return the pixel format used by this window
71 AGLPixelFormat GetAGLPixelFormat() const { return m_aglFormat; }
72
73 // update the view port of the current context to match this window
74 void SetViewport();
75
76
77 // deprecated methods
78 // ------------------
79
80 #if WXWIN_COMPATIBILITY_2_8
81 wxDEPRECATED(
82 wxGLCanvas(wxWindow *parent,
83 wxWindowID id = wxID_ANY,
84 const wxPoint& pos = wxDefaultPosition,
85 const wxSize& size = wxDefaultSize,
86 long style = 0,
87 const wxString& name = wxGLCanvasName,
88 const int *attribList = NULL,
89 const wxPalette& palette = wxNullPalette)
90 );
91
92 wxDEPRECATED(
93 wxGLCanvas(wxWindow *parent,
94 const wxGLContext *shared,
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 wxGLCanvas *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 #endif // WXWIN_COMPATIBILITY_2_8
116
117 // implementation-only from now on
118
119 // Unlike some other platforms, this must get called if you override it.
120 // It sets the viewport correctly and update the context.
121 // You shouldn't call glViewport yourself either (use SetViewport if you must reset it.)
122 void OnSize(wxSizeEvent& event);
123
124 virtual void MacSuperChangedPosition();
125 virtual void MacTopLevelWindowChangedPosition();
126 virtual void MacVisibilityChanged();
127
128 void MacUpdateView();
129
130 protected:
131 AGLPixelFormat m_aglFormat;
132
133 bool m_macCanvasIsShown,
134 m_needsUpdate;
135
136 DECLARE_EVENT_TABLE()
137 DECLARE_CLASS(wxGLCanvas)
138 };
139
140 #endif // _WX_GLCANVAS_H_