+ /**
+ Ensure that this object's data is not shared with any other object.
+
+ If we have no data, it is created using CreateRefData();
+ if we have shared data (i.e. data with a reference count greater than 1),
+ it is copied using CloneRefData(); otherwise nothing is done (the data
+ is already present and is not shared by other object instances).
+
+ If you use this function you should make sure that you override the
+ CreateRefData() and CloneRefData() functions in your class otherwise
+ an assertion will fail at runtime.
+ */
+ void AllocExclusive();
+
+ /**
+ Creates a new instance of the wxObjectRefData-derived class specific to
+ this object and returns it.
+
+ This is usually implemented as a one-line call:
+ @code
+ wxObjectRefData *MyObject::CreateRefData() const
+ {
+ return new MyObjectRefData;
+ }
+ @endcode
+ */
+ virtual wxObjectRefData *CreateRefData() const;
+
+ /**
+ Creates a new instance of the wxObjectRefData-derived class specific to
+ this object and initializes it copying @a data.
+
+ This is usually implemented as a one-line call:
+ @code
+ wxObjectRefData *MyObject::CloneRefData(const wxObjectRefData *data) const
+ {
+ // rely on the MyObjectRefData copy ctor:
+ return new MyObjectRefData(*(MyObjectRefData *)data);
+ }
+ @endcode
+ */
+ virtual wxObjectRefData *CloneRefData(const wxObjectRefData *data) const;