[wxpython-dev] richtextstyles wrapping

Robin Dunn robin at alldunn.com
Mon Mar 24 18:33:14 PDT 2008


Petr Šimon wrote:
> Robin Dunn wrote:
>> Petr Šimon wrote:
>>> Hello,
>>> I am very much interested in wrapping the richtextstyles and related 
>>> stuff. I don't have much experience with swig, though. My initial 
>>> attempt was only partially succesful. I am getting "No constructor 
>>> defined" error.
>>>
>>> My .i file looks like this:
>>> //-----------------
>>> %{
>>> #include <wx/richtext/richtextstyles.h>
>>> %}
>>> //--------------------------------------------------------------------------- 
>>>
>>> %newgroup
>>> class wxRichTextStyleDefinition: public wxObject
>>> {
>>> public:
>>>   wxRichTextStyleDefinition(const wxRichTextStyleDefinition& def);
>>>   /// Default constructor
>>>   wxRichTextStyleDefinition(const wxString& name = wxPyEmptyString);
>>>   virtual ~wxRichTextStyleDefinition();
>>>
>>>    /// Initialises members
>>>   void Init();
>>>
>>>    /// Copies from def
>>>    void Copy(const wxRichTextStyleDefinition& def);
>>>
>>>    /// Equality test
>>>    bool Eq(const wxRichTextStyleDefinition& def) const;
>>> etc...
>>>
>>> My questions:
>>>
>>> 1. What am I doing wrong?
>>
>> Not sure.  You do have constructors defined there...

> I still don't understand why RichTextStyleDefinition doesn't work, but 

You don't show the full class above, do you have the "= 0" at the end of 
the declaration for the Clone method?  If so then SWIG is going to 
recognize it as a pure virtual method and will not let you create 
instances of it.  (Since I had my own style of dealing with ABCs before 
SWIG was smart enough to deal with them itself, I always leave out the 
"= 0"'s and just comment out the constructor declaration myself.  It 
accomplishes the same thing.


-- 
Robin Dunn
Software Craftsman
http://wxPython.org  Java give you jitters?  Relax with wxPython!



More information about the wxpython-dev mailing list