Use new vnc syntax (with a colon).
[qemu-gui.git] / pipedprocess.h
blob89a1b193562cd43dadb0db1068fff65ee25ca1d5
1 #ifndef QEMU_GUI_PIPED_PROCESS_H
2 #define QEMU_GUI_PIPED_PROCESS_H
4 #include <wx/event.h>
5 #include <wx/process.h>
6 #include <wx/timer.h>
7 #include "events.h"
8 //#include <wx/wx.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
19 public:
20 PipedProcess();
21 ~PipedProcess();
23 /**
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);
29 /**
30 * sends the given string to the childs stdin
32 void SendString(const wxString& text);
34 /**
35 * checks whether the child process printed something to it's
36 * stdout and if so generates EVT_PROCESS_INPUT events
38 bool HasInput();
40 /**
41 * adds an event handler which will be notified if an event occurs
43 void AddEventHandler(wxEvtHandler *handler);
44 private:
45 /**
46 * gets called if the child process terminates, generates an
47 * EVT_PROCESS_TERMINATED event.
49 virtual void OnTerminate(int pid, int status);
51 /**
52 * gets called according to the interval passed to Launch()
53 * and checks if there is some input available by calling
54 * HasInput();
56 void OnTimer(wxTimerEvent& event);
57 void OnIdle(wxIdleEvent& event);
59 void SendEvent(wxCommandEvent& event);
61 bool running;
62 wxTimer timer;
63 EvtHandlerArray evtHandlers;
64 long pid;
65 DECLARE_EVENT_TABLE();
68 enum {
69 ID_QEMU_TIMER_POLL_PROCESS = 10002
72 #endif