]> git.saurik.com Git - wxWidgets.git/blame - include/wx/palmos/glcanvas.h
wxMSW and wxPalmOS already had the wxFont(const wxSize&...) ctor; don't duplicate it
[wxWidgets.git] / include / wx / palmos / glcanvas.h
CommitLineData
ffecfa5a
JS
1/////////////////////////////////////////////////////////////////////////////
2// Name: wx/palmos/glcanvas.h
3// Purpose: wxGLCanvas, for using OpenGL with wxWidgets under Palm OS
e1d63b79 4// Author: William Osborne - minimal working wxPalmOS port
ffecfa5a
JS
5// Modified by:
6// Created: 10/13/04
e1d63b79 7// RCS-ID: $Id$
ffecfa5a
JS
8// Copyright: (c) William Osborne
9// Licence: wxWindows licence
10/////////////////////////////////////////////////////////////////////////////
11
ffecfa5a
JS
12#ifndef _WX_GLCANVAS_H_
13#define _WX_GLCANVAS_H_
14
15#include "wx/palette.h"
16#include "wx/scrolwin.h"
17
0643d43c 18#include "wx/msw/wrapwin.h"
ffecfa5a
JS
19
20#include <GL/gl.h>
21
b5dbe15d 22class WXDLLIMPEXP_FWD_GL wxGLCanvas; /* forward reference */
ffecfa5a
JS
23
24class WXDLLIMPEXP_GL wxGLContext: public wxObject
25{
26public:
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
d3c7fc99 33 virtual ~wxGLContext();
ffecfa5a
JS
34
35
36 void SetCurrent();
37
35f1f4f7 38 void SetColour(const wxString& colour);
ffecfa5a
JS
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
49public:
50 HGLRC m_glContext;
51 WXHDC m_hDC;
52 wxWindow* m_window;
53};
54
55class WXDLLIMPEXP_GL wxGLCanvas: public wxWindow
56{
57 DECLARE_CLASS(wxGLCanvas)
58public:
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,
d3b9f782 66 const wxGLContext *shared = NULL,
ffecfa5a
JS
67 wxWindowID id = wxID_ANY,
68 const wxPoint& pos = wxDefaultPosition,
69 const wxSize& size = wxDefaultSize,
70 long style = 0,
71 const wxString& name = wxGLCanvasName,
d3b9f782 72 int *attribList = NULL,
ffecfa5a
JS
73 const wxPalette& palette = wxNullPalette);
74
75 wxGLCanvas(wxWindow *parent,
d3b9f782 76 const wxGLCanvas *shared = NULL,
ffecfa5a
JS
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
d3c7fc99 85 virtual ~wxGLCanvas();
ffecfa5a
JS
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
d3b9f782 113 void SetupPixelFormat(int *attribList = NULL);
ffecfa5a
JS
114
115 void SetupPalette(const wxPalette& palette);
116
ffecfa5a 117protected:
ffecfa5a
JS
118 WXHDC m_hDC;
119
120 DECLARE_EVENT_TABLE()
121};
122
123#endif
124 // _WX_GLCANVAS_H_
125