X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/618f2efa413947456c7efb17d143a44a76787619..bceff574a860c4ecd9bb2d5a1a3f8889fef9306a:/contrib/samples/animate/anitest.cpp diff --git a/contrib/samples/animate/anitest.cpp b/contrib/samples/animate/anitest.cpp index f75cdf3c9c..d402201c76 100644 --- a/contrib/samples/animate/anitest.cpp +++ b/contrib/samples/animate/anitest.cpp @@ -28,7 +28,7 @@ #include "wx/wx.h" #endif -#if defined(__WXGTK__) || defined(__WXX11__) || defined(__WXMOTIF__) || defined(__WXMAC__) +#ifndef __WXMSW__ #include "mondrian.xpm" #endif @@ -45,9 +45,11 @@ IMPLEMENT_APP(MyApp) // --------------------------------------------------------------------------- BEGIN_EVENT_TABLE(MyFrame, wxFrame) - EVT_MENU(ANITEST_ABOUT, MyFrame::OnAbout) - EVT_MENU(ANITEST_QUIT, MyFrame::OnQuit) - EVT_MENU(ANITEST_OPEN, MyFrame::OnOpen) + EVT_MENU(wxID_ABOUT, MyFrame::OnAbout) + EVT_MENU(wxID_EXIT, MyFrame::OnQuit) +#if wxUSE_FILEDLG + EVT_MENU(wxID_OPEN, MyFrame::OnOpen) +#endif // wxUSE_FILEDLG EVT_SIZE(MyFrame::OnSize) END_EVENT_TABLE() @@ -65,13 +67,13 @@ bool MyApp::OnInit() { // Create the main frame window - MyFrame* frame = new MyFrame((wxFrame *)NULL, -1, "Animation Demo", + MyFrame* frame = new MyFrame((wxFrame *)NULL, -1, _T("Animation Demo"), wxPoint(-1, -1), wxSize(500, 400), wxDEFAULT_FRAME_STYLE); // Give it an icon #ifdef __WXMSW__ - frame->SetIcon(wxIcon("mdi_icn")); + frame->SetIcon(wxIcon(_T("mdi_icn"))); #else frame->SetIcon(wxIcon( mondrian_xpm )); #endif @@ -79,27 +81,31 @@ bool MyApp::OnInit() // Make a menubar wxMenu *file_menu = new wxMenu; - file_menu->Append(ANITEST_OPEN, "&Open Animation...\tCtrl+O", "Open a GIF animation"); - file_menu->Append(ANITEST_QUIT, "&Exit\tAlt+X", "Quit the program"); +#if wxUSE_FILEDLG + file_menu->Append(wxID_OPEN, _T("&Open Animation...\tCtrl+O"), _T("Open a GIF animation")); +#endif // wxUSE_FILEDLG + file_menu->Append(wxID_EXIT, _T("&Exit\tAlt+X"), _T("Quit the program")); wxMenu *help_menu = new wxMenu; - help_menu->Append(ANITEST_ABOUT, "&About\tF1"); + help_menu->Append(wxID_ABOUT, _T("&About\tF1")); wxMenuBar *menu_bar = new wxMenuBar; - menu_bar->Append(file_menu, "&File"); - menu_bar->Append(help_menu, "&Help"); + menu_bar->Append(file_menu, _T("&File")); + menu_bar->Append(help_menu, _T("&Help")); // Associate the menu bar with the frame frame->SetMenuBar(menu_bar); +#if wxUSE_STATUSBAR frame->CreateStatusBar(); +#endif // wxUSE_STATUSBAR - frame->Show(TRUE); + frame->Show(true); SetTopWindow(frame); - return TRUE; + return true; } // --------------------------------------------------------------------------- @@ -117,9 +123,9 @@ MyFrame::MyFrame(wxWindow *parent, style | wxNO_FULL_REPAINT_ON_RESIZE) { // m_animation = NULL; - m_canvas = new MyCanvas(this, wxPoint(0, 0), wxSize(-1, -1)); + m_canvas = new MyCanvas(this, wxPoint(0, 0), wxDefaultSize); #if 0 - m_player.SetDestroyAnimation(FALSE); + m_player.SetDestroyAnimation(false); m_player.SetWindow(m_canvas); m_player.SetPosition(wxPoint(0, 0)); #endif @@ -139,15 +145,16 @@ void MyFrame::OnQuit(wxCommandEvent& WXUNUSED(event)) void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event) ) { - (void)wxMessageBox("wxWindows 2 Animation Demo\n" - "Author: Julian Smart (c) 2001\n", - "About Animation Demo"); + (void)wxMessageBox(_T("wxWidgets 2 Animation Demo\n") + _T("Author: Julian Smart (c) 2001\n"), + _T("About Animation Demo")); } -void MyFrame::OnOpen(wxCommandEvent& event) +#if wxUSE_FILEDLG +void MyFrame::OnOpen(wxCommandEvent& WXUNUSED(event)) { - wxFileDialog dialog(this, wxT("Please choose an animated GIF"), - wxEmptyString, wxEmptyString, wxT("*.gif"), wxOPEN); + wxFileDialog dialog(this, _T("Please choose an animated GIF"), + wxEmptyString, wxEmptyString, wxT("*.gif"), wxFD_OPEN); if (dialog.ShowModal() == wxID_OK) { wxString filename(dialog.GetPath()); @@ -159,10 +166,11 @@ void MyFrame::OnOpen(wxCommandEvent& event) } else { - wxMessageBox("Sorry, this animation was not a valid animated GIF."); + wxMessageBox(_T("Sorry, this animation was not a valid animated GIF.")); } } } +#endif // wxUSE_FILEDLG // --------------------------------------------------------------------------- @@ -180,10 +188,10 @@ MyCanvas::MyCanvas(wxWindow *parent, const wxPoint& pos, const wxSize& size) wxNO_FULL_REPAINT_ON_RESIZE | wxVSCROLL | wxHSCROLL) { - SetBackgroundColour(wxColour("YELLOW")); + SetBackgroundColour(wxColour(_T("YELLOW"))); } -void MyCanvas::OnPaint(wxPaintEvent& event) +void MyCanvas::OnPaint(wxPaintEvent& WXUNUSED(event)) { wxPaintDC dc(this); #if 0 @@ -194,4 +202,3 @@ void MyCanvas::OnPaint(wxPaintEvent& event) } #endif } -