]> git.saurik.com Git - wxWidgets.git/blame - include/wx/cocoa/glcanvas.h
Fix wxPropertyGrid::GetPropertyRect when the last item is collapsed.
[wxWidgets.git] / include / wx / cocoa / glcanvas.h
CommitLineData
bd2af428
DE
1/////////////////////////////////////////////////////////////////////////////
2// Name: wx/cocoa/glcanvas.h
3// Purpose: wxGLCanvas class
4// Author: David Elliott
5// Modified by:
6// Created: 2004/09/29
bd2af428
DE
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
067c050c
VZ
14#include "wx/window.h"
15
bd2af428
DE
16// #include "wx/cocoa/NSOpenGLView.h"
17// Include gl.h from the OpenGL framework
18#include <OpenGL/gl.h>
19
b5dbe15d 20class WXDLLIMPEXP_FWD_GL wxGLCanvas;
bd2af428 21DECLARE_WXCOCOA_OBJC_CLASS(NSOpenGLContext);
dc3065a5 22DECLARE_WXCOCOA_OBJC_CLASS(NSOpenGLView);
bd2af428
DE
23
24// ========================================================================
25// wxGLContext
26// ========================================================================
dc3065a5
VZ
27
28class WXDLLIMPEXP_GL wxGLContext : public wxGLContextBase
bd2af428
DE
29{
30public:
dc3065a5 31 wxGLContext(wxGLCanvas *win, const wxGLContext *other = NULL);
bd2af428 32
d3c7fc99 33 virtual ~wxGLContext();
bd2af428 34
dc3065a5 35 virtual void SetCurrent(const wxGLCanvas& win) const;
bd2af428 36
dc3065a5
VZ
37 WX_NSOpenGLContext GetNSOpenGLContext() const
38 { return m_cocoaNSOpenGLContext; }
bd2af428 39
dc3065a5 40private:
bd2af428 41 WX_NSOpenGLContext m_cocoaNSOpenGLContext;
bd2af428
DE
42};
43
bd2af428
DE
44// ========================================================================
45// wxGLCanvas
46// ========================================================================
dc3065a5
VZ
47
48class WXDLLIMPEXP_GL wxGLCanvas : public wxGLCanvasBase
49 // , protected wxCocoaNSOpenGLView
bd2af428
DE
50{
51 DECLARE_DYNAMIC_CLASS(wxGLCanvas)
bd2af428
DE
52// WX_DECLARE_COCOA_OWNER(NSOpenGLView,NSView,NSView)
53// ------------------------------------------------------------------------
54// initialization
55// ------------------------------------------------------------------------
56public:
bd2af428 57 wxGLCanvas(wxWindow *parent,
dc3065a5
VZ
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);
bd2af428 77
bd2af428
DE
78 virtual ~wxGLCanvas();
79
80// ------------------------------------------------------------------------
81// Cocoa callbacks
82// ------------------------------------------------------------------------
83protected:
84 // NSOpenGLView cannot be enabled/disabled
85 virtual void CocoaSetEnabled(bool enable) { }
86// ------------------------------------------------------------------------
87// Implementation
88// ------------------------------------------------------------------------
89public:
dc3065a5 90 virtual void SwapBuffers();
bd2af428 91
dc3065a5
VZ
92
93 NSOpenGLView *GetNSOpenGLView() const
94 { return (NSOpenGLView *)m_cocoaNSView; }
bd2af428
DE
95};
96
97#endif //ndef _WX_COCOA_GLCANVAS_H__