+
+void MyFrame::OnThumbnail( wxCommandEvent &WXUNUSED(event) )
+{
+#if wxUSE_FILEDLG
+ wxString filename = wxFileSelector(_T("Select image file"));
+ if ( filename.empty() )
+ return;
+
+ static const int THUMBNAIL_WIDTH = 320;
+ static const int THUMBNAIL_HEIGHT = 240;
+
+ wxImage image;
+ image.SetOption(wxIMAGE_OPTION_MAX_WIDTH, THUMBNAIL_WIDTH);
+ image.SetOption(wxIMAGE_OPTION_MAX_HEIGHT, THUMBNAIL_HEIGHT);
+
+ wxStopWatch sw;
+ if ( !image.LoadFile(filename) )
+ {
+ wxLogError(_T("Couldn't load image from '%s'."), filename.c_str());
+ return;
+ }
+
+ const long loadTime = sw.Time();
+
+ MyImageFrame * const
+ frame = new MyImageFrame(this, filename, wxBitmap(image));
+ frame->Show();
+ wxLogStatus(frame, "Loaded \"%s\" in %ldms", filename, loadTime);
+#else
+ wxLogError( _T("Couldn't create file selector dialog") );
+ return;
+#endif // wxUSE_FILEDLG
+}
+