further wxPenStyle/wxBrushStyle fixes for builds with compat off (partially by Marcin Wojdyr)

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@52626 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Francesco Montorsi
2008-03-19 18:28:04 +00:00
parent 96f5888b18
commit cb129171c2
9 changed files with 32 additions and 30 deletions

View File

@@ -1399,7 +1399,7 @@ void wxWindowBase::ClearBackground()
// wxGTK uses its own version, no need to add never used code // wxGTK uses its own version, no need to add never used code
#ifndef __WXGTK__ #ifndef __WXGTK__
wxClientDC dc((wxWindow *)this); wxClientDC dc((wxWindow *)this);
wxBrush brush(GetBackgroundColour(), wxSOLID); wxBrush brush(GetBackgroundColour(), wxBRUSHSTYLE_SOLID);
dc.SetBackground(brush); dc.SetBackground(brush);
dc.Clear(); dc.Clear();
#endif // __WXGTK__ #endif // __WXGTK__

View File

@@ -131,7 +131,8 @@ bool wxBrushRefData::operator==(const wxBrushRefData& data) const
void wxBrushRefData::DoSetStipple(const wxBitmap& stipple) void wxBrushRefData::DoSetStipple(const wxBitmap& stipple)
{ {
m_stipple = stipple; m_stipple = stipple;
m_style = stipple.GetMask() ? wxSTIPPLE_MASK_OPAQUE : wxSTIPPLE; m_style = stipple.GetMask() ? wxBRUSHSTYLE_STIPPLE_MASK_OPAQUE
: wxBRUSHSTYLE_STIPPLE;
} }
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
@@ -154,12 +155,12 @@ static int TranslateHatchStyle(int style)
{ {
switch ( style ) switch ( style )
{ {
case wxBDIAGONAL_HATCH: return HS_BDIAGONAL; case wxBRUSHSTYLE_BDIAGONAL_HATCH: return HS_BDIAGONAL;
case wxCROSSDIAG_HATCH: return HS_DIAGCROSS; case wxBRUSHSTYLE_CROSSDIAG_HATCH: return HS_DIAGCROSS;
case wxFDIAGONAL_HATCH: return HS_FDIAGONAL; case wxBRUSHSTYLE_FDIAGONAL_HATCH: return HS_FDIAGONAL;
case wxCROSS_HATCH: return HS_CROSS; case wxBRUSHSTYLE_CROSS_HATCH: return HS_CROSS;
case wxHORIZONTAL_HATCH:return HS_HORIZONTAL; case wxBRUSHSTYLE_HORIZONTAL_HATCH:return HS_HORIZONTAL;
case wxVERTICAL_HATCH: return HS_VERTICAL; case wxBRUSHSTYLE_VERTICAL_HATCH: return HS_VERTICAL;
default: return -1; default: return -1;
} }
} }
@@ -177,15 +178,15 @@ HBRUSH wxBrushRefData::GetHBRUSH()
{ {
switch ( m_style ) switch ( m_style )
{ {
case wxTRANSPARENT: case wxBRUSHSTYLE_TRANSPARENT:
m_hBrush = (HBRUSH)::GetStockObject(NULL_BRUSH); m_hBrush = (HBRUSH)::GetStockObject(NULL_BRUSH);
break; break;
case wxSTIPPLE: case wxBRUSHSTYLE_STIPPLE:
m_hBrush = ::CreatePatternBrush(GetHbitmapOf(m_stipple)); m_hBrush = ::CreatePatternBrush(GetHbitmapOf(m_stipple));
break; break;
case wxSTIPPLE_MASK_OPAQUE: case wxBRUSHSTYLE_STIPPLE_MASK_OPAQUE:
m_hBrush = ::CreatePatternBrush((HBITMAP)m_stipple.GetMask() m_hBrush = ::CreatePatternBrush((HBITMAP)m_stipple.GetMask()
->GetMaskBitmap()); ->GetMaskBitmap());
break; break;
@@ -194,7 +195,7 @@ HBRUSH wxBrushRefData::GetHBRUSH()
wxFAIL_MSG( _T("unknown brush style") ); wxFAIL_MSG( _T("unknown brush style") );
// fall through // fall through
case wxSOLID: case wxBRUSHSTYLE_SOLID:
m_hBrush = ::CreateSolidBrush(m_colour.GetPixel()); m_hBrush = ::CreateSolidBrush(m_colour.GetPixel());
break; break;
} }

View File

@@ -309,7 +309,7 @@ static void wxMSWDrawFocusRect( wxDC& dc, const wxRect& rect )
// it employs wxCAP_BUTT hack to have line of width 1. // it employs wxCAP_BUTT hack to have line of width 1.
dc.SetLogicalFunction(wxINVERT); dc.SetLogicalFunction(wxINVERT);
wxPen pen(*wxBLACK,1,wxDOT); wxPen pen(*wxBLACK, 1, wxPENSTYLE_DOT);
pen.SetCap(wxCAP_BUTT); pen.SetCap(wxCAP_BUTT);
dc.SetPen(pen); dc.SetPen(pen);
dc.SetBrush(*wxTRANSPARENT_BRUSH); dc.SetBrush(*wxTRANSPARENT_BRUSH);

View File

@@ -392,10 +392,9 @@ WXHBRUSH wxControl::DoMSWControlColor(WXHDC pDC, wxColour colBg, WXHWND hWnd)
::SetBkColor(hdc, wxColourToRGB(colBg)); ::SetBkColor(hdc, wxColourToRGB(colBg));
// draw children with the same colour as the parent // draw children with the same colour as the parent
wxBrush *brush = wxTheBrushList->FindOrCreateBrush(colBg, wxSOLID); wxBrush *brush = wxTheBrushList->FindOrCreateBrush(colBg,
wxBRUSHSTYLE_SOLID);
hbr = (WXHBRUSH)brush->GetResourceHandle(); hbr = (WXHBRUSH)brush->GetResourceHandle();
} }
// if we use custom background, we should set foreground ourselves too // if we use custom background, we should set foreground ourselves too

View File

@@ -279,7 +279,7 @@ IMPLEMENT_DYNAMIC_CLASS(wxGDIDLLsCleanupModule, wxModule)
wxColourChanger::wxColourChanger(wxMSWDCImpl& dc) : m_dc(dc) wxColourChanger::wxColourChanger(wxMSWDCImpl& dc) : m_dc(dc)
{ {
const wxBrush& brush = dc.GetBrush(); const wxBrush& brush = dc.GetBrush();
if ( brush.IsOk() && brush.GetStyle() == wxSTIPPLE_MASK_OPAQUE ) if ( brush.IsOk() && brush.GetStyle() == wxBRUSHSTYLE_STIPPLE_MASK_OPAQUE )
{ {
HDC hdc = GetHdcOf(dc); HDC hdc = GetHdcOf(dc);
m_colFgOld = ::GetTextColor(hdc); m_colFgOld = ::GetTextColor(hdc);
@@ -300,8 +300,8 @@ wxColourChanger::wxColourChanger(wxMSWDCImpl& dc) : m_dc(dc)
} }
SetBkMode(hdc, SetBkMode(hdc,
dc.GetBackgroundMode() == wxTRANSPARENT ? TRANSPARENT dc.GetBackgroundMode() == wxBRUSHSTYLE_TRANSPARENT
: OPAQUE); ? TRANSPARENT : OPAQUE);
// flag which telsl us to undo changes in the dtor // flag which telsl us to undo changes in the dtor
m_changed = true; m_changed = true;
@@ -740,7 +740,7 @@ void wxMSWDCImpl::DoDrawArc(wxCoord x1, wxCoord y1,
wxCoord xxx2 = (wxCoord) (xxc+ray); wxCoord xxx2 = (wxCoord) (xxc+ray);
wxCoord yyy2 = (wxCoord) (yyc+ray); wxCoord yyy2 = (wxCoord) (yyc+ray);
if ( m_brush.IsOk() && m_brush.GetStyle() != wxTRANSPARENT ) if ( m_brush.IsOk() && m_brush.GetStyle() != wxBRUSHSTYLE_TRANSPARENT )
{ {
// Have to add 1 to bottom-right corner of rectangle // Have to add 1 to bottom-right corner of rectangle
// to make semi-circles look right (crooked line otherwise). // to make semi-circles look right (crooked line otherwise).
@@ -948,7 +948,7 @@ void wxMSWDCImpl::DoDrawRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord h
// (i.e. drawn with a transparent pen) one pixel smaller in both directions // (i.e. drawn with a transparent pen) one pixel smaller in both directions
// and we want them to have the same size regardless of which pen is used // and we want them to have the same size regardless of which pen is used
#ifndef __WXWINCE__ #ifndef __WXWINCE__
if ( m_pen.GetStyle() == wxTRANSPARENT ) if ( m_pen.GetStyle() == wxPENSTYLE_TRANSPARENT )
{ {
x2dev++; x2dev++;
y2dev++; y2dev++;
@@ -982,7 +982,7 @@ void wxMSWDCImpl::DoDrawRoundedRectangle(wxCoord x, wxCoord y, wxCoord width, wx
// Windows draws the filled rectangles without outline (i.e. drawn with a // Windows draws the filled rectangles without outline (i.e. drawn with a
// transparent pen) one pixel smaller in both directions and we want them // transparent pen) one pixel smaller in both directions and we want them
// to have the same size regardless of which pen is used - adjust // to have the same size regardless of which pen is used - adjust
if ( m_pen.GetStyle() == wxTRANSPARENT ) if ( m_pen.GetStyle() == wxPENSTYLE_TRANSPARENT )
{ {
x2++; x2++;
y2++; y2++;
@@ -1349,7 +1349,7 @@ void wxMSWDCImpl::DrawAnyText(const wxString& text, wxCoord x, wxCoord y)
old_background = SetBkColor(GetHdc(), m_textBackgroundColour.GetPixel() ); old_background = SetBkColor(GetHdc(), m_textBackgroundColour.GetPixel() );
} }
SetBkMode(GetHdc(), m_backgroundMode == wxTRANSPARENT ? TRANSPARENT SetBkMode(GetHdc(), m_backgroundMode == wxBRUSHSTYLE_TRANSPARENT ? TRANSPARENT
: OPAQUE); : OPAQUE);
#ifdef __WXWINCE__ #ifdef __WXWINCE__

View File

@@ -110,7 +110,7 @@ void wxWindowDCImpl::InitDC()
::SetBkMode(GetHdc(), TRANSPARENT); ::SetBkMode(GetHdc(), TRANSPARENT);
// default bg colour is pne of the window // default bg colour is pne of the window
SetBackground(wxBrush(m_window->GetBackgroundColour(), wxSOLID)); SetBackground(wxBrush(m_window->GetBackgroundColour(), wxBRUSHSTYLE_SOLID));
// since we are a window dc we need to grab the palette from the window // since we are a window dc we need to grab the palette from the window
#if wxUSE_PALETTE #if wxUSE_PALETTE

View File

@@ -218,7 +218,7 @@ bool wxDragImage::Create(const wxString& str, const wxCursor& cursor)
dc2.SetBackground(* wxWHITE_BRUSH); dc2.SetBackground(* wxWHITE_BRUSH);
dc2.Clear(); dc2.Clear();
dc2.SetBackgroundMode(wxTRANSPARENT); dc2.SetBackgroundMode(wxBRUSHSTYLE_TRANSPARENT);
dc2.SetTextForeground(* wxLIGHT_GREY); dc2.SetTextForeground(* wxLIGHT_GREY);
dc2.DrawText(str, 0, 0); dc2.DrawText(str, 0, 0);
dc2.DrawText(str, 1, 0); dc2.DrawText(str, 1, 0);

View File

@@ -435,10 +435,12 @@ wxPen::wxPen(const wxColour& col, int width, wxPenStyle style)
m_refData = new wxPenRefData(col, width, style); m_refData = new wxPenRefData(col, width, style);
} }
/* error: `wxBrushStyle' has not been declared
wxPen::wxPen(const wxColour& colour, int width, wxBrushStyle style) wxPen::wxPen(const wxColour& colour, int width, wxBrushStyle style)
{ {
m_refData = new wxPenRefData(colour, width, (wxPenStyle)style); m_refData = new wxPenRefData(colour, width, (wxPenStyle)style);
} }
*/
wxPen::wxPen(const wxBitmap& stipple, int width) wxPen::wxPen(const wxBitmap& stipple, int width)
{ {

View File

@@ -289,11 +289,11 @@ bool SurfaceImpl::Initialised() {
void SurfaceImpl::PenColour(ColourAllocated fore) { void SurfaceImpl::PenColour(ColourAllocated fore) {
hdc->SetPen(wxPen(wxColourFromCA(fore), 1, wxSOLID)); hdc->SetPen(wxPen(wxColourFromCA(fore)));
} }
void SurfaceImpl::BrushColour(ColourAllocated back) { void SurfaceImpl::BrushColour(ColourAllocated back) {
hdc->SetBrush(wxBrush(wxColourFromCA(back), wxSOLID)); hdc->SetBrush(wxBrush(wxColourFromCA(back)));
} }
void SurfaceImpl::SetFont(Font &font_) { void SurfaceImpl::SetFont(Font &font_) {
@@ -344,7 +344,7 @@ void SurfaceImpl::FillRectangle(PRectangle rc, Surface &surfacePattern) {
if (((SurfaceImpl&)surfacePattern).bitmap) if (((SurfaceImpl&)surfacePattern).bitmap)
br = wxBrush(*((SurfaceImpl&)surfacePattern).bitmap); br = wxBrush(*((SurfaceImpl&)surfacePattern).bitmap);
else // Something is wrong so display in red else // Something is wrong so display in red
br = wxBrush(*wxRED, wxSOLID); br = wxBrush(*wxRED);
hdc->SetPen(*wxTRANSPARENT_PEN); hdc->SetPen(*wxTRANSPARENT_PEN);
hdc->SetBrush(br); hdc->SetBrush(br);
hdc->DrawRectangle(wxRectFromPRectangle(rc)); hdc->DrawRectangle(wxRectFromPRectangle(rc));
@@ -475,13 +475,13 @@ void SurfaceImpl::DrawTextTransparent(PRectangle rc, Font &font, int ybase,
SetFont(font); SetFont(font);
hdc->SetTextForeground(wxColourFromCA(fore)); hdc->SetTextForeground(wxColourFromCA(fore));
hdc->SetBackgroundMode(wxTRANSPARENT); hdc->SetBackgroundMode(wxBRUSHSTYLE_TRANSPARENT);
// ybase is where the baseline should be, but wxWin uses the upper left // ybase is where the baseline should be, but wxWin uses the upper left
// corner, so I need to calculate the real position for the text... // corner, so I need to calculate the real position for the text...
hdc->DrawText(stc2wx(s, len), rc.left, ybase - font.ascent); hdc->DrawText(stc2wx(s, len), rc.left, ybase - font.ascent);
hdc->SetBackgroundMode(wxSOLID); hdc->SetBackgroundMode(wxBRUSHSTYLE_SOLID);
} }