]> git.saurik.com Git - wxWidgets.git/blob - docs/latex/wx/strtotxt.tex
added new and improved wxFileCtrl implementation (patch 1763164)
[wxWidgets.git] / docs / latex / wx / strtotxt.tex
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
14 This class can be used to (temporarily) redirect all output sent to a C++
15 ostream object to a \helpref{wxTextCtrl}{wxtextctrl} instead.
16
17 {\bf NB:} Some compilers and/or build configurations don't support multiply
18 inheriting \helpref{wxTextCtrl}{wxtextctrl} from {\tt std::streambuf} in which
19 case this class is not compiled in. You also must have {\tt wxUSE\_STD\_IOSTREAM}
20 option on (i.e. set to $1$) in your setup.h to be able to use it. Under Unix,
21 specify {\tt --enable-std\_iostreams} switch when running configure for this.
22
23 Example 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 somewhere else, presumably to stdout
38 cout << "Hello, console!" << endl;
39 \end{verbatim}
40 }%
41
42 \wxheading{Derived from}
43
44 No base class
45
46 \wxheading{Include files}
47
48 <wx/textctrl.h>
49
50 \wxheading{Library}
51
52 \helpref{wxCore}{librarieslist}
53
54 \wxheading{See also}
55
56 \helpref{wxTextCtrl}{wxtextctrl}
57
58 \latexignore{\rtfignore{\wxheading{Members}}}
59
60 \membersection{wxStreamToTextRedirector::wxStreamToTextRedirector}\label{wxstreamtotextredirectorctor}
61
62 \func{}{wxStreamToTextRedirector}{\param{wxTextCtrl }{*text}, \param{ostream *}{ostr = NULL}}
63
64 The constructor starts redirecting output sent to {\it ostr} or {\it cout} for
65 the default parameter value to the text control {\it text}.
66
67 \wxheading{Parameters}
68
69 \docparam{text}{The text control to append output too, must be non-NULL}
70
71 \docparam{ostr}{The C++ stream to redirect, {\it cout} is used if it is NULL}
72
73 \membersection{wxStreamToTextRedirector::\destruct{wxStreamToTextRedirector}}\label{wxstreamtotextredirectordtor}
74
75 \func{}{\destruct{wxStreamToTextRedirector}}{\void}
76
77 When a wxStreamToTextRedirector object is destroyed, the redirection is ended
78 and any output sent to the C++ ostream which had been specified at the time of
79 the object construction will go to its original destination.
80