]> git.saurik.com Git - wxWidgets.git/blobdiff - src/mgl/brush.cpp
Committed Raise()Lower() fix.
[wxWidgets.git] / src / mgl / brush.cpp
index 173c3b2b3c205e418314aab4509e93f39c5775a7..8579529fc8193fd6f942b155b6bfd6d16ba0efb6 100644 (file)
@@ -3,11 +3,11 @@
 // Purpose:
 // Author:      Vaclav Slavik
 // Id:          $Id$
-// Copyright:   (c) 2001 SciTech Software, Inc. (www.scitechsoft.com)
+// Copyright:   (c) 2001-2002 SciTech Software, Inc. (www.scitechsoft.com)
 // Licence:    wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
 
-#ifdef __GNUG__
+#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
 #pragma implementation "brush.h"
 #endif
 
@@ -121,18 +121,11 @@ wxBrushRefData::wxBrushRefData(const wxBrushRefData& data)
 
 IMPLEMENT_DYNAMIC_CLASS(wxBrush,wxGDIObject)
 
-wxBrush::wxBrush()
-{
-    if (wxTheBrushList) wxTheBrushList->AddBrush(this);
-}
-
 wxBrush::wxBrush(const wxColour &colour, int style)
 {
     m_refData = new wxBrushRefData();
     M_BRUSHDATA->m_style = style;
     M_BRUSHDATA->m_colour = colour;
-
-    if (wxTheBrushList) wxTheBrushList->AddBrush(this);
 }
 
 wxBrush::wxBrush(const wxBitmap &stippleBitmap)
@@ -152,20 +145,11 @@ wxBrush::wxBrush(const wxBitmap &stippleBitmap)
                M_BRUSHDATA->m_style = wxSTIPPLE_MASK_OPAQUE;
        else
                M_BRUSHDATA->m_style = wxSTIPPLE;
-
-    if (wxTheBrushList) wxTheBrushList->AddBrush(this);
 }
 
 wxBrush::wxBrush(const wxBrush &brush)
 {
     Ref(brush);
-
-    if (wxTheBrushList) wxTheBrushList->AddBrush(this);
-}
-
-wxBrush::~wxBrush()
-{
-    if (wxTheBrushList) wxTheBrushList->RemoveBrush(this);
 }
 
 wxBrush& wxBrush::operator = (const wxBrush& brush)
@@ -239,25 +223,25 @@ void* wxBrush::GetPixPattern() const
 
 void wxBrush::SetColour(const wxColour& col)
 {
-    Unshare();
+    AllocExclusive();
     M_BRUSHDATA->m_colour = col;
 }
 
 void wxBrush::SetColour(unsigned char r, unsigned char g, unsigned char b)
 {
-    Unshare();
+    AllocExclusive();
     M_BRUSHDATA->m_colour.Set(r, g, b);
 }
 
 void wxBrush::SetStyle( int style )
 {
-    Unshare();
+    AllocExclusive();
     M_BRUSHDATA->m_style = style;
 }
 
 void wxBrush::SetStipple(const wxBitmap& stipple)
 {
-    Unshare();
+    AllocExclusive();
 
     wxCHECK_RET( stipple.Ok(), _T("invalid bitmap") );
     wxCHECK_RET( stipple.GetWidth() == 8 && stipple.GetHeight() == 8, 
@@ -273,17 +257,13 @@ void wxBrush::SetStipple(const wxBitmap& stipple)
         M_BRUSHDATA->m_style = wxSTIPPLE;
 }
 
-void wxBrush::Unshare()
+wxObjectRefData *wxBrush::CreateRefData() const
 {
-    if (!m_refData)
-    {
-        m_refData = new wxBrushRefData();
-    }
-    else
-    {
-        wxBrushRefData* ref = new wxBrushRefData(*(wxBrushRefData*)m_refData);
-        UnRef();
-        m_refData = ref;
-    }
+    return new wxBrushRefData;
+}
+
+wxObjectRefData *wxBrush::CloneRefData(const wxObjectRefData *data) const
+{
+    return new wxBrushRefData(*(wxBrushRefData *)data);
 }