diff --git a/src/wx/drawing.h b/src/wx/drawing.h index 4d095a68..7c63ab01 100644 --- a/src/wx/drawing.h +++ b/src/wx/drawing.h @@ -6,14 +6,6 @@ class BasicDrawingPanel : public DrawingPanel, public wxPanel { public: BasicDrawingPanel(wxWindow* parent, int _width, int _height); - wxWindow* GetWindow() - { - return this; - } - void Delete() - { - Destroy(); - } protected: void PaintEv2(wxPaintEvent& ev) @@ -33,14 +25,6 @@ class GLDrawingPanel : public DrawingPanel, public wxGLCanvas { public: GLDrawingPanel(wxWindow* parent, int _width, int _height); virtual ~GLDrawingPanel(); - wxWindow* GetWindow() - { - return this; - } - void Delete() - { - Destroy(); - } protected: void PaintEv2(wxPaintEvent& ev) @@ -64,14 +48,6 @@ protected: class DXDrawingPanel : public DrawingPanel, public wxPanel { public: DXDrawingPanel(wxWindow* parent, int _width, int _height); - wxWindow* GetWindow() - { - return this; - } - void Delete() - { - Destroy(); - } protected: void PaintEv2(wxPaintEvent& ev) @@ -93,14 +69,6 @@ class CairoDrawingPanel : public DrawingPanel, public wxPanel { public: CairoDrawingPanel(wxWindow* parent, int _width, int _height); ~CairoDrawingPanel(); - wxWindow* GetWindow() - { - return this; - } - void Delete() - { - Destroy(); - } protected: void PaintEv2(wxPaintEvent& ev) diff --git a/src/wx/wxvbam.h b/src/wx/wxvbam.h index 78227fff..40c2d1d9 100644 --- a/src/wx/wxvbam.h +++ b/src/wx/wxvbam.h @@ -628,9 +628,11 @@ public: DrawingPanel(int _width, int _height); ~DrawingPanel(); void DrawArea(uint8_t** pixels); - // the following wouldn't be necessary with virtual inheritance - virtual wxWindow* GetWindow() = 0; - virtual void Delete() = 0; + + // using dynamic_cast<> to not force trivial reimplementation in concrete classes + // TODO: figure something out for PaintEv as well + virtual wxWindow* GetWindow() { return dynamic_cast(this); } + virtual void Delete() { (dynamic_cast(this))->Destroy(); } protected: virtual void DrawArea(wxWindowDC&) = 0;