RealizeResource();
}
-wxObjectRefData* wxBrush::CreateRefData() const
+void wxBrush::Unshare()
{
- return new wxBrushRefData;
-}
-
-wxObjectRefData* wxBrush::CloneRefData(const wxObjectRefData* data) const
-{
- return new wxBrushRefData(*wx_static_cast(const wxBrushRefData*, data));
+ // Don't change shared data
+ if (!m_refData)
+ {
+ m_refData = new wxBrushRefData();
+ }
+ else
+ {
+ wxBrushRefData* ref = new wxBrushRefData(*(wxBrushRefData*)m_refData);
+ UnRef();
+ m_refData = ref;
+ }
}
void wxBrush::SetColour(const wxColour& col)
{
- AllocExclusive();
+ Unshare();
M_BRUSHDATA->m_macBrushKind = kwxMacBrushColour;
M_BRUSHDATA->m_colour = col;
void wxBrush::SetColour(unsigned char r, unsigned char g, unsigned char b)
{
- AllocExclusive();
+ Unshare();
M_BRUSHDATA->m_macBrushKind = kwxMacBrushColour;
M_BRUSHDATA->m_colour.Set(r, g, b);
void wxBrush::SetStyle(int Style)
{
- AllocExclusive();
+ Unshare();
M_BRUSHDATA->m_macBrushKind = kwxMacBrushColour;
M_BRUSHDATA->m_style = Style;
void wxBrush::SetStipple(const wxBitmap& Stipple)
{
- AllocExclusive();
+ Unshare();
M_BRUSHDATA->m_macBrushKind = kwxMacBrushColour;
M_BRUSHDATA->m_stipple = Stipple;
void wxBrush::MacSetTheme(ThemeBrush macThemeBrush)
{
- AllocExclusive();
+ Unshare();
M_BRUSHDATA->m_macBrushKind = kwxMacBrushTheme;
M_BRUSHDATA->m_macThemeBrush = macThemeBrush;
void wxBrush::MacSetThemeBackground(unsigned long macThemeBackground, const WXRECTPTR extent)
{
- AllocExclusive();
+ Unshare();
M_BRUSHDATA->m_macBrushKind = kwxMacBrushThemeBackground;
M_BRUSHDATA->m_macThemeBackground = macThemeBackground;