From ea92bb677d2a7db395519565da724fe7fccd774a Mon Sep 17 00:00:00 2001 From: Paul Cornett Date: Sat, 1 Dec 2012 23:06:50 +0000 Subject: [PATCH] use stock colour/pen/brush objects in samples git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@73095 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- samples/controls/controls.cpp | 4 ++-- samples/drawing/drawing.cpp | 26 +++++++++++++------------- samples/mdi/mdi.cpp | 2 +- samples/mediaplayer/mediaplayer.cpp | 2 +- samples/memcheck/memcheck.cpp | 2 +- samples/regtest/regtest.cpp | 2 +- samples/richtext/richtext.cpp | 4 ++-- samples/sashtest/sashtest.cpp | 6 +++--- samples/shaped/shaped.cpp | 2 +- samples/svg/svgtest.cpp | 2 +- samples/treectrl/treetest.cpp | 2 +- samples/widgets/button.cpp | 2 +- samples/widgets/odcombobox.cpp | 2 +- samples/widgets/toggle.cpp | 2 +- 14 files changed, 30 insertions(+), 30 deletions(-) diff --git a/samples/controls/controls.cpp b/samples/controls/controls.cpp index 6c73d21a03..ea60421a1e 100644 --- a/samples/controls/controls.cpp +++ b/samples/controls/controls.cpp @@ -1250,8 +1250,8 @@ void MyPanel::OnChangeColour(wxCommandEvent& WXUNUSED(event)) } else { - s_colOld = wxColour(wxT("red")); - SetBackgroundColour(wxT("white")); + s_colOld = *wxRED; + SetBackgroundColour(*wxWHITE); m_lbSelectThis->SetForegroundColour(wxT("white")); m_lbSelectThis->SetBackgroundColour(wxT("red")); diff --git a/samples/drawing/drawing.cpp b/samples/drawing/drawing.cpp index dd9709656f..1404a120d9 100644 --- a/samples/drawing/drawing.cpp +++ b/samples/drawing/drawing.cpp @@ -1302,19 +1302,19 @@ void MyCanvas::DrawGradients(wxDC& dc) r3.y += 60; wxRect r4 = r2; r4.y += 60; - dc.SetPen(wxPen(wxColour(255, 0, 0))); + dc.SetPen(*wxRED_PEN); dc.DrawRectangle(r); r.Deflate(1); - dc.GradientFillLinear(r, wxColour(0,255,0), wxColour(0,0,0), wxNORTH); + dc.GradientFillLinear(r, *wxGREEN, *wxBLACK, wxNORTH); dc.DrawRectangle(r2); r2.Deflate(1); - dc.GradientFillLinear(r2, wxColour(0,0,0), wxColour(0,255,0), wxSOUTH); + dc.GradientFillLinear(r2, *wxBLACK, *wxGREEN, wxSOUTH); dc.DrawRectangle(r3); r3.Deflate(1); - dc.GradientFillLinear(r3, wxColour(0,255,0), wxColour(0,0,0), wxEAST); + dc.GradientFillLinear(r3, *wxGREEN, *wxBLACK, wxEAST); dc.DrawRectangle(r4); r4.Deflate(1); - dc.GradientFillLinear(r4, wxColour(0,0,0), wxColour(0,255,0), wxWEST); + dc.GradientFillLinear(r4, *wxBLACK, *wxGREEN, wxWEST); #if wxUSE_GRAPHICS_CONTEXT if (m_useContext) @@ -1328,9 +1328,9 @@ void MyCanvas::DrawGradients(wxDC& dc) dc.DrawText(wxT("Linear Gradient with Stops"), gfr.x, gfr.y); gfr.Offset(0, TEXT_HEIGHT); - stops = wxGraphicsGradientStops(wxColour(255,0,0), wxColour(0,0,255)); + stops = wxGraphicsGradientStops(*wxRED, *wxBLUE); stops.Add(wxColour(255,255,0), 0.33f); - stops.Add(wxColour(0,255,0), 0.67f); + stops.Add(*wxGREEN, 0.67f); gc->SetBrush(gc->CreateLinearGradientBrush(gfr.x, gfr.y, gfr.x + gfr.width, gfr.y + gfr.height, @@ -1365,11 +1365,11 @@ void MyCanvas::DrawGradients(wxDC& dc) dc.DrawText(wxT("Linear Gradient with Stops and Gaps"), gfr.x, gfr.y); gfr.Offset(0, TEXT_HEIGHT); - stops = wxGraphicsGradientStops(wxColour(255,0,0), wxColour(0,0,255)); + stops = wxGraphicsGradientStops(*wxRED, *wxBLUE); stops.Add(wxColour(255,255,0), 0.33f); stops.Add(wxTransparentColour, 0.33f); stops.Add(wxTransparentColour, 0.67f); - stops.Add(wxColour(0,255,0), 0.67f); + stops.Add(*wxGREEN, 0.67f); gc->SetBrush(gc->CreateLinearGradientBrush(gfr.x, gfr.y + gfr.height, gfr.x + gfr.width, gfr.y, @@ -1404,12 +1404,12 @@ void MyCanvas::DrawGradients(wxDC& dc) dc.DrawText(wxT("Gradients with Stops and Transparency"), gfr.x, gfr.y); gfr.Offset(0, TEXT_HEIGHT); - stops = wxGraphicsGradientStops(wxColour(255,0,0), wxTransparentColour); - stops.Add(wxColour(255,0,0), 0.33f); + stops = wxGraphicsGradientStops(*wxRED, wxTransparentColour); + stops.Add(*wxRED, 0.33f); stops.Add(wxTransparentColour, 0.33f); stops.Add(wxTransparentColour, 0.67f); - stops.Add(wxColour(0,0,255), 0.67f); - stops.Add(wxColour(0,0,255), 1.0f); + stops.Add(*wxBLUE, 0.67f); + stops.Add(*wxBLUE, 1.0f); pth = gc->CreatePath(); pth.MoveToPoint(gfr.x,gfr.y); diff --git a/samples/mdi/mdi.cpp b/samples/mdi/mdi.cpp index e68364cf01..c65e285682 100644 --- a/samples/mdi/mdi.cpp +++ b/samples/mdi/mdi.cpp @@ -340,7 +340,7 @@ MyCanvas::MyCanvas(wxWindow *parent, const wxPoint& pos, const wxSize& size) wxNO_FULL_REPAINT_ON_RESIZE | wxVSCROLL | wxHSCROLL) { - SetBackgroundColour(wxColour("WHITE")); + SetBackgroundColour(*wxWHITE); SetCursor(wxCursor(wxCURSOR_PENCIL)); SetScrollbars(20, 20, 50, 50); diff --git a/samples/mediaplayer/mediaplayer.cpp b/samples/mediaplayer/mediaplayer.cpp index c75bb4e970..4055a71261 100644 --- a/samples/mediaplayer/mediaplayer.cpp +++ b/samples/mediaplayer/mediaplayer.cpp @@ -1603,7 +1603,7 @@ wxMediaPlayerNotebookPage::wxMediaPlayerNotebookPage(wxMediaPlayerFrame* parentF | wxSUNKEN_BORDER); // Set the background of our listctrl to white - m_playlist->SetBackgroundColour(wxColour(255,255,255)); + m_playlist->SetBackgroundColour(*wxWHITE); // The layout of the headers of the listctrl are like // | | File | Length diff --git a/samples/memcheck/memcheck.cpp b/samples/memcheck/memcheck.cpp index 43e33bb801..511d8691e6 100644 --- a/samples/memcheck/memcheck.cpp +++ b/samples/memcheck/memcheck.cpp @@ -86,7 +86,7 @@ bool MyApp::OnInit(void) #endif // object allocation - wxBrush* brush = new wxBrush(*wxRED); + wxBrush* brush = new wxBrush(*wxRED_BRUSH); wxBitmap* bitmap = new wxBitmap(100, 100); // non-object allocation diff --git a/samples/regtest/regtest.cpp b/samples/regtest/regtest.cpp index a12d6f28b7..711d0241f1 100644 --- a/samples/regtest/regtest.cpp +++ b/samples/regtest/regtest.cpp @@ -367,7 +367,7 @@ RegFrame::RegFrame(wxFrame *parent, const wxChar *title, int x, int y, int w, in : wxFrame(parent, wxID_ANY, title, wxPoint(x, y), wxSize(w, h)) { // this reduces flicker effects - SetBackgroundColour(wxColour(255, 255, 255)); + SetBackgroundColour(*wxWHITE); // set the icon // ------------ diff --git a/samples/richtext/richtext.cpp b/samples/richtext/richtext.cpp index f101c86e5b..b14b9bf1d3 100644 --- a/samples/richtext/richtext.cpp +++ b/samples/richtext/richtext.cpp @@ -985,13 +985,13 @@ void MyFrame::WriteInitialText() r.WriteImage(wxBitmap(smiley_xpm)); r.WriteText(wxT(" Well, you can change text ")); - r.BeginTextColour(wxColour(255, 0, 0)); + r.BeginTextColour(*wxRED); r.WriteText(wxT("colour, like this red bit.")); r.EndTextColour(); wxRichTextAttr backgroundColourAttr; backgroundColourAttr.SetBackgroundColour(*wxGREEN); - backgroundColourAttr.SetTextColour(wxColour(0, 0, 255)); + backgroundColourAttr.SetTextColour(*wxBLUE); r.BeginStyle(backgroundColourAttr); r.WriteText(wxT(" And this blue on green bit.")); r.EndStyle(); diff --git a/samples/sashtest/sashtest.cpp b/samples/sashtest/sashtest.cpp index 5ed6c61b88..13b6a9df3d 100644 --- a/samples/sashtest/sashtest.cpp +++ b/samples/sashtest/sashtest.cpp @@ -108,7 +108,7 @@ MyFrame::MyFrame(wxWindow *parent, const wxWindowID id, const wxString& title, c win->SetDefaultSize(wxSize(1000, 30)); win->SetOrientation(wxLAYOUT_HORIZONTAL); win->SetAlignment(wxLAYOUT_TOP); - win->SetBackgroundColour(wxColour(255, 0, 0)); + win->SetBackgroundColour(*wxRED); win->SetSashVisible(wxSASH_BOTTOM, true); m_topWindow = win; @@ -120,7 +120,7 @@ MyFrame::MyFrame(wxWindow *parent, const wxWindowID id, const wxString& title, c win->SetDefaultSize(wxSize(1000, 30)); win->SetOrientation(wxLAYOUT_HORIZONTAL); win->SetAlignment(wxLAYOUT_BOTTOM); - win->SetBackgroundColour(wxColour(0, 0, 255)); + win->SetBackgroundColour(*wxBLUE); win->SetSashVisible(wxSASH_TOP, true); m_bottomWindow = win; @@ -132,7 +132,7 @@ MyFrame::MyFrame(wxWindow *parent, const wxWindowID id, const wxString& title, c win->SetDefaultSize(wxSize(120, 1000)); win->SetOrientation(wxLAYOUT_VERTICAL); win->SetAlignment(wxLAYOUT_LEFT); - win->SetBackgroundColour(wxColour(0, 255, 0)); + win->SetBackgroundColour(*wxGREEN); win->SetSashVisible(wxSASH_RIGHT, true); win->SetExtraBorderSize(10); diff --git a/samples/shaped/shaped.cpp b/samples/shaped/shaped.cpp index e1e3afc17a..614b7d076a 100644 --- a/samples/shaped/shaped.cpp +++ b/samples/shaped/shaped.cpp @@ -490,7 +490,7 @@ SeeThroughFrame::SeeThroughFrame() wxSTAY_ON_TOP), m_currentState(STATE_SEETHROUGH) { - SetBackgroundColour(wxColour(255, 255, 255, 255)); + SetBackgroundColour(*wxWHITE); SetBackgroundStyle(wxBG_STYLE_TRANSPARENT); } diff --git a/samples/svg/svgtest.cpp b/samples/svg/svgtest.cpp index bcd3339105..a70673a594 100644 --- a/samples/svg/svgtest.cpp +++ b/samples/svg/svgtest.cpp @@ -320,7 +320,7 @@ END_EVENT_TABLE() MyCanvas::MyCanvas(MyChild *parent, const wxPoint& pos, const wxSize& size) : wxScrolledWindow(parent, wxID_ANY, pos, size, wxSUNKEN_BORDER|wxVSCROLL|wxHSCROLL) { - SetBackgroundColour(wxColour(wxT("WHITE"))); + SetBackgroundColour(*wxWHITE); m_child = parent; m_index = m_child->GetFrame()->GetCountOfChildren() % 9; diff --git a/samples/treectrl/treetest.cpp b/samples/treectrl/treetest.cpp index 8e0064d1df..8085917c9e 100644 --- a/samples/treectrl/treetest.cpp +++ b/samples/treectrl/treetest.cpp @@ -215,7 +215,7 @@ MyFrame::MyFrame(const wxString& title, int x, int y, int w, int h) // This reduces flicker effects - even better would be to define // OnEraseBackground to do nothing. When the tree control's scrollbars are // show or hidden, the frame is sent a background erase event. - SetBackgroundColour(wxColour(255, 255, 255)); + SetBackgroundColour(*wxWHITE); // Give it an icon SetIcon(wxICON(sample)); diff --git a/samples/widgets/button.cpp b/samples/widgets/button.cpp index 07523bf543..4376e39ae2 100644 --- a/samples/widgets/button.cpp +++ b/samples/widgets/button.cpp @@ -619,7 +619,7 @@ wxBitmap ButtonWidgetsPage::CreateBitmap(const wxString& label) wxBitmap bmp(180, 70); // shouldn't hardcode but it's simpler like this wxMemoryDC dc; dc.SelectObject(bmp); - dc.SetBackground(wxBrush(*wxCYAN)); + dc.SetBackground(*wxCYAN_BRUSH); dc.Clear(); dc.SetTextForeground(*wxBLACK); dc.DrawLabel(wxStripMenuCodes(m_textLabel->GetValue()) + wxT("\n") diff --git a/samples/widgets/odcombobox.cpp b/samples/widgets/odcombobox.cpp index 419a13408a..6473e51983 100644 --- a/samples/widgets/odcombobox.cpp +++ b/samples/widgets/odcombobox.cpp @@ -541,7 +541,7 @@ void ODComboboxWidgetsPage::CreateCombo() if ( m_chkBitmapbutton->GetValue() ) { - wxBitmap bmpNormal = CreateBitmap(wxColour(0,0,255)); + wxBitmap bmpNormal = CreateBitmap(*wxBLUE); wxBitmap bmpPressed = CreateBitmap(wxColour(0,0,128)); wxBitmap bmpHover = CreateBitmap(wxColour(128,128,255)); m_combobox->SetButtonBitmaps(bmpNormal,m_chkStdbutton->GetValue(),bmpPressed,bmpHover); diff --git a/samples/widgets/toggle.cpp b/samples/widgets/toggle.cpp index 9c3dc354bc..349181862d 100644 --- a/samples/widgets/toggle.cpp +++ b/samples/widgets/toggle.cpp @@ -526,7 +526,7 @@ wxBitmap ToggleWidgetsPage::CreateBitmap(const wxString& label) wxBitmap bmp(180, 70); // shouldn't hardcode but it's simpler like this wxMemoryDC dc; dc.SelectObject(bmp); - dc.SetBackground(wxBrush(*wxCYAN)); + dc.SetBackground(*wxCYAN_BRUSH); dc.Clear(); dc.SetTextForeground(*wxBLACK); dc.DrawLabel(wxStripMenuCodes(m_textLabel->GetValue()) + wxT("\n") -- 2.45.2