X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/e2478fde622a16d25c66690af353dfdc37e7b582..2a45803fc3877afd0ae3ce356dfe216505165882:/include/wx/unix/apptbase.h diff --git a/include/wx/unix/apptbase.h b/include/wx/unix/apptbase.h index 3832761d13..8bf6b4cb97 100644 --- a/include/wx/unix/apptbase.h +++ b/include/wx/unix/apptbase.h @@ -5,58 +5,62 @@ // Modified by: // Created: 23.06.2003 // RCS-ID: $Id$ -// Copyright: (c) 2003 Vadim Zeitlin +// Copyright: (c) 2003 Vadim Zeitlin // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// #ifndef _WX_UNIX_APPTBASE_H_ #define _WX_UNIX_APPTBASE_H_ -class wxExecuteData; -class wxPipe; +struct wxEndProcessData; +struct wxExecuteData; +class wxFDIOManager; // ---------------------------------------------------------------------------- // wxAppTraits: the Unix version adds extra hooks needed by Unix code // ---------------------------------------------------------------------------- -class WXDLLEXPORT wxAppTraits : public wxAppTraitsBase +class WXDLLIMPEXP_BASE wxAppTraits : public wxAppTraitsBase { public: // wxExecute() support methods // --------------------------- - // called before starting the child process and creates the pipe used for - // detecting the process termination asynchronously in GUI, does nothing in - // wxBase - // - // if it returns false, we should return from wxExecute() with an error - virtual bool CreateEndProcessPipe(wxExecuteData& execData) = 0; - - // test if the given descriptor is the end of the pipe create by the - // function above - virtual bool IsWriteFDOfEndProcessPipe(wxExecuteData& execData, int fd) = 0; - - // ensure that the write end of the pipe is not closed by wxPipe dtor - virtual void DetachWriteFDOfEndProcessPipe(wxExecuteData& execData) = 0; - // wait for the process termination, return whatever wxExecute() must // return - virtual int WaitForChild(wxExecuteData& execData) = 0; - - - // wxThread helpers - // ---------------- - - // TODO - - - // other miscellaneous helpers - // --------------------------- - - // wxGetOsVersion() behaves differently in GUI and non-GUI builds udner - // Unix: in the former case it returns the information about the toolkit - // and in the latter -- about the OS, so we need to virtualize it - virtual int GetOSVersion(int *verMaj, int *verMin) = 0; + // + // base class implementation handles all cases except wxEXEC_SYNC without + // wxEXEC_NOEVENTS one which is implemented at the GUI level + virtual int WaitForChild(wxExecuteData& execData); + + // integrate the monitoring of the given fd with the port-specific event + // loop: when this fd, which corresponds to a dummy pipe opened between the + // parent and child processes, is closed by the child, the parent is + // notified about this via a call to wxHandleProcessTermination() function + // + // the default implementation uses wxFDIODispatcher and so is suitable for + // the console applications or ports which don't have any specific event + // loop + virtual int AddProcessCallback(wxEndProcessData *data, int fd); + +#if wxUSE_SOCKETS + // return a pointer to the object which should be used to integrate + // monitoring of the file descriptors to the event loop (currently this is + // used for the sockets only but should be used for arbitrary event loop + // sources in the future) + // + // this object may be different for the console and GUI applications + // + // the pointer is not deleted by the caller as normally it points to a + // static variable + virtual wxFDIOManager *GetFDIOManager(); +#endif // wxUSE_SOCKETS + +protected: + // a helper for the implementation of WaitForChild() in wxGUIAppTraits: + // checks the streams used for redirected IO in execData and returns true + // if there is any activity in them + bool CheckForRedirectedIO(wxExecuteData& execData); }; #endif // _WX_UNIX_APPTBASE_H_