]> git.saurik.com Git - wxWidgets.git/blob - docs/latex/wx/htwindow.tex
implemented EVT_LIST_CACHE_HINT support: send this message from OnPaint() now
[wxWidgets.git] / docs / latex / wx / htwindow.tex
1 %
2 % automatically generated by HelpGen from
3 % htmlwindow.tex at 14/Mar/99 20:13:37
4 %
5
6 \section{\class{wxHtmlWindow}}\label{wxhtmlwindow}
7
8 wxHtmlWindow is probably the only class you will directly use
9 unless you want to do something special (like adding new tag
10 handlers or MIME filters).
11
12 The purpose of this class is to display HTML pages (either local
13 file or downloaded via HTTP protocol) in a window. The width
14 of the window is constant - given in the constructor - and virtual height
15 is changed dynamically depending on page size.
16 Once the window is created you can set its content by calling
17 \helpref{SetPage(text)}{wxhtmlwindowsetpage} or
18 \helpref{LoadPage(filename)}{wxhtmlwindowloadpage}.
19
20 \wxheading{Derived from}
21
22 \helpref{wxScrolledWindow}{wxscrolledwindow}
23
24 \wxheading{Include files}
25
26 <wx/html/htmlwin.h>
27
28 \membersection{wxHtmlWindow::wxHtmlWindow}\label{wxhtmlwindowwxhtmlwindow}
29
30 \func{}{wxHtmlWindow}{\void}
31
32 Default constructor.
33
34 \func{}{wxHtmlWindow}{\param{wxWindow }{*parent}, \param{wxWindowID }{id = -1}, \param{const wxPoint\& }{pos = wxDefaultPosition}, \param{const wxSize\& }{size = wxDefaultSize}, \param{long }{style = wxHW\_SCROLLBAR\_AUTO}, \param{const wxString\& }{name = "htmlWindow"}}
35
36 Constructor. The parameters are the same as for the \helpref{wxScrolledWindow}{wxscrolledwindow} constructor.
37
38 \wxheading{Parameters}
39
40 \docparam{style}{wxHW\_SCROLLBAR\_NEVER, or wxHW\_SCROLLBAR\_AUTO.
41 Affects the appearance of vertical scrollbar in the window.}
42
43 \membersection{wxHtmlWindow::AddFilter}\label{wxhtmlwindowaddfilter}
44
45 \func{static void}{AddFilter}{\param{wxHtmlFilter }{*filter}}
46
47 Adds \helpref{input filter}{filters} to the static list of available
48 filters. These filters are present by default:
49
50 \begin{itemize}\itemsep=0pt
51 \item {\tt text/html} MIME type
52 \item {\tt image/*} MIME types
53 \item Plain Text filter (this filter is used if no other filter matches)
54 \end{itemize}
55
56 \membersection{wxHtmlWindow::GetInternalRepresentation}\label{wxhtmlwindowgetinternalrepresentation}
57
58 \constfunc{wxHtmlContainerCell*}{GetInternalRepresentation}{\void}
59
60 Returns pointer to the top-level container.
61
62 See also: \helpref{Cells Overview}{cells},
63 \helpref{Printing Overview}{printing}
64
65 \membersection{wxHtmlWindow::GetOpenedAnchor}\label{wxhtmlwindowgetopenedanchor}
66
67 \func{wxString}{GetOpenedAnchor}{\void}
68
69 Returns anchor within currently opened page
70 (see \helpref{GetOpenedPage}{wxhtmlwindowgetopenedpage}).
71 If no page is opened or if the displayed page wasn't
72 produced by call to LoadPage, empty string is returned.
73
74
75 \membersection{wxHtmlWindow::GetOpenedPage}\label{wxhtmlwindowgetopenedpage}
76
77 \func{wxString}{GetOpenedPage}{\void}
78
79 Returns full location of the opened page. If no page is opened or if the displayed page wasn't
80 produced by call to LoadPage, empty string is returned.
81
82 \membersection{wxHtmlWindow::GetOpenedPageTitle}\label{wxhtmlwindowgetopenedpagetitle}
83
84 \func{wxString}{GetOpenedPageTitle}{\void}
85
86 Returns title of the opened page or wxEmptyString if current page does not contain {\tt <TITLE>} tag.
87
88 \membersection{wxHtmlWindow::GetRelatedFrame}\label{wxhtmlwindowgetrelatedframe}
89
90 \constfunc{wxFrame*}{GetRelatedFrame}{\void}
91
92 Returns the related frame.
93
94 \membersection{wxHtmlWindow::HistoryBack}\label{wxhtmlwindowhistoryback}
95
96 \func{bool}{HistoryBack}{\void}
97
98 Moves back to the previous page. (each page displayed using
99 \helpref{LoadPage}{wxhtmlwindowloadpage} is stored in history list.)
100
101 \membersection{wxHtmlWindow::HistoryCanBack}\label{wxhtmlwindowhistorycanback}
102
103 \func{bool}{HistoryCanBack}{\void}
104
105 Returns true if it is possible to go back in the history (i.e. HistoryBack()
106 won't fail).
107
108 \membersection{wxHtmlWindow::HistoryCanForward}\label{wxhtmlwindowhistorycanforward}
109
110 \func{bool}{HistoryCanForward}{\void}
111
112 Returns true if it is possible to go forward in the history (i.e. HistoryBack()
113 won't fail).
114
115
116 \membersection{wxHtmlWindow::HistoryClear}\label{wxhtmlwindowhistoryclear}
117
118 \func{void}{HistoryClear}{\void}
119
120 Clears history.
121
122 \membersection{wxHtmlWindow::HistoryForward}\label{wxhtmlwindowhistoryforward}
123
124 \func{bool}{HistoryForward}{\void}
125
126 Moves to next page in history.
127
128 \membersection{wxHtmlWindow::LoadPage}\label{wxhtmlwindowloadpage}
129
130 \func{virtual bool}{LoadPage}{\param{const wxString\& }{location}}
131
132 Unlike SetPage this function first loads HTML page from {\it location}
133 and then displays it. See example:
134
135 \begin{verbatim}
136 htmlwin -> SetPage("help/myproject/index.htm");
137 \end{verbatim}
138
139 \wxheading{Parameters}
140
141 \docparam{location}{The address of document. See \helpref{wxFileSystem}{wxfilesystem} for details on address format and behaviour of "opener".}
142
143 \wxheading{Return value}
144
145 FALSE if an error occurred, TRUE otherwise
146
147 \membersection{wxHtmlWindow::OnLinkClicked}\label{wxhtmlwindowonlinkclicked}
148
149 \func{virtual void}{OnLinkClicked}{\param{const wxHtmlLinkInfo\& }{link}}
150
151 Called when user clicks on hypertext link. Default behaviour is to call
152 \helpref{LoadPage}{wxhtmlwindowloadpage} and do nothing else.
153
154 Also see \helpref{wxHtmlLinkInfo}{wxhtmllinkinfo}.
155
156
157 \membersection{wxHtmlWindow::OnSetTitle}\label{wxhtmlwindowonsettitle}
158
159 \func{virtual void}{OnSetTitle}{\param{const wxString\& }{title}}
160
161 Called on parsing {\tt <TITLE>} tag.
162
163
164 \membersection{wxHtmlWindow::ReadCustomization}\label{wxhtmlwindowreadcustomization}
165
166 \func{virtual void}{ReadCustomization}{\param{wxConfigBase }{*cfg}, \param{wxString }{path = wxEmptyString}}
167
168 This reads custom settings from wxConfig. It uses the path 'path'
169 if given, otherwise it saves info into currently selected path.
170 The values are stored in sub-path {\tt wxHtmlWindow}
171
172 Read values: all things set by SetFonts, SetBorders.
173
174 \wxheading{Parameters}
175
176 \docparam{cfg}{wxConfig from which you want to read the configuration.}
177
178 \docparam{path}{Optional path in config tree. If not given current path is used.}
179
180 \membersection{wxHtmlWindow::SetBorders}\label{wxhtmlwindowsetborders}
181
182 \func{void}{SetBorders}{\param{int }{b}}
183
184 This function sets the space between border of window and HTML contents. See image:
185
186 \helponly{\image{}{border.bmp}}
187
188 \wxheading{Parameters}
189
190 \docparam{b}{indentation from borders in pixels}
191
192 \membersection{wxHtmlWindow::SetFonts}\label{wxhtmlwindowsetfonts}
193
194 \func{void}{SetFonts}{\param{wxString }{normal\_face}, \param{wxString }{fixed\_face}, \param{const int }{*sizes}}
195
196 This function sets font sizes and faces.
197
198 \wxheading{Parameters}
199
200 \docparam{normal\_face}{This is face name for normal (i.e. non-fixed) font.
201 It can be either empty string (then the default face is choosen) or
202 platform-specific face name. Examples are "helvetica" under Unix or
203 "Times New Roman" under Windows.}
204
205 \docparam{fixed\_face}{The same thing for fixed face ( <TT>..</TT> )}
206
207 \docparam{sizes}{This is an array of 7 items of {\it int} type.
208 The values represent size of font with HTML size from -2 to +4
209 ( <FONT SIZE=-2> to <FONT SIZE=+4> )}
210
211 \wxheading{Defaults}
212
213 Under wxGTK:
214
215 \begin{verbatim}
216 SetFonts("", "", {10, 12, 14, 16, 19, 24, 32});
217 \end{verbatim}
218
219 Under Windows:
220
221 \begin{verbatim}
222 SetFonts("", "", {7, 8, 10, 12, 16, 22, 30});
223 \end{verbatim}
224
225 Athough it seems different the fact is that the fonts are of approximately
226 same size under both platforms (due to wxMSW / wxGTK inconsistency)
227
228 \membersection{wxHtmlWindow::SetPage}\label{wxhtmlwindowsetpage}
229
230 \func{bool}{SetPage}{\param{const wxString\& }{source}}
231
232 Sets HTML page and display it. This won't {\bf load} the page!!
233 It will display the {\it source}. See example:
234
235 \begin{verbatim}
236 htmlwin -> SetPage("<html><body>Hello, world!</body></html>");
237 \end{verbatim}
238
239 If you want to load a document from some location use
240 \helpref{LoadPage}{wxhtmlwindowloadpage} instead.
241
242 \wxheading{Parameters}
243
244 \docparam{source}{The HTML document source to be displayed.}
245
246 \wxheading{Return value}
247
248 FALSE if an error occurred, TRUE otherwise.
249
250 \membersection{wxHtmlWindow::SetRelatedFrame}\label{wxhtmlwindowsetrelatedframe}
251
252 \func{void}{SetRelatedFrame}{\param{wxFrame* }{frame}, \param{const wxString\& }{format}}
253
254 Sets the frame in which page title will be displayed. {\it format} is format of
255 frame title, e.g. "HtmlHelp : \%s". It must contain exactly one \%s. This
256 \%s is substituted with HTML page title.
257
258 \membersection{wxHtmlWindow::SetRelatedStatusBar}\label{wxhtmlwindowsetrelatedstatusbar}
259
260 \func{void}{SetRelatedStatusBar}{\param{int }{bar}}
261
262 {\bf After} calling \helpref{SetRelatedFrame}{wxhtmlwindowsetrelatedframe},
263 this sets statusbar slot where messages will be displayed.
264 (Default is -1 = no messages.)
265
266 \wxheading{Parameters}
267
268 \docparam{bar}{statusbar slot number (0..n)}
269
270
271 \membersection{wxHtmlWindow::WriteCustomization}\label{wxhtmlwindowwritecustomization}
272
273 \func{virtual void}{WriteCustomization}{\param{wxConfigBase }{*cfg}, \param{wxString }{path = wxEmptyString}}
274
275 Saves custom settings into wxConfig. It uses the path 'path'
276 if given, otherwise it saves info into currently selected path.
277 Regardless of whether the path is given or not, the function creates sub-path
278 {\tt wxHtmlWindow}.
279
280 Saved values: all things set by SetFonts, SetBorders.
281
282 \wxheading{Parameters}
283
284 \docparam{cfg}{wxConfig to which you want to save the configuration.}
285
286 \docparam{path}{Optional path in config tree. If not given, the current path is used.}
287