2001-10-19 16:27:15 +00:00
|
|
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
|
|
%% Name: strtotxt.tex
|
|
|
|
%% Purpose: wxStreamToTextRedirector documentation
|
|
|
|
%% Author: Vadim Zeitlin
|
|
|
|
%% Modified by:
|
|
|
|
%% Created: 19.10.01
|
|
|
|
%% RCS-ID: $Id$
|
|
|
|
%% Copyright: (c) 2001 Vadim Zeitlin <vadim@wxwindows.org>
|
2005-02-22 15:09:56 +00:00
|
|
|
%% License: wxWindows license
|
2001-10-19 16:27:15 +00:00
|
|
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
|
|
|
|
|
|
\section{\class{wxStreamToTextRedirector}}\label{wxstreamtotextredirector}
|
|
|
|
|
|
|
|
This class can be used to (temporarily) redirect all output sent to a C++
|
|
|
|
ostream object to a \helpref{wxTextCtrl}{wxtextctrl} instead.
|
|
|
|
|
|
|
|
{\bf NB:} Some compilers and/or build configurations don't support multiply
|
|
|
|
inheriting \helpref{wxTextCtrl}{wxtextctrl} from {\tt std::streambuf} in which
|
|
|
|
case this class is not compiled in. You also must have {\tt wxUSE\_STD\_IOSTREAM}
|
|
|
|
option on (i.e. set to $1$) in your setup.h to be able to use it. Under Unix,
|
|
|
|
specify {\tt --enable-std\_iostreams} switch when running configure for this.
|
|
|
|
|
|
|
|
Example of usage:
|
|
|
|
{\small%
|
|
|
|
\begin{verbatim}
|
|
|
|
using namespace std;
|
|
|
|
|
|
|
|
wxTextCtrl *text = new wxTextCtrl(...);
|
|
|
|
|
|
|
|
{
|
|
|
|
wxStreamToTextRedirector redirect(text);
|
|
|
|
|
|
|
|
// this goes to the text control
|
|
|
|
cout << "Hello, text!" << endl;
|
|
|
|
}
|
|
|
|
|
2004-10-22 19:15:35 +00:00
|
|
|
// this goes somewhere else, presumably to stdout
|
2001-10-19 16:27:15 +00:00
|
|
|
cout << "Hello, console!" << endl;
|
|
|
|
\end{verbatim}
|
|
|
|
}%
|
|
|
|
|
|
|
|
\wxheading{Derived from}
|
|
|
|
|
|
|
|
No base class
|
|
|
|
|
|
|
|
\wxheading{Include files}
|
|
|
|
|
|
|
|
<wx/textctrl.h>
|
|
|
|
|
|
|
|
\wxheading{See also}
|
|
|
|
|
|
|
|
\helpref{wxTextCtrl}{wxtextctrl}
|
|
|
|
|
|
|
|
\latexignore{\rtfignore{\wxheading{Members}}}
|
|
|
|
|
|
|
|
\membersection{wxStreamToTextRedirector::wxStreamToTextRedirector}\label{wxstreamtotextredirectorctor}
|
|
|
|
|
2001-10-31 17:11:04 +00:00
|
|
|
\func{}{wxStreamToTextRedirector}{\param{wxTextCtrl }{*text}, \param{ostream *}{ostr = NULL}}
|
2001-10-19 16:27:15 +00:00
|
|
|
|
|
|
|
The constructor starts redirecting output sent to {\it ostr} or {\it cout} for
|
|
|
|
the default parameter value to the text control {\it text}.
|
|
|
|
|
|
|
|
\wxheading{Parameters}
|
|
|
|
|
2006-05-28 23:56:51 +00:00
|
|
|
\docparam{text}{The text control to append output too, must be non-NULL}
|
2001-10-19 16:27:15 +00:00
|
|
|
|
|
|
|
\docparam{ostr}{The C++ stream to redirect, {\it cout} is used if it is NULL}
|
|
|
|
|
2004-09-22 10:59:57 +00:00
|
|
|
\membersection{wxStreamToTextRedirector::\destruct{wxStreamToTextRedirector}}\label{wxstreamtotextredirectordtor}
|
2001-10-19 16:27:15 +00:00
|
|
|
|
|
|
|
\func{}{\destruct{wxStreamToTextRedirector}}{\void}
|
|
|
|
|
|
|
|
When a wxStreamToTextRedirector object is destroyed, the redirection is ended
|
|
|
|
and any output sent to the C++ ostream which had been specified at the time of
|
|
|
|
the object construction will go to its original destination.
|
|
|
|
|