From 79490c3d8b9c999216c295cb91d8d94968dbaabf Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Wed, 9 Dec 1998 17:43:07 +0000 Subject: [PATCH] "wxGDIObject * => &" changes git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@1143 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- samples/forty/forty.cpp | 15 +++++++++------ samples/forty/forty.h | 6 +++--- samples/forty/game.cpp | 10 +++++----- samples/image/image.cpp | 4 ++-- 4 files changed, 19 insertions(+), 16 deletions(-) diff --git a/samples/forty/forty.cpp b/samples/forty/forty.cpp index 65a9c463d1..960816e916 100644 --- a/samples/forty/forty.cpp +++ b/samples/forty/forty.cpp @@ -96,31 +96,34 @@ bool FortyApp::OnInit() return true; } -wxColour* FortyApp::BackgroundColour() +const wxColour& FortyApp::BackgroundColour() { if (!m_backgroundColour) { m_backgroundColour = new wxColour(0, 128, 0); } - return m_backgroundColour; + + return *m_backgroundColour; } -wxBrush* FortyApp::BackgroundBrush() +const wxBrush& FortyApp::BackgroundBrush() { if (!m_backgroundBrush) { m_backgroundBrush = new wxBrush(*BackgroundColour(), wxSOLID); } - return m_backgroundBrush; + + return *m_backgroundBrush; } -wxColour* FortyApp::TextColour() +const wxColour& FortyApp::TextColour() { if (!m_textColour) { m_textColour = new wxColour("BLACK"); } - return m_textColour; + + return *m_textColour; } // My frame constructor diff --git a/samples/forty/forty.h b/samples/forty/forty.h index bdbb7832fd..1fbf6449f1 100644 --- a/samples/forty/forty.h +++ b/samples/forty/forty.h @@ -18,9 +18,9 @@ class FortyApp: public wxApp public: bool OnInit(); - static wxColour* BackgroundColour(); - static wxColour* TextColour(); - static wxBrush* BackgroundBrush(); + static const wxColour& BackgroundColour(); + static const wxColour& TextColour(); + static const wxBrush& BackgroundBrush(); private: static wxColour* m_backgroundColour; diff --git a/samples/forty/game.cpp b/samples/forty/game.cpp index 90bfc194c0..a6dca69cac 100644 --- a/samples/forty/game.cpp +++ b/samples/forty/game.cpp @@ -364,7 +364,7 @@ bool Game::LButtonDown(wxDC& dc, int x, int y) // Initialise the card bitmap to the background colour { wxMemoryDC memoryDC; - memoryDC.SelectObject(m_bmap); + memoryDC.SelectObject(*m_bmap); m_liftedCard = m_srcPile->RemoveTopCard(memoryDC, m_xPos, m_yPos); } @@ -372,7 +372,7 @@ bool Game::LButtonDown(wxDC& dc, int x, int y) // the screen { wxMemoryDC memoryDC; - memoryDC.SelectObject(m_bmapCard); + memoryDC.SelectObject(*m_bmapCard); m_liftedCard->Draw(memoryDC, 0, 0); } } @@ -558,7 +558,7 @@ void Game::LButtonUp(wxDC& dc, int x, int y) // Restore the area under the card wxMemoryDC memoryDC; - memoryDC.SelectObject(m_bmap); + memoryDC.SelectObject(*m_bmap); dc.Blit(m_xPos, m_yPos, CardWidth, CardHeight, &memoryDC, 0, 0, wxCOPY); @@ -604,7 +604,7 @@ void Game::MouseMove(wxDC& dc, int mx, int my) if (m_liftedCard) { wxMemoryDC memoryDC; - memoryDC.SelectObject(m_bmap); + memoryDC.SelectObject(*m_bmap); int dx = mx + m_xOffset - m_xPos; int dy = my + m_yOffset - m_yPos; @@ -675,7 +675,7 @@ void Game::MouseMove(wxDC& dc, int mx, int my) m_yPos += dy; // draw the card in its new position - memoryDC.SelectObject(m_bmapCard); + memoryDC.SelectObject(*m_bmapCard); dc.Blit(m_xPos, m_yPos, CardWidth, CardHeight, &memoryDC, 0, 0, wxCOPY); } diff --git a/samples/image/image.cpp b/samples/image/image.cpp index 002e1da9f4..4e51460807 100644 --- a/samples/image/image.cpp +++ b/samples/image/image.cpp @@ -122,8 +122,8 @@ void MyCanvas::OnPaint( wxPaintEvent &WXUNUSED(event) ) // MyFrame -const ID_QUIT = 108; -const ID_ABOUT = 109; +const int ID_QUIT = 108; +const int ID_ABOUT = 109; IMPLEMENT_DYNAMIC_CLASS( MyFrame, wxFrame )