]>
Commit | Line | Data |
---|---|---|
8cf73271 | 1 | ///////////////////////////////////////////////////////////////////////////// |
b73e73f9 | 2 | // Name: wx/mac/carbon/glcanvas.h |
77ffb593 | 3 | // Purpose: wxGLCanvas, for using OpenGL with wxWidgets under Macintosh |
8cf73271 SC |
4 | // Author: Stefan Csomor |
5 | // Modified by: | |
6 | // Created: 1998-01-01 | |
7 | // RCS-ID: $Id$ | |
8 | // Copyright: (c) Stefan Csomor | |
65571936 | 9 | // Licence: wxWindows licence |
8cf73271 SC |
10 | ///////////////////////////////////////////////////////////////////////////// |
11 | ||
db4c39a9 VZ |
12 | #ifndef _WX_GLCANVAS_H_ |
13 | #define _WX_GLCANVAS_H_ | |
14 | ||
8cf73271 SC |
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 | ||
163b3ad7 | 23 | class WXDLLIMPEXP_GL wxGLContext : public wxGLContextBase |
8cf73271 SC |
24 | { |
25 | public: | |
dc3065a5 VZ |
26 | wxGLContext(wxGLCanvas *win, const wxGLContext *other = NULL); |
27 | virtual ~wxGLContext(); | |
8cf73271 | 28 | |
50ccc908 | 29 | virtual bool SetCurrent(const wxGLCanvas& win) const; |
8cf73271 | 30 | |
dc3065a5 VZ |
31 | // Mac-specific |
32 | AGLContext GetAGLContext() const { return m_aglContext; } | |
8cf73271 | 33 | |
dc3065a5 VZ |
34 | private: |
35 | AGLContext m_aglContext; | |
8cf73271 | 36 | |
dc3065a5 | 37 | DECLARE_NO_COPY_CLASS(wxGLContext) |
8cf73271 SC |
38 | }; |
39 | ||
163b3ad7 | 40 | class WXDLLIMPEXP_GL wxGLCanvas : public wxGLCanvasBase |
8cf73271 | 41 | { |
dc3065a5 VZ |
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 | |
50ccc908 | 64 | virtual bool SwapBuffers(); |
dc3065a5 VZ |
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 | ||
728bcab0 VZ |
119 | // Unlike some other platforms, this must get called if you override it, |
120 | // i.e. don't forget "event.Skip()" in your EVT_SIZE handler | |
dc3065a5 VZ |
121 | void OnSize(wxSizeEvent& event); |
122 | ||
123 | virtual void MacSuperChangedPosition(); | |
124 | virtual void MacTopLevelWindowChangedPosition(); | |
125 | virtual void MacVisibilityChanged(); | |
126 | ||
127 | void MacUpdateView(); | |
8cf73271 SC |
128 | |
129 | protected: | |
dc3065a5 VZ |
130 | AGLPixelFormat m_aglFormat; |
131 | ||
132 | bool m_macCanvasIsShown, | |
133 | m_needsUpdate; | |
134 | ||
135 | DECLARE_EVENT_TABLE() | |
136 | DECLARE_CLASS(wxGLCanvas) | |
8cf73271 SC |
137 | }; |
138 | ||
8cf73271 | 139 | #endif // _WX_GLCANVAS_H_ |