1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/cocoa/glcanvas.h
3 // Purpose: wxGLCanvas class
4 // Author: David Elliott
8 // Copyright: (c) 2004 David Elliott
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
12 #ifndef _WX_COCOA_GLCANVAS_H__
13 #define _WX_COCOA_GLCANVAS_H__
15 #include "wx/window.h"
17 // #include "wx/cocoa/NSOpenGLView.h"
18 // Include gl.h from the OpenGL framework
19 #include <OpenGL/gl.h>
21 class WXDLLIMPEXP_FWD_GL wxGLCanvas
;
22 DECLARE_WXCOCOA_OBJC_CLASS(NSOpenGLContext
);
23 DECLARE_WXCOCOA_OBJC_CLASS(NSOpenGLView
);
25 // ========================================================================
27 // ========================================================================
29 class WXDLLIMPEXP_GL wxGLContext
: public wxGLContextBase
32 wxGLContext(wxGLCanvas
*win
, const wxGLContext
*other
= NULL
);
34 virtual ~wxGLContext();
36 virtual void SetCurrent(const wxGLCanvas
& win
) const;
38 WX_NSOpenGLContext
GetNSOpenGLContext() const
39 { return m_cocoaNSOpenGLContext
; }
42 WX_NSOpenGLContext m_cocoaNSOpenGLContext
;
45 // ========================================================================
47 // ========================================================================
49 class WXDLLIMPEXP_GL wxGLCanvas
: public wxGLCanvasBase
50 // , protected wxCocoaNSOpenGLView
52 DECLARE_DYNAMIC_CLASS(wxGLCanvas
)
53 // WX_DECLARE_COCOA_OWNER(NSOpenGLView,NSView,NSView)
54 // ------------------------------------------------------------------------
56 // ------------------------------------------------------------------------
58 wxGLCanvas(wxWindow
*parent
,
59 wxWindowID id
= wxID_ANY
,
60 const int *attribList
= NULL
,
61 const wxPoint
& pos
= wxDefaultPosition
,
62 const wxSize
& size
= wxDefaultSize
,
64 const wxString
& name
= wxGLCanvasName
,
65 const wxPalette
& palette
= wxNullPalette
)
67 Create(parent
, id
, pos
, size
, style
, name
, attribList
, palette
);
70 bool Create(wxWindow
*parent
,
71 wxWindowID id
= wxID_ANY
,
72 const wxPoint
& pos
= wxDefaultPosition
,
73 const wxSize
& size
= wxDefaultSize
,
75 const wxString
& name
= wxGLCanvasName
,
76 const int *attribList
= NULL
,
77 const wxPalette
& palette
= wxNullPalette
);
79 virtual ~wxGLCanvas();
81 // ------------------------------------------------------------------------
83 // ------------------------------------------------------------------------
85 // NSOpenGLView cannot be enabled/disabled
86 virtual void CocoaSetEnabled(bool enable
) { }
87 // ------------------------------------------------------------------------
89 // ------------------------------------------------------------------------
91 virtual void SwapBuffers();
94 NSOpenGLView
*GetNSOpenGLView() const
95 { return (NSOpenGLView
*)m_cocoaNSView
; }
98 #endif //ndef _WX_COCOA_GLCANVAS_H__