X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/2804f77d88eb478f85a281b19d87e38cd96e0d0c..66c2bf7b1d9326fb650acfaae22ec50528cfbf7c:/include/wx/unix/apptbase.h diff --git a/include/wx/unix/apptbase.h b/include/wx/unix/apptbase.h index 50f30040f8..6ce6f152c3 100644 --- a/include/wx/unix/apptbase.h +++ b/include/wx/unix/apptbase.h @@ -4,7 +4,6 @@ // Author: Vadim Zeitlin // Modified by: // Created: 23.06.2003 -// RCS-ID: $Id$ // Copyright: (c) 2003 Vadim Zeitlin // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -12,8 +11,12 @@ #ifndef _WX_UNIX_APPTBASE_H_ #define _WX_UNIX_APPTBASE_H_ -struct wxExecuteData; -class wxPipe; +#include "wx/evtloop.h" +#include "wx/evtloopsrc.h" + +class wxExecuteData; +class wxFDIOManager; +class wxEventLoopSourcesManagerBase; // ---------------------------------------------------------------------------- // wxAppTraits: the Unix version adds extra hooks needed by Unix code @@ -25,36 +28,39 @@ 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 + // Wait for the process termination and return its exit code or -1 on error. // - // 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; - + // Notice that this is only used when execData.flags contains wxEXEC_SYNC + // and does not contain wxEXEC_NOEVENTS, i.e. when we need to really wait + // until the child process exit and dispatch the events while doing it. + virtual int WaitForChild(wxExecuteData& execData); - // wxThread helpers - // ---------------- +#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 - // TODO +#if wxUSE_CONSOLE_EVENTLOOP + // Return a non-NULL pointer to the object responsible for managing the + // event loop sources in this kind of application. + virtual wxEventLoopSourcesManagerBase* GetEventLoopSourcesManager(); +#endif // wxUSE_CONSOLE_EVENTLOOP -#if wxUSE_SOCKETS - // returns the select()-based socket manager for console applications which - // is also used by some ports (wxX11, wxDFB) in the GUI build (hence it is - // here and not in wxConsoleAppTraits) - virtual GSocketManager *GetSocketManager(); -#endif +protected: + // Wait for the process termination by running the given event loop until + // this happens. + // + // This is used by the public WaitForChild() after creating the event loop + // of the appropriate kind. + int RunLoopUntilChildExit(wxExecuteData& execData, wxEventLoopBase& loop); }; #endif // _WX_UNIX_APPTBASE_H_