X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/73deed44e63d9d8d21a2ef6182bc685edc2bb0f9..72b4f026a20d35b2053df7764a63c88a0c108e08:/include/wx/utils.h diff --git a/include/wx/utils.h b/include/wx/utils.h index 854711fa9a..2b984a8d4c 100644 --- a/include/wx/utils.h +++ b/include/wx/utils.h @@ -148,17 +148,42 @@ WXDLLEXPORT wxString wxDecToHex(int dec); // Process management // ---------------------------------------------------------------------------- -// Execute another program. Returns 0 if there was an error, a PID otherwise. -WXDLLEXPORT long wxExecute(wxChar **argv, bool sync = FALSE, +// NB: for backwars compatibility reasons the values of wxEXEC_[A]SYNC *must* +// be 0 and 1, don't change! + +enum +{ + // execute the process asynchronously + wxEXEC_ASYNC = 0, + + // execute it synchronously, i.e. wait until it finishes + wxEXEC_SYNC = 1, + + // under Windows, don't hide the child even if it's IO is redirected (this + // is done by default) + wxEXEC_NOHIDE = 2, + + // under Unix, if the process is the group leader then killing -pid kills + // all children as well as pid + wxEXEC_MAKE_GROUP_LEADER = 4 +}; + +// Execute another program. +// +// If flags contain wxEXEC_SYNC, return -1 on failure and the exit code of the +// process if everything was ok. Otherwise (i.e. if wxEXEC_ASYNC), return 0 on +// failure and the PID of the launched process if ok. +WXDLLEXPORT long wxExecute(char **argv, int flags = wxEXEC_ASYNC, wxProcess *process = (wxProcess *) NULL); -WXDLLEXPORT long wxExecute(const wxString& command, bool sync = FALSE, +WXDLLEXPORT long wxExecute(const wxString& command, int flags = wxEXEC_ASYNC, wxProcess *process = (wxProcess *) NULL); -// execute the command capturing its output into an array line by line +// execute the command capturing its output into an array line by line, this is +// always synchronous WXDLLEXPORT long wxExecute(const wxString& command, wxArrayString& output); -// also capture stderr +// also capture stderr (also synchronous) WXDLLEXPORT long wxExecute(const wxString& command, wxArrayString& output, wxArrayString& error); @@ -195,6 +220,15 @@ enum wxKillError wxKILL_ERROR // another, unspecified error }; +enum wxShutdownFlags +{ + wxSHUTDOWN_POWEROFF, // power off the computer + wxSHUTDOWN_REBOOT // shutdown and reboot +}; + +// Shutdown or reboot the PC +WXDLLEXPORT bool wxShutdown(wxShutdownFlags wFlags); + // send the given signal to the process (only NONE and KILL are supported under // Windows, all others mean TERM), return 0 if ok and -1 on error // @@ -341,6 +375,8 @@ WXDLLEXPORT void wxFlushEvents(); // ctor and enables them back in its dtor class WXDLLEXPORT wxWindowDisabler { + DECLARE_NO_COPY_CLASS(wxWindowDisabler) + public: wxWindowDisabler(wxWindow *winToSkip = (wxWindow *)NULL); ~wxWindowDisabler();