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/cocoa/NSOpenGLView.h"
16 // Include gl.h from the OpenGL framework
17 #include <OpenGL/gl.h>
19 class WXDLLIMPEXP_GL wxGLCanvas
;
20 DECLARE_WXCOCOA_OBJC_CLASS(NSOpenGLContext
);
21 //DECLARE_WXCOCOA_OBJC_CLASS(NSOpenGLView);
23 // ========================================================================
25 // ========================================================================
26 class WXDLLIMPEXP_GL wxGLContext
: public wxObject
29 wxGLContext(bool isRGB
, wxGLCanvas
*win
, const wxPalette
& palette
= wxNullPalette
);
31 wxGLContext( bool isRGB
, wxGLCanvas
*win
,
32 const wxPalette
& WXUNUSED(palette
),
33 const wxGLContext
*other
/* for sharing display lists */ );
40 void SetColour(const wxChar
*colour
);
45 inline wxWindow
* GetWindow() const
48 inline WX_NSOpenGLContext
GetNSOpenGLContext() const
49 { return m_cocoaNSOpenGLContext
; }
52 WX_NSOpenGLContext m_cocoaNSOpenGLContext
;
58 // ========================================================================
60 // ========================================================================
61 class WXDLLIMPEXP_GL wxGLCanvas
: public wxWindow
// , protected wxCocoaNSOpenGLView
63 DECLARE_DYNAMIC_CLASS(wxGLCanvas
)
65 // WX_DECLARE_COCOA_OWNER(NSOpenGLView,NSView,NSView)
66 // ------------------------------------------------------------------------
68 // ------------------------------------------------------------------------
73 wxGLCanvas(wxWindow
*parent
, wxWindowID winid
= wxID_ANY
,
74 const wxPoint
& pos
= wxDefaultPosition
,
75 const wxSize
& size
= wxDefaultSize
,
76 long style
= 0, const wxString
& name
= wxGLCanvasName
,
77 int *attribList
= NULL
, const wxPalette
& palette
= wxNullPalette
);
79 wxGLCanvas(wxWindow
*parent
,
80 const wxGLContext
*shared
= NULL
,
81 wxWindowID winid
= wxID_ANY
,
82 const wxPoint
& pos
= wxDefaultPosition
,
83 const wxSize
& size
= wxDefaultSize
,
84 long style
= 0, const wxString
& name
= wxGLCanvasName
,
85 int *attribList
= NULL
, const wxPalette
& palette
= wxNullPalette
);
87 wxGLCanvas(wxWindow
*parent
,
88 const wxGLCanvas
*shared
= NULL
,
89 wxWindowID winid
= wxID_ANY
,
90 const wxPoint
& pos
= wxDefaultPosition
,
91 const wxSize
& size
= wxDefaultSize
,
92 long style
= 0, const wxString
& name
= wxGLCanvasName
,
93 int *attribList
= NULL
, const wxPalette
& palette
= wxNullPalette
);
95 bool Create(wxWindow
*parent
, wxWindowID winid
,
96 const wxPoint
& pos
= wxDefaultPosition
,
97 const wxSize
& size
= wxDefaultSize
,
98 long style
= 0, const wxString
& name
= wxGLCanvasName
);
99 virtual ~wxGLCanvas();
101 // ------------------------------------------------------------------------
103 // ------------------------------------------------------------------------
105 // NSOpenGLView cannot be enabled/disabled
106 virtual void CocoaSetEnabled(bool enable
) { }
107 // ------------------------------------------------------------------------
109 // ------------------------------------------------------------------------
114 void OnSize(wxSizeEvent
& event
)
116 inline wxGLContext
* GetContext() const
117 { return m_glContext
; }
119 wxGLContext
*m_glContext
;
123 #endif //ndef _WX_COCOA_GLCANVAS_H__