wxCocoa: Added (mostly) stubs for wxGLCanvas and friends.
[wxWidgets.git] / include / wx / cocoa / glcanvas.h
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
15 // #include "wx/cocoa/NSOpenGLView.h"
16 // Include gl.h from the OpenGL framework
17 #include <OpenGL/gl.h>
18
19 class WXDLLIMPEXP_GL wxGLCanvas;
20 DECLARE_WXCOCOA_OBJC_CLASS(NSOpenGLContext);
21 //DECLARE_WXCOCOA_OBJC_CLASS(NSOpenGLView);
22
23 // ========================================================================
24 // wxGLContext
25 // ========================================================================
26 class WXDLLIMPEXP_GL wxGLContext: public wxObject
27 {
28 public:
29 wxGLContext(bool isRGB, wxGLCanvas *win, const wxPalette& palette = wxNullPalette);
30
31 wxGLContext( bool isRGB, wxGLCanvas *win,
32 const wxPalette& WXUNUSED(palette),
33 const wxGLContext *other /* for sharing display lists */ );
34
35 ~wxGLContext();
36
37
38 void SetCurrent();
39
40 void SetColour(const wxChar *colour);
41
42 void SwapBuffers();
43
44
45 inline wxWindow* GetWindow() const
46 { return m_window; }
47
48 inline WX_NSOpenGLContext GetNSOpenGLContext() const
49 { return m_cocoaNSOpenGLContext; }
50
51 public:
52 WX_NSOpenGLContext m_cocoaNSOpenGLContext;
53 wxWindow* m_window;
54 };
55
56
57
58 // ========================================================================
59 // wxGLCanvas
60 // ========================================================================
61 class WXDLLIMPEXP_GL wxGLCanvas: public wxWindow// , protected wxCocoaNSOpenGLView
62 {
63 DECLARE_DYNAMIC_CLASS(wxGLCanvas)
64 DECLARE_EVENT_TABLE()
65 // WX_DECLARE_COCOA_OWNER(NSOpenGLView,NSView,NSView)
66 // ------------------------------------------------------------------------
67 // initialization
68 // ------------------------------------------------------------------------
69 public:
70 wxGLCanvas()
71 : m_glContext(NULL)
72 { }
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);
78
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);
86
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);
94
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();
100
101 // ------------------------------------------------------------------------
102 // Cocoa callbacks
103 // ------------------------------------------------------------------------
104 protected:
105 // NSOpenGLView cannot be enabled/disabled
106 virtual void CocoaSetEnabled(bool enable) { }
107 // ------------------------------------------------------------------------
108 // Implementation
109 // ------------------------------------------------------------------------
110 public:
111 void SetCurrent();
112 void SwapBuffers();
113
114 void OnSize(wxSizeEvent& event)
115 {}
116 inline wxGLContext* GetContext() const
117 { return m_glContext; }
118 protected:
119 wxGLContext *m_glContext;
120 wxPalette m_palette;
121 };
122
123 #endif //ndef _WX_COCOA_GLCANVAS_H__