]> git.saurik.com Git - wxWidgets.git/blame - src/common/process.cpp
Now uses proper wxUSE_xxx flags
[wxWidgets.git] / src / common / process.cpp
CommitLineData
ca7731b7
GL
1/////////////////////////////////////////////////////////////////////////////
2// Name: process.cpp
3// Purpose: Process termination classes
4// Author: Guilhem Lavaux
7e84f02d 5// Modified by: Vadim Zeitlin to check error codes, added Detach() method
ca7731b7
GL
6// Created: 24/06/98
7// RCS-ID: $Id$
8// Copyright: (c) Guilhem Lavaux
7e84f02d 9// Licence: wxWindows license
ca7731b7
GL
10/////////////////////////////////////////////////////////////////////////////
11
12#ifdef __GNUG__
5336ece4 13 #pragma implementation "process.h"
ca7731b7
GL
14#endif
15
16// For compilers that support precompilation, includes "wx.h".
17#include "wx/wxprec.h"
18
19#ifdef __BORLANDC__
5336ece4 20 #pragma hdrstop
ca7731b7
GL
21#endif
22
23#ifndef WX_PRECOMP
5336ece4 24 #include "wx/defs.h"
ca7731b7
GL
25#endif
26
27#include "wx/process.h"
28
eebb848a
KB
29IMPLEMENT_DYNAMIC_CLASS(wxProcess, wxEvtHandler)
30IMPLEMENT_DYNAMIC_CLASS(wxProcessEvent, wxEvent)
ca7731b7
GL
31
32wxProcess::wxProcess(wxEvtHandler *parent, int id)
33{
7e84f02d
VZ
34 if (parent)
35 SetNextHandler(parent);
ca7731b7 36
7e84f02d 37 m_id = id;
ca7731b7
GL
38}
39
5336ece4 40void wxProcess::OnTerminate(int pid, int status)
81d66cf3 41{
7e84f02d 42 wxProcessEvent event(m_id, pid, status);
ca7731b7 43
7e84f02d
VZ
44 if ( !ProcessEvent(event) )
45 delete this;
46 //else: the object which processed the event is responsible for deleting
47 // us!
48}
49
50void wxProcess::Detach()
51{
52 SetNextHandler(NULL);
ca7731b7 53}