From de9144361243da20c90b6e40d6b8570c2cb7ec89 Mon Sep 17 00:00:00 2001 From: Paul Cornett Date: Sat, 1 Dec 2012 22:14:36 +0000 Subject: [PATCH] remove colour/pen/brush arguments which are the default in the samples git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@73091 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- samples/dnd/dnd.cpp | 10 +++++----- samples/drawing/drawing.cpp | 44 +++++++++++++++++++------------------------- samples/font/font.cpp | 4 ++-- samples/image/canvas.cpp | 4 ++-- samples/scroll/scroll.cpp | 6 ++---- 5 files changed, 30 insertions(+), 38 deletions(-) diff --git a/samples/dnd/dnd.cpp b/samples/dnd/dnd.cpp index 9066221..2109640 100644 --- a/samples/dnd/dnd.cpp +++ b/samples/dnd/dnd.cpp @@ -342,7 +342,7 @@ public: virtual void Draw(wxDC& dc) { - dc.SetPen(wxPen(m_col, 1, wxSOLID)); + dc.SetPen(wxPen(m_col)); } protected: @@ -395,7 +395,7 @@ public: dc.DrawLine(p3, p1); //works in multicolor modes; on GTK (at least) will fail in 16-bit color - dc.SetBrush(wxBrush(m_col, wxSOLID)); + dc.SetBrush(wxBrush(m_col)); dc.FloodFill(GetCentre(), m_col, wxFLOOD_BORDER); } }; @@ -431,7 +431,7 @@ public: dc.DrawLine(p3, p4); dc.DrawLine(p4, p1); - dc.SetBrush(wxBrush(m_col, wxSOLID)); + dc.SetBrush(wxBrush(m_col)); dc.FloodFill(GetCentre(), m_col, wxFLOOD_BORDER); } }; @@ -459,7 +459,7 @@ public: dc.DrawEllipse(m_pos, m_size); - dc.SetBrush(wxBrush(m_col, wxSOLID)); + dc.SetBrush(wxBrush(m_col)); dc.FloodFill(GetCentre(), m_col, wxFLOOD_BORDER); } }; @@ -2023,7 +2023,7 @@ void DnDShapeDataObject::CreateBitmap() const wxBitmap bitmap(x, y); wxMemoryDC dc; dc.SelectObject(bitmap); - dc.SetBrush(wxBrush(wxT("white"), wxSOLID)); + dc.SetBrush(*wxWHITE_BRUSH); dc.Clear(); m_shape->Draw(dc); dc.SelectObject(wxNullBitmap); diff --git a/samples/drawing/drawing.cpp b/samples/drawing/drawing.cpp index 308ea82..80f0402 100644 --- a/samples/drawing/drawing.cpp +++ b/samples/drawing/drawing.cpp @@ -421,7 +421,7 @@ void MyCanvas::DrawTestBrushes(wxDC& dc) wxCoord x = 10, y = 10; - dc.SetBrush(wxBrush(*wxGREEN, wxSOLID)); + dc.SetBrush(*wxGREEN_BRUSH); dc.DrawRectangle(x, y, WIDTH, HEIGHT); dc.DrawText(wxT("Solid green"), x + 10, y + 10); @@ -495,13 +495,13 @@ void MyCanvas::DrawTestPoly(wxDC& dc) void MyCanvas::DrawTestLines( int x, int y, int width, wxDC &dc ) { - dc.SetPen( wxPen( wxT("black"), width, wxSOLID) ); + dc.SetPen( wxPen( *wxBLACK, width ) ); dc.SetBrush( *wxRED_BRUSH ); dc.DrawText(wxString::Format(wxT("Testing lines of width %d"), width), x + 10, y - 10); dc.DrawRectangle( x+10, y+10, 100, 190 ); dc.DrawText(wxT("Solid/dot/short dash/long dash/dot dash"), x + 150, y + 10); - dc.SetPen( wxPen( wxT("black"), width, wxSOLID) ); + dc.SetPen( wxPen( *wxBLACK, width ) ); dc.DrawLine( x+20, y+20, 100, y+20 ); dc.SetPen( wxPen( wxT("black"), width, wxDOT) ); dc.DrawLine( x+20, y+30, 100, y+30 ); @@ -733,13 +733,9 @@ void MyCanvas::DrawDefault(wxDC& dc) wxMemoryDC memdc2; memdc2.SelectObject(bitmap2); - wxColour clr(255, 255, 0); - wxBrush yellowBrush(clr, wxSOLID); - memdc2.SetBackground(yellowBrush); + memdc2.SetBackground(*wxYELLOW_BRUSH); memdc2.Clear(); - wxPen yellowPen(clr, 1, wxSOLID); - // Now draw a white rectangle with red outline. It should // entirely eclipse the yellow background. memdc2.SetPen(*wxRED_PEN); @@ -757,8 +753,8 @@ void MyCanvas::DrawDefault(wxDC& dc) // Draw a yellow rectangle filling the bitmap x = 600; int y = 270; - dc.SetPen(yellowPen); - dc.SetBrush(yellowBrush); + dc.SetPen(*wxYELLOW_PEN); + dc.SetBrush(*wxYELLOW_BRUSH); dc.DrawRectangle(x, y, totalWidth, totalHeight); // Now draw a white rectangle with red outline. It should @@ -890,7 +886,7 @@ void MyCanvas::DrawWithLogicalOps(wxDC& dc) static const wxCoord h = 60; // reuse the text colour here - dc.SetPen(wxPen(m_owner->m_colourForeground, 1, wxSOLID)); + dc.SetPen(wxPen(m_owner->m_colourForeground)); dc.SetBrush(*wxTRANSPARENT_BRUSH); size_t n; @@ -907,7 +903,7 @@ void MyCanvas::DrawWithLogicalOps(wxDC& dc) } // now some filled rectangles - dc.SetBrush(wxBrush(m_owner->m_colourForeground, wxSOLID)); + dc.SetBrush(wxBrush(m_owner->m_colourForeground)); for ( n = 0; n < WXSIZEOF(rasterOperations); n++ ) { @@ -936,22 +932,22 @@ void MyCanvas::DrawAlpha(wxDC& dc) wxDouble width = 180 ; wxDouble radius = 30 ; - dc.SetPen( wxPen( wxColour( 128, 0, 0, 255 ),12, wxSOLID)); - dc.SetBrush( wxBrush( wxColour( 255, 0, 0, 255),wxSOLID)); + dc.SetPen( wxPen( wxColour( 128, 0, 0 ), 12 )); + dc.SetBrush(*wxRED_BRUSH); wxRect r(margin,margin+width*0.66,width,width) ; dc.DrawRoundedRectangle( r.x, r.y, r.width, r.width, radius ) ; - dc.SetPen( wxPen( wxColour( 0, 0, 128, 255 ),12, wxSOLID)); - dc.SetBrush( wxBrush( wxColour( 0, 0, 255, 255),wxSOLID)); + dc.SetPen( wxPen( wxColour( 0, 0, 128 ), 12)); + dc.SetBrush(*wxBLUE_BRUSH); r.Offset( width * 0.8 , - width * 0.66 ) ; dc.DrawRoundedRectangle( r.x, r.y, r.width, r.width, radius ) ; - dc.SetPen( wxPen( wxColour( 128, 128, 0, 255 ),12, wxSOLID)); - dc.SetBrush( wxBrush( wxColour( 192, 192, 0, 255),wxSOLID)); + dc.SetPen( wxPen( wxColour( 128, 128, 0 ), 12)); + dc.SetBrush( wxBrush( wxColour( 192, 192, 0))); r.Offset( width * 0.8 , width *0.5 ) ; @@ -998,7 +994,7 @@ void MyCanvas::DrawGraphics(wxGraphicsContext* gc) gc->PushState(); // save current translation/scale/other state gc->Translate(60, 75); // reposition the context origin - gc->SetPen(wxPen("navy", 1)); + gc->SetPen(wxPen("navy")); gc->SetBrush(wxBrush("pink")); for( int i = 0 ; i < 3 ; ++i ) @@ -1230,9 +1226,9 @@ void MyCanvas::DrawSplines(wxDC& dc) letters[m][n].y = center.y + h[ letters[m][n].y ]; } - dc.SetPen( wxPen( wxT("blue"), 1, wxDOT) ); + dc.SetPen( wxPen( *wxBLUE, 1, wxDOT) ); dc.DrawLines(5, letters[m]); - dc.SetPen( wxPen( wxT("black"), 4, wxSOLID) ); + dc.SetPen( wxPen( *wxBLACK, 4) ); dc.DrawSpline(5, letters[m]); } @@ -1557,9 +1553,7 @@ void MyCanvas::Draw(wxDC& pdc) if ( m_owner->m_textureBackground) { if ( ! m_owner->m_backgroundBrush.IsOk() ) { - wxColour clr(0,128,0); - wxBrush b(clr, wxSOLID); - dc.SetBackground(b); + dc.SetBackground(wxBrush(wxColour(0, 128, 0))); } } @@ -1675,7 +1669,7 @@ void MyCanvas::OnMouseMove(wxMouseEvent &event) dc.SetPen( *wxGREY_PEN ); dc.SetBrush( wxColour( 192,192,192,64 ) ); #else - dc.SetPen( wxPen( *wxLIGHT_GREY, 2, wxSOLID ) ); + dc.SetPen( wxPen( *wxLIGHT_GREY, 2, ) ); dc.SetBrush( *wxTRANSPARENT_BRUSH ); #endif dc.DrawRectangle( newrect ); diff --git a/samples/font/font.cpp b/samples/font/font.cpp index 4c78adc..0dbf46a 100644 --- a/samples/font/font.cpp +++ b/samples/font/font.cpp @@ -1023,7 +1023,7 @@ void MyCanvas::OnPaint( wxPaintEvent &WXUNUSED(event) ) PrepareDC(dc); // set background - dc.SetBackground(wxBrush(wxT("white"), wxSOLID)); + dc.SetBackground(*wxWHITE_BRUSH); dc.Clear(); dc.SetFont(m_font); @@ -1105,7 +1105,7 @@ void MyCanvas::OnPaint( wxPaintEvent &WXUNUSED(event) ) } // draw the lines between them - dc.SetPen(wxPen(wxColour(wxT("blue")), 1, wxSOLID)); + dc.SetPen(*wxBLUE_PEN); int l; // horizontal diff --git a/samples/image/canvas.cpp b/samples/image/canvas.cpp index cdba69a..31ea54f 100644 --- a/samples/image/canvas.cpp +++ b/samples/image/canvas.cpp @@ -63,7 +63,7 @@ MyCanvas::MyCanvas( wxWindow *parent, wxWindowID id, wxMemoryDC dc; dc.SelectObject( bitmap ); - dc.SetBrush( wxBrush( wxT("orange"), wxSOLID ) ); + dc.SetBrush( wxBrush( wxS("orange") ) ); dc.SetPen( *wxBLACK_PEN ); dc.DrawRectangle( 0, 0, 100, 100 ); dc.SetBrush( *wxWHITE_BRUSH ); @@ -407,7 +407,7 @@ void MyCanvas::OnPaint( wxPaintEvent &WXUNUSED(event) ) dc.DrawBitmap( my_square, 30, 30 ); dc.DrawText( wxT("Drawn directly"), 150, 10 ); - dc.SetBrush( wxBrush( wxT("orange"), wxSOLID ) ); + dc.SetBrush( wxBrush( wxS("orange") ) ); dc.SetPen( *wxBLACK_PEN ); dc.DrawRectangle( 150, 30, 100, 100 ); dc.SetBrush( *wxWHITE_BRUSH ); diff --git a/samples/scroll/scroll.cpp b/samples/scroll/scroll.cpp index 0ee088f..342bdfd 100644 --- a/samples/scroll/scroll.cpp +++ b/samples/scroll/scroll.cpp @@ -1233,10 +1233,8 @@ MyAutoScrollingWindow::DCNormalize(int x, int y, int w, int h) void MyAutoScrollingWindow::OnDraw(wxDC& dc) { dc.SetFont(m_font); - wxBrush normBrush(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW) - , wxSOLID); - wxBrush selBrush(wxSystemSettings::GetColour(wxSYS_COLOUR_HIGHLIGHT) - , wxSOLID); + wxBrush normBrush(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW)); + wxBrush selBrush(wxSystemSettings::GetColour(wxSYS_COLOUR_HIGHLIGHT)); dc.SetPen(*wxTRANSPARENT_PEN); const wxString str = sm_testData; size_t strLength = str.length(); -- 2.7.4