+ wxDirDialog dialog(this, "Testing directory picker", dirHome);
+
+ if (dialog.ShowModal() == wxID_OK)
+ {
+ wxMessageDialog dialog2(this, dialog.GetPath(), "Selected path");
+ dialog2.ShowModal();
+ }
+}
+
+#if defined(__WXMSW__) || defined(__WXMAC__)
+
+void MyFrame::GenericDirChoose(wxCommandEvent& WXUNUSED(event) )
+{
+#if !defined(__WXMSW__) || defined(wxUSE_DIRDLGG) && wxUSE_DIRDLGG
+ // pass some initial dir to wxDirDialog
+ wxString dirHome;
+ wxGetHomeDir(&dirHome);
+
+ wxGenericDirDialog dialog(this, "Testing generic directory picker", dirHome);
+
+ if (dialog.ShowModal() == wxID_OK)
+ {
+ wxMessageDialog dialog2(this, dialog.GetPath(), "Selected path");
+ dialog2.ShowModal();
+ }
+#else
+ wxLogError(wxT("Sorry, generic dir dialog not available:\n")
+ wxT("set wxUSE_DIRDLGG to 1 and recompile"));
+#endif
+}
+
+#endif // wxMSW || wxMAC
+
+void MyFrame::ModalDlg(wxCommandEvent& WXUNUSED(event))
+{
+ MyModalDialog dlg(this);
+ dlg.ShowModal();
+}
+
+void MyFrame::ModelessDlg(wxCommandEvent& event)
+{
+ bool show = GetMenuBar()->IsChecked(event.GetId());
+
+ if ( show )
+ {
+ if ( !m_dialog )
+ {
+ m_dialog = new MyModelessDialog(this);
+ }
+
+ m_dialog->Show(TRUE);
+ }
+ else // hide
+ {
+ m_dialog->Hide();
+ }
+}
+
+void MyFrame::ShowTip(wxCommandEvent& event)
+{
+#if wxUSE_STARTUP_TIPS
+ static size_t s_index = (size_t)-1;
+
+ if ( s_index == (size_t)-1 )
+ {
+ srand(time(NULL));
+
+ // this is completely bogus, we don't know how many lines are there
+ // in the file, but who cares, it's a demo only...
+ s_index = rand() % 5;
+ }
+
+ wxTipProvider *tipProvider = wxCreateFileTipProvider("tips.txt", s_index);
+
+ bool showAtStartup = wxShowTip(this, tipProvider);
+
+ if ( showAtStartup )
+ {
+ wxMessageBox("Will show tips on startup", "Tips dialog",
+ wxOK | wxICON_INFORMATION, this);
+ }
+
+ s_index = tipProvider->GetCurrentTip();
+ delete tipProvider;