1 #ifndef QEMU_GUI_PIPED_PROCESS_H
2 #define QEMU_GUI_PIPED_PROCESS_H
5 #include <wx/process.h>
9 //#include <wx/txtstrm.h>
11 DECLARE_EVENT_TYPE(EVT_PROCESS_INPUT
,wxID_ANY
)
12 DECLARE_EVENT_TYPE(EVT_PROCESS_OUTPUT
,wxID_ANY
)
13 DECLARE_EVENT_TYPE(EVT_PROCESS_CREATED
,wxID_ANY
)
14 DECLARE_EVENT_TYPE(EVT_PROCESS_TERMINATED
,wxID_ANY
)
15 //WX_DEFINE_ARRAY_PTR(wxEvtHandler *,EvtHandlerArray);
17 class PipedProcess
: public wxProcess
24 * runs the passed command, and checks for input in the given
25 * interval. returns the pid or 0 if an error occured.
27 long Launch(const wxString
& cmd
,unsigned int interval
= 100);
30 * sends the given string to the childs stdin
32 void SendString(const wxString
& text
);
35 * checks whether the child process printed something to it's
36 * stdout and if so generates EVT_PROCESS_INPUT events
41 * adds an event handler which will be notified if an event occurs
43 void AddEventHandler(wxEvtHandler
*handler
);
46 * gets called if the child process terminates, generates an
47 * EVT_PROCESS_TERMINATED event.
49 virtual void OnTerminate(int pid
, int status
);
52 * gets called according to the interval passed to Launch()
53 * and checks if there is some input available by calling
56 void OnTimer(wxTimerEvent
& event
);
57 void OnIdle(wxIdleEvent
& event
);
59 void SendEvent(wxCommandEvent
& event
);
63 EvtHandlerArray evtHandlers
;
65 DECLARE_EVENT_TABLE();
69 ID_QEMU_TIMER_POLL_PROCESS
= 10002