X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/600683ca0561c9d56e73f1faa3f21d8a6670936b..287cb697c94ec34c0f7020f8347327a59d2cb51d:/samples/rotate/rotate.cpp?ds=sidebyside diff --git a/samples/rotate/rotate.cpp b/samples/rotate/rotate.cpp index c7eacc7ef7..f2baa3715c 100644 --- a/samples/rotate/rotate.cpp +++ b/samples/rotate/rotate.cpp @@ -21,15 +21,7 @@ #endif #include "wx/image.h" - -/* GRG: This is not ANSI standard, define M_PI explicitly -#include // M_PI -*/ - -#ifndef M_PI -#define M_PI 3.1415926535897932384626433832795 -#endif - +#include "wx/numdlg.h" class MyApp: public wxApp { @@ -98,19 +90,19 @@ bool MyApp::OnInit() { wxLogError(wxT("Can't load the test image, please copy it to the ") wxT("program directory")); - return FALSE; + return false; } - MyFrame *frame = new MyFrame (_T("wxWindows rotate sample"), + MyFrame *frame = new MyFrame (_T("wxWidgets rotate sample"), wxPoint(20,20), wxSize(600,450)); - frame->Show (TRUE); + frame->Show (true); SetTopWindow (frame); - return TRUE; + return true; } MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size) - : wxFrame((wxFrame *)NULL, -1, title, pos, size) + : wxFrame((wxFrame *)NULL, wxID_ANY, title, pos, size) { m_angle = 0.1; @@ -132,7 +124,7 @@ void MyFrame::OnAngle (wxCommandEvent &) long degrees = (long)((180*m_angle)/M_PI); degrees = wxGetNumberFromUser(_T("Change the image rotation angle"), _T("Angle in degrees:"), - _T("wxWindows rotate sample"), + _T("wxWidgets rotate sample"), degrees, -180, +180, this); @@ -142,14 +134,14 @@ void MyFrame::OnAngle (wxCommandEvent &) void MyFrame::OnQuit (wxCommandEvent &) { - Close (TRUE); + Close (true); } MyCanvas::MyCanvas(wxWindow* parent): - wxScrolledWindow(parent, -1) + wxScrolledWindow(parent, wxID_ANY) { SetBackgroundColour (wxColour (0,80,60)); - Clear(); + ClearBackground(); } // Rotate with interpolation and with offset correction @@ -159,12 +151,12 @@ void MyCanvas::OnMouseLeftUp (wxMouseEvent & event) wxPoint offset; const wxImage& img = wxGetApp().GetImage(); - wxImage img2 = img.Rotate(frame->m_angle, wxPoint(img.GetWidth()/2, img.GetHeight()/2), TRUE, &offset); + wxImage img2 = img.Rotate(frame->m_angle, wxPoint(img.GetWidth()/2, img.GetHeight()/2), true, &offset); wxBitmap bmp(img2); wxClientDC dc (this); - dc.DrawBitmap (bmp, event.m_x + offset.x, event.m_y + offset.y, TRUE); + dc.DrawBitmap (bmp, event.m_x + offset.x, event.m_y + offset.y, true); } // without interpolation, and without offset correction @@ -173,10 +165,10 @@ void MyCanvas::OnMouseRightUp (wxMouseEvent & event) MyFrame* frame = (MyFrame*) GetParent(); const wxImage& img = wxGetApp().GetImage(); - wxImage img2 = img.Rotate(frame->m_angle, wxPoint(img.GetWidth()/2, img.GetHeight()/2), FALSE); + wxImage img2 = img.Rotate(frame->m_angle, wxPoint(img.GetWidth()/2, img.GetHeight()/2), false); wxBitmap bmp(img2); wxClientDC dc (this); - dc.DrawBitmap (bmp, event.m_x, event.m_y, TRUE); + dc.DrawBitmap (bmp, event.m_x, event.m_y, true); }