+MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size)
+ : wxFrame((wxFrame *)NULL, wxID_ANY, title, pos, size)
+{
+ m_angle = 0.1;
+
+ m_canvas = new MyCanvas(this);
+
+ wxMenu *menuFile = new wxMenu;
+ menuFile->Append (ID_Angle, _T("Set &angle...\tCtrl-A"));
+ menuFile->Append (ID_Clear, _T("&Clear all ducks\tCtrl-C"));
+ menuFile->AppendSeparator();
+ menuFile->Append (ID_Quit, _T("E&xit\tAlt-X"));
+
+ wxMenuBar *menuBar = new wxMenuBar;
+ menuBar->Append (menuFile, _T("&File"));
+
+ SetMenuBar (menuBar);
+}
+
+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("wxWidgets rotate sample"),
+ degrees,
+ -180, +180,
+ this);
+ if ( degrees != -1 )
+ m_angle = (degrees * M_PI) / 180.0;
+}
+
+void MyFrame::OnQuit (wxCommandEvent &)
+{
+ Close (true);