]> git.saurik.com Git - wxWidgets.git/blob - include/wx/cocoa/glcanvas.h
Add wxActivateEvent::GetActivationReason().
[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 // Copyright: (c) 2004 David Elliott
8 // Licence: wxWindows licence
9 /////////////////////////////////////////////////////////////////////////////
10
11 #ifndef _WX_COCOA_GLCANVAS_H__
12 #define _WX_COCOA_GLCANVAS_H__
13
14 #include "wx/window.h"
15
16 // #include "wx/cocoa/NSOpenGLView.h"
17 // Include gl.h from the OpenGL framework
18 #include <OpenGL/gl.h>
19
20 class WXDLLIMPEXP_FWD_GL wxGLCanvas;
21 DECLARE_WXCOCOA_OBJC_CLASS(NSOpenGLContext);
22 DECLARE_WXCOCOA_OBJC_CLASS(NSOpenGLView);
23
24 // ========================================================================
25 // wxGLContext
26 // ========================================================================
27
28 class WXDLLIMPEXP_GL wxGLContext : public wxGLContextBase
29 {
30 public:
31 wxGLContext(wxGLCanvas *win, const wxGLContext *other = NULL);
32
33 virtual ~wxGLContext();
34
35 virtual void SetCurrent(const wxGLCanvas& win) const;
36
37 WX_NSOpenGLContext GetNSOpenGLContext() const
38 { return m_cocoaNSOpenGLContext; }
39
40 private:
41 WX_NSOpenGLContext m_cocoaNSOpenGLContext;
42 };
43
44 // ========================================================================
45 // wxGLCanvas
46 // ========================================================================
47
48 class WXDLLIMPEXP_GL wxGLCanvas : public wxGLCanvasBase
49 // , protected wxCocoaNSOpenGLView
50 {
51 DECLARE_DYNAMIC_CLASS(wxGLCanvas)
52 // WX_DECLARE_COCOA_OWNER(NSOpenGLView,NSView,NSView)
53 // ------------------------------------------------------------------------
54 // initialization
55 // ------------------------------------------------------------------------
56 public:
57 wxGLCanvas(wxWindow *parent,
58 wxWindowID id = wxID_ANY,
59 const int *attribList = NULL,
60 const wxPoint& pos = wxDefaultPosition,
61 const wxSize& size = wxDefaultSize,
62 long style = 0,
63 const wxString& name = wxGLCanvasName,
64 const wxPalette& palette = wxNullPalette)
65 {
66 Create(parent, id, pos, size, style, name, attribList, palette);
67 }
68
69 bool Create(wxWindow *parent,
70 wxWindowID id = wxID_ANY,
71 const wxPoint& pos = wxDefaultPosition,
72 const wxSize& size = wxDefaultSize,
73 long style = 0,
74 const wxString& name = wxGLCanvasName,
75 const int *attribList = NULL,
76 const wxPalette& palette = wxNullPalette);
77
78 virtual ~wxGLCanvas();
79
80 // ------------------------------------------------------------------------
81 // Cocoa callbacks
82 // ------------------------------------------------------------------------
83 protected:
84 // NSOpenGLView cannot be enabled/disabled
85 virtual void CocoaSetEnabled(bool enable) { }
86 // ------------------------------------------------------------------------
87 // Implementation
88 // ------------------------------------------------------------------------
89 public:
90 virtual void SwapBuffers();
91
92
93 NSOpenGLView *GetNSOpenGLView() const
94 { return (NSOpenGLView *)m_cocoaNSView; }
95 };
96
97 #endif //ndef _WX_COCOA_GLCANVAS_H__