]> git.saurik.com Git - wxWidgets.git/blob - include/wx/palmos/glcanvas.h
destroy IDirectFBWindow in wxTLW dtor
[wxWidgets.git] / include / wx / palmos / glcanvas.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/palmos/glcanvas.h
3 // Purpose: wxGLCanvas, for using OpenGL with wxWidgets under Palm OS
4 // Author: William Osborne - minimal working wxPalmOS port
5 // Modified by:
6 // Created: 10/13/04
7 // RCS-ID: $Id$
8 // Copyright: (c) William Osborne
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
11
12 #ifndef _WX_GLCANVAS_H_
13 #define _WX_GLCANVAS_H_
14
15 #include "wx/palette.h"
16 #include "wx/scrolwin.h"
17
18 #include "wx/msw/wrapwin.h"
19
20 #include <GL/gl.h>
21
22 class WXDLLIMPEXP_GL wxGLCanvas; /* forward reference */
23
24 class WXDLLIMPEXP_GL wxGLContext: public wxObject
25 {
26 public:
27 wxGLContext(bool isRGB, wxGLCanvas *win, const wxPalette& palette = wxNullPalette);
28
29 wxGLContext( bool isRGB, wxGLCanvas *win,
30 const wxPalette& WXUNUSED(palette),
31 const wxGLContext *other /* for sharing display lists */ );
32
33 virtual ~wxGLContext();
34
35
36 void SetCurrent();
37
38 void SetColour(const wxChar *colour);
39
40 void SwapBuffers();
41
42
43 inline wxWindow* GetWindow() const { return m_window; }
44
45 inline WXHDC GetHDC() const { return m_hDC; }
46
47 inline HGLRC GetGLRC() const { return m_glContext; }
48
49 public:
50 HGLRC m_glContext;
51 WXHDC m_hDC;
52 wxWindow* m_window;
53 };
54
55 class WXDLLIMPEXP_GL wxGLCanvas: public wxWindow
56 {
57 DECLARE_CLASS(wxGLCanvas)
58 public:
59 wxGLCanvas(wxWindow *parent, wxWindowID id = wxID_ANY,
60 const wxPoint& pos = wxDefaultPosition,
61 const wxSize& size = wxDefaultSize, long style = 0,
62 const wxString& name = wxGLCanvasName, int *attribList = 0,
63 const wxPalette& palette = wxNullPalette);
64
65 wxGLCanvas(wxWindow *parent,
66 const wxGLContext *shared = (wxGLContext *) NULL,
67 wxWindowID id = wxID_ANY,
68 const wxPoint& pos = wxDefaultPosition,
69 const wxSize& size = wxDefaultSize,
70 long style = 0,
71 const wxString& name = wxGLCanvasName,
72 int *attribList = (int *) NULL,
73 const wxPalette& palette = wxNullPalette);
74
75 wxGLCanvas(wxWindow *parent,
76 const wxGLCanvas *shared = (wxGLCanvas *)NULL,
77 wxWindowID id = wxID_ANY,
78 const wxPoint& pos = wxDefaultPosition,
79 const wxSize& size = wxDefaultSize,
80 long style = 0,
81 const wxString& name = wxGLCanvasName,
82 int *attribList = 0,
83 const wxPalette& palette = wxNullPalette);
84
85 virtual ~wxGLCanvas();
86
87 // Replaces wxWindow::Create functionality, since
88 // we need to use a different window class
89 bool Create(wxWindow *parent, wxWindowID id,
90 const wxPoint& pos, const wxSize& size,
91 long style, const wxString& name);
92
93 void SetCurrent();
94
95 #ifdef __WXUNIVERSAL__
96 virtual bool SetCurrent(bool doit) { return wxWindow::SetCurrent(doit); };
97 #endif
98
99 void SetColour(const wxChar *colour);
100
101 void SwapBuffers();
102
103 void OnSize(wxSizeEvent& event);
104
105 void OnQueryNewPalette(wxQueryNewPaletteEvent& event);
106
107 void OnPaletteChanged(wxPaletteChangedEvent& event);
108
109 inline wxGLContext* GetContext() const { return m_glContext; }
110
111 inline WXHDC GetHDC() const { return m_hDC; }
112
113 void SetupPixelFormat(int *attribList = (int *) NULL);
114
115 void SetupPalette(const wxPalette& palette);
116
117 wxPalette CreateDefaultPalette();
118
119 inline wxPalette* GetPalette() const { return (wxPalette *) &m_palette; }
120
121 protected:
122 wxGLContext* m_glContext; // this is typedef-ed ptr, in fact
123 wxPalette m_palette;
124 WXHDC m_hDC;
125
126 DECLARE_EVENT_TABLE()
127 };
128
129 #endif
130 // _WX_GLCANVAS_H_
131