]>
git.saurik.com Git - wxWidgets.git/blob - utils/glcanvas/gtk/glcanvas.h
1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: wxGLCanvas, for using OpenGL/Mesa with wxWindows and GTK
4 // Author: Robert Roebling
8 // Copyright: (c) Robert Roebling
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
13 #pragma interface "glcanvas.h"
16 #ifndef _WX_GLCANVAS_H_
17 #define _WX_GLCANVAS_H_
20 #include "wx/scrolwin.h"
28 //---------------------------------------------------------------------------
30 //---------------------------------------------------------------------------
35 //---------------------------------------------------------------------------
37 //---------------------------------------------------------------------------
40 class wxGLContext
: public wxObject
42 DECLARE_CLASS(wxGLContext
)
46 wxGLContext( bool isRGB
, wxWindow
*win
, const wxPalette
& palette
= wxNullPalette
);
50 void SetColour(const char *colour
);
53 void SetupPixelFormat();
54 void SetupPalette(const wxPalette
& palette
);
55 wxPalette
CreateDefaultPalette();
57 inline wxPalette
* GetPalette() const { return (wxPalette
*) & m_palette
; }
58 inline wxWindow
* GetWindow() const { return m_window
; }
59 inline GtkWidget
* GetWidget() const { return m_widget
; }
60 inline GLXContext
GetContext() const { return m_glContext
; }
64 GLXContext m_glContext
;
71 //---------------------------------------------------------------------------
73 //---------------------------------------------------------------------------
75 class wxGLCanvas
: public wxScrolledWindow
77 DECLARE_CLASS(wxGLCanvas
)
80 wxGLCanvas( wxWindow
*parent
, wxWindowID id
= -1,
81 const wxPoint
& pos
= wxDefaultPosition
,
82 const wxSize
& size
= wxDefaultSize
,
83 long style
= 0, const wxString
& name
= "GLCanvas",
84 int *attribList
= (int*) NULL
,
85 const wxPalette
& palette
= wxNullPalette
);
87 bool Create( wxWindow
*parent
, wxWindowID id
= -1,
88 const wxPoint
& pos
= wxDefaultPosition
,
89 const wxSize
& size
= wxDefaultSize
,
90 long style
= 0, const wxString
& name
= "GLCanvas",
91 int *attribList
= (int*) NULL
,
92 const wxPalette
& palette
= wxNullPalette
);
97 void SetColour(const char *colour
);
100 void OnSize(wxSizeEvent
& event
);
102 inline wxGLContext
* GetContext() const { return m_glContext
; }
106 virtual void DoSetSize( int x
, int y
, int width
, int height
,
107 int sizeFlags
= wxSIZE_AUTO
);
109 virtual GtkWidget
*GetConnectWidget();
110 bool IsOwnGtkWindow( GdkWindow
*window
);
112 wxGLContext
*m_glContext
;
113 GtkWidget
*m_glWidget
;
115 DECLARE_EVENT_TABLE()