wxWidgets/include/wx/unix/apptbase.h
Vadim Zeitlin 6bcc1145fe Cleanly separate GUI socket-related code from net library.
This fixes linking problems under Unix introduced by recent changes which
fixed previous problems which were due to files not being linked in at all.

In order to provide a clean separation between base, net and core libraries we
now use the same wxSocketManager (wxSocketFDBasedManager), defined in net
library for both console and GUI Unix applications and just use different FD
IO manager for them: the latter can be defined in base and core libraries as
it doesn't involve wxSocketImpl at all, only its base wxFDIOHandler class.

At more detailed level, these changes required:
 1. Adding the new wxFDIOManager class.
 2. Refactoring the old (and now removed) wxSocketFDIOManager to use the same
    code as wxSocketFDIOManager. This involved:
  a) Adding handler and direction parameter to RemoveInput().
  b) Storing the mask of registered events in wxFDIOHandler itself.
  c) Defining wxFDIOManagerUnix which works with wxFDIODispatcher.
 3. Changing the traits classes in Unix ports to define GetFDIOManager()
    instead of GetSocketManager().

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@61688 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-08-17 23:02:46 +00:00

68 lines
2.6 KiB
C++

///////////////////////////////////////////////////////////////////////////////
// Name: wx/unix/apptbase.h
// Purpose: declaration of wxAppTraits for Unix systems
// Author: Vadim Zeitlin
// Modified by:
// Created: 23.06.2003
// RCS-ID: $Id$
// Copyright: (c) 2003 Vadim Zeitlin <vadim@wxwidgets.org>
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
#ifndef _WX_UNIX_APPTBASE_H_
#define _WX_UNIX_APPTBASE_H_
struct wxEndProcessData;
struct wxExecuteData;
class wxFDIOManager;
// ----------------------------------------------------------------------------
// wxAppTraits: the Unix version adds extra hooks needed by Unix code
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_BASE wxAppTraits : public wxAppTraitsBase
{
public:
// wxExecute() support methods
// ---------------------------
// wait for the process termination, return whatever wxExecute() must
// return
//
// 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_