X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/9b6b9e0c9cb36b6a7c6f3fb556eaf762e96877cf..76f1eb7e1f6be1d53c81fd3fa6ebb6f9c9b689b7:/samples/exec/exec.cpp?ds=inline diff --git a/samples/exec/exec.cpp b/samples/exec/exec.cpp index 1d334c8d3d..19d2dba153 100644 --- a/samples/exec/exec.cpp +++ b/samples/exec/exec.cpp @@ -97,6 +97,9 @@ public: void OnClear(wxCommandEvent& event); + void OnBeginBusyCursor(wxCommandEvent& event); + void OnEndBusyCursor(wxCommandEvent& event); + void OnSyncExec(wxCommandEvent& event); void OnSyncNoEventsExec(wxCommandEvent& event); void OnAsyncExec(wxCommandEvent& event); @@ -300,6 +303,8 @@ enum Exec_Quit = 100, Exec_Kill, Exec_ClearLog, + Exec_BeginBusyCursor, + Exec_EndBusyCursor, Exec_SyncExec = 200, Exec_SyncNoEventsExec, Exec_AsyncExec, @@ -333,6 +338,8 @@ BEGIN_EVENT_TABLE(MyFrame, wxFrame) EVT_MENU(Exec_Quit, MyFrame::OnQuit) EVT_MENU(Exec_Kill, MyFrame::OnKill) EVT_MENU(Exec_ClearLog, MyFrame::OnClear) + EVT_MENU(Exec_BeginBusyCursor, MyFrame::OnBeginBusyCursor) + EVT_MENU(Exec_EndBusyCursor, MyFrame::OnEndBusyCursor) EVT_MENU(Exec_SyncExec, MyFrame::OnSyncExec) EVT_MENU(Exec_SyncNoEventsExec, MyFrame::OnSyncNoEventsExec) @@ -432,9 +439,12 @@ MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size) menuFile->Append(Exec_Kill, _T("&Kill process...\tCtrl-K"), _T("Kill a process by PID")); menuFile->AppendSeparator(); - menuFile->Append(Exec_ClearLog, _T("&Clear log\tCtrl-C"), + menuFile->Append(Exec_ClearLog, _T("&Clear log\tCtrl-L"), _T("Clear the log window")); menuFile->AppendSeparator(); + menuFile->Append(Exec_BeginBusyCursor, _T("Show &busy cursor\tCtrl-C")); + menuFile->Append(Exec_EndBusyCursor, _T("Show &normal cursor\tShift-Ctrl-C")); + menuFile->AppendSeparator(); menuFile->Append(Exec_Quit, _T("E&xit\tAlt-X"), _T("Quit this program")); wxMenu *execMenu = new wxMenu; @@ -506,6 +516,16 @@ void MyFrame::OnClear(wxCommandEvent& WXUNUSED(event)) m_lbox->Clear(); } +void MyFrame::OnBeginBusyCursor(wxCommandEvent& WXUNUSED(event)) +{ + wxBeginBusyCursor(); +} + +void MyFrame::OnEndBusyCursor(wxCommandEvent& WXUNUSED(event)) +{ + wxEndBusyCursor(); +} + void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event)) { wxMessageBox(_T("Exec wxWidgets Sample\n(c) 2000-2002 Vadim Zeitlin"), @@ -727,9 +747,12 @@ void MyFrame::OnExecWithRedirect(wxCommandEvent& WXUNUSED(event)) if ( sync ) { + wxLogStatus( _T("'%s' is running please wait..."), cmd.c_str() ); + wxArrayString output, errors; int code = wxExecute(cmd, output, errors); - wxLogStatus(_T("command '%s' terminated with exit code %d."), + + wxLogStatus(_T("Command '%s' terminated with exit code %d."), cmd.c_str(), code); if ( code != -1 ) @@ -833,7 +856,7 @@ void MyFrame::OnFileExec(wxCommandEvent& WXUNUSED(event)) wxString filename; #if wxUSE_FILEDLG - filename = wxLoadFileSelector(_T("any file"), NULL, s_filename, this); + filename = wxLoadFileSelector(_T("any file"), wxEmptyString, s_filename, this); #else // !wxUSE_FILEDLG filename = wxGetTextFromUser(_T("Enter the file name"), _T("exec sample"), s_filename, this); @@ -869,7 +892,7 @@ void MyFrame::OnFileExec(wxCommandEvent& WXUNUSED(event)) void MyFrame::OnOpenURL(wxCommandEvent& WXUNUSED(event)) { - static wxString s_filename; + static wxString s_filename(_T("http://www.wxwidgets.org/")); wxString filename = wxGetTextFromUser (