]> git.saurik.com Git - wxWidgets.git/blobdiff - samples/artprov/arttest.cpp
Fix wrong configure test for abi::__forced_unwind in previous commit.
[wxWidgets.git] / samples / artprov / arttest.cpp
index 4c991b0258a05ff83b66e3f31a7de6d8d3626517..29fda747de70d8ee062acd673807f4d5d3a6b876 100644 (file)
@@ -6,7 +6,7 @@
 // Created:     2002/03/25
 // RCS-ID:      $Id$
 // Copyright:   (c) Vaclav Slavik
-// Licence:     wxWindows license
+// Licence:     wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
 
 // For compilers that support precompilation, includes "wx/wx.h".
@@ -20,8 +20,8 @@
 #include "wx/wx.h"
 #endif
 
-#ifndef __WXMSW__
-    #include "mondrian.xpm"
+#ifndef wxHAS_IMAGES_IN_RESOURCES
+    #include "../sample.xpm"
 #endif
 
 #include "wx/artprov.h"
@@ -47,10 +47,12 @@ private:
     // event handlers (these functions should _not_ be virtual)
     void OnQuit(wxCommandEvent& event);
     void OnAbout(wxCommandEvent& event);
+#if wxUSE_LOG
     void OnLogs(wxCommandEvent& event);
+#endif // wxUSE_LOG
     void OnBrowser(wxCommandEvent& event);
     void OnPlugProvider(wxCommandEvent& event);
-    
+
     DECLARE_EVENT_TABLE()
 };
 
@@ -61,8 +63,8 @@ private:
 // IDs for the controls and the menu commands
 enum
 {
-    ID_Quit = wxID_HIGHEST,
-    ID_Logs,
+    ID_Quit = wxID_EXIT,
+    ID_Logs = wxID_HIGHEST+1,
     ID_Browser,
     ID_PlugProvider
 };
@@ -73,7 +75,9 @@ enum
 
 BEGIN_EVENT_TABLE(MyFrame, wxFrame)
     EVT_MENU(ID_Quit,         MyFrame::OnQuit)
+#if wxUSE_LOG
     EVT_MENU(ID_Logs,         MyFrame::OnLogs)
+#endif // wxUSE_LOG
     EVT_MENU(wxID_ABOUT,      MyFrame::OnAbout)
     EVT_MENU(ID_Browser,      MyFrame::OnBrowser)
     EVT_MENU(ID_PlugProvider, MyFrame::OnPlugProvider)
@@ -92,8 +96,11 @@ IMPLEMENT_APP(MyApp)
 // 'Main program' equivalent: the program execution "starts" here
 bool MyApp::OnInit()
 {
+    if ( !wxApp::OnInit() )
+        return false;
+
     // create the main application window
-    MyFrame *frame = new MyFrame(_T("wxArtProvider sample"),
+    MyFrame *frame = new MyFrame(wxT("wxArtProvider sample"),
                                  wxPoint(50, 50), wxSize(450, 340));
     frame->Show(true);
     return true;
@@ -143,28 +150,30 @@ wxBitmap MyArtProvider::CreateBitmap(const wxArtID& id,
 MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size, long style)
        : wxFrame(NULL, wxID_ANY, title, pos, size, style)
 {
-    SetIcon(wxICON(mondrian));
+    SetIcon(wxICON(sample));
 
     // create a menu bar
     wxMenu *menuFile = new wxMenu;
 
     // the "About" item should be in the help menu
     wxMenu *helpMenu = new wxMenu;
-    helpMenu->Append(wxID_ABOUT, _T("&About...\tF1"), _T("Show about dialog"));
+    helpMenu->Append(wxID_ABOUT, wxT("&About\tF1"), wxT("Show about dialog"));
 
-    menuFile->AppendCheckItem(ID_PlugProvider, _T("&Plug-in art provider"), _T("Enable custom art provider"));   
+    menuFile->AppendCheckItem(ID_PlugProvider, wxT("&Plug-in art provider"), wxT("Enable custom art provider"));
     menuFile->AppendSeparator();
 
-    menuFile->Append(ID_Logs, _T("&Logging test"), _T("Show some logging output"));
-    menuFile->Append(ID_Browser, _T("&Resources browser"), _T("Browse all available icons"));
+#if wxUSE_LOG
+    menuFile->Append(ID_Logs, wxT("&Logging test"), wxT("Show some logging output"));
+#endif // wxUSE_LOG
+    menuFile->Append(ID_Browser, wxT("&Resources browser"), wxT("Browse all available icons"));
     menuFile->AppendSeparator();
 
-    menuFile->Append(ID_Quit, _T("E&xit\tAlt-X"), _T("Quit this program"));
+    menuFile->Append(ID_Quit, wxT("E&xit\tAlt-X"), wxT("Quit this program"));
 
     // now append the freshly created menu to the menu bar...
     wxMenuBar *menuBar = new wxMenuBar();
-    menuBar->Append(menuFile, _T("&File"));
-    menuBar->Append(helpMenu, _T("&Help"));
+    menuBar->Append(menuFile, wxT("&File"));
+    menuBar->Append(helpMenu, wxT("&Help"));
 
     // ... and attach this menu bar to the frame
     SetMenuBar(menuBar);
@@ -179,23 +188,25 @@ void MyFrame::OnQuit(wxCommandEvent& WXUNUSED(event))
     Close(true);
 }
 
+#if wxUSE_LOG
 void MyFrame::OnLogs(wxCommandEvent& WXUNUSED(event))
 {
-    wxLogMessage(_T("Some information."));
-    wxLogError(_T("This is an error."));
-    wxLogWarning(_T("A warning."));
-    wxLogError(_T("Yet another error."));
+    wxLogMessage(wxT("Some information."));
+    wxLogError(wxT("This is an error."));
+    wxLogWarning(wxT("A warning."));
+    wxLogError(wxT("Yet another error."));
     wxLog::GetActiveTarget()->Flush();
-    wxLogMessage(_T("Check/uncheck 'File/Plug-in art provider' and try again."));
+    wxLogMessage(wxT("Check/uncheck 'File/Plug-in art provider' and try again."));
 }
+#endif // wxUSE_LOG
 
 void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event))
 {
     wxString msg;
-    msg.Printf( _T("This is the about dialog of wxArtProvider sample.\n")
-                _T("Welcome to %s"), wxVERSION_STRING);
+    msg.Printf( wxT("This is the about dialog of wxArtProvider sample.\n")
+                wxT("Welcome to %s"), wxVERSION_STRING);
 
-    wxMessageBox(msg, _T("About wxArtProvider sample"),
+    wxMessageBox(msg, wxT("About wxArtProvider sample"),
         wxOK | wxICON_INFORMATION, this);
 }
 
@@ -208,7 +219,7 @@ void MyFrame::OnBrowser(wxCommandEvent& WXUNUSED(event))
 void MyFrame::OnPlugProvider(wxCommandEvent& event)
 {
     if ( event.IsChecked() )
-        wxArtProvider::PushProvider(new MyArtProvider);
+        wxArtProvider::Push(new MyArtProvider);
     else
-        wxArtProvider::PopProvider();
+        wxArtProvider::Pop();
 }