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
8 // Copyright: (c) William Osborne
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
12 #ifndef _WX_GLCANVAS_H_
13 #define _WX_GLCANVAS_H_
15 #include "wx/palette.h"
16 #include "wx/scrolwin.h"
18 #include "wx/msw/wrapwin.h"
22 class WXDLLIMPEXP_FWD_GL wxGLCanvas
; /* forward reference */
24 class WXDLLIMPEXP_GL wxGLContext
: public wxObject
27 wxGLContext(bool isRGB
, wxGLCanvas
*win
, const wxPalette
& palette
= wxNullPalette
);
29 wxGLContext( bool isRGB
, wxGLCanvas
*win
,
30 const wxPalette
& WXUNUSED(palette
),
31 const wxGLContext
*other
/* for sharing display lists */ );
33 virtual ~wxGLContext();
38 void SetColour(const wxString
& colour
);
43 inline wxWindow
* GetWindow() const { return m_window
; }
45 inline WXHDC
GetHDC() const { return m_hDC
; }
47 inline HGLRC
GetGLRC() const { return m_glContext
; }
55 class WXDLLIMPEXP_GL wxGLCanvas
: public wxWindow
57 DECLARE_CLASS(wxGLCanvas
)
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
);
65 wxGLCanvas(wxWindow
*parent
,
66 const wxGLContext
*shared
= NULL
,
67 wxWindowID id
= wxID_ANY
,
68 const wxPoint
& pos
= wxDefaultPosition
,
69 const wxSize
& size
= wxDefaultSize
,
71 const wxString
& name
= wxGLCanvasName
,
72 int *attribList
= NULL
,
73 const wxPalette
& palette
= wxNullPalette
);
75 wxGLCanvas(wxWindow
*parent
,
76 const wxGLCanvas
*shared
= NULL
,
77 wxWindowID id
= wxID_ANY
,
78 const wxPoint
& pos
= wxDefaultPosition
,
79 const wxSize
& size
= wxDefaultSize
,
81 const wxString
& name
= wxGLCanvasName
,
83 const wxPalette
& palette
= wxNullPalette
);
85 virtual ~wxGLCanvas();
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
);
95 #ifdef __WXUNIVERSAL__
96 virtual bool SetCurrent(bool doit
) { return wxWindow::SetCurrent(doit
); }
99 void SetColour(const wxChar
*colour
);
103 void OnSize(wxSizeEvent
& event
);
105 void OnQueryNewPalette(wxQueryNewPaletteEvent
& event
);
107 void OnPaletteChanged(wxPaletteChangedEvent
& event
);
109 inline wxGLContext
* GetContext() const { return m_glContext
; }
111 inline WXHDC
GetHDC() const { return m_hDC
; }
113 void SetupPixelFormat(int *attribList
= NULL
);
115 void SetupPalette(const wxPalette
& palette
);
120 DECLARE_EVENT_TABLE()