]> git.saurik.com Git - wxWidgets.git/blame - include/wx/osx/glcanvas.h
adding scroll wheel support
[wxWidgets.git] / include / wx / osx / glcanvas.h
CommitLineData
6762286d
SC
1/////////////////////////////////////////////////////////////////////////////
2// Name: wx/mac/carbon/glcanvas.h
3// Purpose: wxGLCanvas, for using OpenGL with wxWidgets under Macintosh
4// Author: Stefan Csomor
5// Modified by:
6// Created: 1998-01-01
7// RCS-ID: $Id$
8// Copyright: (c) Stefan Csomor
9// Licence: wxWindows licence
10/////////////////////////////////////////////////////////////////////////////
11
12#ifndef _WX_GLCANVAS_H_
13#define _WX_GLCANVAS_H_
14
15#include <OpenGL/gl.h>
16
17// low level calls
18
19WXDLLIMPEXP_GL WXGLContext WXGLCreateContext( WXGLPixelFormat pixelFormat, WXGLContext shareContext );
20WXDLLIMPEXP_GL void WXGLDestroyContext( WXGLContext context );
21WXDLLIMPEXP_GL WXGLContext WXGLGetCurrentContext();
22WXDLLIMPEXP_GL void WXGLSwapBuffers( WXGLContext context );
23
24WXDLLIMPEXP_GL WXGLPixelFormat WXGLChoosePixelFormat(const int *attribList);
25WXDLLIMPEXP_GL void WXGLDestroyPixelFormat( WXGLPixelFormat pixelFormat );
26
27class WXDLLIMPEXP_GL wxGLContext : public wxGLContextBase
28{
29public:
30 wxGLContext(wxGLCanvas *win, const wxGLContext *other = NULL);
31 virtual ~wxGLContext();
32
33 virtual bool SetCurrent(const wxGLCanvas& win) const;
34
35 // Mac-specific
36 WXGLContext GetWXGLContext() const { return m_glContext; }
37
38private:
39 WXGLContext m_glContext;
40
41 DECLARE_NO_COPY_CLASS(wxGLContext)
42};
43
44class WXDLLIMPEXP_GL wxGLCanvas : public wxGLCanvasBase
45{
46public:
47 wxGLCanvas(wxWindow *parent,
48 wxWindowID id = wxID_ANY,
49 const int *attribList = NULL,
50 const wxPoint& pos = wxDefaultPosition,
51 const wxSize& size = wxDefaultSize,
52 long style = 0,
53 const wxString& name = wxGLCanvasName,
54 const wxPalette& palette = wxNullPalette);
55
56 bool Create(wxWindow *parent,
57 wxWindowID id = wxID_ANY,
58 const wxPoint& pos = wxDefaultPosition,
59 const wxSize& size = wxDefaultSize,
60 long style = 0,
61 const wxString& name = wxGLCanvasName,
62 const int *attribList = NULL,
63 const wxPalette& palette = wxNullPalette);
64
65 virtual ~wxGLCanvas();
66
67 // implement wxGLCanvasBase methods
68 virtual bool SwapBuffers();
69
70
71 // Mac-specific functions
72 // ----------------------
73
74 // return true if multisample extension is supported
75 static bool IsAGLMultiSampleAvailable();
76
77 // return the pixel format used by this window
78 WXGLPixelFormat GetWXGLPixelFormat() const { return m_glFormat; }
79
80 // update the view port of the current context to match this window
81 void SetViewport();
82
83
84 // deprecated methods
85 // ------------------
86
87#if WXWIN_COMPATIBILITY_2_8
88 wxDEPRECATED(
89 wxGLCanvas(wxWindow *parent,
90 wxWindowID id = wxID_ANY,
91 const wxPoint& pos = wxDefaultPosition,
92 const wxSize& size = wxDefaultSize,
93 long style = 0,
94 const wxString& name = wxGLCanvasName,
95 const int *attribList = NULL,
96 const wxPalette& palette = wxNullPalette)
97 );
98
99 wxDEPRECATED(
100 wxGLCanvas(wxWindow *parent,
101 const wxGLContext *shared,
102 wxWindowID id = wxID_ANY,
103 const wxPoint& pos = wxDefaultPosition,
104 const wxSize& size = wxDefaultSize,
105 long style = 0,
106 const wxString& name = wxGLCanvasName,
107 const int *attribList = NULL,
108 const wxPalette& palette = wxNullPalette)
109 );
110
111 wxDEPRECATED(
112 wxGLCanvas(wxWindow *parent,
113 const wxGLCanvas *shared,
114 wxWindowID id = wxID_ANY,
115 const wxPoint& pos = wxDefaultPosition,
116 const wxSize& size = wxDefaultSize,
117 long style = 0,
118 const wxString& name = wxGLCanvasName,
119 const int *attribList = NULL,
120 const wxPalette& palette = wxNullPalette)
121 );
122#endif // WXWIN_COMPATIBILITY_2_8
123
124 // implementation-only from now on
125
126#if wxOSX_USE_CARBON
127 // Unlike some other platforms, this must get called if you override it,
128 // i.e. don't forget "event.Skip()" in your EVT_SIZE handler
129 void OnSize(wxSizeEvent& event);
130
131 virtual void MacSuperChangedPosition();
132 virtual void MacTopLevelWindowChangedPosition();
133 virtual void MacVisibilityChanged();
134
135 void MacUpdateView();
136
137 GLint GetAglBufferName() const { return m_bufferName; }
138#endif
139
140protected:
141 WXGLPixelFormat m_glFormat;
142
143#if wxOSX_USE_CARBON
144 bool m_macCanvasIsShown,
145 m_needsUpdate;
146 WXGLContext m_dummyContext;
147 GLint m_bufferName;
148#endif
149
150 DECLARE_EVENT_TABLE()
151 DECLARE_CLASS(wxGLCanvas)
152};
153
154#endif // _WX_GLCANVAS_H_