]> git.saurik.com Git - wxWidgets.git/blame - include/wx/process.h
Corrected some more docs,
[wxWidgets.git] / include / wx / process.h
CommitLineData
cf447356
GL
1/////////////////////////////////////////////////////////////////////////////
2// Name: process.h
3// Purpose: wxProcess class
4// Author: Guilhem Lavaux
7e84f02d 5// Modified by: Vadim Zeitlin to check error codes, added Detach() method
cf447356
GL
6// Created: 24/06/98
7// RCS-ID: $Id$
8// Copyright: (c) 1998 Guilhem Lavaux
7e84f02d 9// Licence: wxWindows license
cf447356
GL
10/////////////////////////////////////////////////////////////////////////////
11
34138703
JS
12#ifndef _WX_PROCESSH__
13#define _WX_PROCESSH__
cf447356
GL
14
15#ifdef __GNUG__
5336ece4 16 #pragma interface "process.h"
cf447356
GL
17#endif
18
19#include "wx/defs.h"
20#include "wx/object.h"
21#include "wx/event.h"
22
5336ece4
VZ
23// Process Event handling
24class WXDLLEXPORT wxProcessEvent : public wxEvent
cf447356 25{
5336ece4 26DECLARE_DYNAMIC_CLASS(wxProcessEvent)
cf447356 27
5336ece4
VZ
28public:
29 wxProcessEvent(int id = 0, int pid = 0, int exitcode = 0) : wxEvent(id)
30 {
31 m_eventType = wxEVT_END_PROCESS;
32 m_pid = pid;
33 m_exitcode = exitcode;
34 }
cf447356 35
5336ece4
VZ
36 // accessors
37 // PID of process which terminated
38 int GetPid() { return m_pid; }
cf447356 39
5336ece4
VZ
40 // the exit code
41 int GetExitCode() { return m_exitcode; }
cf447356 42
5336ece4
VZ
43public:
44 int m_pid, m_exitcode;
45};
cf447356 46
5336ece4
VZ
47// A wxProcess object should be passed to wxExecute - than its OnTerminate()
48// function will be called when the process terminates.
49class WXDLLEXPORT wxProcess : public wxEvtHandler
cf447356 50{
5336ece4
VZ
51DECLARE_DYNAMIC_CLASS(wxProcess)
52
53public:
54 wxProcess(wxEvtHandler *parent = (wxEvtHandler *) NULL, int id = -1);
cf447356 55
5336ece4 56 virtual void OnTerminate(int pid, int status);
cf447356 57
7e84f02d
VZ
58 // detach from the parent - should be called by the parent if it's deleted
59 // before the process it started terminates
60 void Detach();
61
5336ece4
VZ
62protected:
63 int m_id;
cf447356
GL
64};
65
66typedef void (wxObject::*wxProcessEventFunction)(wxProcessEvent&);
67
5336ece4 68#define EVT_END_PROCESS(id, func) { wxEVT_END_PROCESS, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxProcessEventFunction) & func, NULL},
cf447356
GL
69
70#endif
34138703 71 // _WX_PROCESSH__