Add default ctor to wxGLCanvas
It didn't make any sense to have Create() functions in this class without the default ctor as they could be never used -- calling them would result in creating the window twice. Add the default ctor to make this class more similar to all the other windows.
This commit is contained in:
parent
46857a73ba
commit
1f9113b40a
8 changed files with 21 additions and 15 deletions
|
|
@ -29,6 +29,8 @@ class WXDLLIMPEXP_GL wxGLCanvas : public wxGLCanvasImpl
|
|||
{
|
||||
typedef wxGLCanvasImpl BaseType;
|
||||
public:
|
||||
wxGLCanvas() = default;
|
||||
|
||||
wxGLCanvas(wxWindow *parent,
|
||||
const wxGLAttributes& dispAttrs,
|
||||
wxWindowID id = wxID_ANY,
|
||||
|
|
|
|||
|
|
@ -47,6 +47,8 @@ private:
|
|||
class WXDLLIMPEXP_GL wxGLCanvas : public wxGLCanvasBase
|
||||
{
|
||||
public:
|
||||
wxGLCanvas() = default;
|
||||
|
||||
explicit // avoid implicitly converting a wxWindow* to wxGLCanvas
|
||||
wxGLCanvas(wxWindow *parent,
|
||||
const wxGLAttributes& dispAttrs,
|
||||
|
|
@ -115,9 +117,6 @@ public:
|
|||
#endif // wxUSE_PALETTE
|
||||
|
||||
protected:
|
||||
// common part of all ctors
|
||||
void Init();
|
||||
|
||||
// the real window creation function, Create() may reuse it twice as we may
|
||||
// need to create an OpenGL window to query the available extensions and
|
||||
// then potentially delete and recreate it with another pixel format
|
||||
|
|
@ -133,7 +132,7 @@ protected:
|
|||
|
||||
|
||||
// HDC for this window, we keep it all the time
|
||||
HDC m_hDC;
|
||||
HDC m_hDC = nullptr;
|
||||
|
||||
private:
|
||||
wxDECLARE_EVENT_TABLE();
|
||||
|
|
|
|||
|
|
@ -60,6 +60,8 @@ private:
|
|||
class WXDLLIMPEXP_GL wxGLCanvas : public wxGLCanvasBase
|
||||
{
|
||||
public:
|
||||
wxGLCanvas() = default;
|
||||
|
||||
wxGLCanvas(wxWindow *parent,
|
||||
const wxGLAttributes& dispAttrs,
|
||||
wxWindowID id = wxID_ANY,
|
||||
|
|
@ -126,7 +128,7 @@ protected:
|
|||
long style,
|
||||
const wxString& name);
|
||||
|
||||
WXGLPixelFormat m_glFormat;
|
||||
WXGLPixelFormat m_glFormat = nullptr;
|
||||
wxGLAttributes m_GLAttrs;
|
||||
|
||||
wxDECLARE_EVENT_TABLE();
|
||||
|
|
|
|||
|
|
@ -34,6 +34,8 @@ public:
|
|||
class WXDLLIMPEXP_GL wxGLCanvas : public wxGLCanvasBase
|
||||
{
|
||||
public:
|
||||
wxGLCanvas() = default;
|
||||
|
||||
explicit // avoid implicitly converting a wxWindow* to wxGLCanvas
|
||||
wxGLCanvas(wxWindow *parent,
|
||||
const wxGLAttributes& dispAttrs,
|
||||
|
|
|
|||
|
|
@ -17,6 +17,8 @@
|
|||
class WXDLLIMPEXP_GL wxGLCanvas : public wxGLCanvasX11
|
||||
{
|
||||
public:
|
||||
wxGLCanvas() = default;
|
||||
|
||||
wxGLCanvas(wxWindow *parent,
|
||||
const wxGLAttributes& dispAttrs,
|
||||
wxWindowID id = wxID_ANY,
|
||||
|
|
|
|||
|
|
@ -785,6 +785,15 @@ enum
|
|||
class wxGLCanvas : public wxWindow
|
||||
{
|
||||
public:
|
||||
/**
|
||||
Default constructor not creating the window.
|
||||
|
||||
Create() must be used to actually create it later.
|
||||
|
||||
@since 3.3.0
|
||||
*/
|
||||
wxGLCanvas();
|
||||
|
||||
/**
|
||||
Creates a window with the given parameters. Notice that you need to
|
||||
create and use a wxGLContext to output to this window.
|
||||
|
|
|
|||
|
|
@ -641,11 +641,6 @@ wxEND_EVENT_TABLE()
|
|||
// wxGLCanvas construction
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
void wxGLCanvas::Init()
|
||||
{
|
||||
m_hDC = nullptr;
|
||||
}
|
||||
|
||||
wxGLCanvas::wxGLCanvas(wxWindow *parent,
|
||||
const wxGLAttributes& dispAttrs,
|
||||
wxWindowID id,
|
||||
|
|
@ -655,8 +650,6 @@ wxGLCanvas::wxGLCanvas(wxWindow *parent,
|
|||
const wxString& name,
|
||||
const wxPalette& palette)
|
||||
{
|
||||
Init();
|
||||
|
||||
(void)Create(parent, dispAttrs, id, pos, size, style, name, palette);
|
||||
}
|
||||
|
||||
|
|
@ -669,8 +662,6 @@ wxGLCanvas::wxGLCanvas(wxWindow *parent,
|
|||
const wxString& name,
|
||||
const wxPalette& palette)
|
||||
{
|
||||
Init();
|
||||
|
||||
(void)Create(parent, id, pos, size, style, name, attribList, palette);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -465,7 +465,6 @@ bool wxGLCanvas::Create(wxWindow *parent,
|
|||
const wxString& name,
|
||||
const wxPalette& WXUNUSED(palette))
|
||||
{
|
||||
m_glFormat = nullptr;
|
||||
// Don't allow an empty list
|
||||
if ( !dispAttrs.GetGLAttrs() )
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue