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_GL wxGLCanvas
;
22 DECLARE_WXCOCOA_OBJC_CLASS(NSOpenGLContext
);
23 //DECLARE_WXCOCOA_OBJC_CLASS(NSOpenGLView);
25 // ========================================================================
27 // ========================================================================
28 class WXDLLIMPEXP_GL wxGLContext
: public wxObject
31 wxGLContext(bool isRGB
, wxGLCanvas
*win
, const wxPalette
& palette
= wxNullPalette
);
33 wxGLContext( bool isRGB
, wxGLCanvas
*win
,
34 const wxPalette
& WXUNUSED(palette
),
35 const wxGLContext
*other
/* for sharing display lists */ );
37 virtual ~wxGLContext();
42 void SetColour(const wxChar
*colour
);
47 inline wxWindow
* GetWindow() const
50 inline WX_NSOpenGLContext
GetNSOpenGLContext() const
51 { return m_cocoaNSOpenGLContext
; }
54 WX_NSOpenGLContext m_cocoaNSOpenGLContext
;
60 // ========================================================================
62 // ========================================================================
63 class WXDLLIMPEXP_GL wxGLCanvas
: public wxWindow
// , protected wxCocoaNSOpenGLView
65 DECLARE_DYNAMIC_CLASS(wxGLCanvas
)
67 // WX_DECLARE_COCOA_OWNER(NSOpenGLView,NSView,NSView)
68 // ------------------------------------------------------------------------
70 // ------------------------------------------------------------------------
75 wxGLCanvas(wxWindow
*parent
, wxWindowID winid
= wxID_ANY
,
76 const wxPoint
& pos
= wxDefaultPosition
,
77 const wxSize
& size
= wxDefaultSize
,
78 long style
= 0, const wxString
& name
= wxGLCanvasName
,
79 int *attribList
= NULL
, const wxPalette
& palette
= wxNullPalette
);
81 wxGLCanvas(wxWindow
*parent
,
82 const wxGLContext
*shared
= NULL
,
83 wxWindowID winid
= wxID_ANY
,
84 const wxPoint
& pos
= wxDefaultPosition
,
85 const wxSize
& size
= wxDefaultSize
,
86 long style
= 0, const wxString
& name
= wxGLCanvasName
,
87 int *attribList
= NULL
, const wxPalette
& palette
= wxNullPalette
);
89 wxGLCanvas(wxWindow
*parent
,
90 const wxGLCanvas
*shared
= NULL
,
91 wxWindowID winid
= wxID_ANY
,
92 const wxPoint
& pos
= wxDefaultPosition
,
93 const wxSize
& size
= wxDefaultSize
,
94 long style
= 0, const wxString
& name
= wxGLCanvasName
,
95 int *attribList
= NULL
, const wxPalette
& palette
= wxNullPalette
);
97 bool Create(wxWindow
*parent
, wxWindowID winid
,
98 const wxPoint
& pos
= wxDefaultPosition
,
99 const wxSize
& size
= wxDefaultSize
,
100 long style
= 0, const wxString
& name
= wxGLCanvasName
);
101 virtual ~wxGLCanvas();
103 // ------------------------------------------------------------------------
105 // ------------------------------------------------------------------------
107 // NSOpenGLView cannot be enabled/disabled
108 virtual void CocoaSetEnabled(bool enable
) { }
109 // ------------------------------------------------------------------------
111 // ------------------------------------------------------------------------
116 void OnSize(wxSizeEvent
& event
)
118 inline wxGLContext
* GetContext() const
119 { return m_glContext
; }
121 wxGLContext
*m_glContext
;
125 #endif //ndef _WX_COCOA_GLCANVAS_H__