X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/ab89a5b59b104dcbac4d30217209dc873c07d036..a71dec776e22b9bdaa73027d67ec5c0c7d0b21df:/src/mac/carbon/glcanvas.cpp diff --git a/src/mac/carbon/glcanvas.cpp b/src/mac/carbon/glcanvas.cpp index aca2b5be13..7f44e45910 100644 --- a/src/mac/carbon/glcanvas.cpp +++ b/src/mac/carbon/glcanvas.cpp @@ -1,6 +1,6 @@ ///////////////////////////////////////////////////////////////////////////// // Name: glcanvas.cpp -// Purpose: wxGLCanvas, for using OpenGL with wxWindows under Macintosh +// Purpose: wxGLCanvas, for using OpenGL with wxWidgets under Macintosh // Author: Stefan Csomor // Modified by: // Created: 1998-01-01 @@ -9,7 +9,7 @@ // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// -#ifdef __GNUG__ +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) #pragma implementation "glcanvas.h" #endif @@ -19,8 +19,6 @@ #pragma hdrstop #endif -#include "wx/setup.h" - #if wxUSE_GLCANVAS #ifndef WX_PRECOMP @@ -33,6 +31,10 @@ #include "wx/glcanvas.h" #include "wx/mac/uma.h" +// DLL options compatibility check: +#include "wx/build.h" +WX_CHECK_BUILD_OPTIONS("wxGL") + /* * GLContext implementation */ @@ -45,7 +47,7 @@ wxGLContext::wxGLContext( { m_window = win; - m_drawable = (AGLDrawable) UMAGetWindowPort(MAC_WXHWND(win->MacGetRootWindow())); + m_drawable = (AGLDrawable) UMAGetWindowPort(MAC_WXHWND(win->MacGetTopLevelWindowRef())); m_glContext = aglCreateContext(fmt, other ? other->m_glContext : NULL); wxCHECK_RET( m_glContext, wxT("Couldn't create OpenGl context") ); @@ -91,17 +93,14 @@ void wxGLContext::Update() } } -void wxGLContext::SetColour(const char *colour) +void wxGLContext::SetColour(const wxChar *colour) { - float r = 0.0; - float g = 0.0; - float b = 0.0; - wxColour *col = wxTheColourDatabase->FindColour(colour); - if (col) + wxColour col = wxTheColourDatabase->Find(colour); + if (col.Ok()) { - r = (float)(col->Red()/256.0); - g = (float)(col->Green()/256.0); - b = (float)(col->Blue()/256.0); + float r = (float)(col.Red()/256.0); + float g = (float)(col.Green()/256.0); + float b = (float)(col.Blue()/256.0); glColor3f( r, g, b); } } @@ -261,7 +260,7 @@ void wxGLCanvas::SetViewport() int width, height; GetClientSize(& width, & height); Rect bounds ; - GetWindowPortBounds( MAC_WXHWND(MacGetRootWindow()) , &bounds ) ; + GetWindowPortBounds( MAC_WXHWND(MacGetTopLevelWindowRef()) , &bounds ) ; GLint parms[4] ; parms[0] = x ; parms[1] = bounds.bottom - bounds.top - ( y + height ) ; @@ -309,7 +308,7 @@ void wxGLCanvas::SetCurrent() } } -void wxGLCanvas::SetColour(const char *colour) +void wxGLCanvas::SetColour(const wxChar *colour) { if (m_glContext) m_glContext->SetColour(colour); @@ -319,7 +318,7 @@ bool wxGLCanvas::Show(bool show) { if ( !wxWindow::Show( show ) ) return FALSE ; - +/* if ( !show ) { if ( m_macCanvasIsShown ) @@ -330,18 +329,19 @@ bool wxGLCanvas::Show(bool show) } else { - if ( MacIsReallyShown() && !m_macCanvasIsShown ) + if ( m_peer->IsVisible()&& !m_macCanvasIsShown ) { m_macCanvasIsShown = true ; SetViewport() ; } } +*/ return TRUE ; } -void wxGLCanvas::MacSuperShown( bool show ) +void wxGLCanvas::MacVisibilityChanged() { - if ( !show ) + if ( !MacIsReallyShown() ) { if ( m_macCanvasIsShown ) { @@ -351,14 +351,13 @@ void wxGLCanvas::MacSuperShown( bool show ) } else { - if ( MacIsReallyShown() && !m_macCanvasIsShown ) + if ( !m_macCanvasIsShown ) { m_macCanvasIsShown = true ; SetViewport() ; } } - - wxWindow::MacSuperShown( show ) ; + wxWindowMac::MacVisibilityChanged() ; } //---------------------------------------------------------------------------