X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/dc3065a56f1febf3de3b3bbf0904cf8fdc7f7c50..419a3607032dc850b5045c622e3f10caa9e1cf91:/include/wx/glcanvas.h?ds=sidebyside diff --git a/include/wx/glcanvas.h b/include/wx/glcanvas.h index 9e1c89ea8e..e02657cc96 100644 --- a/include/wx/glcanvas.h +++ b/include/wx/glcanvas.h @@ -20,8 +20,8 @@ #include "wx/palette.h" #include "wx/window.h" -class WXDLLIMPEXP_GL wxGLCanvas; -class WXDLLIMPEXP_GL wxGLContext; +class WXDLLIMPEXP_FWD_GL wxGLCanvas; +class WXDLLIMPEXP_FWD_GL wxGLContext; // ---------------------------------------------------------------------------- // Constants for attributes list @@ -66,7 +66,7 @@ public: */ // set this context as the current one - virtual void SetCurrent(const wxGLCanvas& win) const = 0; + virtual bool SetCurrent(const wxGLCanvas& win) const = 0; }; // ---------------------------------------------------------------------------- @@ -77,12 +77,7 @@ class WXDLLIMPEXP_GL wxGLCanvasBase : public wxWindow { public: // default ctor doesn't initialize the window, use Create() later - wxGLCanvasBase() - { -#if WXWIN_COMPATIBILITY_2_8 - m_glContext = NULL; -#endif - } + wxGLCanvasBase(); virtual ~wxGLCanvasBase(); @@ -104,15 +99,18 @@ public: // ---------- // set the given context associated with this window as the current one - void SetCurrent(const wxGLContext& context) const; + bool SetCurrent(const wxGLContext& context) const; // flush the back buffer (if we have it) - virtual void SwapBuffers() = 0; + virtual bool SwapBuffers() = 0; // accessors // --------- + // check if the given attributes are supported without creating a canvas + static bool IsDisplaySupported(const int *attribList); + const wxPalette *GetPalette() const { return &m_palette; } // miscellaneous helper functions @@ -120,7 +118,7 @@ public: // call glcolor() for the colour with the given name, return false if // colour not found - bool SetColour(const wxChar *colour); + bool SetColour(const wxString& colour); @@ -155,6 +153,22 @@ protected: #endif // WXWIN_COMPATIBILITY_2_8 }; +// ---------------------------------------------------------------------------- +// wxGLApp: a special wxApp subclass for OpenGL applications which must be used +// to select a visual compatible with the given attributes +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_GL wxGLAppBase : public wxApp +{ +public: + wxGLAppBase() : wxApp() { } + + // use this in the constructor of the user-derived wxGLApp class to + // determine if an OpenGL rendering context with these attributes + // is available - returns true if so, false if not. + virtual bool InitGLVisual(const int *attribList) = 0; +}; + #if defined(__WXMSW__) #include "wx/msw/glcanvas.h" #elif defined(__WXMOTIF__) || defined(__WXX11__) @@ -171,20 +185,22 @@ protected: #error "wxGLCanvas not supported in this wxWidgets port" #endif -class WXDLLIMPEXP_GL wxGLApp : public wxApp +// wxMac and wxMSW don't need anything extra in wxGLAppBase, so declare it here +#ifndef wxGL_APP_DEFINED + +class WXDLLIMPEXP_GL wxGLApp : public wxGLAppBase { public: - wxGLApp() : wxApp() { } + wxGLApp() : wxGLAppBase() { } - // use this in the constructor of the user-derived wxGLApp class to - // determine if an OpenGL rendering context with these attributes - // is available - returns true if so, false if not. - bool InitGLVisual(const int *attribList); + virtual bool InitGLVisual(const int *attribList); private: DECLARE_DYNAMIC_CLASS(wxGLApp) }; +#endif // !wxGL_APP_DEFINED + #endif // wxUSE_GLCANVAS #endif // _WX_GLCANVAS_H_BASE_