-/****
- // Don't reset cbrush, wxTRANSPARENT is handled by wxBrush::SelectBrush()
- // this could save (many) time if frequently switching from
- // wxSOLID to wxTRANSPARENT, because Create... is not always called!!
- //
- // NB August 95: now create and select a Null brush instead.
- // This could be optimized as above.
- case wxTRANSPARENT:
- M_BRUSHDATA->m_hBrush = NULL; // Must always select a suitable background brush
- // - could choose white always for a quick solution
- break;
-***/
- case wxBDIAGONAL_HATCH:
- M_BRUSHDATA->m_hBrush = (WXHBRUSH) CreateHatchBrush(HS_BDIAGONAL,ms_colour) ;
- break ;
- case wxCROSSDIAG_HATCH:
- M_BRUSHDATA->m_hBrush = (WXHBRUSH) CreateHatchBrush(HS_DIAGCROSS,ms_colour) ;
- break ;
- case wxFDIAGONAL_HATCH:
- M_BRUSHDATA->m_hBrush = (WXHBRUSH) CreateHatchBrush(HS_FDIAGONAL,ms_colour) ;
- break ;
- case wxCROSS_HATCH:
- M_BRUSHDATA->m_hBrush = (WXHBRUSH) CreateHatchBrush(HS_CROSS,ms_colour) ;
- break ;
- case wxHORIZONTAL_HATCH:
- M_BRUSHDATA->m_hBrush = (WXHBRUSH) CreateHatchBrush(HS_HORIZONTAL,ms_colour) ;
- break ;
- case wxVERTICAL_HATCH:
- M_BRUSHDATA->m_hBrush = (WXHBRUSH) CreateHatchBrush(HS_VERTICAL,ms_colour) ;
- break ;
- case wxSTIPPLE:
- if (M_BRUSHDATA->m_stipple.Ok())
- M_BRUSHDATA->m_hBrush = (WXHBRUSH) CreatePatternBrush((HBITMAP) M_BRUSHDATA->m_stipple.GetHBITMAP()) ;
- else
- M_BRUSHDATA->m_hBrush = (WXHBRUSH) CreateSolidBrush(ms_colour) ;
- break ;
- case wxSOLID:
- default:
- M_BRUSHDATA->m_hBrush = (WXHBRUSH) CreateSolidBrush(ms_colour) ;
- break;
- }
-#ifdef DEBUG_CREATE
- if (M_BRUSHDATA->m_hBrush==NULL) wxError("Cannot create brush","Internal error") ;
+#if !defined(__WXMICROWIN__) && !defined(__WXWINCE__)
+ int hatchStyle = TranslateHatchStyle(m_style);
+ if ( hatchStyle == -1 )
+#endif // !__WXMICROWIN__ && !__WXWINCE__
+ {
+ switch ( m_style )
+ {
+ case wxBRUSHSTYLE_TRANSPARENT:
+ m_hBrush = (HBRUSH)::GetStockObject(NULL_BRUSH);
+ break;
+
+ case wxBRUSHSTYLE_STIPPLE:
+ m_hBrush = ::CreatePatternBrush(GetHbitmapOf(m_stipple));
+ break;
+
+ case wxBRUSHSTYLE_STIPPLE_MASK_OPAQUE:
+ m_hBrush = ::CreatePatternBrush((HBITMAP)m_stipple.GetMask()
+ ->GetMaskBitmap());
+ break;
+
+ default:
+ wxFAIL_MSG( _T("unknown brush style") );
+ // fall through
+
+ case wxBRUSHSTYLE_SOLID:
+ m_hBrush = ::CreateSolidBrush(m_colour.GetPixel());
+ break;
+ }
+ }
+#ifndef __WXWINCE__
+ else // create a hatched brush
+ {
+ m_hBrush = ::CreateHatchBrush(hatchStyle, m_colour.GetPixel());
+ }