]> git.saurik.com Git - wxWidgets.git/blob - docs/latex/wx/htwindow.tex
fix wxChar error in docs
[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},
18 \helpref{LoadPage(filename)}{wxhtmlwindowloadpage} or
19 \helpref{LoadFile}{wxhtmlwindowloadfile}.
20
21 \wxheading{Note}
22
23 wxHtmlWindow uses the \helpref{wxImage}{wximage} class for displaying images.
24 Don't forget to initialize all image formats you need before loading any page!
25 (See \helpref{wxInitAllImageHandlers}{wxinitallimagehandlers} and
26 \helpref{wxImage::AddHandler}{wximageaddhandler}.)
27
28 \wxheading{Derived from}
29
30 \helpref{wxScrolledWindow}{wxscrolledwindow}
31
32 \wxheading{Include files}
33
34 <wx/html/htmlwin.h>
35
36 \membersection{wxHtmlWindow::wxHtmlWindow}\label{wxhtmlwindowwxhtmlwindow}
37
38 \func{}{wxHtmlWindow}{\void}
39
40 Default constructor.
41
42 \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"}}
43
44 Constructor. The parameters are the same as for the \helpref{wxScrolledWindow}{wxscrolledwindow} constructor.
45
46 \wxheading{Parameters}
47
48 \docparam{style}{wxHW\_SCROLLBAR\_NEVER, or wxHW\_SCROLLBAR\_AUTO.
49 Affects the appearance of vertical scrollbar in the window.}
50
51 \membersection{wxHtmlWindow::AddFilter}\label{wxhtmlwindowaddfilter}
52
53 \func{static void}{AddFilter}{\param{wxHtmlFilter }{*filter}}
54
55 Adds \helpref{input filter}{filters} to the static list of available
56 filters. These filters are present by default:
57
58 \begin{itemize}\itemsep=0pt
59 \item {\tt text/html} MIME type
60 \item {\tt image/*} MIME types
61 \item Plain Text filter (this filter is used if no other filter matches)
62 \end{itemize}
63
64 \membersection{wxHtmlWindow::AppendToPage}\label{wxhtmlwindowappendtopage}
65
66 \func{bool}{AppendToPage}{\param{const wxString\& }{source}}
67
68 Appends HTML fragment to currently displayed text and refreshes the window.
69
70 \wxheading{Parameters}
71
72 \docparam{source}{HTML code fragment}
73
74 \wxheading{Return value}
75
76 false if an error occurred, true otherwise.
77
78 \membersection{wxHtmlWindow::GetInternalRepresentation}\label{wxhtmlwindowgetinternalrepresentation}
79
80 \constfunc{wxHtmlContainerCell*}{GetInternalRepresentation}{\void}
81
82 Returns pointer to the top-level container.
83
84 See also: \helpref{Cells Overview}{cells},
85 \helpref{Printing Overview}{printing}
86
87 \membersection{wxHtmlWindow::GetOpenedAnchor}\label{wxhtmlwindowgetopenedanchor}
88
89 \func{wxString}{GetOpenedAnchor}{\void}
90
91 Returns anchor within currently opened page
92 (see \helpref{GetOpenedPage}{wxhtmlwindowgetopenedpage}).
93 If no page is opened or if the displayed page wasn't
94 produced by call to LoadPage, empty string is returned.
95
96
97 \membersection{wxHtmlWindow::GetOpenedPage}\label{wxhtmlwindowgetopenedpage}
98
99 \func{wxString}{GetOpenedPage}{\void}
100
101 Returns full location of the opened page. If no page is opened or if the displayed page wasn't
102 produced by call to LoadPage, empty string is returned.
103
104 \membersection{wxHtmlWindow::GetOpenedPageTitle}\label{wxhtmlwindowgetopenedpagetitle}
105
106 \func{wxString}{GetOpenedPageTitle}{\void}
107
108 Returns title of the opened page or wxEmptyString if current page does not contain {\tt <TITLE>} tag.
109
110 \membersection{wxHtmlWindow::GetRelatedFrame}\label{wxhtmlwindowgetrelatedframe}
111
112 \constfunc{wxFrame*}{GetRelatedFrame}{\void}
113
114 Returns the related frame.
115
116 \membersection{wxHtmlWindow::HistoryBack}\label{wxhtmlwindowhistoryback}
117
118 \func{bool}{HistoryBack}{\void}
119
120 Moves back to the previous page. (each page displayed using
121 \helpref{LoadPage}{wxhtmlwindowloadpage} is stored in history list.)
122
123 \membersection{wxHtmlWindow::HistoryCanBack}\label{wxhtmlwindowhistorycanback}
124
125 \func{bool}{HistoryCanBack}{\void}
126
127 Returns true if it is possible to go back in the history (i.e. HistoryBack()
128 won't fail).
129
130 \membersection{wxHtmlWindow::HistoryCanForward}\label{wxhtmlwindowhistorycanforward}
131
132 \func{bool}{HistoryCanForward}{\void}
133
134 Returns true if it is possible to go forward in the history (i.e. HistoryBack()
135 won't fail).
136
137
138 \membersection{wxHtmlWindow::HistoryClear}\label{wxhtmlwindowhistoryclear}
139
140 \func{void}{HistoryClear}{\void}
141
142 Clears history.
143
144 \membersection{wxHtmlWindow::HistoryForward}\label{wxhtmlwindowhistoryforward}
145
146 \func{bool}{HistoryForward}{\void}
147
148 Moves to next page in history.
149
150 \membersection{wxHtmlWindow::LoadFile}\label{wxhtmlwindowloadfile}
151
152 \func{virtual bool}{LoadFile}{\param{const wxFileName\& }{filename}}
153
154 Loads HTML page from file and displays it.
155
156 \wxheading{Return value}
157
158 false if an error occurred, true otherwise
159
160 \wxheading{See also}
161
162 \helpref{LoadPage}{wxhtmlwindowloadpage}
163
164 \membersection{wxHtmlWindow::LoadPage}\label{wxhtmlwindowloadpage}
165
166 \func{virtual bool}{LoadPage}{\param{const wxString\& }{location}}
167
168 Unlike SetPage this function first loads HTML page from {\it location}
169 and then displays it. See example:
170
171 \begin{verbatim}
172 htmlwin->LoadPage("help/myproject/index.htm");
173 \end{verbatim}
174
175 \wxheading{Parameters}
176
177 \docparam{location}{The address of document. See \helpref{wxFileSystem}{wxfilesystem} for details on address format and behaviour of "opener".}
178
179 \wxheading{Return value}
180
181 false if an error occurred, true otherwise
182
183 \wxheading{See also}
184
185 \helpref{LoadFile}{wxhtmlwindowloadfile}
186
187 \membersection{wxHtmlWindow::OnCellClicked}\label{wxhtmlwindowoncellclicked}
188
189 \func{virtual void}{OnCellClicked}{\param{wxHtmlCell }{*cell}, \param{wxCoord }{x}, \param{wxCoord }{y}, \param{const wxMouseEvent\& }{event}}
190
191 This method is called when a mouse button is clicked inside wxHtmlWindow.
192 The default behaviour is to call
193 \helpref{OnLinkClicked}{wxhtmlwindowonlinkclicked} if the cell contains a
194 hypertext link.
195
196 \wxheading{Parameters}
197
198 \docparam{cell}{The cell inside which the mouse was clicked, always a simple
199 (i.e. non container) cell}
200
201 \docparam{x, y}{The logical coordinates of the click point}
202
203 \docparam{event}{The mouse event containing other information about the click}
204
205 \membersection{wxHtmlWindow::OnCellMouseHover}\label{wxhtmlwindowoncellmousehover}
206
207 \func{virtual void}{OnCellMouseHover}{\param{wxHtmlCell }{*cell}, \param{wxCoord }{x}, \param{wxCoord }{y}}
208
209 This method is called when a mouse moves over an HTML cell.
210
211 \wxheading{Parameters}
212
213 \docparam{cell}{The cell inside which the mouse is currently, always a simple
214 (i.e. non container) cell}
215
216 \docparam{x, y}{The logical coordinates of the click point}
217
218 \membersection{wxHtmlWindow::OnLinkClicked}\label{wxhtmlwindowonlinkclicked}
219
220 \func{virtual void}{OnLinkClicked}{\param{const wxHtmlLinkInfo\& }{link}}
221
222 Called when user clicks on hypertext link. Default behaviour is to call
223 \helpref{LoadPage}{wxhtmlwindowloadpage} and do nothing else.
224
225 Also see \helpref{wxHtmlLinkInfo}{wxhtmllinkinfo}.
226
227 \membersection{wxHtmlWindow::OnOpeningURL}\label{wxhtmlwindowonopeningurl}
228
229 \func{virtual wxHtmlOpeningStatus}{OnOpeningURL}{\param{wxHtmlURLType }{type},\param{const wxString\& }{url}, \param{wxString *}{redirect}}
230
231 Called when an URL is being opened (either when the user clicks on a link or
232 an image is loaded). The URL will be opened only if OnOpeningURL returns
233 {\tt wxHTML\_OPEN}. This method is called by
234 \helpref{wxHtmlParser::OpenURL}{wxhtmlparseropenurl}.
235 You can override OnOpeningURL to selectively block some
236 URLs (e.g. for security reasons) or to redirect them elsewhere. Default
237 behaviour is to always return {\tt wxHTML\_OPEN}.
238
239 \wxheading{Parameters}
240
241 \docparam{type}{Indicates type of the resource. Is one of
242 \begin{twocollist}\itemsep=0pt
243 \twocolitem{{\bf wxHTML\_URL\_PAGE}}{Opening a HTML page.}
244 \twocolitem{{\bf wxHTML\_URL\_IMAGE}}{Opening an image.}
245 \twocolitem{{\bf wxHTML\_URL\_OTHER}}{Opening a resource that doesn't fall into
246 any other category.}
247 \end{twocollist}}
248
249 \docparam{url}{URL being opened.}
250
251 \docparam{redirect}{Pointer to wxString variable that must be filled with an
252 URL if OnOpeningURL returns {\tt wxHTML\_REDIRECT}.}
253
254 \wxheading{Return value}
255 \begin{twocollist}\itemsep=0pt
256 \twocolitem{{\bf wxHTML\_OPEN}}{Open the URL.}
257 \twocolitem{{\bf wxHTML\_BLOCK}}{Deny access to the URL, \helpref{wxHtmlParser::OpenURL}{wxhtmlparseropenurl} will return NULL.}
258 \twocolitem{{\bf wxHTML\_REDIRECT}}{Don't open {\it url}, redirect to another
259 URL. OnOpeningURL must fill {\it *redirect} with the new URL. OnOpeningURL will
260 be called again on returned URL.}
261 \end{twocollist}
262
263 \membersection{wxHtmlWindow::OnSetTitle}\label{wxhtmlwindowonsettitle}
264
265 \func{virtual void}{OnSetTitle}{\param{const wxString\& }{title}}
266
267 Called on parsing {\tt <TITLE>} tag.
268
269
270 \membersection{wxHtmlWindow::ReadCustomization}\label{wxhtmlwindowreadcustomization}
271
272 \func{virtual void}{ReadCustomization}{\param{wxConfigBase }{*cfg}, \param{wxString }{path = wxEmptyString}}
273
274 This reads custom settings from wxConfig. It uses the path 'path'
275 if given, otherwise it saves info into currently selected path.
276 The values are stored in sub-path {\tt wxHtmlWindow}
277
278 Read values: all things set by SetFonts, SetBorders.
279
280 \wxheading{Parameters}
281
282 \docparam{cfg}{wxConfig from which you want to read the configuration.}
283
284 \docparam{path}{Optional path in config tree. If not given current path is used.}
285
286 \membersection{wxHtmlWindow::SetBorders}\label{wxhtmlwindowsetborders}
287
288 \func{void}{SetBorders}{\param{int }{b}}
289
290 This function sets the space between border of window and HTML contents. See image:
291
292 \helponly{\image{}{border.bmp}}
293
294 \wxheading{Parameters}
295
296 \docparam{b}{indentation from borders in pixels}
297
298 \membersection{wxHtmlWindow::SetFonts}\label{wxhtmlwindowsetfonts}
299
300 \func{void}{SetFonts}{\param{wxString }{normal\_face}, \param{wxString }{fixed\_face}, \param{const int }{*sizes = NULL}}
301
302 This function sets font sizes and faces.
303
304 \wxheading{Parameters}
305
306 \docparam{normal\_face}{This is face name for normal (i.e. non-fixed) font.
307 It can be either empty string (then the default face is chosen) or
308 platform-specific face name. Examples are "helvetica" under Unix or
309 "Times New Roman" under Windows.}
310
311 \docparam{fixed\_face}{The same thing for fixed face ( <TT>..</TT> )}
312
313 \docparam{sizes}{This is an array of 7 items of {\it int} type.
314 The values represent size of font with HTML size from -2 to +4
315 ( <FONT SIZE=-2> to <FONT SIZE=+4> ). Default sizes are used if {\it sizes}
316 is NULL.}
317
318 \wxheading{Defaults}
319
320 Default font sizes are defined by constants wxHTML\_FONT\_SIZE\_1,
321 wxHTML\_FONT\_SIZE\_2, ..., wxHTML\_FONT\_SIZE\_7. Note that they differ among
322 platforms. Default face names are empty strings.
323
324 \membersection{wxHtmlWindow::SetPage}\label{wxhtmlwindowsetpage}
325
326 \func{bool}{SetPage}{\param{const wxString\& }{source}}
327
328 Sets HTML page and display it. This won't {\bf load} the page!!
329 It will display the {\it source}. See example:
330
331 \begin{verbatim}
332 htmlwin -> SetPage("<html><body>Hello, world!</body></html>");
333 \end{verbatim}
334
335 If you want to load a document from some location use
336 \helpref{LoadPage}{wxhtmlwindowloadpage} instead.
337
338 \wxheading{Parameters}
339
340 \docparam{source}{The HTML document source to be displayed.}
341
342 \wxheading{Return value}
343
344 false if an error occurred, true otherwise.
345
346 \membersection{wxHtmlWindow::SetRelatedFrame}\label{wxhtmlwindowsetrelatedframe}
347
348 \func{void}{SetRelatedFrame}{\param{wxFrame* }{frame}, \param{const wxString\& }{format}}
349
350 Sets the frame in which page title will be displayed. {\it format} is format of
351 frame title, e.g. "HtmlHelp : \%s". It must contain exactly one \%s. This
352 \%s is substituted with HTML page title.
353
354 \membersection{wxHtmlWindow::SetRelatedStatusBar}\label{wxhtmlwindowsetrelatedstatusbar}
355
356 \func{void}{SetRelatedStatusBar}{\param{int }{bar}}
357
358 {\bf After} calling \helpref{SetRelatedFrame}{wxhtmlwindowsetrelatedframe},
359 this sets statusbar slot where messages will be displayed.
360 (Default is -1 = no messages.)
361
362 \wxheading{Parameters}
363
364 \docparam{bar}{statusbar slot number (0..n)}
365
366
367 \membersection{wxHtmlWindow::WriteCustomization}\label{wxhtmlwindowwritecustomization}
368
369 \func{virtual void}{WriteCustomization}{\param{wxConfigBase }{*cfg}, \param{wxString }{path = wxEmptyString}}
370
371 Saves custom settings into wxConfig. It uses the path 'path'
372 if given, otherwise it saves info into currently selected path.
373 Regardless of whether the path is given or not, the function creates sub-path
374 {\tt wxHtmlWindow}.
375
376 Saved values: all things set by SetFonts, SetBorders.
377
378 \wxheading{Parameters}
379
380 \docparam{cfg}{wxConfig to which you want to save the configuration.}
381
382 \docparam{path}{Optional path in config tree. If not given, the current path is used.}
383