Code::Blocks Forums

Developer forums (C::B DEVELOPMENT STRICTLY!) => Plugins development => Topic started by: stahta01 on August 17, 2013, 11:11:04 pm

Title: wx2.9.5 Patch for wxWidgets - Contrib Items wx2.9.x
Post by: stahta01 on August 17, 2013, 11:11:04 pm
I have found an compile bug/design changed issue caused by wxWidgets 2.9.5

Example Compiler Error
Code
src\plugins\contrib\wxContribItems\wxchart\src\legendwindow.cpp|34|error: no 'wxObject* wxLegendWindow::wxCreateObject()' member function declared in class 'wxLegendWindow'|

Reason seems to be the use of wxWidgets Macro DECLARE_CLASS when the correct Macro is DECLARE_DYNAMIC_CLASS in the header file.
It is needed if IMPLEMENT_DYNAMIC_CLASS is used in the source file.

Can an C++ and wxWidgets expect confirm this is correct?

Patch below; it compiles with wxWidgets 2.9.5; but, no other testing has been done.

Code
Index: src/plugins/contrib/wxContribItems/wxchart/include/wx/yaxiswindow.h
===================================================================
--- src/plugins/contrib/wxContribItems/wxchart/include/wx/yaxiswindow.h (revision 9266)
+++ src/plugins/contrib/wxContribItems/wxchart/include/wx/yaxiswindow.h (working copy)
@@ -86,7 +86,7 @@
     void OnPaint(wxPaintEvent &event);
     void OnMouse(wxMouseEvent &event);
 
-    DECLARE_CLASS(wxYAxisWindow)
+    DECLARE_DYNAMIC_CLASS(wxYAxisWindow)
     DECLARE_EVENT_TABLE()
 };
 
Index: src/plugins/contrib/wxContribItems/wxchart/include/wx/legendwindow.h
===================================================================
--- src/plugins/contrib/wxContribItems/wxchart/include/wx/legendwindow.h (revision 9266)
+++ src/plugins/contrib/wxContribItems/wxchart/include/wx/legendwindow.h (working copy)
@@ -67,7 +67,7 @@
     void OnMouse(wxMouseEvent &event);
     void OnMouseMove(wxMouseEvent &event);
 
-    DECLARE_CLASS(wxLegendWindow)
+    DECLARE_DYNAMIC_CLASS(wxLegendWindow);
     DECLARE_EVENT_TABLE()
 };
 

Tim S.

 
Title: Re: wx2.9.5 Patch for wxWidgets - Contrib Items wx2.9.x
Post by: Jenna on August 17, 2013, 11:53:51 pm
I just stumbled across the same issue.
I just committed the fix.

In wx2.8 DECLARE_CLASS and DECLARE_DYNAMIC_CLASS are the same, while in wx2.9 they differ.
The dynamic classes implement a static wxCreateObject function, which is not declared by DECLARE_CLASS.
Title: Re: wx2.9.5 Patch for wxWidgets - Contrib Items wx2.9.x
Post by: MortenMacFly on August 18, 2013, 07:14:41 am
...I already have a patch pending for this - it just needs testing....