]> git.saurik.com Git - wxWidgets.git/blobdiff - src/mgl/brush.cpp
don't refresh the current cell in SetCellHighlightROPenWidth() if it's invalid (...
[wxWidgets.git] / src / mgl / brush.cpp
index 749af4a4f05326c714f1afb65351229da7972024..c5f2b03cc083c33d28cce3f451d33f45bc39a878 100644 (file)
@@ -16,7 +16,7 @@
 
 #include "wx/brush.h"
 #include "wx/mgl/private.h"
-#include "wx/mgl/dcmemory.h"
+#include "wx/dcmemory.h"
 
 
 // ---------------------------------------------------------------------------
@@ -70,20 +70,22 @@ void wxBitmapToPixPattern(const wxBitmap& bitmap,
 // wxBrush
 //-----------------------------------------------------------------------------
 
-class wxBrushRefData: public wxObjectRefData
+class wxBrushRefData : public wxGDIRefData
 {
 public:
     wxBrushRefData();
     wxBrushRefData(const wxBrushRefData& data);
 
-    bool operator == (const wxBrushRefData& data) const
+    virtual bool IsOk() const { return m_colour.IsOk(); }
+
+    bool operator==(const wxBrushRefData& data) const
     {
         return (m_style == data.m_style &&
                 m_stipple.IsSameAs(data.m_stipple) &&
                 m_colour == data.m_colour);
     }
 
-    int            m_style;
+    wxBrushStyle   m_style;
     wxColour       m_colour;
     wxBitmap       m_stipple;
     pixpattern24_t m_pixPattern;
@@ -124,13 +126,22 @@ wxBrushRefData::wxBrushRefData(const wxBrushRefData& data)
 
 IMPLEMENT_DYNAMIC_CLASS(wxBrush,wxGDIObject)
 
-wxBrush::wxBrush(const wxColour &colour, int style)
+wxBrush::wxBrush(const wxColour &colour, wxBrushStyle style)
 {
     m_refData = new wxBrushRefData();
     M_BRUSHDATA->m_style = style;
     M_BRUSHDATA->m_colour = colour;
 }
 
+#if FUTURE_WXWIN_COMPATIBILITY_3_0
+wxBrush::wxBrush(const wxColour& col, int style)
+{
+    m_refData = new wxBrushRefData;
+    M_BRUSHDATA->m_style = (wxBrushStyle)style;
+    M_BRUSHDATA->m_colour = colour;
+}
+#endif
+
 wxBrush::wxBrush(const wxBitmap &stippleBitmap)
 {
     wxCHECK_RET( stippleBitmap.Ok(), _T("invalid bitmap") );
@@ -164,40 +175,23 @@ bool wxBrush::operator != (const wxBrush& brush) const
     return m_refData != brush.m_refData;
 }
 
-bool wxBrush::IsOk() const
+wxBrushStyle wxBrush::GetStyle() const
 {
-    return ((m_refData) && M_BRUSHDATA->m_colour.Ok());
-}
-
-int wxBrush::GetStyle() const
-{
-    if (m_refData == NULL)
-    {
-        wxFAIL_MSG( wxT("invalid brush") );
-        return 0;
-    }
+    wxCHECK_MSG( Ok(), wxBRUSHSTYLE_INVALID, _T("invalid brush") );
 
     return M_BRUSHDATA->m_style;
 }
 
-wxColour &wxBrush::GetColour() const
+wxColour wxBrush::GetColour() const
 {
-    if (m_refData == NULL)
-    {
-        wxFAIL_MSG( wxT("invalid brush") );
-        return wxNullColour;
-    }
+    wxCHECK_MSG( Ok(), wxNullColour, _T("invalid brush") );
 
     return M_BRUSHDATA->m_colour;
 }
 
 wxBitmap *wxBrush::GetStipple() const
 {
-    if (m_refData == NULL)
-    {
-        wxFAIL_MSG( wxT("invalid brush") );
-        return &wxNullBitmap;
-    }
+    wxCHECK_MSG( Ok(), NULL, _T("invalid brush") );
 
     return &M_BRUSHDATA->m_stipple;
 }
@@ -228,7 +222,7 @@ void wxBrush::SetColour(unsigned char r, unsigned char g, unsigned char b)
     M_BRUSHDATA->m_colour.Set(r, g, b);
 }
 
-void wxBrush::SetStyle( int style )
+void wxBrush::SetStyle( wxBrushStyle style )
 {
     AllocExclusive();
     M_BRUSHDATA->m_style = style;
@@ -252,12 +246,12 @@ void wxBrush::SetStipple(const wxBitmap& stipple)
         M_BRUSHDATA->m_style = wxSTIPPLE;
 }
 
-wxObjectRefData *wxBrush::CreateRefData() const
+wxGDIRefData *wxBrush::CreateGDIRefData() const
 {
     return new wxBrushRefData;
 }
 
-wxObjectRefData *wxBrush::CloneRefData(const wxObjectRefData *data) const
+wxGDIRefData *wxBrush::CloneGDIRefData(const wxGDIRefData *data) const
 {
     return new wxBrushRefData(*(wxBrushRefData *)data);
 }