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