]> git.saurik.com Git - wxWidgets.git/blobdiff - src/msw/brush.cpp
removed assert which could be provoked by correct code
[wxWidgets.git] / src / msw / brush.cpp
index 3f31a36166b2f300b837cb5e4d8ce5c3f1af6cae..83f9652783a2e69f3d9836fa4d93dee2fb3761a7 100644 (file)
@@ -33,9 +33,7 @@
 
 #include "assert.h"
 
-#if !USE_SHARED_LIBRARIES
 IMPLEMENT_DYNAMIC_CLASS(wxBrush, wxGDIObject)
-#endif
 
 wxBrushRefData::wxBrushRefData(void)
 {
@@ -84,26 +82,16 @@ wxBrush::wxBrush(const wxColour& col, int Style)
     wxTheBrushList->AddBrush(this);
 }
 
-wxBrush::wxBrush(const wxString& col, int Style)
-{
-  m_refData = new wxBrushRefData;
-
-  M_BRUSHDATA->m_colour = col;
-  M_BRUSHDATA->m_style = Style;
-  M_BRUSHDATA->m_hBrush = 0;
-
-  RealizeResource();
-
-  if ( wxTheBrushList )
-    wxTheBrushList->AddBrush(this);
-}
-
 wxBrush::wxBrush(const wxBitmap& stipple)
 {
   m_refData = new wxBrushRefData;
 
-  M_BRUSHDATA->m_style = wxSTIPPLE;
   M_BRUSHDATA->m_stipple = stipple;
+  if (M_BRUSHDATA->m_stipple.GetMask())
+         M_BRUSHDATA->m_style = wxSTIPPLE_MASK_OPAQUE;
+  else
+         M_BRUSHDATA->m_style = wxSTIPPLE;
+
   M_BRUSHDATA->m_hBrush = 0;
 
   RealizeResource();
@@ -112,7 +100,7 @@ wxBrush::wxBrush(const wxBitmap& stipple)
     wxTheBrushList->AddBrush(this);
 }
 
-bool wxBrush::RealizeResource(void) 
+bool wxBrush::RealizeResource(void)
 {
   if (M_BRUSHDATA && (M_BRUSHDATA->m_hBrush == 0))
   {
@@ -139,6 +127,7 @@ bool wxBrush::RealizeResource(void)
                       // - could choose white always for a quick solution
       break;
 ***/
+#ifndef __WXMICROWIN__
       case wxBDIAGONAL_HATCH:
         M_BRUSHDATA->m_hBrush = (WXHBRUSH) CreateHatchBrush(HS_BDIAGONAL,ms_colour) ;
         break ;
@@ -163,6 +152,13 @@ bool wxBrush::RealizeResource(void)
         else
           M_BRUSHDATA->m_hBrush = (WXHBRUSH) CreateSolidBrush(ms_colour) ;
         break ;
+      case wxSTIPPLE_MASK_OPAQUE:
+        if (M_BRUSHDATA->m_stipple.Ok() && M_BRUSHDATA->m_stipple.GetMask())
+          M_BRUSHDATA->m_hBrush = (WXHBRUSH) CreatePatternBrush((HBITMAP) M_BRUSHDATA->m_stipple.GetMask()->GetMaskBitmap());
+        else
+          M_BRUSHDATA->m_hBrush = (WXHBRUSH) CreateSolidBrush(ms_colour) ;
+        break ;
+#endif
       case wxSOLID:
       default:
         M_BRUSHDATA->m_hBrush = (WXHBRUSH) CreateSolidBrush(ms_colour) ;
@@ -182,7 +178,7 @@ WXHANDLE wxBrush::GetResourceHandle(void)
   return (WXHANDLE) M_BRUSHDATA->m_hBrush;
 }
 
-bool wxBrush::FreeResource(bool force)
+bool wxBrush::FreeResource(bool WXUNUSED(force))
 {
   if (M_BRUSHDATA && (M_BRUSHDATA->m_hBrush != 0))
   {
@@ -193,7 +189,7 @@ bool wxBrush::FreeResource(bool force)
   else return FALSE;
 }
 
-bool wxBrush::IsFree(void)
+bool wxBrush::IsFree() const
 {
   return (M_BRUSHDATA && (M_BRUSHDATA->m_hBrush == 0));
 }
@@ -223,16 +219,7 @@ void wxBrush::SetColour(const wxColour& col)
     RealizeResource();
 }
 
-void wxBrush::SetColour(const wxString& col)
-{
-    Unshare();
-
-    M_BRUSHDATA->m_colour = col;
-
-    RealizeResource();
-}
-
-void wxBrush::SetColour(const unsigned char r, const unsigned char g, const unsigned char b)
+void wxBrush::SetColour(unsigned char r, unsigned char g, unsigned char b)
 {
     Unshare();
 
@@ -255,6 +242,10 @@ void wxBrush::SetStipple(const wxBitmap& Stipple)
     Unshare();
 
     M_BRUSHDATA->m_stipple = Stipple;
+    if (M_BRUSHDATA->m_stipple.GetMask())
+       M_BRUSHDATA->m_style = wxSTIPPLE_MASK_OPAQUE;
+    else
+       M_BRUSHDATA->m_style = wxSTIPPLE;
 
     RealizeResource();
 }