]> git.saurik.com Git - wxWidgets.git/blame - docs/latex/wx/strtotxt.tex
ugh. Nesting the (per class) plugin sentries can require them to
[wxWidgets.git] / docs / latex / wx / strtotxt.tex
CommitLineData
d73e6791
VZ
1%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2%% Name: strtotxt.tex
3%% Purpose: wxStreamToTextRedirector documentation
4%% Author: Vadim Zeitlin
5%% Modified by:
6%% Created: 19.10.01
7%% RCS-ID: $Id$
8%% Copyright: (c) 2001 Vadim Zeitlin <vadim@wxwindows.org>
9%% License: wxWindows license
10%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11
12\section{\class{wxStreamToTextRedirector}}\label{wxstreamtotextredirector}
13
14This class can be used to (temporarily) redirect all output sent to a C++
15ostream object to a \helpref{wxTextCtrl}{wxtextctrl} instead.
16
17{\bf NB:} Some compilers and/or build configurations don't support multiply
18inheriting \helpref{wxTextCtrl}{wxtextctrl} from {\tt std::streambuf} in which
19case this class is not compiled in. You also must have {\tt wxUSE\_STD\_IOSTREAM}
20option on (i.e. set to $1$) in your setup.h to be able to use it. Under Unix,
21specify {\tt --enable-std\_iostreams} switch when running configure for this.
22
23Example of usage:
24{\small%
25\begin{verbatim}
26 using namespace std;
27
28 wxTextCtrl *text = new wxTextCtrl(...);
29
30 {
31 wxStreamToTextRedirector redirect(text);
32
33 // this goes to the text control
34 cout << "Hello, text!" << endl;
35 }
36
37 // this goes soemwhere else, presumably to stdout
38 cout << "Hello, console!" << endl;
39\end{verbatim}
40}%
41
42\wxheading{Derived from}
43
44No base class
45
46\wxheading{Include files}
47
48<wx/textctrl.h>
49
50\wxheading{See also}
51
52\helpref{wxTextCtrl}{wxtextctrl}
53
54\latexignore{\rtfignore{\wxheading{Members}}}
55
56\membersection{wxStreamToTextRedirector::wxStreamToTextRedirector}\label{wxstreamtotextredirectorctor}
57
051443d4 58\func{}{wxStreamToTextRedirector}{\param{wxTextCtrl }{*text}, \param{ostream *}{ostr = NULL}}
d73e6791
VZ
59
60The constructor starts redirecting output sent to {\it ostr} or {\it cout} for
61the default parameter value to the text control {\it text}.
62
63\wxheading{Parameters}
64
65\docparam{text}{The text control to append output too, must be non NULL}
66
67\docparam{ostr}{The C++ stream to redirect, {\it cout} is used if it is NULL}
68
69\membersection{wxStreamToTextRedirector::\destruct{wxStreamToTextRedirector}}
70
71\func{}{\destruct{wxStreamToTextRedirector}}{\void}
72
73When a wxStreamToTextRedirector object is destroyed, the redirection is ended
74and any output sent to the C++ ostream which had been specified at the time of
75the object construction will go to its original destination.
76