From cb129171c2653ca2202849e609cc41a6ddd0a9cb Mon Sep 17 00:00:00 2001 From: Francesco Montorsi Date: Wed, 19 Mar 2008 18:28:04 +0000 Subject: [PATCH] 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 --- src/common/wincmn.cpp | 2 +- src/msw/brush.cpp | 23 ++++++++++++----------- src/msw/combo.cpp | 2 +- src/msw/control.cpp | 5 ++--- src/msw/dc.cpp | 14 +++++++------- src/msw/dcclient.cpp | 2 +- src/msw/dragimag.cpp | 2 +- src/msw/pen.cpp | 2 ++ src/stc/PlatWX.cpp | 10 +++++----- 9 files changed, 32 insertions(+), 30 deletions(-) diff --git a/src/common/wincmn.cpp b/src/common/wincmn.cpp index a30532702b..6a5a381c05 100644 --- a/src/common/wincmn.cpp +++ b/src/common/wincmn.cpp @@ -1399,7 +1399,7 @@ void wxWindowBase::ClearBackground() // wxGTK uses its own version, no need to add never used code #ifndef __WXGTK__ wxClientDC dc((wxWindow *)this); - wxBrush brush(GetBackgroundColour(), wxSOLID); + wxBrush brush(GetBackgroundColour(), wxBRUSHSTYLE_SOLID); dc.SetBackground(brush); dc.Clear(); #endif // __WXGTK__ diff --git a/src/msw/brush.cpp b/src/msw/brush.cpp index 8876224ae2..95119e26b6 100644 --- a/src/msw/brush.cpp +++ b/src/msw/brush.cpp @@ -131,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; } // ---------------------------------------------------------------------------- @@ -154,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; } } @@ -177,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; @@ -194,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; } diff --git a/src/msw/combo.cpp b/src/msw/combo.cpp index 72b053da45..d27c1594d9 100644 --- a/src/msw/combo.cpp +++ b/src/msw/combo.cpp @@ -309,7 +309,7 @@ static void wxMSWDrawFocusRect( wxDC& dc, const wxRect& rect ) // it employs wxCAP_BUTT hack to have line of width 1. dc.SetLogicalFunction(wxINVERT); - wxPen pen(*wxBLACK,1,wxDOT); + wxPen pen(*wxBLACK, 1, wxPENSTYLE_DOT); pen.SetCap(wxCAP_BUTT); dc.SetPen(pen); dc.SetBrush(*wxTRANSPARENT_BRUSH); diff --git a/src/msw/control.cpp b/src/msw/control.cpp index b58195c0cf..24a4e37f2c 100644 --- a/src/msw/control.cpp +++ b/src/msw/control.cpp @@ -392,10 +392,9 @@ WXHBRUSH wxControl::DoMSWControlColor(WXHDC pDC, wxColour colBg, WXHWND hWnd) ::SetBkColor(hdc, wxColourToRGB(colBg)); // 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(); - } // if we use custom background, we should set foreground ourselves too diff --git a/src/msw/dc.cpp b/src/msw/dc.cpp index 1e326b44a8..1db02a2c57 100644 --- a/src/msw/dc.cpp +++ b/src/msw/dc.cpp @@ -279,7 +279,7 @@ IMPLEMENT_DYNAMIC_CLASS(wxGDIDLLsCleanupModule, wxModule) wxColourChanger::wxColourChanger(wxMSWDCImpl& dc) : m_dc(dc) { 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); m_colFgOld = ::GetTextColor(hdc); @@ -300,8 +300,8 @@ wxColourChanger::wxColourChanger(wxMSWDCImpl& dc) : m_dc(dc) } SetBkMode(hdc, - dc.GetBackgroundMode() == wxTRANSPARENT ? TRANSPARENT - : OPAQUE); + dc.GetBackgroundMode() == wxBRUSHSTYLE_TRANSPARENT + ? TRANSPARENT : OPAQUE); // flag which telsl us to undo changes in the dtor m_changed = true; @@ -740,7 +740,7 @@ void wxMSWDCImpl::DoDrawArc(wxCoord x1, wxCoord y1, wxCoord xxx2 = (wxCoord) (xxc+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 // 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 // and we want them to have the same size regardless of which pen is used #ifndef __WXWINCE__ - if ( m_pen.GetStyle() == wxTRANSPARENT ) + if ( m_pen.GetStyle() == wxPENSTYLE_TRANSPARENT ) { x2dev++; 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 // transparent pen) one pixel smaller in both directions and we want them // to have the same size regardless of which pen is used - adjust - if ( m_pen.GetStyle() == wxTRANSPARENT ) + if ( m_pen.GetStyle() == wxPENSTYLE_TRANSPARENT ) { x2++; y2++; @@ -1349,7 +1349,7 @@ void wxMSWDCImpl::DrawAnyText(const wxString& text, wxCoord x, wxCoord y) old_background = SetBkColor(GetHdc(), m_textBackgroundColour.GetPixel() ); } - SetBkMode(GetHdc(), m_backgroundMode == wxTRANSPARENT ? TRANSPARENT + SetBkMode(GetHdc(), m_backgroundMode == wxBRUSHSTYLE_TRANSPARENT ? TRANSPARENT : OPAQUE); #ifdef __WXWINCE__ diff --git a/src/msw/dcclient.cpp b/src/msw/dcclient.cpp index 3eff38d0d4..e97fe01af2 100644 --- a/src/msw/dcclient.cpp +++ b/src/msw/dcclient.cpp @@ -110,7 +110,7 @@ void wxWindowDCImpl::InitDC() ::SetBkMode(GetHdc(), TRANSPARENT); // 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 #if wxUSE_PALETTE diff --git a/src/msw/dragimag.cpp b/src/msw/dragimag.cpp index 4f42ad81d9..0f1aa1ebb7 100644 --- a/src/msw/dragimag.cpp +++ b/src/msw/dragimag.cpp @@ -218,7 +218,7 @@ bool wxDragImage::Create(const wxString& str, const wxCursor& cursor) dc2.SetBackground(* wxWHITE_BRUSH); dc2.Clear(); - dc2.SetBackgroundMode(wxTRANSPARENT); + dc2.SetBackgroundMode(wxBRUSHSTYLE_TRANSPARENT); dc2.SetTextForeground(* wxLIGHT_GREY); dc2.DrawText(str, 0, 0); dc2.DrawText(str, 1, 0); diff --git a/src/msw/pen.cpp b/src/msw/pen.cpp index d13f4310e5..be20ac765d 100644 --- a/src/msw/pen.cpp +++ b/src/msw/pen.cpp @@ -435,10 +435,12 @@ wxPen::wxPen(const wxColour& col, int width, wxPenStyle style) m_refData = new wxPenRefData(col, width, style); } +/* error: `wxBrushStyle' has not been declared wxPen::wxPen(const wxColour& colour, int width, wxBrushStyle style) { m_refData = new wxPenRefData(colour, width, (wxPenStyle)style); } +*/ wxPen::wxPen(const wxBitmap& stipple, int width) { diff --git a/src/stc/PlatWX.cpp b/src/stc/PlatWX.cpp index 299aea9e9d..79bb27b801 100644 --- a/src/stc/PlatWX.cpp +++ b/src/stc/PlatWX.cpp @@ -289,11 +289,11 @@ bool SurfaceImpl::Initialised() { void SurfaceImpl::PenColour(ColourAllocated fore) { - hdc->SetPen(wxPen(wxColourFromCA(fore), 1, wxSOLID)); + hdc->SetPen(wxPen(wxColourFromCA(fore))); } void SurfaceImpl::BrushColour(ColourAllocated back) { - hdc->SetBrush(wxBrush(wxColourFromCA(back), wxSOLID)); + hdc->SetBrush(wxBrush(wxColourFromCA(back))); } void SurfaceImpl::SetFont(Font &font_) { @@ -344,7 +344,7 @@ void SurfaceImpl::FillRectangle(PRectangle rc, Surface &surfacePattern) { if (((SurfaceImpl&)surfacePattern).bitmap) br = wxBrush(*((SurfaceImpl&)surfacePattern).bitmap); else // Something is wrong so display in red - br = wxBrush(*wxRED, wxSOLID); + br = wxBrush(*wxRED); hdc->SetPen(*wxTRANSPARENT_PEN); hdc->SetBrush(br); hdc->DrawRectangle(wxRectFromPRectangle(rc)); @@ -475,13 +475,13 @@ void SurfaceImpl::DrawTextTransparent(PRectangle rc, Font &font, int ybase, SetFont(font); hdc->SetTextForeground(wxColourFromCA(fore)); - hdc->SetBackgroundMode(wxTRANSPARENT); + hdc->SetBackgroundMode(wxBRUSHSTYLE_TRANSPARENT); // 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... hdc->DrawText(stc2wx(s, len), rc.left, ybase - font.ascent); - hdc->SetBackgroundMode(wxSOLID); + hdc->SetBackgroundMode(wxBRUSHSTYLE_SOLID); } -- 2.45.2