+#if USE_FILEDLG_GENERIC
+void MyFrame::FileOpenGeneric(wxCommandEvent& WXUNUSED(event) )
+{
+ wxGenericFileDialog dialog
+ (
+ this,
+ _T("Testing open file dialog"),
+ wxEmptyString,
+ wxEmptyString,
+ _T("C++ files (*.cpp;*.h)|*.cpp;*.h")
+ );
+
+ dialog.SetDirectory(wxGetHomeDir());
+
+ if (dialog.ShowModal() == wxID_OK)
+ {
+ wxString info;
+ info.Printf(_T("Full file name: %s\n")
+ _T("Path: %s\n")
+ _T("Name: %s"),
+ dialog.GetPath().c_str(),
+ dialog.GetDirectory().c_str(),
+ dialog.GetFilename().c_str());
+ wxMessageDialog dialog2(this, info, _T("Selected file"));
+ dialog2.ShowModal();
+ }
+}
+
+void MyFrame::FilesOpenGeneric(wxCommandEvent& WXUNUSED(event) )
+{
+ wxString wildcards = _T("All files (*.*)|*.*|C++ files (*.cpp;*.h)|*.cpp;*.h");
+ wxGenericFileDialog dialog(this, _T("Testing open multiple file dialog"),
+ wxEmptyString, wxEmptyString, wildcards,
+ wxMULTIPLE);
+
+ if (dialog.ShowModal() == wxID_OK)
+ {
+ wxArrayString paths, filenames;
+
+ dialog.GetPaths(paths);
+ dialog.GetFilenames(filenames);
+
+ wxString msg, s;
+ size_t count = paths.GetCount();
+ for ( size_t n = 0; n < count; n++ )
+ {
+ s.Printf(_T("File %d: %s (%s)\n"),
+ (int)n, paths[n].c_str(), filenames[n].c_str());
+
+ msg += s;
+ }
+ s.Printf(_T("Filter index: %d"), dialog.GetFilterIndex());
+ msg += s;
+
+ wxMessageDialog dialog2(this, msg, _T("Selected files"));
+ dialog2.ShowModal();
+ }
+}
+
+void MyFrame::FileSaveGeneric(wxCommandEvent& WXUNUSED(event) )
+{
+ wxGenericFileDialog dialog(this,
+ _T("Testing save file dialog"),
+ wxEmptyString,
+ _T("myletter.doc"),
+ _T("Text files (*.txt)|*.txt|Document files (*.doc)|*.doc"),
+ wxSAVE|wxOVERWRITE_PROMPT);
+
+ dialog.SetFilterIndex(1);
+
+ if (dialog.ShowModal() == wxID_OK)
+ {
+ wxLogMessage(_T("%s, filter %d"),
+ dialog.GetPath().c_str(), dialog.GetFilterIndex());
+ }
+}
+#endif // USE_FILEDLG_GENERIC
+
+#if wxUSE_DIRDLG