]> git.saurik.com Git - wxWidgets.git/blobdiff - src/msw/brush.cpp
fix wxMenu leak (reopened #9089)
[wxWidgets.git] / src / msw / brush.cpp
index b8e881b81fbd5cbf5c24e21656b39797e9e88700..f71e16746efe0e8b3018ce7c5f638ac80e596621 100644 (file)
@@ -30,6 +30,7 @@
     #include "wx/list.h"
     #include "wx/utils.h"
     #include "wx/app.h"
+    #include "wx/bitmap.h"
 #endif // WX_PRECOMP
 
 #include "wx/msw/private.h"
@@ -130,7 +131,8 @@ bool wxBrushRefData::operator==(const wxBrushRefData& data) const
 void wxBrushRefData::DoSetStipple(const wxBitmap& stipple)
 {
     m_stipple = stipple;
-    m_style = stipple.GetMask() ? wxSTIPPLE_MASK_OPAQUE : wxSTIPPLE;
+    m_style = stipple.GetMask() ? wxBRUSHSTYLE_STIPPLE_MASK_OPAQUE
+                                : wxBRUSHSTYLE_STIPPLE;
 }
 
 // ----------------------------------------------------------------------------
@@ -153,12 +155,12 @@ static int TranslateHatchStyle(int style)
 {
     switch ( style )
     {
-        case wxBDIAGONAL_HATCH: return HS_BDIAGONAL;
-        case wxCROSSDIAG_HATCH: return HS_DIAGCROSS;
-        case wxFDIAGONAL_HATCH: return HS_FDIAGONAL;
-        case wxCROSS_HATCH:     return HS_CROSS;
-        case wxHORIZONTAL_HATCH:return HS_HORIZONTAL;
-        case wxVERTICAL_HATCH:  return HS_VERTICAL;
+        case wxBRUSHSTYLE_BDIAGONAL_HATCH: return HS_BDIAGONAL;
+        case wxBRUSHSTYLE_CROSSDIAG_HATCH: return HS_DIAGCROSS;
+        case wxBRUSHSTYLE_FDIAGONAL_HATCH: return HS_FDIAGONAL;
+        case wxBRUSHSTYLE_CROSS_HATCH:     return HS_CROSS;
+        case wxBRUSHSTYLE_HORIZONTAL_HATCH:return HS_HORIZONTAL;
+        case wxBRUSHSTYLE_VERTICAL_HATCH:  return HS_VERTICAL;
         default:                return -1;
     }
 }
@@ -176,15 +178,15 @@ HBRUSH wxBrushRefData::GetHBRUSH()
         {
             switch ( m_style )
             {
-                case wxTRANSPARENT:
+                case wxBRUSHSTYLE_TRANSPARENT:
                     m_hBrush = (HBRUSH)::GetStockObject(NULL_BRUSH);
                     break;
 
-                case wxSTIPPLE:
+                case wxBRUSHSTYLE_STIPPLE:
                     m_hBrush = ::CreatePatternBrush(GetHbitmapOf(m_stipple));
                     break;
 
-                case wxSTIPPLE_MASK_OPAQUE:
+                case wxBRUSHSTYLE_STIPPLE_MASK_OPAQUE:
                     m_hBrush = ::CreatePatternBrush((HBITMAP)m_stipple.GetMask()
                                                         ->GetMaskBitmap());
                     break;
@@ -193,7 +195,7 @@ HBRUSH wxBrushRefData::GetHBRUSH()
                     wxFAIL_MSG( _T("unknown brush style") );
                     // fall through
 
-                case wxSOLID:
+                case wxBRUSHSTYLE_SOLID:
                     m_hBrush = ::CreateSolidBrush(m_colour.GetPixel());
                     break;
             }
@@ -231,6 +233,13 @@ wxBrush::wxBrush(const wxColour& col, wxBrushStyle style)
     m_refData = new wxBrushRefData(col, style);
 }
 
+#if FUTURE_WXWIN_COMPATIBILITY_3_0
+wxBrush::wxBrush(const wxColour& col, int style)
+{
+    m_refData = new wxBrushRefData(col, (wxBrushStyle)style);
+}
+#endif
+
 wxBrush::wxBrush(const wxBitmap& stipple)
 {
     m_refData = new wxBrushRefData(stipple);
@@ -275,7 +284,7 @@ wxColour wxBrush::GetColour() const
 
 wxBrushStyle wxBrush::GetStyle() const
 {
-    wxCHECK_MSG( Ok(), 0, _T("invalid brush") );
+    wxCHECK_MSG( Ok(), wxBRUSHSTYLE_INVALID, _T("invalid brush") );
 
     return M_BRUSHDATA->GetStyle();
 }