]>
Commit | Line | Data |
---|---|---|
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: wxWidgets 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 soemwhere 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{See also} | |
51 | ||
52 | \helpref{wxTextCtrl}{wxtextctrl} | |
53 | ||
54 | \latexignore{\rtfignore{\wxheading{Members}}} | |
55 | ||
56 | \membersection{wxStreamToTextRedirector::wxStreamToTextRedirector}\label{wxstreamtotextredirectorctor} | |
57 | ||
58 | \func{}{wxStreamToTextRedirector}{\param{wxTextCtrl }{*text}, \param{ostream *}{ostr = NULL}} | |
59 | ||
60 | The constructor starts redirecting output sent to {\it ostr} or {\it cout} for | |
61 | the 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 | ||
73 | When a wxStreamToTextRedirector object is destroyed, the redirection is ended | |
74 | and any output sent to the C++ ostream which had been specified at the time of | |
75 | the object construction will go to its original destination. | |
76 |