Hi all !.
I would like to have shapes of different types with my own member variables in all of them.
So the right thing to do should be to create a new base class call it MyBase and add all the member variables there.
The, derive for example a MyRectShape from wxSFRectShape and MyBase right ?
If I do this for all the shapes I need I could have pointers to all the shapes in the canvas and access the members through the MyBase base class. Well that is not easy to do because of the dynamic RTTI object creation mechanism and macros used in each shape declaration and implementation. I have tested with XS_IMPLEMENT_CLONABLE_CLASS2 but it doesnt work for me. Has somebody done this ?
What about to derive your data class from xsSerializable and simply attach it to the shapes via wxSFShapeBase::SetUserData() ? In this case you just need the simple XS_DECLARE_CLONABLE_CLASS macro placed inside the derived class declaration and XS_IMPLEMENT_CLONABLE_CLASS somewhere in the implementation. All members of the data class will be correctly serialized if marked by XS_SERIALIZE macro.
Log in to post a comment.