RealizeResource();
}
-wxObjectRefData* wxPen::CreateRefData() const
+void wxPen::Unshare()
{
- return new wxPenRefData;
-}
-
-wxObjectRefData* wxPen::CloneRefData(const wxObjectRefData* data) const
-{
- return new wxPenRefData(*wx_static_cast(const wxPenRefData*, data));
+ // Don't change shared data
+ if (!m_refData)
+ {
+ m_refData = new wxPenRefData();
+ }
+ else
+ {
+ wxPenRefData* ref = new wxPenRefData(*(wxPenRefData*)m_refData);
+ UnRef();
+ m_refData = ref;
+ }
}
void wxPen::SetColour(const wxColour& col)
{
- AllocExclusive();
+ Unshare();
M_PENDATA->m_colour = col;
void wxPen::SetColour(unsigned char r, unsigned char g, unsigned char b)
{
- AllocExclusive();
+ Unshare();
M_PENDATA->m_colour.Set(r, g, b);
void wxPen::SetWidth(int Width)
{
- AllocExclusive();
+ Unshare();
M_PENDATA->m_width = Width;
void wxPen::SetStyle(int Style)
{
- AllocExclusive();
+ Unshare();
M_PENDATA->m_style = Style;
void wxPen::SetStipple(const wxBitmap& Stipple)
{
- AllocExclusive();
+ Unshare();
M_PENDATA->m_stipple = Stipple;
M_PENDATA->m_style = wxSTIPPLE;
void wxPen::SetDashes(int nb_dashes, const wxDash *Dash)
{
- AllocExclusive();
+ Unshare();
M_PENDATA->m_nbDash = nb_dashes;
M_PENDATA->m_dash = (wxDash *)Dash;
void wxPen::SetJoin(int Join)
{
- AllocExclusive();
+ Unshare();
M_PENDATA->m_join = Join;
void wxPen::SetCap(int Cap)
{
- AllocExclusive();
+ Unshare();
M_PENDATA->m_cap = Cap;