+#if wxUSE_BUSYINFO
+
+void MyFrame::ShowBusyInfo(wxCommandEvent& WXUNUSED(event))
+{
+ wxWindowDisabler disableAll;
+
+ wxBusyInfo info(_T("Working, please wait..."), this);
+
+ for ( int i = 0; i < 18; i++ )
+ {
+ //wxUsleep(100);
+ wxTheApp->Yield();
+ }
+
+ wxSleep(2);
+ //wxWakeUpIdle();
+}
+
+#endif // wxUSE_BUSYINFO
+
+#if wxUSE_FINDREPLDLG
+
+void MyFrame::ShowReplaceDialog( wxCommandEvent& WXUNUSED(event) )
+{
+ if ( m_dlgReplace )
+ {
+ delete m_dlgReplace;
+ m_dlgReplace = NULL;
+ }
+ else
+ {
+ m_dlgReplace = new wxFindReplaceDialog
+ (
+ this,
+ &m_findData,
+ _T("Find and replace dialog"),
+ wxFR_REPLACEDIALOG
+ );
+
+ m_dlgReplace->Show(true);
+ }
+}
+
+void MyFrame::ShowFindDialog( wxCommandEvent& WXUNUSED(event) )
+{
+ if ( m_dlgFind )
+ {
+ delete m_dlgFind;
+ m_dlgFind = NULL;
+ }
+ else
+ {
+ m_dlgFind = new wxFindReplaceDialog
+ (
+ this,
+ &m_findData,
+ _T("Find dialog"),
+ // just for testing
+ wxFR_NOWHOLEWORD
+ );
+
+ m_dlgFind->Show(true);
+ }
+}
+
+static wxString DecodeFindDialogEventFlags(int flags)
+{
+ wxString str;
+ str << (flags & wxFR_DOWN ? _T("down") : _T("up")) << _T(", ")
+ << (flags & wxFR_WHOLEWORD ? _T("whole words only, ") : _T(""))
+ << (flags & wxFR_MATCHCASE ? _T("") : _T("not "))
+ << _T("case sensitive");
+
+ return str;
+}
+
+void MyFrame::OnFindDialog(wxFindDialogEvent& event)
+{
+ wxEventType type = event.GetEventType();
+
+ if ( type == wxEVT_COMMAND_FIND || type == wxEVT_COMMAND_FIND_NEXT )
+ {
+ wxLogMessage(wxT("Find %s'%s' (flags: %s)"),
+ type == wxEVT_COMMAND_FIND_NEXT ? wxT("next ") : wxT(""),
+ event.GetFindString().c_str(),
+ DecodeFindDialogEventFlags(event.GetFlags()).c_str());
+ }
+ else if ( type == wxEVT_COMMAND_FIND_REPLACE ||
+ type == wxEVT_COMMAND_FIND_REPLACE_ALL )
+ {
+ wxLogMessage(wxT("Replace %s'%s' with '%s' (flags: %s)"),
+ type == wxEVT_COMMAND_FIND_REPLACE_ALL ? _T("all ") : wxT(""),
+ event.GetFindString().c_str(),
+ event.GetReplaceString().c_str(),
+ DecodeFindDialogEventFlags(event.GetFlags()).c_str());
+ }
+ else if ( type == wxEVT_COMMAND_FIND_CLOSE )
+ {
+ wxFindReplaceDialog *dlg = event.GetDialog();
+
+ int idMenu;
+ const wxChar *txt;
+ if ( dlg == m_dlgFind )
+ {
+ txt = _T("Find");
+ idMenu = DIALOGS_FIND;
+ m_dlgFind = NULL;
+ }
+ else if ( dlg == m_dlgReplace )
+ {
+ txt = _T("Replace");
+ idMenu = DIALOGS_REPLACE;
+ m_dlgReplace = NULL;
+ }
+ else
+ {
+ txt = _T("Unknown");
+ idMenu = wxID_ANY;
+
+ wxFAIL_MSG( _T("unexpected event") );
+ }
+
+ wxLogMessage(wxT("%s dialog is being closed."), txt);
+
+ if ( idMenu != wxID_ANY )
+ {
+ GetMenuBar()->Check(idMenu, false);
+ }
+
+ dlg->Destroy();
+ }
+ else
+ {
+ wxLogError(wxT("Unknown find dialog event!"));
+ }
+}
+
+#endif // wxUSE_FINDREPLDLG
+