1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/cocoa/glcanvas.h
3 // Purpose: wxGLCanvas class
4 // Author: David Elliott
7 // Copyright: (c) 2004 David Elliott
8 // Licence: wxWindows licence
9 /////////////////////////////////////////////////////////////////////////////
11 #ifndef _WX_COCOA_GLCANVAS_H__
12 #define _WX_COCOA_GLCANVAS_H__
14 #include "wx/window.h"
16 // #include "wx/cocoa/NSOpenGLView.h"
17 // Include gl.h from the OpenGL framework
18 #include <OpenGL/gl.h>
20 class WXDLLIMPEXP_FWD_GL wxGLCanvas
;
21 DECLARE_WXCOCOA_OBJC_CLASS(NSOpenGLContext
);
22 DECLARE_WXCOCOA_OBJC_CLASS(NSOpenGLView
);
24 // ========================================================================
26 // ========================================================================
28 class WXDLLIMPEXP_GL wxGLContext
: public wxGLContextBase
31 wxGLContext(wxGLCanvas
*win
, const wxGLContext
*other
= NULL
);
33 virtual ~wxGLContext();
35 virtual void SetCurrent(const wxGLCanvas
& win
) const;
37 WX_NSOpenGLContext
GetNSOpenGLContext() const
38 { return m_cocoaNSOpenGLContext
; }
41 WX_NSOpenGLContext m_cocoaNSOpenGLContext
;
44 // ========================================================================
46 // ========================================================================
48 class WXDLLIMPEXP_GL wxGLCanvas
: public wxGLCanvasBase
49 // , protected wxCocoaNSOpenGLView
51 DECLARE_DYNAMIC_CLASS(wxGLCanvas
)
52 // WX_DECLARE_COCOA_OWNER(NSOpenGLView,NSView,NSView)
53 // ------------------------------------------------------------------------
55 // ------------------------------------------------------------------------
57 wxGLCanvas(wxWindow
*parent
,
58 wxWindowID id
= wxID_ANY
,
59 const int *attribList
= NULL
,
60 const wxPoint
& pos
= wxDefaultPosition
,
61 const wxSize
& size
= wxDefaultSize
,
63 const wxString
& name
= wxGLCanvasName
,
64 const wxPalette
& palette
= wxNullPalette
)
66 Create(parent
, id
, pos
, size
, style
, name
, attribList
, palette
);
69 bool Create(wxWindow
*parent
,
70 wxWindowID id
= wxID_ANY
,
71 const wxPoint
& pos
= wxDefaultPosition
,
72 const wxSize
& size
= wxDefaultSize
,
74 const wxString
& name
= wxGLCanvasName
,
75 const int *attribList
= NULL
,
76 const wxPalette
& palette
= wxNullPalette
);
78 virtual ~wxGLCanvas();
80 // ------------------------------------------------------------------------
82 // ------------------------------------------------------------------------
84 // NSOpenGLView cannot be enabled/disabled
85 virtual void CocoaSetEnabled(bool enable
) { }
86 // ------------------------------------------------------------------------
88 // ------------------------------------------------------------------------
90 virtual void SwapBuffers();
93 NSOpenGLView
*GetNSOpenGLView() const
94 { return (NSOpenGLView
*)m_cocoaNSView
; }
97 #endif //ndef _WX_COCOA_GLCANVAS_H__