]>
Commit | Line | Data |
---|---|---|
bd2af428 DE |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: wx/cocoa/glcanvas.h | |
3 | // Purpose: wxGLCanvas class | |
4 | // Author: David Elliott | |
5 | // Modified by: | |
6 | // Created: 2004/09/29 | |
7 | // RCS-ID: $Id$ | |
8 | // Copyright: (c) 2004 David Elliott | |
9 | // Licence: wxWindows licence | |
10 | ///////////////////////////////////////////////////////////////////////////// | |
11 | ||
12 | #ifndef _WX_COCOA_GLCANVAS_H__ | |
13 | #define _WX_COCOA_GLCANVAS_H__ | |
14 | ||
067c050c VZ |
15 | #include "wx/window.h" |
16 | ||
bd2af428 DE |
17 | // #include "wx/cocoa/NSOpenGLView.h" |
18 | // Include gl.h from the OpenGL framework | |
19 | #include <OpenGL/gl.h> | |
20 | ||
21 | class WXDLLIMPEXP_GL wxGLCanvas; | |
22 | DECLARE_WXCOCOA_OBJC_CLASS(NSOpenGLContext); | |
dc3065a5 | 23 | DECLARE_WXCOCOA_OBJC_CLASS(NSOpenGLView); |
bd2af428 DE |
24 | |
25 | // ======================================================================== | |
26 | // wxGLContext | |
27 | // ======================================================================== | |
dc3065a5 VZ |
28 | |
29 | class WXDLLIMPEXP_GL wxGLContext : public wxGLContextBase | |
bd2af428 DE |
30 | { |
31 | public: | |
dc3065a5 | 32 | wxGLContext(wxGLCanvas *win, const wxGLContext *other = NULL); |
bd2af428 | 33 | |
d3c7fc99 | 34 | virtual ~wxGLContext(); |
bd2af428 | 35 | |
dc3065a5 | 36 | virtual void SetCurrent(const wxGLCanvas& win) const; |
bd2af428 | 37 | |
dc3065a5 VZ |
38 | WX_NSOpenGLContext GetNSOpenGLContext() const |
39 | { return m_cocoaNSOpenGLContext; } | |
bd2af428 | 40 | |
dc3065a5 | 41 | private: |
bd2af428 | 42 | WX_NSOpenGLContext m_cocoaNSOpenGLContext; |
bd2af428 DE |
43 | }; |
44 | ||
bd2af428 DE |
45 | // ======================================================================== |
46 | // wxGLCanvas | |
47 | // ======================================================================== | |
dc3065a5 VZ |
48 | |
49 | class WXDLLIMPEXP_GL wxGLCanvas : public wxGLCanvasBase | |
50 | // , protected wxCocoaNSOpenGLView | |
bd2af428 DE |
51 | { |
52 | DECLARE_DYNAMIC_CLASS(wxGLCanvas) | |
bd2af428 DE |
53 | // WX_DECLARE_COCOA_OWNER(NSOpenGLView,NSView,NSView) |
54 | // ------------------------------------------------------------------------ | |
55 | // initialization | |
56 | // ------------------------------------------------------------------------ | |
57 | public: | |
bd2af428 | 58 | wxGLCanvas(wxWindow *parent, |
dc3065a5 VZ |
59 | wxWindowID id = wxID_ANY, |
60 | const int *attribList = NULL, | |
61 | const wxPoint& pos = wxDefaultPosition, | |
62 | const wxSize& size = wxDefaultSize, | |
63 | long style = 0, | |
64 | const wxString& name = wxGLCanvasName, | |
65 | const wxPalette& palette = wxNullPalette) | |
66 | { | |
67 | Create(parent, id, pos, size, style, name, attribList, palette); | |
68 | } | |
69 | ||
70 | bool Create(wxWindow *parent, | |
71 | wxWindowID id = wxID_ANY, | |
72 | const wxPoint& pos = wxDefaultPosition, | |
73 | const wxSize& size = wxDefaultSize, | |
74 | long style = 0, | |
75 | const wxString& name = wxGLCanvasName, | |
76 | const int *attribList = NULL, | |
77 | const wxPalette& palette = wxNullPalette); | |
bd2af428 | 78 | |
bd2af428 DE |
79 | virtual ~wxGLCanvas(); |
80 | ||
81 | // ------------------------------------------------------------------------ | |
82 | // Cocoa callbacks | |
83 | // ------------------------------------------------------------------------ | |
84 | protected: | |
85 | // NSOpenGLView cannot be enabled/disabled | |
86 | virtual void CocoaSetEnabled(bool enable) { } | |
87 | // ------------------------------------------------------------------------ | |
88 | // Implementation | |
89 | // ------------------------------------------------------------------------ | |
90 | public: | |
dc3065a5 | 91 | virtual void SwapBuffers(); |
bd2af428 | 92 | |
dc3065a5 VZ |
93 | |
94 | NSOpenGLView *GetNSOpenGLView() const | |
95 | { return (NSOpenGLView *)m_cocoaNSView; } | |
bd2af428 DE |
96 | }; |
97 | ||
98 | #endif //ndef _WX_COCOA_GLCANVAS_H__ |