use AllocExclusive
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@44761 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -64,9 +64,9 @@ public:
|
|||||||
// Useful helper: create the brush resource
|
// Useful helper: create the brush resource
|
||||||
bool RealizeResource();
|
bool RealizeResource();
|
||||||
|
|
||||||
// When setting properties, we must make sure we're not changing
|
protected:
|
||||||
// another object
|
virtual wxObjectRefData* CreateRefData() const;
|
||||||
void Unshare();
|
virtual wxObjectRefData* CloneRefData(const wxObjectRefData* data) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@@ -43,6 +43,9 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
virtual wxObjectRefData* CreateRefData() const;
|
||||||
|
virtual wxObjectRefData* CloneRefData(const wxObjectRefData* data) const;
|
||||||
|
|
||||||
int m_width;
|
int m_width;
|
||||||
int m_style;
|
int m_style;
|
||||||
int m_join ;
|
int m_join ;
|
||||||
|
@@ -122,24 +122,19 @@ wxBrush::wxBrush( ThemeBrush macThemeBrush )
|
|||||||
RealizeResource();
|
RealizeResource();
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxBrush::Unshare()
|
wxObjectRefData* wxBrush::CreateRefData() const
|
||||||
{
|
{
|
||||||
// Don't change shared data
|
return new wxBrushRefData;
|
||||||
if (!m_refData)
|
}
|
||||||
{
|
|
||||||
m_refData = new wxBrushRefData();
|
wxObjectRefData* wxBrush::CloneRefData(const wxObjectRefData* data) const
|
||||||
}
|
{
|
||||||
else
|
return new wxBrushRefData(*wx_static_cast(const wxBrushRefData*, data));
|
||||||
{
|
|
||||||
wxBrushRefData* ref = new wxBrushRefData(*(wxBrushRefData*)m_refData);
|
|
||||||
UnRef();
|
|
||||||
m_refData = ref;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxBrush::SetColour(const wxColour& col)
|
void wxBrush::SetColour(const wxColour& col)
|
||||||
{
|
{
|
||||||
Unshare();
|
AllocExclusive();
|
||||||
M_BRUSHDATA->m_macBrushKind = kwxMacBrushColour;
|
M_BRUSHDATA->m_macBrushKind = kwxMacBrushColour;
|
||||||
M_BRUSHDATA->m_colour = col;
|
M_BRUSHDATA->m_colour = col;
|
||||||
|
|
||||||
@@ -148,7 +143,7 @@ void wxBrush::SetColour(const wxColour& col)
|
|||||||
|
|
||||||
void wxBrush::SetColour(unsigned char r, unsigned char g, unsigned char b)
|
void wxBrush::SetColour(unsigned char r, unsigned char g, unsigned char b)
|
||||||
{
|
{
|
||||||
Unshare();
|
AllocExclusive();
|
||||||
|
|
||||||
M_BRUSHDATA->m_macBrushKind = kwxMacBrushColour;
|
M_BRUSHDATA->m_macBrushKind = kwxMacBrushColour;
|
||||||
M_BRUSHDATA->m_colour.Set(r, g, b);
|
M_BRUSHDATA->m_colour.Set(r, g, b);
|
||||||
@@ -158,7 +153,7 @@ void wxBrush::SetColour(unsigned char r, unsigned char g, unsigned char b)
|
|||||||
|
|
||||||
void wxBrush::SetStyle(int Style)
|
void wxBrush::SetStyle(int Style)
|
||||||
{
|
{
|
||||||
Unshare();
|
AllocExclusive();
|
||||||
|
|
||||||
M_BRUSHDATA->m_macBrushKind = kwxMacBrushColour;
|
M_BRUSHDATA->m_macBrushKind = kwxMacBrushColour;
|
||||||
M_BRUSHDATA->m_style = Style;
|
M_BRUSHDATA->m_style = Style;
|
||||||
@@ -168,7 +163,7 @@ void wxBrush::SetStyle(int Style)
|
|||||||
|
|
||||||
void wxBrush::SetStipple(const wxBitmap& Stipple)
|
void wxBrush::SetStipple(const wxBitmap& Stipple)
|
||||||
{
|
{
|
||||||
Unshare();
|
AllocExclusive();
|
||||||
|
|
||||||
M_BRUSHDATA->m_macBrushKind = kwxMacBrushColour;
|
M_BRUSHDATA->m_macBrushKind = kwxMacBrushColour;
|
||||||
M_BRUSHDATA->m_stipple = Stipple;
|
M_BRUSHDATA->m_stipple = Stipple;
|
||||||
@@ -178,7 +173,7 @@ void wxBrush::SetStipple(const wxBitmap& Stipple)
|
|||||||
|
|
||||||
void wxBrush::MacSetTheme(ThemeBrush macThemeBrush)
|
void wxBrush::MacSetTheme(ThemeBrush macThemeBrush)
|
||||||
{
|
{
|
||||||
Unshare();
|
AllocExclusive();
|
||||||
|
|
||||||
M_BRUSHDATA->m_macBrushKind = kwxMacBrushTheme;
|
M_BRUSHDATA->m_macBrushKind = kwxMacBrushTheme;
|
||||||
M_BRUSHDATA->m_macThemeBrush = macThemeBrush;
|
M_BRUSHDATA->m_macThemeBrush = macThemeBrush;
|
||||||
@@ -192,7 +187,7 @@ void wxBrush::MacSetTheme(ThemeBrush macThemeBrush)
|
|||||||
|
|
||||||
void wxBrush::MacSetThemeBackground(unsigned long macThemeBackground, const WXRECTPTR extent)
|
void wxBrush::MacSetThemeBackground(unsigned long macThemeBackground, const WXRECTPTR extent)
|
||||||
{
|
{
|
||||||
Unshare();
|
AllocExclusive();
|
||||||
|
|
||||||
M_BRUSHDATA->m_macBrushKind = kwxMacBrushThemeBackground;
|
M_BRUSHDATA->m_macBrushKind = kwxMacBrushThemeBackground;
|
||||||
M_BRUSHDATA->m_macThemeBackground = macThemeBackground;
|
M_BRUSHDATA->m_macThemeBackground = macThemeBackground;
|
||||||
|
@@ -86,24 +86,19 @@ wxPen::wxPen(const wxBitmap& stipple, int Width)
|
|||||||
RealizeResource();
|
RealizeResource();
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxPen::Unshare()
|
wxObjectRefData* wxPen::CreateRefData() const
|
||||||
{
|
{
|
||||||
// Don't change shared data
|
return new wxPenRefData;
|
||||||
if (!m_refData)
|
}
|
||||||
{
|
|
||||||
m_refData = new wxPenRefData();
|
wxObjectRefData* wxPen::CloneRefData(const wxObjectRefData* data) const
|
||||||
}
|
{
|
||||||
else
|
return new wxPenRefData(*wx_static_cast(const wxPenRefData*, data));
|
||||||
{
|
|
||||||
wxPenRefData* ref = new wxPenRefData(*(wxPenRefData*)m_refData);
|
|
||||||
UnRef();
|
|
||||||
m_refData = ref;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxPen::SetColour(const wxColour& col)
|
void wxPen::SetColour(const wxColour& col)
|
||||||
{
|
{
|
||||||
Unshare();
|
AllocExclusive();
|
||||||
|
|
||||||
M_PENDATA->m_colour = col;
|
M_PENDATA->m_colour = col;
|
||||||
|
|
||||||
@@ -112,7 +107,7 @@ void wxPen::SetColour(const wxColour& col)
|
|||||||
|
|
||||||
void wxPen::SetColour(unsigned char r, unsigned char g, unsigned char b)
|
void wxPen::SetColour(unsigned char r, unsigned char g, unsigned char b)
|
||||||
{
|
{
|
||||||
Unshare();
|
AllocExclusive();
|
||||||
|
|
||||||
M_PENDATA->m_colour.Set(r, g, b);
|
M_PENDATA->m_colour.Set(r, g, b);
|
||||||
|
|
||||||
@@ -121,7 +116,7 @@ void wxPen::SetColour(unsigned char r, unsigned char g, unsigned char b)
|
|||||||
|
|
||||||
void wxPen::SetWidth(int Width)
|
void wxPen::SetWidth(int Width)
|
||||||
{
|
{
|
||||||
Unshare();
|
AllocExclusive();
|
||||||
|
|
||||||
M_PENDATA->m_width = Width;
|
M_PENDATA->m_width = Width;
|
||||||
|
|
||||||
@@ -130,7 +125,7 @@ void wxPen::SetWidth(int Width)
|
|||||||
|
|
||||||
void wxPen::SetStyle(int Style)
|
void wxPen::SetStyle(int Style)
|
||||||
{
|
{
|
||||||
Unshare();
|
AllocExclusive();
|
||||||
|
|
||||||
M_PENDATA->m_style = Style;
|
M_PENDATA->m_style = Style;
|
||||||
|
|
||||||
@@ -139,7 +134,7 @@ void wxPen::SetStyle(int Style)
|
|||||||
|
|
||||||
void wxPen::SetStipple(const wxBitmap& Stipple)
|
void wxPen::SetStipple(const wxBitmap& Stipple)
|
||||||
{
|
{
|
||||||
Unshare();
|
AllocExclusive();
|
||||||
|
|
||||||
M_PENDATA->m_stipple = Stipple;
|
M_PENDATA->m_stipple = Stipple;
|
||||||
M_PENDATA->m_style = wxSTIPPLE;
|
M_PENDATA->m_style = wxSTIPPLE;
|
||||||
@@ -149,7 +144,7 @@ void wxPen::SetStipple(const wxBitmap& Stipple)
|
|||||||
|
|
||||||
void wxPen::SetDashes(int nb_dashes, const wxDash *Dash)
|
void wxPen::SetDashes(int nb_dashes, const wxDash *Dash)
|
||||||
{
|
{
|
||||||
Unshare();
|
AllocExclusive();
|
||||||
|
|
||||||
M_PENDATA->m_nbDash = nb_dashes;
|
M_PENDATA->m_nbDash = nb_dashes;
|
||||||
M_PENDATA->m_dash = (wxDash *)Dash;
|
M_PENDATA->m_dash = (wxDash *)Dash;
|
||||||
@@ -159,7 +154,7 @@ void wxPen::SetDashes(int nb_dashes, const wxDash *Dash)
|
|||||||
|
|
||||||
void wxPen::SetJoin(int Join)
|
void wxPen::SetJoin(int Join)
|
||||||
{
|
{
|
||||||
Unshare();
|
AllocExclusive();
|
||||||
|
|
||||||
M_PENDATA->m_join = Join;
|
M_PENDATA->m_join = Join;
|
||||||
|
|
||||||
@@ -168,7 +163,7 @@ void wxPen::SetJoin(int Join)
|
|||||||
|
|
||||||
void wxPen::SetCap(int Cap)
|
void wxPen::SetCap(int Cap)
|
||||||
{
|
{
|
||||||
Unshare();
|
AllocExclusive();
|
||||||
|
|
||||||
M_PENDATA->m_cap = Cap;
|
M_PENDATA->m_cap = Cap;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user