\input point.tex
\input prevwin.tex
\input print.tex
+\input process.tex
\input postscpt.tex
\input query.tex
\input radiobox.tex
\membersection{::wxExecute}\label{wxexecute}
-\func{long}{wxExecute}{\param{const wxString\& }{command}, \param{bool }{sync = FALSE}}
+\func{long}{wxExecute}{\param{const wxString\& }{command}, \param{bool }{sync = FALSE}, \param{wxProcess *}{callback = NULL}}
-\func{long}{wxExecute}{\param{const wxString\& *}{argv}, \param{bool }{sync = FALSE}}
+\func{long}{wxExecute}{\param{const wxString\& *}{argv}, \param{bool }{sync = FALSE}, \param{wxProcess *}{callback = NULL}}
Executes another program in UNIX or Windows.
otherwise it is a status value. A zero value indicates that the command could not
be executed.
-See also \helpref{wxShell}{wxshell}.
+If callback isn't NULL and if execution is asynchronous,
+\helpref{wxProcess::OnTerminate}{wxprocessonterminate} will be called when
+the process finishes.
+
+See also \helpref{wxShell}{wxshell}, \helpref{wxProcess}{wxprocess}.
\membersection{::wxExit}\label{wxexit}
--- /dev/null
+\section{\class{wxProcess}}\label{wxprocess}
+
+This class contains a method which is invoked when a process finishes.
+It can raise a \helpref{wxProcessEvent}{wxprocessevent} if wxProcess::OnTerminate
+isn't overriden.
+
+\wxheading{Derived from}
+
+\helpref{wxEvtHandler}{wxevthandler}
+
+\latexignore{\rtfignore{\wxheading{Members}}}
+
+\membersection{wxProcess::wxProcess}\label{wxprocessconstr}
+
+\func{}{wxProcess}{\param{wxEvtHandler *}{ parent = NULL}, \param{int}{ id = -1}}
+
+Constructs a process object. {\it id} is only used in the case you want to
+use wxWindows events.
+
+\wxheading{Parameters}
+
+\docparam{parent}{The event handler parent.}
+
+\docparam{id}{id of an event.}
+
+\membersection{wxProcess::\destruct{wxProcess}}
+
+\func{}{\destruct{wxProcess}}{\void}
+
+Destroys the wxProcess object.
+
+\membersection{wxProcess::OnTerminate}\label{wxprocessonterminate}
+
+\constfunc{void}{OnTerminate}{\param{int}{ pid}}
+
+It is called when the process with the pid {\it pid} finishes.
+It raises a wxWindows event when it isn't overriden.
+
+\docparam{pid}{The pid of the process which ends.}
unsigned char Read8();
double ReadDouble();
wxString ReadLine();
+ wxString ReadString();
void Write32(unsigned long i);
void Write16(unsigned short i);
void Write8(unsigned char i);
void WriteDouble(double d);
void WriteLine(const wxString& line);
+ void WriteString(const wxString& string);
protected:
istream *m_istream;
ostream *m_ostream;
return i_strg;
}
+wxString wxDataStream::ReadString()
+{
+ wxString wx_string;
+ char *string;
+ unsigned long len;
+
+ if (!m_istream)
+ return "";
+
+ len = Read32();
+ string = new char[len+1];
+
+ m_istream->read(string, len);
+
+ string[len] = 0;
+ wx_string = string;
+ delete string;
+
+ return wx_string;
+}
+
void wxDataStream::Write32(unsigned long i)
{
char buf[4];
void wxDataStream::WriteLine(const wxString& line)
{
+#ifdef __WINDOWS__
+ wxString tmp_string = line + "\r\n";
+#else
wxString tmp_string = line + '\n';
+#endif
+
+ if (!m_ostream)
+ return;
+ m_ostream->write((const char *) tmp_string, tmp_string.Length());
+}
+
+void wxDataStream::WriteString(const wxString& string)
+{
if (!m_ostream)
return;
+ Write32(tmp_string.Length());
m_ostream->write((const char *) tmp_string, tmp_string.Length());
}
proc_data->pid = 0;
};
-long wxExecute( char **argv, bool Async, wxProcess *process )
+long wxExecute( char **argv, bool sync, wxProcess *process )
{
wxEndProcessData *data = new wxEndProcessData;
int end_proc_detect[2];
data->tag = gdk_input_add(end_proc_detect[0], GDK_INPUT_READ,
GTK_EndProcessDetector, (gpointer)data);
data->pid = pid;
- if (Async) {
+ if (!sync) {
data->process = process;
} else {
data->process = NULL;
return pid;
};
-long wxExecute( const wxString& command, bool Async, wxProcess *process )
+long wxExecute( const wxString& command, bool sync, wxProcess *process )
{
if (command.IsNull() || command == "") return FALSE;
argv[argc++] = strtok (tmp, IFS);
while ((argv[argc++] = strtok(NULL, IFS)) != NULL)
/* loop */ ;
- return wxExecute(argv, Async, process);
+ return wxExecute(argv, sync, process);
};
proc_data->pid = 0;
};
-long wxExecute( char **argv, bool Async, wxProcess *process )
+long wxExecute( char **argv, bool sync, wxProcess *process )
{
wxEndProcessData *data = new wxEndProcessData;
int end_proc_detect[2];
data->tag = gdk_input_add(end_proc_detect[0], GDK_INPUT_READ,
GTK_EndProcessDetector, (gpointer)data);
data->pid = pid;
- if (Async) {
+ if (!sync) {
data->process = process;
} else {
data->process = NULL;
return pid;
};
-long wxExecute( const wxString& command, bool Async, wxProcess *process )
+long wxExecute( const wxString& command, bool sync, wxProcess *process )
{
if (command.IsNull() || command == "") return FALSE;
argv[argc++] = strtok (tmp, IFS);
while ((argv[argc++] = strtok(NULL, IFS)) != NULL)
/* loop */ ;
- return wxExecute(argv, Async, process);
+ return wxExecute(argv, sync, process);
};