From bd1b0b3ed12a4ead0710261b0d3d54b799d3d888 Mon Sep 17 00:00:00 2001 From: Sylvain Bougnoux Date: Mon, 7 Feb 2000 20:47:05 +0000 Subject: [PATCH] Add ctor with shared GLCanvas ( to be gtk compliant) git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@5893 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- utils/glcanvas/win/glcanvas.cpp | 34 +++++++++++++++++++++++++++++---- utils/glcanvas/win/glcanvas.h | 10 +++------- 2 files changed, 33 insertions(+), 11 deletions(-) diff --git a/utils/glcanvas/win/glcanvas.cpp b/utils/glcanvas/win/glcanvas.cpp index 28defce46d..aee52f2f2a 100644 --- a/utils/glcanvas/win/glcanvas.cpp +++ b/utils/glcanvas/win/glcanvas.cpp @@ -141,13 +141,12 @@ wxGLCanvas::wxGLCanvas(wxWindow *parent, wxWindowID id, SetFont(wxSystemSettings::GetSystemFont(wxSYS_DEFAULT_GUI_FONT)); } - m_hDC = (WXHDC) ::GetDC((HWND) GetHWND()); + m_hDC = (WXHDC) ::GetDC((HWND) GetHWND()); SetupPixelFormat(); SetupPalette(palette); m_glContext = new wxGLContext(TRUE, this, palette); - } wxGLCanvas::wxGLCanvas( wxWindow *parent, @@ -156,9 +155,9 @@ wxGLCanvas::wxGLCanvas( wxWindow *parent, int *attribList, const wxPalette& palette ) : wxScrolledWindow() { - m_glContext = (wxGLContext*) NULL; + m_glContext = (wxGLContext*) NULL; - bool ret = Create(parent, id, pos, size, style, name); + bool ret = Create(parent, id, pos, size, style, name); if ( ret ) { @@ -174,6 +173,33 @@ wxGLCanvas::wxGLCanvas( wxWindow *parent, m_glContext = new wxGLContext(TRUE, this, palette, shared ); } +// Not very usefull for wxMSW, but this is to be wxGTK compliant + +wxGLCanvas::wxGLCanvas( wxWindow *parent, const wxGLCanvas *shared, wxWindowID id, + const wxPoint& pos, const wxSize& size, long style, const wxString& name, + int *attribList, const wxPalette& palette ): + wxScrolledWindow() +{ + m_glContext = (wxGLContext*) NULL; + + bool ret = Create(parent, id, pos, size, style, name); + + if ( ret ) + { + SetBackgroundColour(wxSystemSettings::GetSystemColour(wxSYS_COLOUR_3DFACE)); + SetFont(wxSystemSettings::GetSystemFont(wxSYS_DEFAULT_GUI_FONT)); + } + + m_hDC = (WXHDC) ::GetDC((HWND) GetHWND()); + + SetupPixelFormat(); + SetupPalette(palette); + + wxGLContext *sharedContext=0; + if (shared) sharedContext=shared->GetContext(); + m_glContext = new wxGLContext(TRUE, this, palette, sharedContext ); +} + wxGLCanvas::~wxGLCanvas() { if (m_glContext) diff --git a/utils/glcanvas/win/glcanvas.h b/utils/glcanvas/win/glcanvas.h index 9c6dbc746d..e684478b28 100644 --- a/utils/glcanvas/win/glcanvas.h +++ b/utils/glcanvas/win/glcanvas.h @@ -69,12 +69,6 @@ class wxGLCanvas: public wxScrolledWindow { DECLARE_CLASS(wxGLCanvas) public: - wxGLCanvas() - { - m_glContext = (wxGLContext*) NULL; - m_hDC = 0; - } - wxGLCanvas(wxWindow *parent, wxWindowID id = -1, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = 0, const wxString& name = "GLCanvas", int *attribList = 0, const wxPalette& palette = wxNullPalette); @@ -82,7 +76,9 @@ class wxGLCanvas: public wxScrolledWindow wxWindowID id = -1, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = 0, const wxString& name = "GLCanvas", int *attribList = (int*) NULL, const wxPalette& palette = wxNullPalette ); - + wxGLCanvas( wxWindow *parent, const wxGLCanvas *shared = (wxGLCanvas *)NULL, wxWindowID id = -1, + const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = 0, + const wxString& name = "GLCanvas", int *attribList = 0, const wxPalette& palette = wxNullPalette ); ~wxGLCanvas(); // Replaces wxWindow::Create functionality, since we need to use a different window class